Compare commits

...

18 Commits

Author SHA1 Message Date
vaxerski
12f9a0d0b9 [gha] Nix: update inputs 2024-11-19 21:47:18 +00:00
Vaxry
fab0f426b5 version: bump to 0.45.2 2024-11-19 21:45:40 +00:00
Vaxry
e735eae4ad xdg-shell: don't report invalid min/max sizes on unset
fixes #8522
2024-11-19 21:45:20 +00:00
Aqa-Ib
57cf6d81a9 internal: fix changeWindowZOrder reordering incorrectly (#8494) 2024-11-19 21:45:20 +00:00
Vaxry
77b9d03c3f version: bump to 0.45.1 2024-11-18 14:27:21 +00:00
johannes hanika
53e8513000 constraints: don't warp pointer position on release (#8491)
this was annoying for nuklear properties/ui slider elements that grab
the pointer via GLFW_CURSOR_DISABLE to allow more range and finer control.
upon mouse release, the pointer is reset to the middle of the window
without this patch, making long mouse movements necessary to go back
to the original position for readjustments. fwiw the new behaviour
is consistent with x11 and weston.
2024-11-18 14:26:44 +00:00
Vaxry
7976bfa2df shell: don't use fgrep, prefer grep -F 2024-11-18 14:26:44 +00:00
Vaxry
a77ffa8cb8 windows/xdg: minor cleanup of min/max size calculations
fixes #8495
2024-11-18 14:26:44 +00:00
Vaxry
a4a1ad1f9b hyprpm: fix format crash
ref #8487
2024-11-18 14:26:44 +00:00
Vaxry
737b51d032 renderer: don't render unmapped popups
fixes #8485
2024-11-18 14:26:44 +00:00
staz
b3251f2961 workspacerules: Do not check 'on-created-empty' if using a workspace windowrule (#8486) 2024-11-18 14:26:44 +00:00
Vaxry
c4a77b8da7 core: guard pmonitor in focuswindow
may be null

fixes #8483
2024-11-18 14:26:44 +00:00
sslater11
38b6f3babb workspace: fix missing name via focusworkspaceoncurrentmonitor (#8484) 2024-11-18 14:26:44 +00:00
Vaxry
ace7ece4f2 protocols: mark primarySelection as not privileged
fixes #8479
2024-11-18 14:26:44 +00:00
Tom Englund
0557b2ed8c xcursors: store themes in a std:set to order it (#8474)
using a unordered_set means its store based on a hash_value meaning
currently it can end up loading inherited themes before the actual theme
itself depending on the hash of the theme name used, reason for using
set at all over vector is to keep unique members and not foreverever
looping broken inherit themeing.
2024-11-18 14:26:44 +00:00
Vaxry
9728a39b2e makefile: add stub to discourage direct make 2024-11-18 14:26:44 +00:00
dawsers
7120dde3d1 renderer: scaled surfaces could have zero area (#8423) 2024-11-18 14:26:44 +00:00
Vaxry
e7ab2d8533 defaultConfig: fixup smart gaps rules 2024-11-18 14:26:44 +00:00
27 changed files with 125 additions and 119 deletions

View File

@@ -1,5 +1,8 @@
PREFIX = /usr/local PREFIX = /usr/local
stub:
@echo "Do not run $(MAKE) directly without any arguments. Please refer to the wiki on how to compile Hyprland."
legacyrenderer: legacyrenderer:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`

View File

@@ -1 +1 @@
0.45.0 0.45.2

View File

@@ -136,13 +136,10 @@ animations {
# Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/ # Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/
# "Smart gaps" / "No gaps when only" # "Smart gaps" / "No gaps when only"
# uncomment all if you wish to use that. # uncomment all if you wish to use that.
# workspace = w[t1], gapsout:0, gapsin:0 # workspace = w[tv1], gapsout:0, gapsin:0
# workspace = w[tg1], gapsout:0, gapsin:0
# workspace = f[1], gapsout:0, gapsin:0 # workspace = f[1], gapsout:0, gapsin:0
# windowrulev2 = bordersize 0, floating:0, onworkspace:w[t1] # windowrulev2 = bordersize 0, floating:0, onworkspace:w[tv1]
# windowrulev2 = rounding 0, floating:0, onworkspace:w[t1] # windowrulev2 = rounding 0, floating:0, onworkspace:w[tv1]
# windowrulev2 = bordersize 0, floating:0, onworkspace:w[tg1]
# windowrulev2 = rounding 0, floating:0, onworkspace:w[tg1]
# windowrulev2 = bordersize 0, floating:0, onworkspace:f[1] # windowrulev2 = bordersize 0, floating:0, onworkspace:f[1]
# windowrulev2 = rounding 0, floating:0, onworkspace:f[1] # windowrulev2 = rounding 0, floating:0, onworkspace:f[1]

30
flake.lock generated
View File

@@ -16,11 +16,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1730968822, "lastModified": 1731959031,
"narHash": "sha256-NocDjINsh6ismkhb0Xr6xPRksmhuB2WGf8ZmXMhxu7Y=", "narHash": "sha256-TGcvIjftziC1CjuiHCzrYDwmOoSFYIhdiKmLetzB5L0=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "aquamarine", "repo": "aquamarine",
"rev": "a49bc3583ff223f426cb3526fdaa4bcaa247ec14", "rev": "4468981c1c50999f315baa1508f0e53c4ee70c52",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -151,11 +151,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1730968903, "lastModified": 1731702627,
"narHash": "sha256-zFvzLXcSm0Ia4XI1SE4FQ9KE63hlGrRWhLtwMolWuR8=", "narHash": "sha256-+JeO9gevnXannQxMfR5xzZtF4sYmSlWkX/BPmPx0mWk=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprutils", "repo": "hyprutils",
"rev": "3ce0cde8709cdacbfba471f8e828433b58a561e9", "rev": "e911361a687753bbbdfe3b6a9eab755ecaf1d9e1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -189,11 +189,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1730785428, "lastModified": 1731676054,
"narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", "narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", "rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -229,11 +229,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1730814269, "lastModified": 1732021966,
"narHash": "sha256-fWPHyhYE6xvMI1eGY3pwBTq85wcy1YXqdzTZF+06nOg=", "narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "d70155fdc00df4628446352fc58adc640cd705c2", "rev": "3308484d1a443fc5bc92012435d79e80458fe43c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -293,11 +293,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1730743262, "lastModified": 1731703417,
"narHash": "sha256-iTLqj3lU8kFehPm5tXpctzkD274t/k1nwSSq3qCWXeg=", "narHash": "sha256-rheDc/7C+yI+QspYr9J2z9kQ5P9F4ATapI7qyFAe1XA=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland", "repo": "xdg-desktop-portal-hyprland",
"rev": "09b23cef06fe248e61cec8862c04b9bcb62f4b6d", "rev": "8070f36deec723de71e7557441acb17e478204d3",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -275,7 +275,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
} }
if (m_bVerbose) if (m_bVerbose)
std::println("{}", verboseString("shell returned: " + out)); std::println("{}", verboseString("shell returned: {}", out));
if (!std::filesystem::exists(m_szWorkingPluginDirectory + "/" + p.output)) { if (!std::filesystem::exists(m_szWorkingPluginDirectory + "/" + p.output)) {
progress.printMessageAbove(failureString("Plugin {} failed to build.\n" progress.printMessageAbove(failureString("Plugin {} failed to build.\n"

View File

@@ -1077,7 +1077,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface
PWORKSPACE->rememberPrevWorkspace(m_pLastMonitor->activeWorkspace); PWORKSPACE->rememberPrevWorkspace(m_pLastMonitor->activeWorkspace);
if (PWORKSPACE->m_bIsSpecialWorkspace) if (PWORKSPACE->m_bIsSpecialWorkspace)
m_pLastMonitor->changeWorkspace(PWORKSPACE, false, true); // if special ws, open on current monitor m_pLastMonitor->changeWorkspace(PWORKSPACE, false, true); // if special ws, open on current monitor
else else if (PMONITOR)
PMONITOR->changeWorkspace(PWORKSPACE, false, true); PMONITOR->changeWorkspace(PWORKSPACE, false, true);
// changeworkspace already calls focusWindow // changeworkspace already calls focusWindow
return; return;
@@ -1088,7 +1088,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface
/* If special fallthrough is enabled, this behavior will be disabled, as I have no better idea of nicely tracking which /* If special fallthrough is enabled, this behavior will be disabled, as I have no better idea of nicely tracking which
window focuses are "via keybinds" and which ones aren't. */ window focuses are "via keybinds" and which ones aren't. */
if (PMONITOR->activeSpecialWorkspace && PMONITOR->activeSpecialWorkspace != pWindow->m_pWorkspace && !pWindow->m_bPinned && !*PSPECIALFALLTHROUGH) if (PMONITOR && PMONITOR->activeSpecialWorkspace && PMONITOR->activeSpecialWorkspace != pWindow->m_pWorkspace && !pWindow->m_bPinned && !*PSPECIALFALLTHROUGH)
PMONITOR->setSpecialWorkspace(nullptr); PMONITOR->setSpecialWorkspace(nullptr);
// we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window // we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window
@@ -1389,6 +1389,9 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
if (!validMapped(pWindow)) if (!validMapped(pWindow))
return; return;
if (top)
pWindow->m_bCreatedOverFullscreen = true;
if (pWindow == (top ? m_vWindows.back() : m_vWindows.front())) if (pWindow == (top ? m_vWindows.back() : m_vWindows.front()))
return; return;
@@ -1413,9 +1416,6 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
g_pHyprRenderer->damageMonitor(pw->m_pMonitor.lock()); g_pHyprRenderer->damageMonitor(pw->m_pMonitor.lock());
}; };
if (top)
pWindow->m_bCreatedOverFullscreen = true;
if (!pWindow->m_bIsX11) if (!pWindow->m_bIsX11)
moveToZ(pWindow, top); moveToZ(pWindow, top);
else { else {

View File

@@ -149,13 +149,10 @@ animations {
# Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/ # Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/
# "Smart gaps" / "No gaps when only" # "Smart gaps" / "No gaps when only"
# uncomment all if you wish to use that. # uncomment all if you wish to use that.
# workspace = w[t1], gapsout:0, gapsin:0 # workspace = w[tv1], gapsout:0, gapsin:0
# workspace = w[tg1], gapsout:0, gapsin:0
# workspace = f[1], gapsout:0, gapsin:0 # workspace = f[1], gapsout:0, gapsin:0
# windowrulev2 = bordersize 0, floating:0, onworkspace:w[t1] # windowrulev2 = bordersize 0, floating:0, onworkspace:w[tv1]
# windowrulev2 = rounding 0, floating:0, onworkspace:w[t1] # windowrulev2 = rounding 0, floating:0, onworkspace:w[tv1]
# windowrulev2 = bordersize 0, floating:0, onworkspace:w[tg1]
# windowrulev2 = rounding 0, floating:0, onworkspace:w[tg1]
# windowrulev2 = bordersize 0, floating:0, onworkspace:f[1] # windowrulev2 = bordersize 0, floating:0, onworkspace:f[1]
# windowrulev2 = rounding 0, floating:0, onworkspace:f[1] # windowrulev2 = rounding 0, floating:0, onworkspace:f[1]

View File

@@ -159,7 +159,7 @@ void CrashReporter::createAndSaveCrash(int sig) {
finalCrashReport += "GPU:\n\t"; finalCrashReport += "GPU:\n\t";
#if defined(__DragonFly__) || defined(__FreeBSD__) #if defined(__DragonFly__) || defined(__FreeBSD__)
finalCrashReport.writeCmdOutput("pciconf -lv | fgrep -A4 vga"); finalCrashReport.writeCmdOutput("pciconf -lv | grep -F -A4 vga");
#else #else
finalCrashReport.writeCmdOutput("lspci -vnn | grep VGA"); finalCrashReport.writeCmdOutput("lspci -vnn | grep VGA");
#endif #endif

View File

@@ -942,7 +942,7 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
result += "\n\n"; result += "\n\n";
#if defined(__DragonFly__) || defined(__FreeBSD__) #if defined(__DragonFly__) || defined(__FreeBSD__)
const std::string GPUINFO = execAndGet("pciconf -lv | fgrep -A4 vga"); const std::string GPUINFO = execAndGet("pciconf -lv | grep -F -A4 vga");
#elif defined(__arm__) || defined(__aarch64__) #elif defined(__arm__) || defined(__aarch64__)
const std::string GPUINFO = execAndGet("cat /proc/device-tree/soc*/gpu*/compatible"); const std::string GPUINFO = execAndGet("cat /proc/device-tree/soc*/gpu*/compatible");
#else #else

View File

@@ -41,6 +41,7 @@ class CPopup {
// //
SP<CWLSurface> m_pWLSurface; SP<CWLSurface> m_pWLSurface;
bool m_bMapped = false;
private: private:
// T1 owners, each popup has to have one of these // T1 owners, each popup has to have one of these
@@ -57,8 +58,7 @@ class CPopup {
bool m_bRequestedReposition = false; bool m_bRequestedReposition = false;
bool m_bInert = false; bool m_bInert = false;
bool m_bMapped = false;
// //
std::vector<SP<CPopup>> m_vChildren; std::vector<SP<CPopup>> m_vChildren;

View File

@@ -1601,3 +1601,29 @@ bool CWindow::isX11OverrideRedirect() {
bool CWindow::isModal() { bool CWindow::isModal() {
return (m_pXWaylandSurface && m_pXWaylandSurface->modal); return (m_pXWaylandSurface && m_pXWaylandSurface->modal);
} }
Vector2D CWindow::requestedMinSize() {
if ((m_bIsX11 && !m_pXWaylandSurface->sizeHints) || (!m_bIsX11 && !m_pXDGSurface->toplevel))
return Vector2D(1, 1);
Vector2D minSize = m_bIsX11 ? Vector2D(m_pXWaylandSurface->sizeHints->min_width, m_pXWaylandSurface->sizeHints->min_height) : m_pXDGSurface->toplevel->layoutMinSize();
minSize = minSize.clamp({1, 1});
return minSize;
}
Vector2D CWindow::requestedMaxSize() {
constexpr int NO_MAX_SIZE_LIMIT = 99999;
if (((m_bIsX11 && !m_pXWaylandSurface->sizeHints) || (!m_bIsX11 && !m_pXDGSurface->toplevel) || m_sWindowData.noMaxSize.valueOrDefault()))
return Vector2D(NO_MAX_SIZE_LIMIT, NO_MAX_SIZE_LIMIT);
Vector2D maxSize = m_bIsX11 ? Vector2D(m_pXWaylandSurface->sizeHints->max_width, m_pXWaylandSurface->sizeHints->max_height) : m_pXDGSurface->toplevel->layoutMaxSize();
if (maxSize.x < 5)
maxSize.x = NO_MAX_SIZE_LIMIT;
if (maxSize.y < 5)
maxSize.y = NO_MAX_SIZE_LIMIT;
return maxSize;
}

View File

@@ -403,12 +403,9 @@ class CWindow {
} }
// methods // methods
CBox getFullWindowBoundingBox(); CBox getFullWindowBoundingBox();
SBoxExtents getFullWindowExtents(); SBoxExtents getFullWindowExtents();
CBox getWindowBoxUnified(uint64_t props); CBox getWindowBoxUnified(uint64_t props);
inline CBox getWindowMainSurfaceBox() const {
return {m_vRealPosition.value().x, m_vRealPosition.value().y, m_vRealSize.value().x, m_vRealSize.value().y};
}
CBox getWindowIdealBoundingBoxIgnoreReserved(); CBox getWindowIdealBoundingBoxIgnoreReserved();
void addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco); void addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco);
void updateWindowDecos(); void updateWindowDecos();
@@ -441,19 +438,15 @@ class CWindow {
void activate(bool force = false); void activate(bool force = false);
int surfacesCount(); int surfacesCount();
void clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize); void clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize);
bool isFullscreen(); bool isFullscreen();
bool isEffectiveInternalFSMode(const eFullscreenMode); bool isEffectiveInternalFSMode(const eFullscreenMode);
int getRealBorderSize(); int getRealBorderSize();
void updateWindowData(); void updateWindowData();
void updateWindowData(const struct SWorkspaceRule&); void updateWindowData(const struct SWorkspaceRule&);
void onBorderAngleAnimEnd(void* ptr); void onBorderAngleAnimEnd(void* ptr);
bool isInCurvedCorner(double x, double y); bool isInCurvedCorner(double x, double y);
bool hasPopupAt(const Vector2D& pos); bool hasPopupAt(const Vector2D& pos);
int popupsCount(); int popupsCount();
void applyGroupRules(); void applyGroupRules();
void createGroup(); void createGroup();
void destroyGroup(); void destroyGroup();
@@ -481,6 +474,12 @@ class CWindow {
void unsetWindowData(eOverridePriority priority); void unsetWindowData(eOverridePriority priority);
bool isX11OverrideRedirect(); bool isX11OverrideRedirect();
bool isModal(); bool isModal();
Vector2D requestedMinSize();
Vector2D requestedMaxSize();
inline CBox getWindowMainSurfaceBox() const {
return {m_vRealPosition.value().x, m_vRealPosition.value().y, m_vRealSize.value().x, m_vRealSize.value().y};
}
// listeners // listeners
void onAck(uint32_t serial); void onAck(uint32_t serial);

View File

@@ -296,7 +296,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
auto pWorkspace = g_pCompositor->getWorkspaceByID(REQUESTEDWORKSPACEID); auto pWorkspace = g_pCompositor->getWorkspaceByID(REQUESTEDWORKSPACEID);
if (!pWorkspace) if (!pWorkspace)
pWorkspace = g_pCompositor->createNewWorkspace(REQUESTEDWORKSPACEID, PWINDOW->monitorID(), requestedWorkspaceName); pWorkspace = g_pCompositor->createNewWorkspace(REQUESTEDWORKSPACEID, PWINDOW->monitorID(), requestedWorkspaceName, false);
PWORKSPACE = pWorkspace; PWORKSPACE = pWorkspace;
@@ -346,7 +346,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' ')); const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1); const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(PWINDOW); const auto MAXSIZE = PWINDOW->requestedMaxSize();
const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, PMONITOR->vecSize.x) : const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, PMONITOR->vecSize.x) :
stringToFloatClamp(SIZEXSTR, PWINDOW->m_vRealSize.goal().x, PMONITOR->vecSize.x); stringToFloatClamp(SIZEXSTR, PWINDOW->m_vRealSize.goal().x, PMONITOR->vecSize.x);
@@ -469,7 +469,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' ')); const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1); const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(PWINDOW); const auto MAXSIZE = PWINDOW->requestedMaxSize();
const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, PMONITOR->vecSize.x) : stringToPercentage(SIZEXSTR, PMONITOR->vecSize.x); const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, PMONITOR->vecSize.x) : stringToPercentage(SIZEXSTR, PMONITOR->vecSize.x);
@@ -753,8 +753,8 @@ void Events::listener_commitWindow(void* owner, void* data) {
PWINDOW->m_vReportedSize = PWINDOW->m_vPendingReportedSize; // apply pending size. We pinged, the window ponged. PWINDOW->m_vReportedSize = PWINDOW->m_vPendingReportedSize; // apply pending size. We pinged, the window ponged.
if (!PWINDOW->m_bIsX11 && !PWINDOW->isFullscreen() && PWINDOW->m_bIsFloating) { if (!PWINDOW->m_bIsX11 && !PWINDOW->isFullscreen() && PWINDOW->m_bIsFloating) {
const auto MINSIZE = PWINDOW->m_pXDGSurface->toplevel->current.minSize; const auto MINSIZE = PWINDOW->m_pXDGSurface->toplevel->layoutMinSize();
const auto MAXSIZE = PWINDOW->m_pXDGSurface->toplevel->current.maxSize; const auto MAXSIZE = PWINDOW->m_pXDGSurface->toplevel->layoutMaxSize();
PWINDOW->clampWindowSize(MINSIZE, MAXSIZE > Vector2D{1, 1} ? std::optional<Vector2D>{MAXSIZE} : std::nullopt); PWINDOW->clampWindowSize(MINSIZE, MAXSIZE > Vector2D{1, 1} ? std::optional<Vector2D>{MAXSIZE} : std::nullopt);
g_pHyprRenderer->damageWindow(PWINDOW); g_pHyprRenderer->damageWindow(PWINDOW);

View File

@@ -610,7 +610,7 @@ void logSystemInfo() {
Debug::log(NONE, "\n"); Debug::log(NONE, "\n");
#if defined(__DragonFly__) || defined(__FreeBSD__) #if defined(__DragonFly__) || defined(__FreeBSD__)
const std::string GPUINFO = execAndGet("pciconf -lv | fgrep -A4 vga"); const std::string GPUINFO = execAndGet("pciconf -lv | grep -F -A4 vga");
#elif defined(__arm__) || defined(__aarch64__) #elif defined(__arm__) || defined(__aarch64__)
const std::string GPUINFO = execAndGet("cat /proc/device-tree/soc*/gpu*/compatible"); const std::string GPUINFO = execAndGet("cat /proc/device-tree/soc*/gpu*/compatible");
#else #else

View File

@@ -283,7 +283,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
// first, check if OPENINGON isn't too big. // first, check if OPENINGON isn't too big.
const auto PREDSIZEMAX = OPENINGON ? Vector2D(OPENINGON->box.w, OPENINGON->box.h) : PMONITOR->vecSize; const auto PREDSIZEMAX = OPENINGON ? Vector2D(OPENINGON->box.w, OPENINGON->box.h) : PMONITOR->vecSize;
if (const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow); MAXSIZE.x < PREDSIZEMAX.x || MAXSIZE.y < PREDSIZEMAX.y) { if (const auto MAXSIZE = pWindow->requestedMaxSize(); MAXSIZE.x < PREDSIZEMAX.x || MAXSIZE.y < PREDSIZEMAX.y) {
// we can't continue. make it floating. // we can't continue. make it floating.
pWindow->m_bIsFloating = true; pWindow->m_bIsFloating = true;
m_lDwindleNodesData.remove(*PNODE); m_lDwindleNodesData.remove(*PNODE);

View File

@@ -597,12 +597,12 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
} else if (g_pInputManager->dragMode == MBIND_RESIZE || g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) { } else if (g_pInputManager->dragMode == MBIND_RESIZE || g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) {
if (DRAGGINGWINDOW->m_bIsFloating) { if (DRAGGINGWINDOW->m_bIsFloating) {
Vector2D MINSIZE = g_pXWaylandManager->getMinSizeForWindow(DRAGGINGWINDOW).clamp(DRAGGINGWINDOW->m_sWindowData.minSize.valueOr(Vector2D(20, 20))); Vector2D MINSIZE = DRAGGINGWINDOW->requestedMinSize().clamp(DRAGGINGWINDOW->m_sWindowData.minSize.valueOr(Vector2D(20, 20)));
Vector2D MAXSIZE; Vector2D MAXSIZE;
if (DRAGGINGWINDOW->m_sWindowData.maxSize.hasValue()) if (DRAGGINGWINDOW->m_sWindowData.maxSize.hasValue())
MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, DRAGGINGWINDOW->m_sWindowData.maxSize.value()); MAXSIZE = DRAGGINGWINDOW->requestedMaxSize().clamp({}, DRAGGINGWINDOW->m_sWindowData.maxSize.value());
else else
MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max())); MAXSIZE = DRAGGINGWINDOW->requestedMaxSize().clamp({}, Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
Vector2D newSize = m_vBeginDragSizeXY; Vector2D newSize = m_vBeginDragSizeXY;
Vector2D newPos = m_vBeginDragPositionXY; Vector2D newPos = m_vBeginDragPositionXY;
@@ -884,7 +884,7 @@ Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // ge
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' ')); const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1); const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow); const auto MAXSIZE = pWindow->requestedMaxSize();
const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, g_pCompositor->m_pLastMonitor->vecSize.x) : const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, g_pCompositor->m_pLastMonitor->vecSize.x) :
stringToPercentage(SIZEXSTR, g_pCompositor->m_pLastMonitor->vecSize.x); stringToPercentage(SIZEXSTR, g_pCompositor->m_pLastMonitor->vecSize.x);

View File

@@ -200,7 +200,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire
PNODE->percMaster = lastSplitPercent; PNODE->percMaster = lastSplitPercent;
// first, check if it isn't too big. // first, check if it isn't too big.
if (const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow); MAXSIZE.x < PMONITOR->vecSize.x * lastSplitPercent || MAXSIZE.y < PMONITOR->vecSize.y) { if (const auto MAXSIZE = pWindow->requestedMaxSize(); MAXSIZE.x < PMONITOR->vecSize.x * lastSplitPercent || MAXSIZE.y < PMONITOR->vecSize.y) {
// we can't continue. make it floating. // we can't continue. make it floating.
pWindow->m_bIsFloating = true; pWindow->m_bIsFloating = true;
m_lMasterNodesData.remove(*PNODE); m_lMasterNodesData.remove(*PNODE);
@@ -212,7 +212,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire
PNODE->percMaster = lastSplitPercent; PNODE->percMaster = lastSplitPercent;
// first, check if it isn't too big. // first, check if it isn't too big.
if (const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow); if (const auto MAXSIZE = pWindow->requestedMaxSize();
MAXSIZE.x < PMONITOR->vecSize.x * (1 - lastSplitPercent) || MAXSIZE.y < PMONITOR->vecSize.y * (1.f / (WINDOWSONWORKSPACE - 1))) { MAXSIZE.x < PMONITOR->vecSize.x * (1 - lastSplitPercent) || MAXSIZE.y < PMONITOR->vecSize.y * (1.f / (WINDOWSONWORKSPACE - 1))) {
// we can't continue. make it floating. // we can't continue. make it floating.
pWindow->m_bIsFloating = true; pWindow->m_bIsFloating = true;

View File

@@ -1849,7 +1849,7 @@ SDispatchResult CKeybindManager::moveWorkspaceToMonitor(std::string args) {
} }
SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args) { SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args) {
auto workspaceID = getWorkspaceIDNameFromString(args).id; auto [workspaceID, workspaceName] = getWorkspaceIDNameFromString(args);
if (workspaceID == WORKSPACE_INVALID) { if (workspaceID == WORKSPACE_INVALID) {
Debug::log(ERR, "focusWorkspaceOnCurrentMonitor invalid workspace!"); Debug::log(ERR, "focusWorkspaceOnCurrentMonitor invalid workspace!");
return {.success = false, .error = "focusWorkspaceOnCurrentMonitor invalid workspace!"}; return {.success = false, .error = "focusWorkspaceOnCurrentMonitor invalid workspace!"};
@@ -1865,7 +1865,7 @@ SDispatchResult CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args
auto pWorkspace = g_pCompositor->getWorkspaceByID(workspaceID); auto pWorkspace = g_pCompositor->getWorkspaceByID(workspaceID);
if (!pWorkspace) { if (!pWorkspace) {
pWorkspace = g_pCompositor->createNewWorkspace(workspaceID, PCURRMONITOR->ID); pWorkspace = g_pCompositor->createNewWorkspace(workspaceID, PCURRMONITOR->ID, workspaceName);
// we can skip the moving, since it's already on the current monitor // we can skip the moving, since it's already on the current monitor
changeworkspace(pWorkspace->getConfigName()); changeworkspace(pWorkspace->getConfigName());
return {}; return {};

View File

@@ -281,6 +281,7 @@ bool CProtocolManager::isGlobalPrivileged(const wl_global* global) {
PROTO::xdgShell->getGlobal(), PROTO::xdgShell->getGlobal(),
PROTO::xdgDialog->getGlobal(), PROTO::xdgDialog->getGlobal(),
PROTO::singlePixel->getGlobal(), PROTO::singlePixel->getGlobal(),
PROTO::primarySelection->getGlobal(),
PROTO::sync ? PROTO::sync->getGlobal() : nullptr, PROTO::sync ? PROTO::sync->getGlobal() : nullptr,
PROTO::mesaDRM ? PROTO::mesaDRM->getGlobal() : nullptr, PROTO::mesaDRM ? PROTO::mesaDRM->getGlobal() : nullptr,
PROTO::linuxDma ? PROTO::linuxDma->getGlobal() : nullptr, PROTO::linuxDma ? PROTO::linuxDma->getGlobal() : nullptr,

View File

@@ -197,7 +197,7 @@ SP<SXCursors> CXCursorManager::createCursor(std::string const& shape, XcursorIma
return xcursor; return xcursor;
} }
std::unordered_set<std::string> CXCursorManager::themePaths(std::string const& theme) { std::set<std::string> CXCursorManager::themePaths(std::string const& theme) {
auto const* path = XcursorLibraryPath(); auto const* path = XcursorLibraryPath();
auto expandTilde = [](std::string const& path) { auto expandTilde = [](std::string const& path) {
@@ -276,10 +276,10 @@ std::unordered_set<std::string> CXCursorManager::themePaths(std::string const& t
return themes; return themes;
}; };
std::unordered_set<std::string> paths; std::set<std::string> paths;
std::unordered_set<std::string> inherits; std::set<std::string> inherits;
auto scanTheme = [&path, &paths, &expandTilde, &inherits, &getInheritThemes](auto const& t) { auto scanTheme = [&path, &paths, &expandTilde, &inherits, &getInheritThemes](auto const& t) {
std::stringstream ss(path); std::stringstream ss(path);
std::string line; std::string line;

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include <unordered_set> #include <set>
#include <array> #include <array>
#include <cstdint> #include <cstdint>
#include <hyprutils/math/Vector2D.hpp> #include <hyprutils/math/Vector2D.hpp>
@@ -34,16 +34,16 @@ class CXCursorManager {
void syncGsettings(); void syncGsettings();
private: private:
SP<SXCursors> createCursor(std::string const& shape, XcursorImages* xImages); SP<SXCursors> createCursor(std::string const& shape, XcursorImages* xImages);
std::unordered_set<std::string> themePaths(std::string const& theme); std::set<std::string> themePaths(std::string const& theme);
std::string getLegacyShapeName(std::string const& shape); std::string getLegacyShapeName(std::string const& shape);
std::vector<SP<SXCursors>> loadStandardCursors(std::string const& name, int size); std::vector<SP<SXCursors>> loadStandardCursors(std::string const& name, int size);
std::vector<SP<SXCursors>> loadAllFromDir(std::string const& path, int size); std::vector<SP<SXCursors>> loadAllFromDir(std::string const& path, int size);
int lastLoadSize = 0; int lastLoadSize = 0;
float lastLoadScale = 0; float lastLoadScale = 0;
std::string themeName = ""; std::string themeName = "";
SP<SXCursors> defaultCursor; SP<SXCursors> defaultCursor;
SP<SXCursors> hyprCursor; SP<SXCursors> hyprCursor;
std::vector<SP<SXCursors>> cursors; std::vector<SP<SXCursors>> cursors;
}; };

View File

@@ -213,36 +213,6 @@ void CHyprXWaylandManager::setWindowFullscreen(PHLWINDOW pWindow, bool fullscree
pWindow->m_pXDGSurface->toplevel->setFullscreen(fullscreen); pWindow->m_pXDGSurface->toplevel->setFullscreen(fullscreen);
} }
Vector2D CHyprXWaylandManager::getMaxSizeForWindow(PHLWINDOW pWindow) {
constexpr int NO_MAX_SIZE_LIMIT = 99999;
if (!validMapped(pWindow) ||
((pWindow->m_bIsX11 && !pWindow->m_pXWaylandSurface->sizeHints) || (!pWindow->m_bIsX11 && !pWindow->m_pXDGSurface->toplevel) ||
pWindow->m_sWindowData.noMaxSize.valueOrDefault()))
return Vector2D(NO_MAX_SIZE_LIMIT, NO_MAX_SIZE_LIMIT);
Vector2D maxSize = pWindow->m_bIsX11 ? Vector2D(pWindow->m_pXWaylandSurface->sizeHints->max_width, pWindow->m_pXWaylandSurface->sizeHints->max_height) :
pWindow->m_pXDGSurface->toplevel->current.maxSize;
if (maxSize.x < 5)
maxSize.x = NO_MAX_SIZE_LIMIT;
if (maxSize.y < 5)
maxSize.y = NO_MAX_SIZE_LIMIT;
return maxSize;
}
Vector2D CHyprXWaylandManager::getMinSizeForWindow(PHLWINDOW pWindow) {
if (!validMapped(pWindow) || ((pWindow->m_bIsX11 && !pWindow->m_pXWaylandSurface->sizeHints) || (!pWindow->m_bIsX11 && !pWindow->m_pXDGSurface->toplevel)))
return Vector2D(0, 0);
Vector2D minSize = pWindow->m_bIsX11 ? Vector2D(pWindow->m_pXWaylandSurface->sizeHints->min_width, pWindow->m_pXWaylandSurface->sizeHints->min_height) :
pWindow->m_pXDGSurface->toplevel->current.minSize;
minSize = minSize.clamp({1, 1});
return minSize;
}
Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) { Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) {
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling"); static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");

View File

@@ -21,8 +21,6 @@ class CHyprXWaylandManager {
void setWindowFullscreen(PHLWINDOW, bool); void setWindowFullscreen(PHLWINDOW, bool);
bool shouldBeFloated(PHLWINDOW, bool pending = false); bool shouldBeFloated(PHLWINDOW, bool pending = false);
void checkBorders(PHLWINDOW); void checkBorders(PHLWINDOW);
Vector2D getMaxSizeForWindow(PHLWINDOW);
Vector2D getMinSizeForWindow(PHLWINDOW);
Vector2D xwaylandToWaylandCoords(const Vector2D&); Vector2D xwaylandToWaylandCoords(const Vector2D&);
}; };

View File

@@ -188,7 +188,7 @@ Vector2D CPointerConstraint::logicPositionHint() {
const auto SURFBOX = pHLSurface->getSurfaceBoxGlobal(); const auto SURFBOX = pHLSurface->getSurfaceBoxGlobal();
const auto CONSTRAINTPOS = SURFBOX.has_value() ? SURFBOX->pos() : Vector2D{}; const auto CONSTRAINTPOS = SURFBOX.has_value() ? SURFBOX->pos() : Vector2D{};
return hintSet ? CONSTRAINTPOS + positionHint : (locked ? CONSTRAINTPOS + SURFBOX->size() / 2.f : cursorPosOnActivate); return hintSet ? CONSTRAINTPOS + positionHint : cursorPosOnActivate;
} }
CPointerConstraintsProtocol::CPointerConstraintsProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { CPointerConstraintsProtocol::CPointerConstraintsProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {

View File

@@ -323,6 +323,18 @@ void CXDGToplevelResource::close() {
resource->sendClose(); resource->sendClose();
} }
Vector2D CXDGToplevelResource::layoutMinSize() {
if (current.minSize.x <= 1 && current.minSize.y <= 1)
return {0, 0};
return owner ? current.minSize + owner->current.geometry.pos() : current.minSize;
}
Vector2D CXDGToplevelResource::layoutMaxSize() {
if (current.maxSize.x <= 1 && current.maxSize.y <= 1)
return {0, 0};
return owner ? current.maxSize + owner->current.geometry.pos() : current.maxSize;
}
CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBase> owner_, SP<CWLSurfaceResource> surface_) : CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBase> owner_, SP<CWLSurfaceResource> surface_) :
owner(owner_), surface(surface_), resource(resource_) { owner(owner_), surface(surface_), resource(resource_) {
if (!good()) if (!good())

View File

@@ -99,6 +99,9 @@ class CXDGToplevelResource {
bool good(); bool good();
Vector2D layoutMinSize();
Vector2D layoutMaxSize();
// schedule a configure event // schedule a configure event
uint32_t setSize(const Vector2D& size); uint32_t setSize(const Vector2D& size);
uint32_t setMaximized(bool maximized); uint32_t setMaximized(bool maximized);

View File

@@ -222,6 +222,11 @@ static void renderSurface(SP<CWLSurfaceResource> surface, int x, int y, void* da
windowBox.height = RDATA->h - y; windowBox.height = RDATA->h - y;
} }
const auto PROJSIZEUNSCALED = windowBox.size();
windowBox.scale(RDATA->pMonitor->scale);
windowBox.round();
if (windowBox.width <= 1 || windowBox.height <= 1) { if (windowBox.width <= 1 || windowBox.height <= 1) {
if (!g_pHyprRenderer->m_bBlockSurfaceFeedback) { if (!g_pHyprRenderer->m_bBlockSurfaceFeedback) {
Debug::log(TRACE, "presentFeedback for invisible surface"); Debug::log(TRACE, "presentFeedback for invisible surface");
@@ -231,11 +236,6 @@ static void renderSurface(SP<CWLSurfaceResource> surface, int x, int y, void* da
return; // invisible return; // invisible
} }
const auto PROJSIZEUNSCALED = windowBox.size();
windowBox.scale(RDATA->pMonitor->scale);
windowBox.round();
const bool MISALIGNEDFSV1 = std::floor(RDATA->pMonitor->scale) != RDATA->pMonitor->scale /* Fractional */ && surface->current.scale == 1 /* fs protocol */ && const bool MISALIGNEDFSV1 = std::floor(RDATA->pMonitor->scale) != RDATA->pMonitor->scale /* Fractional */ && surface->current.scale == 1 /* fs protocol */ &&
windowBox.size() != surface->current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, surface->current.bufferSize.x, 3) && windowBox.size() != surface->current.bufferSize /* misaligned */ && DELTALESSTHAN(windowBox.width, surface->current.bufferSize.x, 3) &&
DELTALESSTHAN(windowBox.height, surface->current.bufferSize.y, 3) /* off by one-or-two */ && DELTALESSTHAN(windowBox.height, surface->current.bufferSize.y, 3) /* off by one-or-two */ &&
@@ -732,7 +732,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, timespe
pWindow->m_pPopupHead->breadthfirst( pWindow->m_pPopupHead->breadthfirst(
[](CPopup* popup, void* data) { [](CPopup* popup, void* data) {
if (!popup->m_pWLSurface || !popup->m_pWLSurface->resource()) if (!popup->m_pWLSurface || !popup->m_pWLSurface->resource() || !popup->m_bMapped)
return; return;
auto pos = popup->coordsRelativeToParent(); auto pos = popup->coordsRelativeToParent();
auto rd = (SRenderData*)data; auto rd = (SRenderData*)data;
@@ -822,7 +822,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, timespec* tim
if (popups) { if (popups) {
pLayer->popupHead->breadthfirst( pLayer->popupHead->breadthfirst(
[](CPopup* popup, void* data) { [](CPopup* popup, void* data) {
if (!popup->m_pWLSurface || !popup->m_pWLSurface->resource()) if (!popup->m_pWLSurface || !popup->m_pWLSurface->resource() || !popup->m_bMapped)
return; return;
Vector2D pos = popup->coordsRelativeToParent(); Vector2D pos = popup->coordsRelativeToParent();