aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2023-11-17 15:49:29 +0000
committerVaxry <[email protected]>2023-11-17 15:49:29 +0000
commit6ffbdbd9e776aadea3b0befdd9c420be24fd1f6d (patch)
treec52ba94857586fec71a32480891f0fb1a6034493
parent84bc0a73f6aad2bdbba9a36f7a751261abf606d9 (diff)
downloadHyprland-6ffbdbd9e776aadea3b0befdd9c420be24fd1f6d.tar.gz
Hyprland-6ffbdbd9e776aadea3b0befdd9c420be24fd1f6d.zip
allow floating on special
-rw-r--r--src/Compositor.cpp95
-rw-r--r--src/managers/KeybindManager.cpp8
-rw-r--r--src/render/Renderer.cpp28
3 files changed, 55 insertions, 76 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 79e9360c..a06b07ea 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -657,24 +657,6 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
static auto* const PBORDERGRABEXTEND = &g_pConfigManager->getConfigValuePtr("general:extend_border_grab_area")->intValue;
const auto BORDER_GRAB_AREA = *PRESIZEONBORDER ? *PBORDERSIZE + *PBORDERGRABEXTEND : 0;
- // special workspace
- if (PMONITOR->specialWorkspaceID) {
- for (auto& w : m_vWindows | std::views::reverse) {
- const auto BB = w->getWindowInputBox();
- 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_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && box.containsPoint(pos) && !w->isHidden() && !w->m_bX11ShouldntFocus &&
- !w->m_bNoFocus)
- return w.get();
- }
-
- for (auto& w : m_vWindows) {
- CBox box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
- if (!w->m_bIsFloating && w->m_iWorkspaceID == PMONITOR->specialWorkspaceID && w->m_bIsMapped && box.containsPoint(pos) && !w->isHidden() && !w->m_bX11ShouldntFocus &&
- !w->m_bNoFocus)
- return w.get();
- }
- }
-
// pinned windows on top of floating regardless
for (auto& w : m_vWindows | std::views::reverse) {
const auto BB = w->getWindowInputBox();
@@ -690,48 +672,69 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
}
}
- // first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
- for (auto& w : m_vWindows | std::views::reverse) {
- const auto BB = w->getWindowInputBox();
- 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) {
- // OR windows should add focus to parent
- if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2)
+ auto windowForWorkspace = [&](bool special) -> CWindow* {
+ // first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
+ for (auto& w : m_vWindows | std::views::reverse) {
+
+ if (special && !isWorkspaceSpecial(w->m_iWorkspaceID)) // because special floating may creep up into regular
continue;
- if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y})) {
+ const auto BB = w->getWindowInputBox();
+ 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) {
+ // OR windows should add focus to parent
+ if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2)
+ continue;
+
+ if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y})) {
+
+ if (w->m_bIsX11 && w->m_iX11Type == 2 && !wlr_xwayland_or_surface_wants_focus(w->m_uSurface.xwayland)) {
+ // Override Redirect
+ return g_pCompositor->m_pLastWindow; // we kinda trick everything here.
+ // TODO: this is wrong, we should focus the parent, but idk how to get it considering it's nullptr in most cases.
+ }
- if (w->m_bIsX11 && w->m_iX11Type == 2 && !wlr_xwayland_or_surface_wants_focus(w->m_uSurface.xwayland)) {
- // Override Redirect
- return g_pCompositor->m_pLastWindow; // we kinda trick everything here.
- // TODO: this is wrong, we should focus the parent, but idk how to get it considering it's nullptr in most cases.
+ return w.get();
}
- return w.get();
+ if (!w->m_bIsX11) {
+ if (w->hasPopupAt(pos))
+ return w.get();
+ }
}
+ }
- if (!w->m_bIsX11) {
- if (w->hasPopupAt(pos))
+ // for windows, we need to check their extensions too, first.
+ for (auto& w : m_vWindows) {
+ if (special != isWorkspaceSpecial(w->m_iWorkspaceID))
+ continue;
+
+ const int64_t WORKSPACEID = special ? PMONITOR->specialWorkspaceID : PMONITOR->activeWorkspace;
+
+ if (!w->m_bIsX11 && !w->m_bIsFloating && w->m_bIsMapped && w->m_iWorkspaceID == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus && !w->m_bNoFocus) {
+ if ((w)->hasPopupAt(pos))
return w.get();
}
}
- }
+ for (auto& w : m_vWindows) {
+ if (special != isWorkspaceSpecial(w->m_iWorkspaceID))
+ continue;
- // for windows, we need to check their extensions too, first.
- for (auto& w : m_vWindows) {
- if (!w->m_bIsX11 && !w->m_bIsFloating && w->m_bIsMapped && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->isHidden() && !w->m_bX11ShouldntFocus && !w->m_bNoFocus) {
- if ((w)->hasPopupAt(pos))
+ const int64_t WORKSPACEID = special ? PMONITOR->specialWorkspaceID : PMONITOR->activeWorkspace;
+
+ CBox box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
+ if (!w->m_bIsFloating && w->m_bIsMapped && box.containsPoint(pos) && w->m_iWorkspaceID == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus && !w->m_bNoFocus)
return w.get();
}
- }
- for (auto& w : m_vWindows) {
- CBox box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
- if (!w->m_bIsFloating && w->m_bIsMapped && box.containsPoint(pos) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->isHidden() && !w->m_bX11ShouldntFocus &&
- !w->m_bNoFocus)
- return w.get();
- }
- return nullptr;
+ return nullptr;
+ };
+
+ // special workspace
+ if (PMONITOR->specialWorkspaceID)
+ return windowForWorkspace(true);
+
+ return windowForWorkspace(false);
}
CWindow* CCompositor::windowFromCursor() {
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index aa35e3fd..c3a5efe1 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -735,11 +735,10 @@ void CKeybindManager::clearKeybinds() {
void CKeybindManager::toggleActiveFloating(std::string args) {
CWindow* PWINDOW = nullptr;
- if (args != "" && args != "active" && args.length() > 1) {
+ if (args != "" && args != "active" && args.length() > 1)
PWINDOW = g_pCompositor->getWindowByRegex(args);
- } else {
+ else
PWINDOW = g_pCompositor->m_pLastWindow;
- }
if (!PWINDOW)
return;
@@ -747,9 +746,6 @@ void CKeybindManager::toggleActiveFloating(std::string args) {
// remove drag status
g_pInputManager->currentlyDraggedWindow = nullptr;
- if (g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID))
- return;
-
if (PWINDOW->m_sGroupData.pNextWindow && PWINDOW->m_sGroupData.pNextWindow != PWINDOW) {
const auto PCURRENT = PWINDOW->getGroupCurrent();
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index bf668004..2b61ab6f 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -253,9 +253,6 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork
if (w->m_bIsFloating)
continue; // floating are in the second pass
- if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
- continue; // special are in the third pass
-
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
continue;
@@ -280,9 +277,6 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork
if (w->m_bIsFloating)
continue; // floating are in the second pass
- if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
- continue; // special are in the third pass
-
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
continue;
@@ -298,9 +292,6 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork
if (!w->m_bIsFloating || w->m_bPinned)
continue;
- if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
- continue;
-
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
continue;
@@ -316,9 +307,6 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork
if (!w->m_bPinned || !w->m_bIsFloating)
continue;
- if (g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
- continue;
-
if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
continue;
@@ -681,18 +669,10 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
}
}
- for (auto& w : g_pCompositor->m_vWindows) {
- if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
- continue;
-
- if (!g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))
- continue;
-
- if (!shouldRenderWindow(w.get(), pMonitor, pWorkspace))
- continue;
-
- // render the bad boy
- renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
+ // special
+ for (auto& ws : g_pCompositor->m_vWorkspaces) {
+ if (ws->m_iMonitorID == pMonitor->ID && ws->m_fAlpha.fl() > 0.f && ws->m_bIsSpecialWorkspace)
+ renderWorkspaceWindows(pMonitor, ws.get(), time);
}
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOWS);