mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-25 18:49:47 +01:00
Merge branch 'main' into hyprlang-migration
This commit is contained in:
commit
3a6451b602
22 changed files with 257 additions and 193 deletions
BIN
assets/wall1.png
BIN
assets/wall1.png
Binary file not shown.
Before Width: | Height: | Size: 5.4 MiB After Width: | Height: | Size: 5.9 MiB |
|
@ -126,7 +126,7 @@ device:epic-mouse-v1 {
|
||||||
# Example windowrule v2
|
# Example windowrule v2
|
||||||
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
||||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||||
windowrulev2 = nomaximizerequest, class:.* # You'll probably like this.
|
windowrulev2 = suppressevent maximize, class:.* # You'll probably like this.
|
||||||
|
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
||||||
|
|
12
flake.lock
12
flake.lock
|
@ -66,11 +66,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1706191920,
|
"lastModified": 1707546158,
|
||||||
"narHash": "sha256-eLihrZAPZX0R6RyM5fYAWeKVNuQPYjAkCUBr+JNvtdE=",
|
"narHash": "sha256-nYYJTpzfPMDxI8mzhQsYjIUX+grorqjKEU9Np6Xwy/0=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ae5c332cbb5827f6b1f02572496b141021de335f",
|
"rev": "d934204a0f8d9198e1e4515dd6fec76a139c87f0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -138,11 +138,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1706145785,
|
"lastModified": 1706521509,
|
||||||
"narHash": "sha256-j9MP4fv2U/vdRKAXXc2gyMTmYwVnHP6kHx1/y6jprrU=",
|
"narHash": "sha256-AInZ50acOJ3wzUwGzNr1TmxGTMx+8j6oSTzz4E7Vbp8=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "xdg-desktop-portal-hyprland",
|
"repo": "xdg-desktop-portal-hyprland",
|
||||||
"rev": "5a592647587cd20b9692a347df6939b6d371b3bb",
|
"rev": "c06fd88b3da492b8f9067be021b9184f7012b5a8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -371,44 +371,8 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
if (fullRequest.contains("/--batch"))
|
if (fullRequest.contains("/--batch"))
|
||||||
batchRequest(fullRequest);
|
batchRequest(fullRequest);
|
||||||
else if (fullRequest.contains("/monitors"))
|
else if (fullRequest.contains("/hyprpaper"))
|
||||||
request(fullRequest);
|
requestHyprpaper(fullRequest);
|
||||||
else if (fullRequest.contains("/clients"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/workspaces"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/activeworkspace"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/workspacerules"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/activewindow"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/layers"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/version"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/kill"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/systeminfo"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/splash"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/devices"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/reload"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/getoption"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/binds"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/cursorpos"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/animations"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/globalshortcuts"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/rollinglog"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/switchxkblayout"))
|
else if (fullRequest.contains("/switchxkblayout"))
|
||||||
request(fullRequest, 2);
|
request(fullRequest, 2);
|
||||||
else if (fullRequest.contains("/seterror"))
|
else if (fullRequest.contains("/seterror"))
|
||||||
|
@ -429,15 +393,10 @@ int main(int argc, char** argv) {
|
||||||
request(fullRequest, 2);
|
request(fullRequest, 2);
|
||||||
else if (fullRequest.contains("/decorations"))
|
else if (fullRequest.contains("/decorations"))
|
||||||
request(fullRequest, 1);
|
request(fullRequest, 1);
|
||||||
else if (fullRequest.contains("/hyprpaper"))
|
|
||||||
requestHyprpaper(fullRequest);
|
|
||||||
else if (fullRequest.contains("/layouts"))
|
|
||||||
request(fullRequest);
|
|
||||||
else if (fullRequest.contains("/--help"))
|
else if (fullRequest.contains("/--help"))
|
||||||
printf("%s", USAGE.c_str());
|
printf("%s", USAGE.c_str());
|
||||||
else {
|
else {
|
||||||
printf("%s\n", USAGE.c_str());
|
request(fullRequest);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
|
@ -32,9 +32,9 @@ in {
|
||||||
hyprland = final.callPackage ./default.nix {
|
hyprland = final.callPackage ./default.nix {
|
||||||
stdenv = final.gcc13Stdenv;
|
stdenv = final.gcc13Stdenv;
|
||||||
version = "${props.version}+date=${date}_${self.shortRev or "dirty"}";
|
version = "${props.version}+date=${date}_${self.shortRev or "dirty"}";
|
||||||
wlroots = prev.wlroots-hyprland;
|
|
||||||
commit = self.rev or "";
|
commit = self.rev or "";
|
||||||
inherit (final) udis86 hyprland-protocols;
|
wlroots = final.wlroots-hyprland; # explicit override until decided on breaking change of the name
|
||||||
|
udis86 = final.udis86-hyprland; # explicit override until decided on breaking change of the name
|
||||||
inherit date;
|
inherit date;
|
||||||
};
|
};
|
||||||
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
||||||
|
@ -62,7 +62,7 @@ in {
|
||||||
];
|
];
|
||||||
|
|
||||||
udis86 = final: prev: {
|
udis86 = final: prev: {
|
||||||
udis86 = final.callPackage ./udis86.nix {};
|
udis86-hyprland = final.callPackage ./udis86.nix {};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Patched version of wlroots for Hyprland.
|
# Patched version of wlroots for Hyprland.
|
||||||
|
|
|
@ -710,7 +710,8 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
for (auto& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
const auto BB = w->getWindowBoxUnified(properties);
|
const auto BB = w->getWindowBoxUnified(properties);
|
||||||
CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
|
CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
|
||||||
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_bNoFocus && w.get() != pIgnoreWindow) {
|
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sAdditionalConfigData.noFocus &&
|
||||||
|
w.get() != pIgnoreWindow) {
|
||||||
if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}))
|
if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}))
|
||||||
return w.get();
|
return w.get();
|
||||||
|
|
||||||
|
@ -732,7 +733,8 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
|
|
||||||
const auto BB = w->getWindowBoxUnified(properties);
|
const auto BB = w->getWindowBoxUnified(properties);
|
||||||
CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
|
CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
|
||||||
if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned && !w->m_bNoFocus && w.get() != pIgnoreWindow) {
|
if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_iWorkspaceID) && !w->isHidden() && !w->m_bPinned && !w->m_sAdditionalConfigData.noFocus &&
|
||||||
|
w.get() != pIgnoreWindow) {
|
||||||
// OR windows should add focus to parent
|
// OR windows should add focus to parent
|
||||||
if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2)
|
if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2)
|
||||||
continue;
|
continue;
|
||||||
|
@ -770,8 +772,8 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
if (special != isWorkspaceSpecial(w->m_iWorkspaceID))
|
if (special != isWorkspaceSpecial(w->m_iWorkspaceID))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!w->m_bIsX11 && !w->m_bIsFloating && w->m_bIsMapped && w->m_iWorkspaceID == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus && !w->m_bNoFocus &&
|
if (!w->m_bIsX11 && !w->m_bIsFloating && w->m_bIsMapped && w->m_iWorkspaceID == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus &&
|
||||||
w.get() != pIgnoreWindow) {
|
!w->m_sAdditionalConfigData.noFocus && w.get() != pIgnoreWindow) {
|
||||||
if (w->hasPopupAt(pos))
|
if (w->hasPopupAt(pos))
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
@ -782,8 +784,8 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CBox box = (properties & USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_vPosition, w->m_vSize};
|
CBox box = (properties & USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_vPosition, w->m_vSize};
|
||||||
if (!w->m_bIsFloating && w->m_bIsMapped && box.containsPoint(pos) && w->m_iWorkspaceID == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus && !w->m_bNoFocus &&
|
if (!w->m_bIsFloating && w->m_bIsMapped && box.containsPoint(pos) && w->m_iWorkspaceID == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus &&
|
||||||
w.get() != pIgnoreWindow)
|
!w->m_sAdditionalConfigData.noFocus && w.get() != pIgnoreWindow)
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,7 +930,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow->m_bNoFocus) {
|
if (pWindow->m_sAdditionalConfigData.noFocus) {
|
||||||
Debug::log(LOG, "Ignoring focus to nofocus window!");
|
Debug::log(LOG, "Ignoring focus to nofocus window!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1646,7 +1648,7 @@ CWindow* CCompositor::getNextWindowOnWorkspace(CWindow* pWindow, bool focusableO
|
||||||
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_bNoFocus))
|
if (w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1654,7 +1656,7 @@ CWindow* CCompositor::getNextWindowOnWorkspace(CWindow* pWindow, bool focusableO
|
||||||
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w.get() != pWindow && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_bNoFocus))
|
if (w.get() != pWindow && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1675,7 +1677,7 @@ CWindow* CCompositor::getPrevWindowOnWorkspace(CWindow* pWindow, bool focusableO
|
||||||
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_bNoFocus))
|
if (w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1683,7 +1685,7 @@ CWindow* CCompositor::getPrevWindowOnWorkspace(CWindow* pWindow, bool focusableO
|
||||||
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w.get() != pWindow && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_bNoFocus))
|
if (w.get() != pWindow && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2028,7 +2030,11 @@ void CCompositor::swapActiveWorkspaces(CMonitor* pMonitorA, CMonitor* pMonitorB)
|
||||||
updateFullscreenFadeOnWorkspace(PWORKSPACEB);
|
updateFullscreenFadeOnWorkspace(PWORKSPACEB);
|
||||||
updateFullscreenFadeOnWorkspace(PWORKSPACEA);
|
updateFullscreenFadeOnWorkspace(PWORKSPACEA);
|
||||||
|
|
||||||
g_pInputManager->sendMotionEventsToFocused();
|
if (pMonitorA->ID == g_pCompositor->m_pLastMonitor->ID || pMonitorB->ID == g_pCompositor->m_pLastMonitor->ID) {
|
||||||
|
const auto LASTWIN = pMonitorA->ID == g_pCompositor->m_pLastMonitor->ID ? PWORKSPACEB->getLastFocusedWindow() : PWORKSPACEA->getLastFocusedWindow();
|
||||||
|
g_pCompositor->focusWindow(LASTWIN ? LASTWIN :
|
||||||
|
(g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING)));
|
||||||
|
}
|
||||||
|
|
||||||
// event
|
// event
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"moveworkspace", PWORKSPACEA->m_szName + "," + pMonitorB->szName});
|
g_pEventManager->postEvent(SHyprIPCEvent{"moveworkspace", PWORKSPACEA->m_szName + "," + pMonitorB->szName});
|
||||||
|
|
|
@ -37,7 +37,15 @@ enum eGetWindowProperties {
|
||||||
FULL_EXTENTS = 1 << 2,
|
FULL_EXTENTS = 1 << 2,
|
||||||
FLOATING_ONLY = 1 << 3,
|
FLOATING_ONLY = 1 << 3,
|
||||||
ALLOW_FLOATING = 1 << 4,
|
ALLOW_FLOATING = 1 << 4,
|
||||||
USE_PROP_TILED = 1 << 5
|
USE_PROP_TILED = 1 << 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eSuppressEvents {
|
||||||
|
SUPPRESS_NONE = 0,
|
||||||
|
SUPPRESS_FULLSCREEN = 1 << 0,
|
||||||
|
SUPPRESS_MAXIMIZE = 1 << 1,
|
||||||
|
SUPPRESS_ACTIVATE = 1 << 2,
|
||||||
|
SUPPRESS_ACTIVATE_FOCUSONLY = 1 << 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
class IWindowTransformer;
|
class IWindowTransformer;
|
||||||
|
@ -143,6 +151,7 @@ struct SWindowAdditionalConfigData {
|
||||||
CWindowOverridableVar<bool> forceNoBorder = false;
|
CWindowOverridableVar<bool> forceNoBorder = false;
|
||||||
CWindowOverridableVar<bool> forceNoShadow = false;
|
CWindowOverridableVar<bool> forceNoShadow = false;
|
||||||
CWindowOverridableVar<bool> forceNoDim = false;
|
CWindowOverridableVar<bool> forceNoDim = false;
|
||||||
|
CWindowOverridableVar<bool> noFocus = false;
|
||||||
CWindowOverridableVar<bool> windowDanceCompat = false;
|
CWindowOverridableVar<bool> windowDanceCompat = false;
|
||||||
CWindowOverridableVar<bool> noMaxSize = false;
|
CWindowOverridableVar<bool> noMaxSize = false;
|
||||||
CWindowOverridableVar<bool> dimAround = false;
|
CWindowOverridableVar<bool> dimAround = false;
|
||||||
|
@ -260,13 +269,13 @@ class CWindow {
|
||||||
//
|
//
|
||||||
|
|
||||||
// For nofocus
|
// For nofocus
|
||||||
bool m_bNoFocus = false;
|
|
||||||
bool m_bNoInitialFocus = false;
|
bool m_bNoInitialFocus = false;
|
||||||
|
|
||||||
// Fullscreen and Maximize
|
// Fullscreen and Maximize
|
||||||
bool m_bWantsInitialFullscreen = false;
|
bool m_bWantsInitialFullscreen = false;
|
||||||
bool m_bNoFullscreenRequest = false;
|
|
||||||
bool m_bNoMaximizeRequest = false;
|
// bitfield eSuppressEvents
|
||||||
|
uint64_t m_eSuppressedEvents = SUPPRESS_NONE;
|
||||||
|
|
||||||
SSurfaceTreeNode* m_pSurfaceTree = nullptr;
|
SSurfaceTreeNode* m_pSurfaceTree = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -1812,11 +1812,11 @@ std::optional<std::string> CConfigManager::handleUnbind(const std::string& comma
|
||||||
bool windowRuleValid(const std::string& RULE) {
|
bool windowRuleValid(const std::string& RULE) {
|
||||||
return RULE == "float" || RULE == "tile" || RULE.starts_with("opacity") || RULE.starts_with("move") || RULE.starts_with("size") || RULE.starts_with("minsize") ||
|
return RULE == "float" || RULE == "tile" || RULE.starts_with("opacity") || RULE.starts_with("move") || RULE.starts_with("size") || RULE.starts_with("minsize") ||
|
||||||
RULE.starts_with("maxsize") || RULE.starts_with("pseudo") || RULE.starts_with("monitor") || RULE.starts_with("idleinhibit") || RULE == "nofocus" || RULE == "noblur" ||
|
RULE.starts_with("maxsize") || RULE.starts_with("pseudo") || RULE.starts_with("monitor") || RULE.starts_with("idleinhibit") || RULE == "nofocus" || RULE == "noblur" ||
|
||||||
RULE == "noshadow" || RULE == "nodim" || RULE == "noborder" || RULE == "opaque" || RULE == "forceinput" || RULE == "fullscreen" || RULE == "nofullscreenrequest" ||
|
RULE == "noshadow" || RULE == "nodim" || RULE == "noborder" || RULE == "opaque" || RULE == "forceinput" || RULE == "fullscreen" || RULE == "fakefullscreen" ||
|
||||||
RULE == "nomaximizerequest" || RULE == "fakefullscreen" || RULE == "nomaxsize" || RULE == "pin" || RULE == "noanim" || RULE == "dimaround" || RULE == "windowdance" ||
|
RULE == "nomaxsize" || RULE == "pin" || RULE == "noanim" || RULE == "dimaround" || RULE == "windowdance" || RULE == "maximize" || RULE == "keepaspectratio" ||
|
||||||
RULE == "maximize" || RULE == "keepaspectratio" || RULE.starts_with("animation") || RULE.starts_with("rounding") || RULE.starts_with("workspace") ||
|
RULE.starts_with("animation") || RULE.starts_with("rounding") || RULE.starts_with("workspace") || RULE.starts_with("bordercolor") || RULE == "forcergbx" ||
|
||||||
RULE.starts_with("bordercolor") || RULE == "forcergbx" || RULE == "noinitialfocus" || RULE == "stayfocused" || RULE.starts_with("bordersize") || RULE.starts_with("xray") ||
|
RULE == "noinitialfocus" || RULE == "stayfocused" || RULE.starts_with("bordersize") || RULE.starts_with("xray") || RULE.starts_with("center") ||
|
||||||
RULE.starts_with("center") || RULE.starts_with("group") || RULE == "immediate" || RULE == "nearestneighbor";
|
RULE.starts_with("group") || RULE == "immediate" || RULE == "nearestneighbor" || RULE.starts_with("suppressevent");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool layerRuleValid(const std::string& RULE) {
|
bool layerRuleValid(const std::string& RULE) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ input {
|
||||||
natural_scroll = no
|
natural_scroll = no
|
||||||
}
|
}
|
||||||
|
|
||||||
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
|
sensitivity = 0 # -1.0 to 1.0, 0 means no modification.
|
||||||
}
|
}
|
||||||
|
|
||||||
general {
|
general {
|
||||||
|
@ -133,7 +133,7 @@ device:epic-mouse-v1 {
|
||||||
# Example windowrule v2
|
# Example windowrule v2
|
||||||
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
||||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||||
windowrulev2 = nomaximizerequest, class:.* # You'll probably like this.
|
windowrulev2 = suppressevent maximize, class:.* # You'll probably like this.
|
||||||
|
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
||||||
|
|
|
@ -965,7 +965,7 @@ std::string dispatchBatch(eHyprCtlOutputFormat format, std::string request) {
|
||||||
|
|
||||||
nextItem();
|
nextItem();
|
||||||
|
|
||||||
while (curitem != "") {
|
while (curitem != "" || request != "") {
|
||||||
reply += g_pHyprCtl->getReply(curitem);
|
reply += g_pHyprCtl->getReply(curitem);
|
||||||
|
|
||||||
nextItem();
|
nextItem();
|
||||||
|
@ -1087,7 +1087,8 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
|
||||||
if (vars.size() < 4)
|
if (vars.size() < 4)
|
||||||
return "not enough args";
|
return "not enough args";
|
||||||
|
|
||||||
const auto PWINDOW = g_pCompositor->getWindowByRegex(vars[1]);
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
||||||
|
const auto PWINDOW = g_pCompositor->getWindowByRegex(vars[1]);
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return "window not found";
|
return "window not found";
|
||||||
|
@ -1095,6 +1096,8 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
|
||||||
const auto PROP = vars[2];
|
const auto PROP = vars[2];
|
||||||
const auto VAL = vars[3];
|
const auto VAL = vars[3];
|
||||||
|
|
||||||
|
auto noFocus = PWINDOW->m_sAdditionalConfigData.noFocus;
|
||||||
|
|
||||||
bool lock = false;
|
bool lock = false;
|
||||||
|
|
||||||
if (vars.size() > 4) {
|
if (vars.size() > 4) {
|
||||||
|
@ -1124,6 +1127,8 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
|
||||||
PWINDOW->m_sAdditionalConfigData.forceNoShadow.forceSetIgnoreLocked(configStringToInt(VAL), lock);
|
PWINDOW->m_sAdditionalConfigData.forceNoShadow.forceSetIgnoreLocked(configStringToInt(VAL), lock);
|
||||||
} else if (PROP == "forcenodim") {
|
} else if (PROP == "forcenodim") {
|
||||||
PWINDOW->m_sAdditionalConfigData.forceNoDim.forceSetIgnoreLocked(configStringToInt(VAL), lock);
|
PWINDOW->m_sAdditionalConfigData.forceNoDim.forceSetIgnoreLocked(configStringToInt(VAL), lock);
|
||||||
|
} else if (PROP == "nofocus") {
|
||||||
|
PWINDOW->m_sAdditionalConfigData.noFocus.forceSetIgnoreLocked(configStringToInt(VAL), lock);
|
||||||
} else if (PROP == "windowdancecompat") {
|
} else if (PROP == "windowdancecompat") {
|
||||||
PWINDOW->m_sAdditionalConfigData.windowDanceCompat.forceSetIgnoreLocked(configStringToInt(VAL), lock);
|
PWINDOW->m_sAdditionalConfigData.windowDanceCompat.forceSetIgnoreLocked(configStringToInt(VAL), lock);
|
||||||
} else if (PROP == "nomaxsize") {
|
} else if (PROP == "nomaxsize") {
|
||||||
|
@ -1159,6 +1164,12 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
|
||||||
|
|
||||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||||
|
|
||||||
|
if (!(PWINDOW->m_sAdditionalConfigData.noFocus.toUnderlying() == noFocus.toUnderlying())) {
|
||||||
|
g_pCompositor->focusWindow(nullptr);
|
||||||
|
g_pCompositor->focusWindow(PWINDOW);
|
||||||
|
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
||||||
|
|
||||||
|
|
|
@ -227,3 +227,7 @@ void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
|
||||||
CBox pMonBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
|
CBox pMonBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y};
|
||||||
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
|
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CHyprNotificationOverlay::hasAny() {
|
||||||
|
return !m_dNotifications.empty();
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ class CHyprNotificationOverlay {
|
||||||
|
|
||||||
void draw(CMonitor* pMonitor);
|
void draw(CMonitor* pMonitor);
|
||||||
void addNotification(const std::string& text, const CColor& color, const float timeMs, const eIcons icon = ICON_NONE);
|
void addNotification(const std::string& text, const CColor& color, const float timeMs, const eIcons icon = ICON_NONE);
|
||||||
|
bool hasAny();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CBox drawNotifications(CMonitor* pMonitor);
|
CBox drawNotifications(CMonitor* pMonitor);
|
||||||
|
|
|
@ -209,10 +209,20 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_monitorStateRequest(void* owner, void* data) {
|
void Events::listener_monitorStateRequest(void* owner, void* data) {
|
||||||
//const auto PMONITOR = (CMonitor*)owner;
|
const auto PMONITOR = (CMonitor*)owner;
|
||||||
//const auto E = (wlr_output_event_request_state*)data;
|
const auto E = (wlr_output_event_request_state*)data;
|
||||||
|
|
||||||
// TODO: maybe don't ignore?
|
if (!PMONITOR->createdByUser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto SIZE = E->state->mode ? Vector2D{E->state->mode->width, E->state->mode->height} : Vector2D{E->state->custom_mode.width, E->state->custom_mode.height};
|
||||||
|
|
||||||
|
PMONITOR->forceSize = SIZE;
|
||||||
|
|
||||||
|
SMonitorRule rule = PMONITOR->activeMonitorRule;
|
||||||
|
rule.resolution = SIZE;
|
||||||
|
|
||||||
|
g_pHyprRenderer->applyMonitorRule(PMONITOR, &rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_monitorDamage(void* owner, void* data) {
|
void Events::listener_monitorDamage(void* owner, void* data) {
|
||||||
|
|
|
@ -173,13 +173,23 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
} else if (r.szRule.starts_with("pseudo")) {
|
} else if (r.szRule.starts_with("pseudo")) {
|
||||||
PWINDOW->m_bIsPseudotiled = true;
|
PWINDOW->m_bIsPseudotiled = true;
|
||||||
} else if (r.szRule.starts_with("nofocus")) {
|
} else if (r.szRule.starts_with("nofocus")) {
|
||||||
PWINDOW->m_bNoFocus = true;
|
PWINDOW->m_sAdditionalConfigData.noFocus = true;
|
||||||
} else if (r.szRule.starts_with("noinitialfocus")) {
|
} else if (r.szRule.starts_with("noinitialfocus")) {
|
||||||
PWINDOW->m_bNoInitialFocus = true;
|
PWINDOW->m_bNoInitialFocus = true;
|
||||||
} else if (r.szRule.starts_with("nofullscreenrequest")) {
|
} else if (r.szRule.starts_with("suppressevent")) {
|
||||||
PWINDOW->m_bNoFullscreenRequest = true;
|
CVarList vars(r.szRule, 0, 's', true);
|
||||||
} else if (r.szRule.starts_with("nomaximizerequest")) {
|
for (size_t i = 1; i < vars.size(); ++i) {
|
||||||
PWINDOW->m_bNoMaximizeRequest = true;
|
if (vars[i] == "fullscreen")
|
||||||
|
PWINDOW->m_eSuppressedEvents |= SUPPRESS_FULLSCREEN;
|
||||||
|
else if (vars[i] == "maximize")
|
||||||
|
PWINDOW->m_eSuppressedEvents |= SUPPRESS_MAXIMIZE;
|
||||||
|
else if (vars[i] == "activate")
|
||||||
|
PWINDOW->m_eSuppressedEvents |= SUPPRESS_ACTIVATE;
|
||||||
|
else if (vars[i] == "activatefocus")
|
||||||
|
PWINDOW->m_eSuppressedEvents |= SUPPRESS_ACTIVATE_FOCUSONLY;
|
||||||
|
else
|
||||||
|
Debug::log(ERR, "Error while parsing suppressevent windowrule: unknown event type {}", vars[i]);
|
||||||
|
}
|
||||||
} else if (r.szRule == "fullscreen") {
|
} else if (r.szRule == "fullscreen") {
|
||||||
requestsFullscreen = true;
|
requestsFullscreen = true;
|
||||||
overridingNoFullscreen = true;
|
overridingNoFullscreen = true;
|
||||||
|
@ -443,9 +453,9 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow;
|
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow;
|
||||||
|
|
||||||
if (PWINDOW->m_sAdditionalConfigData.forceAllowsInput) {
|
if (PWINDOW->m_sAdditionalConfigData.forceAllowsInput) {
|
||||||
PWINDOW->m_bNoFocus = false;
|
PWINDOW->m_sAdditionalConfigData.noFocus = false;
|
||||||
PWINDOW->m_bNoInitialFocus = false;
|
PWINDOW->m_bNoInitialFocus = false;
|
||||||
PWINDOW->m_bX11ShouldntFocus = false;
|
PWINDOW->m_bX11ShouldntFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check LS focus grab
|
// check LS focus grab
|
||||||
|
@ -464,7 +474,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
requestsFullscreen = true;
|
requestsFullscreen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PWINDOW->m_bNoFocus && !PWINDOW->m_bNoInitialFocus &&
|
if (!PWINDOW->m_sAdditionalConfigData.noFocus && !PWINDOW->m_bNoInitialFocus &&
|
||||||
(PWINDOW->m_iX11Type != 2 || (PWINDOW->m_bIsX11 && wlr_xwayland_or_surface_wants_focus(PWINDOW->m_uSurface.xwayland))) && !workspaceSilent &&
|
(PWINDOW->m_iX11Type != 2 || (PWINDOW->m_bIsX11 && wlr_xwayland_or_surface_wants_focus(PWINDOW->m_uSurface.xwayland))) && !workspaceSilent &&
|
||||||
(!PFORCEFOCUS || PFORCEFOCUS == PWINDOW)) {
|
(!PFORCEFOCUS || PFORCEFOCUS == PWINDOW)) {
|
||||||
g_pCompositor->focusWindow(PWINDOW);
|
g_pCompositor->focusWindow(PWINDOW);
|
||||||
|
@ -504,8 +514,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
"XWayland Window Late");
|
"XWayland Window Late");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((requestsFullscreen && (!PWINDOW->m_bNoFullscreenRequest || overridingNoFullscreen)) || (requestsMaximize && (!PWINDOW->m_bNoMaximizeRequest || overridingNoMaximize)) ||
|
if ((requestsFullscreen && (!(PWINDOW->m_eSuppressedEvents & SUPPRESS_FULLSCREEN) || overridingNoFullscreen)) ||
|
||||||
requestsFakeFullscreen) {
|
(requestsMaximize && (!(PWINDOW->m_eSuppressedEvents & SUPPRESS_MAXIMIZE) || overridingNoMaximize)) || requestsFakeFullscreen) {
|
||||||
// fix fullscreen on requested (basically do a switcheroo)
|
// fix fullscreen on requested (basically do a switcheroo)
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
||||||
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
|
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
|
||||||
|
@ -905,7 +915,7 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PWINDOW->isHidden() || PWINDOW->m_bNoFullscreenRequest)
|
if (PWINDOW->isHidden() || (PWINDOW->m_eSuppressedEvents & SUPPRESS_FULLSCREEN))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool requestedFullState = false;
|
bool requestedFullState = false;
|
||||||
|
@ -968,7 +978,7 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) {
|
||||||
|
|
||||||
const auto PWINDOW = g_pCompositor->getWindowFromSurface(E->surface);
|
const auto PWINDOW = g_pCompositor->getWindowFromSurface(E->surface);
|
||||||
|
|
||||||
if (!PWINDOW || PWINDOW == g_pCompositor->m_pLastWindow)
|
if (!PWINDOW || PWINDOW == g_pCompositor->m_pLastWindow || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)PWINDOW)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)PWINDOW)});
|
||||||
|
@ -976,7 +986,7 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) {
|
||||||
|
|
||||||
PWINDOW->m_bIsUrgent = true;
|
PWINDOW->m_bIsUrgent = true;
|
||||||
|
|
||||||
if (!**PFOCUSONACTIVATE)
|
if (!**PFOCUSONACTIVATE || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (PWINDOW->m_bIsFloating)
|
if (PWINDOW->m_bIsFloating)
|
||||||
|
@ -1004,13 +1014,13 @@ void Events::listener_activateX11(void* owner, void* data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PWINDOW == g_pCompositor->m_pLastWindow)
|
if (PWINDOW == g_pCompositor->m_pLastWindow || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)PWINDOW)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)PWINDOW)});
|
||||||
EMIT_HOOK_EVENT("urgent", PWINDOW);
|
EMIT_HOOK_EVENT("urgent", PWINDOW);
|
||||||
|
|
||||||
if (!**PFOCUSONACTIVATE)
|
if (!**PFOCUSONACTIVATE || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (PWINDOW->m_bIsFloating)
|
if (PWINDOW->m_bIsFloating)
|
||||||
|
@ -1206,7 +1216,7 @@ void Events::listener_NewXDGDeco(wl_listener* listener, void* data) {
|
||||||
void Events::listener_requestMaximize(void* owner, void* data) {
|
void Events::listener_requestMaximize(void* owner, void* data) {
|
||||||
const auto PWINDOW = (CWindow*)owner;
|
const auto PWINDOW = (CWindow*)owner;
|
||||||
|
|
||||||
if (PWINDOW->m_bNoMaximizeRequest)
|
if (PWINDOW->m_eSuppressedEvents & SUPPRESS_MAXIMIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Debug::log(LOG, "Maximize request for {}", PWINDOW);
|
Debug::log(LOG, "Maximize request for {}", PWINDOW);
|
||||||
|
|
|
@ -73,33 +73,34 @@ class CMonitor {
|
||||||
CMonitorState state;
|
CMonitorState state;
|
||||||
|
|
||||||
// WLR stuff
|
// WLR stuff
|
||||||
wlr_damage_ring damage;
|
wlr_damage_ring damage;
|
||||||
wlr_output* output = nullptr;
|
wlr_output* output = nullptr;
|
||||||
float refreshRate = 60;
|
float refreshRate = 60;
|
||||||
int framesToSkip = 0;
|
int framesToSkip = 0;
|
||||||
int forceFullFrames = 0;
|
int forceFullFrames = 0;
|
||||||
bool noFrameSchedule = false;
|
bool noFrameSchedule = false;
|
||||||
bool scheduledRecalc = false;
|
bool scheduledRecalc = false;
|
||||||
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||||
bool gammaChanged = false;
|
bool gammaChanged = false;
|
||||||
float xwaylandScale = 1.f;
|
float xwaylandScale = 1.f;
|
||||||
std::array<float, 9> projMatrix = {0};
|
std::array<float, 9> projMatrix = {0};
|
||||||
|
std::optional<Vector2D> forceSize;
|
||||||
|
|
||||||
bool dpmsStatus = true;
|
bool dpmsStatus = true;
|
||||||
bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.
|
bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.
|
||||||
bool enabled10bit = false; // as above, this can be TRUE even if 10 bit failed.
|
bool enabled10bit = false; // as above, this can be TRUE even if 10 bit failed.
|
||||||
bool createdByUser = false;
|
bool createdByUser = false;
|
||||||
uint32_t drmFormat = DRM_FORMAT_INVALID;
|
uint32_t drmFormat = DRM_FORMAT_INVALID;
|
||||||
bool isUnsafeFallback = false;
|
bool isUnsafeFallback = false;
|
||||||
|
|
||||||
bool pendingFrame = false; // if we schedule a frame during rendering, reschedule it after
|
bool pendingFrame = false; // if we schedule a frame during rendering, reschedule it after
|
||||||
bool renderingActive = false;
|
bool renderingActive = false;
|
||||||
|
|
||||||
wl_event_source* renderTimer = nullptr; // for RAT
|
wl_event_source* renderTimer = nullptr; // for RAT
|
||||||
bool RATScheduled = false;
|
bool RATScheduled = false;
|
||||||
CTimer lastPresentationTimer;
|
CTimer lastPresentationTimer;
|
||||||
|
|
||||||
SMonitorRule activeMonitorRule;
|
SMonitorRule activeMonitorRule;
|
||||||
|
|
||||||
// mirroring
|
// mirroring
|
||||||
CMonitor* pMirrorOf = nullptr;
|
CMonitor* pMirrorOf = nullptr;
|
||||||
|
|
|
@ -225,10 +225,13 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
|
||||||
|
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
|
g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
|
||||||
} else {
|
} else {
|
||||||
PWINDOW->m_vRealSize = calcSize;
|
CBox wb = {calcPos, calcSize};
|
||||||
PWINDOW->m_vRealPosition = calcPos;
|
wb.round(); // avoid rounding mess
|
||||||
|
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, calcSize);
|
PWINDOW->m_vRealSize = wb.size();
|
||||||
|
PWINDOW->m_vRealPosition = wb.pos();
|
||||||
|
|
||||||
|
g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
|
@ -644,8 +647,10 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
|
||||||
else
|
else
|
||||||
PWINDOW->m_vPseudoSize.y -= pixResize.y * 2;
|
PWINDOW->m_vPseudoSize.y -= pixResize.y * 2;
|
||||||
|
|
||||||
PWINDOW->m_vPseudoSize.x = std::clamp(PWINDOW->m_vPseudoSize.x, 30.0, PNODE->box.w);
|
CBox wbox = PNODE->box;
|
||||||
PWINDOW->m_vPseudoSize.y = std::clamp(PWINDOW->m_vPseudoSize.y, 30.0, PNODE->box.h);
|
wbox.round();
|
||||||
|
|
||||||
|
PWINDOW->m_vPseudoSize = {std::clamp(PWINDOW->m_vPseudoSize.x, 30.0, wbox.w), std::clamp(PWINDOW->m_vPseudoSize.y, 30.0, wbox.h)};
|
||||||
|
|
||||||
PWINDOW->m_vLastFloatingSize = PWINDOW->m_vPseudoSize;
|
PWINDOW->m_vLastFloatingSize = PWINDOW->m_vPseudoSize;
|
||||||
PNODE->recalcSizePosRecursive(**PANIMATE == 0);
|
PNODE->recalcSizePosRecursive(**PANIMATE == 0);
|
||||||
|
@ -990,6 +995,8 @@ std::any CHyprDwindleLayout::layoutMessage(SLayoutMessageHeader header, std::str
|
||||||
const auto ARGS = CVarList(message, 0, ' ');
|
const auto ARGS = CVarList(message, 0, ' ');
|
||||||
if (ARGS[0] == "togglesplit") {
|
if (ARGS[0] == "togglesplit") {
|
||||||
toggleSplit(header.pWindow);
|
toggleSplit(header.pWindow);
|
||||||
|
} else if (ARGS[0] == "swapsplit") {
|
||||||
|
swapSplit(header.pWindow);
|
||||||
} else if (ARGS[0] == "preselect") {
|
} else if (ARGS[0] == "preselect") {
|
||||||
std::string direction = ARGS[1];
|
std::string direction = ARGS[1];
|
||||||
|
|
||||||
|
@ -1043,6 +1050,20 @@ void CHyprDwindleLayout::toggleSplit(CWindow* pWindow) {
|
||||||
PNODE->pParent->recalcSizePosRecursive();
|
PNODE->pParent->recalcSizePosRecursive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHyprDwindleLayout::swapSplit(CWindow* pWindow) {
|
||||||
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
|
||||||
|
if (!PNODE || !PNODE->pParent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pWindow->m_bIsFullscreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::swap(PNODE->pParent->children[0], PNODE->pParent->children[1]);
|
||||||
|
|
||||||
|
PNODE->pParent->recalcSizePosRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::replaceWindowDataWith(CWindow* from, CWindow* to) {
|
void CHyprDwindleLayout::replaceWindowDataWith(CWindow* from, CWindow* to) {
|
||||||
const auto PNODE = getNodeFromWindow(from);
|
const auto PNODE = getNodeFromWindow(from);
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,7 @@ class CHyprDwindleLayout : public IHyprLayout {
|
||||||
SDwindleNodeData* getMasterNodeOnWorkspace(const int&);
|
SDwindleNodeData* getMasterNodeOnWorkspace(const int&);
|
||||||
|
|
||||||
void toggleSplit(CWindow*);
|
void toggleSplit(CWindow*);
|
||||||
|
void swapSplit(CWindow*);
|
||||||
|
|
||||||
eDirection overrideDirection = DIRECTION_DEFAULT;
|
eDirection overrideDirection = DIRECTION_DEFAULT;
|
||||||
|
|
||||||
|
|
|
@ -530,7 +530,7 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
||||||
// find whether there is a floating window below this one
|
// find whether there is a floating window below this one
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && !w->m_bX11ShouldntFocus &&
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && !w->m_bX11ShouldntFocus &&
|
||||||
!w->m_bNoFocus && w.get() != pWindow) {
|
!w->m_sAdditionalConfigData.noFocus && w.get() != pWindow) {
|
||||||
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
|
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
|
||||||
w->m_vPosition.y + w->m_vSize.y)) {
|
w->m_vPosition.y + w->m_vSize.y)) {
|
||||||
return w.get();
|
return w.get();
|
||||||
|
@ -550,7 +550,7 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
||||||
// if not, floating window
|
// if not, floating window
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && !w->m_bX11ShouldntFocus &&
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && !w->m_bX11ShouldntFocus &&
|
||||||
!w->m_bNoFocus && w.get() != pWindow)
|
!w->m_sAdditionalConfigData.noFocus && w.get() != pWindow)
|
||||||
return w.get();
|
return w.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ CKeybindManager::CKeybindManager() {
|
||||||
m_mDispatchers["changegroupactive"] = changeGroupActive;
|
m_mDispatchers["changegroupactive"] = changeGroupActive;
|
||||||
m_mDispatchers["movegroupwindow"] = moveGroupWindow;
|
m_mDispatchers["movegroupwindow"] = moveGroupWindow;
|
||||||
m_mDispatchers["togglesplit"] = toggleSplit;
|
m_mDispatchers["togglesplit"] = toggleSplit;
|
||||||
|
m_mDispatchers["swapsplit"] = swapSplit;
|
||||||
m_mDispatchers["splitratio"] = alterSplitRatio;
|
m_mDispatchers["splitratio"] = alterSplitRatio;
|
||||||
m_mDispatchers["focusmonitor"] = focusMonitor;
|
m_mDispatchers["focusmonitor"] = focusMonitor;
|
||||||
m_mDispatchers["movecursortocorner"] = moveCursorToCorner;
|
m_mDispatchers["movecursortocorner"] = moveCursorToCorner;
|
||||||
|
@ -1293,6 +1294,21 @@ void CKeybindManager::toggleSplit(std::string args) {
|
||||||
g_pLayoutManager->getCurrentLayout()->layoutMessage(header, "togglesplit");
|
g_pLayoutManager->getCurrentLayout()->layoutMessage(header, "togglesplit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::swapSplit(std::string args) {
|
||||||
|
SLayoutMessageHeader header;
|
||||||
|
header.pWindow = g_pCompositor->m_pLastWindow;
|
||||||
|
|
||||||
|
if (!header.pWindow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(header.pWindow->m_iWorkspaceID);
|
||||||
|
|
||||||
|
if (PWORKSPACE->m_bHasFullscreenWindow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_pLayoutManager->getCurrentLayout()->layoutMessage(header, "swapsplit");
|
||||||
|
}
|
||||||
|
|
||||||
void CKeybindManager::alterSplitRatio(std::string args) {
|
void CKeybindManager::alterSplitRatio(std::string args) {
|
||||||
std::optional<float> splitResult;
|
std::optional<float> splitResult;
|
||||||
bool exact = false;
|
bool exact = false;
|
||||||
|
|
|
@ -127,6 +127,7 @@ class CKeybindManager {
|
||||||
static void alterSplitRatio(std::string);
|
static void alterSplitRatio(std::string);
|
||||||
static void focusMonitor(std::string);
|
static void focusMonitor(std::string);
|
||||||
static void toggleSplit(std::string);
|
static void toggleSplit(std::string);
|
||||||
|
static void swapSplit(std::string);
|
||||||
static void moveCursorToCorner(std::string);
|
static void moveCursorToCorner(std::string);
|
||||||
static void moveCursor(std::string);
|
static void moveCursor(std::string);
|
||||||
static void workspaceOpt(std::string);
|
static void workspaceOpt(std::string);
|
||||||
|
|
|
@ -487,10 +487,15 @@ void CInputManager::processMouseRequest(wlr_seat_pointer_request_set_cursor_even
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (e->seat_client == g_pCompositor->m_sSeat.seat->pointer_state.focused_client) {
|
if (e->seat_client == g_pCompositor->m_sSeat.seat->pointer_state.focused_client) {
|
||||||
m_sCursorSurfaceInfo.wlSurface.unassign();
|
|
||||||
|
if (e->surface != m_sCursorSurfaceInfo.wlSurface.wlr()) {
|
||||||
|
m_sCursorSurfaceInfo.wlSurface.unassign();
|
||||||
|
|
||||||
|
if (e->surface)
|
||||||
|
m_sCursorSurfaceInfo.wlSurface.assign(e->surface);
|
||||||
|
}
|
||||||
|
|
||||||
if (e->surface) {
|
if (e->surface) {
|
||||||
m_sCursorSurfaceInfo.wlSurface.assign(e->surface);
|
|
||||||
m_sCursorSurfaceInfo.vHotspot = {e->hotspot_x, e->hotspot_y};
|
m_sCursorSurfaceInfo.vHotspot = {e->hotspot_x, e->hotspot_y};
|
||||||
m_sCursorSurfaceInfo.hidden = false;
|
m_sCursorSurfaceInfo.hidden = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -645,9 +650,11 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// notify app if we didnt handle it
|
// notify app if we didnt handle it
|
||||||
if (g_pCompositor->doesSeatAcceptInput(g_pCompositor->m_pLastFocus)) {
|
if (g_pCompositor->doesSeatAcceptInput(g_pCompositor->m_pLastFocus))
|
||||||
wlr_seat_pointer_notify_button(g_pCompositor->m_sSeat.seat, e->time_msec, e->button, e->state);
|
wlr_seat_pointer_notify_button(g_pCompositor->m_sSeat.seat, e->time_msec, e->button, e->state);
|
||||||
}
|
|
||||||
|
if (const auto PMON = g_pCompositor->getMonitorFromVector(mouseCoords); PMON != g_pCompositor->m_pLastMonitor && PMON)
|
||||||
|
g_pCompositor->setActiveMonitor(PMON);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) {
|
void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) {
|
||||||
|
|
|
@ -1231,20 +1231,20 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
|
|
||||||
TRACY_GPU_COLLECT;
|
TRACY_GPU_COLLECT;
|
||||||
|
|
||||||
// calc frame damage
|
if (!pMonitor->mirrors.empty()) {
|
||||||
CRegion frameDamage{};
|
CRegion frameDamage{};
|
||||||
|
|
||||||
const auto TRANSFORM = wlr_output_transform_invert(pMonitor->output->transform);
|
const auto TRANSFORM = wlr_output_transform_invert(pMonitor->output->transform);
|
||||||
wlr_region_transform(frameDamage.pixman(), pMonitor->lastFrameDamage.pixman(), TRANSFORM, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
|
wlr_region_transform(frameDamage.pixman(), pMonitor->lastFrameDamage.pixman(), TRANSFORM, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
|
||||||
|
|
||||||
if (**PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || **PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
|
if (**PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || **PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
|
||||||
frameDamage.add(0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
|
frameDamage.add(0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
|
||||||
|
|
||||||
if (**PDAMAGEBLINK)
|
if (**PDAMAGEBLINK)
|
||||||
frameDamage.add(damage);
|
frameDamage.add(damage);
|
||||||
|
|
||||||
if (!pMonitor->mirrors.empty())
|
|
||||||
g_pHyprRenderer->damageMirrorsWith(pMonitor, frameDamage);
|
g_pHyprRenderer->damageMirrorsWith(pMonitor, frameDamage);
|
||||||
|
}
|
||||||
|
|
||||||
pMonitor->renderingActive = false;
|
pMonitor->renderingActive = false;
|
||||||
|
|
||||||
|
@ -1735,8 +1735,13 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
|
|
||||||
pMonitor->activeMonitorRule = *pMonitorRule;
|
pMonitor->activeMonitorRule = *pMonitorRule;
|
||||||
|
|
||||||
|
if (pMonitor->forceSize.has_value())
|
||||||
|
pMonitor->activeMonitorRule.resolution = pMonitor->forceSize.value();
|
||||||
|
|
||||||
|
const auto RULE = &pMonitor->activeMonitorRule;
|
||||||
|
|
||||||
// if it's disabled, disable and ignore
|
// if it's disabled, disable and ignore
|
||||||
if (pMonitorRule->disabled) {
|
if (RULE->disabled) {
|
||||||
if (pMonitor->m_bEnabled)
|
if (pMonitor->m_bEnabled)
|
||||||
pMonitor->onDisconnect();
|
pMonitor->onDisconnect();
|
||||||
|
|
||||||
|
@ -1755,12 +1760,12 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
|
|
||||||
// Check if the rule isn't already applied
|
// Check if the rule isn't already applied
|
||||||
// TODO: clean this up lol
|
// TODO: clean this up lol
|
||||||
if (!force && DELTALESSTHAN(pMonitor->vecPixelSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecPixelSize.y, pMonitorRule->resolution.y, 1) &&
|
if (!force && DELTALESSTHAN(pMonitor->vecPixelSize.x, RULE->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecPixelSize.y, RULE->resolution.y, 1) &&
|
||||||
DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->setScale == pMonitorRule->scale &&
|
DELTALESSTHAN(pMonitor->refreshRate, RULE->refreshRate, 1) && pMonitor->setScale == RULE->scale &&
|
||||||
((DELTALESSTHAN(pMonitor->vecPosition.x, pMonitorRule->offset.x, 1) && DELTALESSTHAN(pMonitor->vecPosition.y, pMonitorRule->offset.y, 1)) ||
|
((DELTALESSTHAN(pMonitor->vecPosition.x, RULE->offset.x, 1) && DELTALESSTHAN(pMonitor->vecPosition.y, RULE->offset.y, 1)) ||
|
||||||
pMonitorRule->offset == Vector2D(-INT32_MAX, -INT32_MAX)) &&
|
RULE->offset == Vector2D(-INT32_MAX, -INT32_MAX)) &&
|
||||||
pMonitor->transform == pMonitorRule->transform && pMonitorRule->enable10bit == pMonitor->enabled10bit &&
|
pMonitor->transform == RULE->transform && RULE->enable10bit == pMonitor->enabled10bit &&
|
||||||
!memcmp(&pMonitor->customDrmMode, &pMonitorRule->drmMode, sizeof(pMonitor->customDrmMode))) {
|
!memcmp(&pMonitor->customDrmMode, &RULE->drmMode, sizeof(pMonitor->customDrmMode))) {
|
||||||
|
|
||||||
Debug::log(LOG, "Not applying a new rule to {} because it's already applied!", pMonitor->szName);
|
Debug::log(LOG, "Not applying a new rule to {} because it's already applied!", pMonitor->szName);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1773,8 +1778,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
pMonitor->customDrmMode = {};
|
pMonitor->customDrmMode = {};
|
||||||
bool autoScale = false;
|
bool autoScale = false;
|
||||||
|
|
||||||
if (pMonitorRule->scale > 0.1) {
|
if (RULE->scale > 0.1) {
|
||||||
pMonitor->scale = pMonitorRule->scale;
|
pMonitor->scale = RULE->scale;
|
||||||
} else {
|
} else {
|
||||||
autoScale = true;
|
autoScale = true;
|
||||||
const auto DEFAULTSCALE = pMonitor->getDefaultScale();
|
const auto DEFAULTSCALE = pMonitor->getDefaultScale();
|
||||||
|
@ -1784,21 +1789,21 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
wlr_output_state_set_scale(pMonitor->state.wlr(), pMonitor->scale);
|
wlr_output_state_set_scale(pMonitor->state.wlr(), pMonitor->scale);
|
||||||
pMonitor->setScale = pMonitor->scale;
|
pMonitor->setScale = pMonitor->scale;
|
||||||
|
|
||||||
wlr_output_state_set_transform(pMonitor->state.wlr(), pMonitorRule->transform);
|
wlr_output_state_set_transform(pMonitor->state.wlr(), RULE->transform);
|
||||||
pMonitor->transform = pMonitorRule->transform;
|
pMonitor->transform = RULE->transform;
|
||||||
|
|
||||||
const auto WLRREFRESHRATE = (wlr_backend_is_wl(pMonitor->output->backend) || wlr_backend_is_x11(pMonitor->output->backend)) ? 0 : pMonitorRule->refreshRate * 1000;
|
const auto WLRREFRESHRATE = (wlr_backend_is_wl(pMonitor->output->backend) || wlr_backend_is_x11(pMonitor->output->backend)) ? 0 : RULE->refreshRate * 1000;
|
||||||
|
|
||||||
// loop over modes and choose an appropriate one.
|
// loop over modes and choose an appropriate one.
|
||||||
if (pMonitorRule->resolution != Vector2D() && pMonitorRule->resolution != Vector2D(-1, -1) && pMonitorRule->resolution != Vector2D(-1, -2)) {
|
if (RULE->resolution != Vector2D() && RULE->resolution != Vector2D(-1, -1) && RULE->resolution != Vector2D(-1, -2)) {
|
||||||
if (!wl_list_empty(&pMonitor->output->modes) && pMonitorRule->drmMode.type != DRM_MODE_TYPE_USERDEF) {
|
if (!wl_list_empty(&pMonitor->output->modes) && RULE->drmMode.type != DRM_MODE_TYPE_USERDEF) {
|
||||||
wlr_output_mode* mode;
|
wlr_output_mode* mode;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
wl_list_for_each(mode, &pMonitor->output->modes, link) {
|
wl_list_for_each(mode, &pMonitor->output->modes, link) {
|
||||||
// if delta of refresh rate, w and h chosen and mode is < 1 we accept it
|
// if delta of refresh rate, w and h chosen and mode is < 1 we accept it
|
||||||
if (DELTALESSTHAN(mode->width, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(mode->height, pMonitorRule->resolution.y, 1) &&
|
if (DELTALESSTHAN(mode->width, RULE->resolution.x, 1) && DELTALESSTHAN(mode->height, RULE->resolution.y, 1) &&
|
||||||
DELTALESSTHAN(mode->refresh / 1000.f, pMonitorRule->refreshRate, 1)) {
|
DELTALESSTHAN(mode->refresh / 1000.f, RULE->refreshRate, 1)) {
|
||||||
wlr_output_state_set_mode(pMonitor->state.wlr(), mode);
|
wlr_output_state_set_mode(pMonitor->state.wlr(), mode);
|
||||||
|
|
||||||
if (!wlr_output_test_state(pMonitor->output, pMonitor->state.wlr())) {
|
if (!wlr_output_test_state(pMonitor->output, pMonitor->state.wlr())) {
|
||||||
|
@ -1806,8 +1811,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Monitor {}: requested {:X0}@{:2f}, found available mode: {}x{}@{}mHz, applying.", pMonitor->output->name, pMonitorRule->resolution,
|
Debug::log(LOG, "Monitor {}: requested {:X0}@{:2f}, found available mode: {}x{}@{}mHz, applying.", pMonitor->output->name, RULE->resolution,
|
||||||
(float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh);
|
(float)RULE->refreshRate, mode->width, mode->height, mode->refresh);
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
|
@ -1819,9 +1824,9 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
wlr_output_state_set_custom_mode(pMonitor->state.wlr(), (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, WLRREFRESHRATE);
|
wlr_output_state_set_custom_mode(pMonitor->state.wlr(), (int)RULE->resolution.x, (int)RULE->resolution.y, WLRREFRESHRATE);
|
||||||
pMonitor->vecSize = pMonitorRule->resolution;
|
pMonitor->vecSize = RULE->resolution;
|
||||||
pMonitor->refreshRate = pMonitorRule->refreshRate;
|
pMonitor->refreshRate = RULE->refreshRate;
|
||||||
|
|
||||||
if (!wlr_output_test_state(pMonitor->output, pMonitor->state.wlr())) {
|
if (!wlr_output_test_state(pMonitor->output, pMonitor->state.wlr())) {
|
||||||
Debug::log(ERR, "Custom resolution FAILED, falling back to preferred");
|
Debug::log(ERR, "Custom resolution FAILED, falling back to preferred");
|
||||||
|
@ -1829,47 +1834,47 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
||||||
|
|
||||||
if (!PREFERREDMODE) {
|
if (!PREFERREDMODE) {
|
||||||
Debug::log(ERR, "Monitor {} has NO PREFERRED MODE, and an INVALID one was requested: {:X0}@{:2f}", pMonitor->ID, pMonitorRule->resolution,
|
Debug::log(ERR, "Monitor {} has NO PREFERRED MODE, and an INVALID one was requested: {:X0}@{:2f}", pMonitor->ID, RULE->resolution,
|
||||||
(float)pMonitorRule->refreshRate);
|
(float)RULE->refreshRate);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preferred is valid
|
// Preferred is valid
|
||||||
wlr_output_state_set_mode(pMonitor->state.wlr(), PREFERREDMODE);
|
wlr_output_state_set_mode(pMonitor->state.wlr(), PREFERREDMODE);
|
||||||
|
|
||||||
Debug::log(ERR, "Monitor {} got an invalid requested mode: {:X0}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name,
|
Debug::log(ERR, "Monitor {} got an invalid requested mode: {:X0}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name, RULE->resolution,
|
||||||
pMonitorRule->resolution, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f);
|
(float)RULE->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f);
|
||||||
|
|
||||||
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
||||||
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
||||||
} else {
|
} else {
|
||||||
Debug::log(LOG, "Set a custom mode {:X0}@{:2f} (mode not found in monitor modes)", pMonitorRule->resolution, (float)pMonitorRule->refreshRate);
|
Debug::log(LOG, "Set a custom mode {:X0}@{:2f} (mode not found in monitor modes)", RULE->resolution, (float)RULE->refreshRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// custom resolution
|
// custom resolution
|
||||||
bool fail = false;
|
bool fail = false;
|
||||||
|
|
||||||
if (pMonitorRule->drmMode.type == DRM_MODE_TYPE_USERDEF) {
|
if (RULE->drmMode.type == DRM_MODE_TYPE_USERDEF) {
|
||||||
if (!wlr_output_is_drm(pMonitor->output)) {
|
if (!wlr_output_is_drm(pMonitor->output)) {
|
||||||
Debug::log(ERR, "Tried to set custom modeline on non-DRM output");
|
Debug::log(ERR, "Tried to set custom modeline on non-DRM output");
|
||||||
fail = true;
|
fail = true;
|
||||||
} else {
|
} else {
|
||||||
auto* mode = wlr_drm_connector_add_mode(pMonitor->output, &pMonitorRule->drmMode);
|
auto* mode = wlr_drm_connector_add_mode(pMonitor->output, &RULE->drmMode);
|
||||||
if (mode) {
|
if (mode) {
|
||||||
wlr_output_state_set_mode(pMonitor->state.wlr(), mode);
|
wlr_output_state_set_mode(pMonitor->state.wlr(), mode);
|
||||||
pMonitor->customDrmMode = pMonitorRule->drmMode;
|
pMonitor->customDrmMode = RULE->drmMode;
|
||||||
} else {
|
} else {
|
||||||
Debug::log(ERR, "wlr_drm_connector_add_mode failed");
|
Debug::log(ERR, "wlr_drm_connector_add_mode failed");
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wlr_output_state_set_custom_mode(pMonitor->state.wlr(), (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, WLRREFRESHRATE);
|
wlr_output_state_set_custom_mode(pMonitor->state.wlr(), (int)RULE->resolution.x, (int)RULE->resolution.y, WLRREFRESHRATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pMonitor->vecSize = pMonitorRule->resolution;
|
pMonitor->vecSize = RULE->resolution;
|
||||||
pMonitor->refreshRate = pMonitorRule->refreshRate;
|
pMonitor->refreshRate = RULE->refreshRate;
|
||||||
|
|
||||||
if (fail || !wlr_output_test_state(pMonitor->output, pMonitor->state.wlr())) {
|
if (fail || !wlr_output_test_state(pMonitor->output, pMonitor->state.wlr())) {
|
||||||
Debug::log(ERR, "Custom resolution FAILED, falling back to preferred");
|
Debug::log(ERR, "Custom resolution FAILED, falling back to preferred");
|
||||||
|
@ -1877,25 +1882,25 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
||||||
|
|
||||||
if (!PREFERREDMODE) {
|
if (!PREFERREDMODE) {
|
||||||
Debug::log(ERR, "Monitor {} has NO PREFERRED MODE, and an INVALID one was requested: {:X0}@{:2f}", pMonitor->output->name, pMonitorRule->resolution,
|
Debug::log(ERR, "Monitor {} has NO PREFERRED MODE, and an INVALID one was requested: {:X0}@{:2f}", pMonitor->output->name, RULE->resolution,
|
||||||
(float)pMonitorRule->refreshRate);
|
(float)RULE->refreshRate);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preferred is valid
|
// Preferred is valid
|
||||||
wlr_output_state_set_mode(pMonitor->state.wlr(), PREFERREDMODE);
|
wlr_output_state_set_mode(pMonitor->state.wlr(), PREFERREDMODE);
|
||||||
|
|
||||||
Debug::log(ERR, "Monitor {} got an invalid requested mode: {:X0}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name,
|
Debug::log(ERR, "Monitor {} got an invalid requested mode: {:X0}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name, RULE->resolution,
|
||||||
pMonitorRule->resolution, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f);
|
(float)RULE->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f);
|
||||||
|
|
||||||
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
||||||
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
||||||
pMonitor->customDrmMode = {};
|
pMonitor->customDrmMode = {};
|
||||||
} else {
|
} else {
|
||||||
Debug::log(LOG, "Set a custom mode {:X0}@{:2f} (mode not found in monitor modes)", pMonitorRule->resolution, (float)pMonitorRule->refreshRate);
|
Debug::log(LOG, "Set a custom mode {:X0}@{:2f} (mode not found in monitor modes)", RULE->resolution, (float)RULE->refreshRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (pMonitorRule->resolution != Vector2D()) {
|
} else if (RULE->resolution != Vector2D()) {
|
||||||
if (!wl_list_empty(&pMonitor->output->modes)) {
|
if (!wl_list_empty(&pMonitor->output->modes)) {
|
||||||
wlr_output_mode* mode;
|
wlr_output_mode* mode;
|
||||||
float currentWidth = 0;
|
float currentWidth = 0;
|
||||||
|
@ -1904,7 +1909,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
//(-1,-1) indicates a preference to refreshrate over resolution, (-1,-2) preference to resolution
|
//(-1,-1) indicates a preference to refreshrate over resolution, (-1,-2) preference to resolution
|
||||||
if (pMonitorRule->resolution == Vector2D(-1, -1)) {
|
if (RULE->resolution == Vector2D(-1, -1)) {
|
||||||
wl_list_for_each(mode, &pMonitor->output->modes, link) {
|
wl_list_for_each(mode, &pMonitor->output->modes, link) {
|
||||||
if ((mode->width >= currentWidth && mode->height >= currentHeight && mode->refresh >= (currentRefresh - 1000.f)) || mode->refresh > (currentRefresh + 3000.f)) {
|
if ((mode->width >= currentWidth && mode->height >= currentHeight && mode->refresh >= (currentRefresh - 1000.f)) || mode->refresh > (currentRefresh + 3000.f)) {
|
||||||
wlr_output_state_set_mode(pMonitor->state.wlr(), mode);
|
wlr_output_state_set_mode(pMonitor->state.wlr(), mode);
|
||||||
|
@ -1932,22 +1937,21 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
Debug::log(LOG, "Monitor {}: REJECTED mode: {:X0}@{:2f}! Falling back to preferred: {}x{}@{:2f}", pMonitor->output->name, pMonitorRule->resolution,
|
Debug::log(LOG, "Monitor {}: REJECTED mode: {:X0}@{:2f}! Falling back to preferred: {}x{}@{:2f}", pMonitor->output->name, RULE->resolution,
|
||||||
(float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
|
(float)RULE->refreshRate, mode->width, mode->height, mode->refresh / 1000.f);
|
||||||
|
|
||||||
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
const auto PREFERREDMODE = wlr_output_preferred_mode(pMonitor->output);
|
||||||
|
|
||||||
if (!PREFERREDMODE) {
|
if (!PREFERREDMODE) {
|
||||||
Debug::log(ERR, "Monitor {} has NO PREFERRED MODE, and an INVALID one was requested: {:X0}@{:2f}", pMonitor->ID, pMonitorRule->resolution,
|
Debug::log(ERR, "Monitor {} has NO PREFERRED MODE, and an INVALID one was requested: {:X0}@{:2f}", pMonitor->ID, RULE->resolution, (float)RULE->refreshRate);
|
||||||
(float)pMonitorRule->refreshRate);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Preferred is valid
|
// Preferred is valid
|
||||||
wlr_output_state_set_mode(pMonitor->state.wlr(), PREFERREDMODE);
|
wlr_output_state_set_mode(pMonitor->state.wlr(), PREFERREDMODE);
|
||||||
|
|
||||||
Debug::log(ERR, "Monitor {} got an invalid requested mode: {:X0}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name,
|
Debug::log(ERR, "Monitor {} got an invalid requested mode: {:X0}@{:2f}, using the preferred one instead: {}x{}@{:2f}", pMonitor->output->name, RULE->resolution,
|
||||||
pMonitorRule->resolution, (float)pMonitorRule->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f);
|
(float)RULE->refreshRate, PREFERREDMODE->width, PREFERREDMODE->height, PREFERREDMODE->refresh / 1000.f);
|
||||||
|
|
||||||
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f;
|
||||||
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height);
|
||||||
|
@ -1976,8 +1980,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Monitor {}: requested {:X0}@{:2f}, found available mode: {}x{}@{}mHz, applying.", pMonitor->output->name, pMonitorRule->resolution,
|
Debug::log(LOG, "Monitor {}: requested {:X0}@{:2f}, found available mode: {}x{}@{}mHz, applying.", pMonitor->output->name, RULE->resolution,
|
||||||
(float)pMonitorRule->refreshRate, mode->width, mode->height, mode->refresh);
|
(float)RULE->refreshRate, mode->width, mode->height, mode->refresh);
|
||||||
|
|
||||||
pMonitor->refreshRate = mode->refresh / 1000.f;
|
pMonitor->refreshRate = mode->refresh / 1000.f;
|
||||||
pMonitor->vecSize = Vector2D(mode->width, mode->height);
|
pMonitor->vecSize = Vector2D(mode->width, mode->height);
|
||||||
|
@ -2075,14 +2079,14 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
bool set10bit = false;
|
bool set10bit = false;
|
||||||
pMonitor->drmFormat = DRM_FORMAT_INVALID;
|
pMonitor->drmFormat = DRM_FORMAT_INVALID;
|
||||||
|
|
||||||
for (auto& fmt : formats[(int)!pMonitorRule->enable10bit]) {
|
for (auto& fmt : formats[(int)!RULE->enable10bit]) {
|
||||||
wlr_output_state_set_render_format(pMonitor->state.wlr(), fmt.second);
|
wlr_output_state_set_render_format(pMonitor->state.wlr(), fmt.second);
|
||||||
|
|
||||||
if (!wlr_output_test_state(pMonitor->output, pMonitor->state.wlr())) {
|
if (!wlr_output_test_state(pMonitor->output, pMonitor->state.wlr())) {
|
||||||
Debug::log(ERR, "output {} failed basic test on format {}", pMonitor->szName, fmt.first);
|
Debug::log(ERR, "output {} failed basic test on format {}", pMonitor->szName, fmt.first);
|
||||||
} else {
|
} else {
|
||||||
Debug::log(LOG, "output {} succeeded basic test on format {}", pMonitor->szName, fmt.first);
|
Debug::log(LOG, "output {} succeeded basic test on format {}", pMonitor->szName, fmt.first);
|
||||||
if (pMonitorRule->enable10bit && fmt.first.contains("101010"))
|
if (RULE->enable10bit && fmt.first.contains("101010"))
|
||||||
set10bit = true;
|
set10bit = true;
|
||||||
|
|
||||||
pMonitor->drmFormat = fmt.second;
|
pMonitor->drmFormat = fmt.second;
|
||||||
|
@ -2146,7 +2150,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
void CHyprRenderer::setCursorSurface(wlr_surface* surf, int hotspotX, int hotspotY, bool force) {
|
void CHyprRenderer::setCursorSurface(wlr_surface* surf, int hotspotX, int hotspotY, bool force) {
|
||||||
m_bCursorHasSurface = surf;
|
m_bCursorHasSurface = surf;
|
||||||
|
|
||||||
if ((surf == m_sLastCursorData.surf || m_bCursorHidden) && !force)
|
if ((surf == m_sLastCursorData.surf || m_bCursorHidden) && hotspotX == m_sLastCursorData.hotspotX && hotspotY == m_sLastCursorData.hotspotY && !force)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_sLastCursorData.name = "";
|
m_sLastCursorData.name = "";
|
||||||
|
@ -2356,6 +2360,9 @@ bool CHyprRenderer::canSkipBackBufferClear(CMonitor* pMonitor) {
|
||||||
void CHyprRenderer::recheckSolitaryForMonitor(CMonitor* pMonitor) {
|
void CHyprRenderer::recheckSolitaryForMonitor(CMonitor* pMonitor) {
|
||||||
pMonitor->solitaryClient = nullptr; // reset it, if we find one it will be set.
|
pMonitor->solitaryClient = nullptr; // reset it, if we find one it will be set.
|
||||||
|
|
||||||
|
if (g_pHyprNotificationOverlay->hasAny())
|
||||||
|
return;
|
||||||
|
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pMonitor->activeWorkspace);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pMonitor->activeWorkspace);
|
||||||
|
|
||||||
if (!PWORKSPACE || !PWORKSPACE->m_bHasFullscreenWindow || g_pInputManager->m_sDrag.drag || g_pCompositor->m_sSeat.exclusiveClient || pMonitor->specialWorkspaceID ||
|
if (!PWORKSPACE || !PWORKSPACE->m_bHasFullscreenWindow || g_pInputManager->m_sDrag.drag || g_pCompositor->m_sSeat.exclusiveClient || pMonitor->specialWorkspaceID ||
|
||||||
|
|
Loading…
Reference in a new issue