aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp61
-rw-r--r--src/Window.cpp17
-rw-r--r--src/Window.hpp11
-rw-r--r--src/events/Windows.cpp31
-rw-r--r--src/layout/DwindleLayout.cpp18
-rw-r--r--src/layout/IHyprLayout.cpp2
-rw-r--r--src/layout/MasterLayout.cpp2
-rw-r--r--src/managers/AnimationManager.cpp2
-rw-r--r--src/managers/KeybindManager.cpp58
-rw-r--r--src/managers/input/InputManager.cpp19
-rw-r--r--src/managers/input/InputManager.hpp7
-rw-r--r--src/managers/input/Tablets.cpp2
-rw-r--r--src/managers/input/Touch.cpp37
-rw-r--r--src/render/OpenGL.cpp4
-rw-r--r--src/render/Renderer.cpp10
-rw-r--r--src/render/decorations/CHyprGroupBarDecoration.cpp2
16 files changed, 166 insertions, 117 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 3fa1448b..121e0661 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -240,7 +240,7 @@ void CCompositor::cleanup() {
// accumulate all PIDs for killing, also request closing.
for (auto& w : m_vWindows) {
- if (w->m_bIsMapped && !w->m_bHidden)
+ if (w->m_bIsMapped && !w->isHidden())
m_dProcessPIDsOnShutdown.push_back(w->getPID());
}
@@ -445,13 +445,13 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
if (PMONITOR->specialWorkspaceOpen) {
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && (*w)->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !(*w)->m_bHidden)
+ if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && (*w)->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !(*w)->isHidden())
return (*w).get();
}
for (auto& w : m_vWindows) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
- if (w->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && !w->m_bHidden)
+ if (w->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && !w->isHidden())
return w.get();
}
}
@@ -459,20 +459,20 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
// pinned
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if (wlr_box_contains_point(&box, pos.x, pos.y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && !(*w)->m_bHidden && (*w)->m_bPinned)
+ if (wlr_box_contains_point(&box, pos.x, pos.y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && !(*w)->isHidden() && (*w)->m_bPinned)
return w->get();
}
// first loop over floating cuz they're above, m_vWindows should be sorted bottom->top, for tiled it doesn't matter.
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if (wlr_box_contains_point(&box, pos.x, pos.y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->m_bHidden && !(*w)->m_bPinned)
+ if (wlr_box_contains_point(&box, pos.x, pos.y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->isHidden() && !(*w)->m_bPinned)
return w->get();
}
for (auto& w : m_vWindows) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
- if (wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && PMONITOR->activeWorkspace == w->m_iWorkspaceID && !w->m_bHidden)
+ if (wlr_box_contains_point(&box, pos.x, pos.y) && w->m_bIsMapped && !w->m_bIsFloating && PMONITOR->activeWorkspace == w->m_iWorkspaceID && !w->isHidden())
return w.get();
}
@@ -485,14 +485,14 @@ CWindow* CCompositor::vectorToWindowTiled(const Vector2D& pos) {
if (PMONITOR->specialWorkspaceOpen) {
for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
- if (w->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && wlr_box_contains_point(&box, pos.x, pos.y) && !w->m_bIsFloating && !w->m_bHidden)
+ if (w->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && wlr_box_contains_point(&box, pos.x, pos.y) && !w->m_bIsFloating && !w->isHidden())
return w.get();
}
}
for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
- if (w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->m_bIsFloating && !w->m_bHidden)
+ if (w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->m_bIsFloating && !w->isHidden())
return w.get();
}
@@ -515,13 +515,13 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
if (PMONITOR->specialWorkspaceOpen) {
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && (*w)->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !(*w)->m_bHidden && !(*w)->m_bX11ShouldntFocus)
+ if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && (*w)->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !(*w)->isHidden() && !(*w)->m_bX11ShouldntFocus)
return (*w).get();
}
for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
- if (!w->m_bIsFloating && w->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->m_bHidden && !w->m_bX11ShouldntFocus)
+ if (!w->m_bIsFloating && w->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && !w->isHidden() && !w->m_bX11ShouldntFocus)
return w.get();
}
}
@@ -529,7 +529,7 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
// pinned windows on top of floating regardless
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if ((*w)->m_bIsFloating && (*w)->m_bIsMapped && !(*w)->m_bHidden && !(*w)->m_bX11ShouldntFocus && (*w)->m_bPinned) {
+ if ((*w)->m_bIsFloating && (*w)->m_bIsMapped && !(*w)->isHidden() && !(*w)->m_bX11ShouldntFocus && (*w)->m_bPinned) {
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y))
return w->get();
@@ -548,7 +548,7 @@ 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.rbegin(); w != m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if ((*w)->m_bIsFloating && (*w)->m_bIsMapped && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->m_bHidden && !(*w)->m_bPinned) {
+ if ((*w)->m_bIsFloating && (*w)->m_bIsMapped && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->isHidden() && !(*w)->m_bPinned) {
// OR windows should add focus to parent
if ((*w)->m_bX11ShouldntFocus && (*w)->m_iX11Type != 2)
continue;
@@ -578,7 +578,7 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
// 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->m_bHidden && !w->m_bX11ShouldntFocus) {
+ if (!w->m_bIsX11 && !w->m_bIsFloating && w->m_bIsMapped && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->isHidden() && !w->m_bX11ShouldntFocus) {
wlr_surface* resultSurf = nullptr;
Vector2D origin = w->m_vRealPosition.vec();
SExtensionFindingData data = {origin, pos, &resultSurf};
@@ -590,7 +590,7 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
}
for (auto& w : m_vWindows) {
wlr_box box = {w->m_vPosition.x, w->m_vPosition.y, w->m_vSize.x, w->m_vSize.y};
- if (!w->m_bIsFloating && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->m_bHidden && !w->m_bX11ShouldntFocus)
+ if (!w->m_bIsFloating && w->m_bIsMapped && wlr_box_contains_point(&box, pos.x, pos.y) && w->m_iWorkspaceID == PMONITOR->activeWorkspace && !w->isHidden() && !w->m_bX11ShouldntFocus)
return w.get();
}
@@ -603,7 +603,7 @@ CWindow* CCompositor::windowFromCursor() {
if (PMONITOR->specialWorkspaceOpen) {
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && (*w)->m_bIsMapped && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && !(*w)->m_bHidden)
+ if ((*w)->m_bIsFloating && (*w)->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && (*w)->m_bIsMapped && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && !(*w)->isHidden())
return (*w).get();
}
@@ -640,13 +640,13 @@ CWindow* CCompositor::windowFromCursor() {
CWindow* CCompositor::windowFloatingFromCursor() {
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && !(*w)->m_bHidden && (*w)->m_bPinned)
+ if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && !(*w)->isHidden() && (*w)->m_bPinned)
return w->get();
}
for (auto w = m_vWindows.rbegin(); w != m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->m_bHidden && !(*w)->m_bPinned)
+ if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && (*w)->m_bIsMapped && (*w)->m_bIsFloating && isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->isHidden() && !(*w)->m_bPinned)
return w->get();
}
@@ -815,6 +815,9 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
}
bool CCompositor::windowValidMapped(CWindow* pWindow) {
+ if (!pWindow)
+ return false;
+
if (!windowExists(pWindow))
return false;
@@ -824,7 +827,7 @@ bool CCompositor::windowValidMapped(CWindow* pWindow) {
if (!pWindow->m_bIsMapped)
return false;
- if (pWindow->m_bHidden)
+ if (pWindow->isHidden())
return false;
return true;
@@ -934,7 +937,7 @@ int CCompositor::getWindowsOnWorkspace(const int& id) {
CWindow* CCompositor::getFirstWindowOnWorkspace(const int& id) {
for (auto& w : m_vWindows) {
- if (w->m_iWorkspaceID == id && w->m_bIsMapped && !w->m_bHidden)
+ if (w->m_iWorkspaceID == id && w->m_bIsMapped && !w->isHidden())
return w.get();
}
@@ -980,7 +983,7 @@ void CCompositor::moveWindowToTop(CWindow* pWindow) {
std::deque<CWindow*> toMove;
for (auto& w : m_vWindows) {
- if (w->m_bIsMapped && w->m_bMappedX11 && !w->m_bHidden && w->m_bIsX11 && w->X11TransientFor() == pWindow) {
+ if (w->m_bIsMapped && w->m_bMappedX11 && !w->isHidden() && w->m_bIsX11 && w->X11TransientFor() == pWindow) {
toMove.emplace_back(w.get());
}
}
@@ -1103,7 +1106,7 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
CWindow* longestIntersectWindow = nullptr;
for (auto& w : m_vWindows) {
- if (w.get() == pWindow || !w->m_bIsMapped || w->m_bHidden || w->m_bIsFloating || !isWorkspaceVisible(w->m_iWorkspaceID))
+ if (w.get() == pWindow || !w->m_bIsMapped || w->isHidden() || w->m_bIsFloating || !isWorkspaceVisible(w->m_iWorkspaceID))
continue;
const auto BWINDOWIDEALBB = w->getWindowIdealBoundingBoxIgnoreReserved();
@@ -1177,12 +1180,12 @@ CWindow* CCompositor::getNextWindowOnWorkspace(CWindow* pWindow, bool focusableO
continue;
}
- if (w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->m_bHidden && (!focusableOnly || !w->m_bNoFocus))
+ if (w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_bNoFocus))
return w.get();
}
for (auto& w : m_vWindows) {
- if (w.get() != pWindow && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->m_bHidden && (!focusableOnly || !w->m_bNoFocus))
+ if (w.get() != pWindow && w->m_iWorkspaceID == pWindow->m_iWorkspaceID && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_bNoFocus))
return w.get();
}
@@ -1200,12 +1203,12 @@ CWindow* CCompositor::getPrevWindowOnWorkspace(CWindow* pWindow, bool focusableO
continue;
}
- if ((*it)->m_iWorkspaceID == pWindow->m_iWorkspaceID && (*it)->m_bIsMapped && !(*it)->m_bHidden && (!focusableOnly || !(*it)->m_bNoFocus))
+ if ((*it)->m_iWorkspaceID == pWindow->m_iWorkspaceID && (*it)->m_bIsMapped && !(*it)->isHidden() && (!focusableOnly || !(*it)->m_bNoFocus))
return it->get();
}
for (auto it = m_vWindows.rbegin(); it != m_vWindows.rend(); it++) {
- if (it->get() != pWindow && (*it)->m_iWorkspaceID == pWindow->m_iWorkspaceID && (*it)->m_bIsMapped && !(*it)->m_bHidden && (!focusableOnly || !(*it)->m_bNoFocus))
+ if (it->get() != pWindow && (*it)->m_iWorkspaceID == pWindow->m_iWorkspaceID && (*it)->m_bIsMapped && !(*it)->isHidden() && (!focusableOnly || !(*it)->m_bNoFocus))
return it->get();
}
@@ -1263,7 +1266,7 @@ CWindow* CCompositor::getConstraintWindow(SMouse* pMouse) {
for (auto& w : m_vWindows) {
if (PSURFACE == g_pXWaylandManager->getWindowSurface(w.get())) {
- if (!w->m_bIsX11 && w->m_bIsMapped && !w->m_bHidden)
+ if (!w->m_bIsX11 && w->m_bIsMapped && !w->isHidden())
continue;
return w.get();
@@ -1564,7 +1567,7 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni
w->m_iMonitorID = pMonitor->ID;
// additionally, move floating and fs windows manually
- if (w->m_bIsMapped && !w->m_bHidden) {
+ if (w->m_bIsMapped && !w->isHidden()) {
if (w->m_bIsFloating)
w->m_vRealPosition = w->m_vRealPosition.vec() - POLDMON->vecPosition + pMonitor->vecPosition;
@@ -1718,7 +1721,7 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
}
for (auto& w : g_pCompositor->m_vWindows) {
- if (!w->m_bIsMapped || w->m_bHidden)
+ if (!w->m_bIsMapped || w->isHidden())
continue;
switch (mode) {
@@ -1846,7 +1849,7 @@ Vector2D CCompositor::parseWindowVectorArgsRelative(const std::string& args, con
void CCompositor::forceReportSizesToWindowsOnWorkspace(const int& wid) {
for (auto& w : m_vWindows) {
- if (w->m_iWorkspaceID == wid && w->m_bIsMapped && !w->m_bHidden) {
+ if (w->m_iWorkspaceID == wid && w->m_bIsMapped && !w->isHidden()) {
g_pXWaylandManager->setWindowSize(w.get(), w->m_vRealSize.vec(), true);
}
}
diff --git a/src/Window.cpp b/src/Window.cpp
index 6b62b5c0..03ca39ad 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -244,3 +244,20 @@ void CWindow::removeDecorationByType(eDecorationType type) {
updateWindowDecos();
}
+
+void CWindow::onUnmap() {
+ if (g_pCompositor->m_pLastWindow == this)
+ g_pCompositor->m_pLastWindow = nullptr;
+}
+
+void CWindow::setHidden(bool hidden) {
+ m_bHidden = hidden;
+
+ if (hidden) {
+ onUnmap();
+ }
+}
+
+bool CWindow::isHidden() {
+ return m_bHidden;
+} \ No newline at end of file
diff --git a/src/Window.hpp b/src/Window.hpp
index e0fa7ffa..5b2b201f 100644
--- a/src/Window.hpp
+++ b/src/Window.hpp
@@ -118,9 +118,6 @@ public:
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
Vector2D m_vOriginalClosedSize; // drawing the closing animations
- // For hidden windows and stuff
- bool m_bHidden = false;
-
// For pinned (sticky) windows
bool m_bPinned = false;
@@ -172,4 +169,12 @@ public:
void updateSurfaceOutputs();
void moveToWorkspace(int);
CWindow* X11TransientFor();
+ void onUnmap();
+ void setHidden(bool hidden);
+ bool isHidden();
+
+private:
+ // For hidden windows and stuff
+ bool m_bHidden = false;
+
};
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index e38d8d1d..9c352e63 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -250,7 +250,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_vRealSize = Vector2D(SIZEX, SIZEY);
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
- PWINDOW->m_bHidden = false;
+ PWINDOW->setHidden(false);
} catch (...) {
Debug::log(LOG, "Rule size failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
}
@@ -265,7 +265,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_vRealSize = SIZE;
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
- PWINDOW->m_bHidden = false;
+ PWINDOW->setHidden(false);
} catch (...) {
Debug::log(LOG, "Rule minsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
}
@@ -282,7 +282,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_vRealPosition = Vector2D(POSX, POSY) + PMONITOR->vecPosition;
- PWINDOW->m_bHidden = false;
+ PWINDOW->setHidden(false);
} catch (...) {
Debug::log(LOG, "Rule move failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
}
@@ -423,7 +423,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
std::vector<CWindow*> found;
CWindow* finalFound = nullptr;
for (auto& w : g_pCompositor->m_vWindows) {
- if (!w->m_bIsMapped || w->m_bHidden)
+ if (!w->m_bIsMapped || w->isHidden())
continue;
if (w->getPID() == ppid) {
@@ -451,7 +451,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(finalFound);
- finalFound->m_bHidden = true;
+ finalFound->setHidden(true);
}
}
}
@@ -499,7 +499,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
// swallowing
if (PWINDOW->m_pSwallowed && g_pCompositor->windowExists(PWINDOW->m_pSwallowed)) {
- PWINDOW->m_pSwallowed->m_bHidden = false;
+ PWINDOW->m_pSwallowed->setHidden(false);
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW->m_pSwallowed);
PWINDOW->m_pSwallowed = nullptr;
}
@@ -532,7 +532,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
if (PWORKSPACE->m_bHasFullscreenWindow && ((!PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bCreatedOverFullscreen) || !PWINDOW->m_bIsFloating))
PWINDOWCANDIDATE = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
- if (!PWINDOWCANDIDATE || PWINDOW == PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bIsMapped || PWINDOWCANDIDATE->m_bHidden || PWINDOWCANDIDATE->m_bX11ShouldntFocus || PWINDOWCANDIDATE->m_iX11Type == 2 || PWINDOWCANDIDATE->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)
+ if (!PWINDOWCANDIDATE || PWINDOW == PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bIsMapped || PWINDOWCANDIDATE->isHidden() || PWINDOWCANDIDATE->m_bX11ShouldntFocus || PWINDOWCANDIDATE->m_iX11Type == 2 || PWINDOWCANDIDATE->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)
PWINDOWCANDIDATE = nullptr;
Debug::log(LOG, "On closed window, new focused candidate is %x", PWINDOWCANDIDATE);
@@ -547,6 +547,9 @@ void Events::listener_unmapWindow(void* owner, void* data) {
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
}
+ // update lastwindow after focus
+ PWINDOW->onUnmap();
+
Debug::log(LOG, "Destroying the SubSurface tree of unmapped window %x", PWINDOW);
SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
@@ -581,7 +584,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
void Events::listener_commitWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
- if (!PWINDOW->m_bMappedX11 || PWINDOW->m_bHidden || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11))
+ if (!PWINDOW->m_bMappedX11 || PWINDOW->isHidden() || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11))
return;
g_pHyprRenderer->damageSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y);
@@ -641,7 +644,7 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
return;
}
- if (PWINDOW->m_bHidden)
+ if (PWINDOW->isHidden())
return;
if (!PWINDOW->m_bIsX11) {
@@ -696,9 +699,9 @@ void Events::listener_configureX11(void* owner, void* data) {
}
if (E->width > 1 && E->height > 1)
- PWINDOW->m_bHidden = false;
+ PWINDOW->setHidden(false);
else
- PWINDOW->m_bHidden = true;
+ PWINDOW->setHidden(true);
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(E->x, E->y));
PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(E->width, E->height));
@@ -723,16 +726,16 @@ void Events::listener_configureX11(void* owner, void* data) {
void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
- if (!PWINDOW->m_bMappedX11 || PWINDOW->m_bHidden)
+ if (!PWINDOW->m_bMappedX11)
return;
const auto POS = PWINDOW->m_vRealPosition.goalv();
const auto SIZ = PWINDOW->m_vRealSize.goalv();
if (PWINDOW->m_uSurface.xwayland->width > 1 && PWINDOW->m_uSurface.xwayland->height > 1)
- PWINDOW->m_bHidden = false;
+ PWINDOW->setHidden(false);
else
- PWINDOW->m_bHidden = true;
+ PWINDOW->setHidden(true);
if (abs(std::floor(POS.x) - PWINDOW->m_uSurface.xwayland->x) > 2 || abs(std::floor(POS.y) - PWINDOW->m_uSurface.xwayland->y) > 2 || abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) {
Debug::log(LOG, "Unmanaged window %x requests geometry update to %i %i %i %i", PWINDOW, (int)PWINDOW->m_uSurface.xwayland->x, (int)PWINDOW->m_uSurface.xwayland->y, (int)PWINDOW->m_uSurface.xwayland->width, (int)PWINDOW->m_uSurface.xwayland->height);
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index df8b1616..e521a17d 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -69,7 +69,7 @@ SDwindleNodeData* SDwindleNodeData::getGroupVisible() {
SDwindleNodeData* current = this->pNextGroupMember;
while (current != this) {
- if (!current->pWindow->m_bHidden) {
+ if (!current->pWindow->isHidden()) {
return current;
}
@@ -83,11 +83,11 @@ void SDwindleNodeData::setGroupFocusedNode(SDwindleNodeData* pMember) {
SDwindleNodeData* current = this->pNextGroupMember;
while (current != this) {
- current->pWindow->m_bHidden = current != pMember;
+ current->pWindow->setHidden(current != pMember);
current = current->pNextGroupMember;
}
- this->pWindow->m_bHidden = pMember != this;
+ this->pWindow->setHidden(pMember != this);
}
int SDwindleNodeData::getGroupMemberCount() {
@@ -301,7 +301,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) {
OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace);
} else if (*PUSEACTIVE) {
- if (g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow != pWindow && g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID && g_pCompositor->m_pLastWindow->m_bIsMapped) {
+ if (g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow != pWindow && g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID && g_pCompositor->m_pLastWindow->m_bIsMapped) {
OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow);
} else {
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
@@ -491,7 +491,7 @@ void CHyprDwindleLayout::onWindowRemovedTiling(CWindow* pWindow) {
}
PNEXT->setGroupFocusedNode(PNEXT);
- PNEXT->pWindow->m_bHidden = false;
+ PNEXT->pWindow->setHidden(false);
m_lDwindleNodesData.remove(*PNODE);
@@ -829,7 +829,7 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) {
toAddWindows.push_back(PWINDOW);
- PWINDOW->m_bHidden = false;
+ PWINDOW->setHidden(false);
}
if (PHEAD->pPreviousGroupMember)
@@ -997,9 +997,9 @@ void CHyprDwindleLayout::switchGroupWindow(CWindow* pWindow, bool forward, CWind
pNewNode->pWindow->m_bIsFloating = PNODE->pWindow->m_bIsFloating;
if (PNODE->pWindow->m_bIsFullscreen) {
- PNODE->pWindow->m_bHidden = false;
+ PNODE->pWindow->setHidden(false);
g_pCompositor->setWindowFullscreen(PNODE->pWindow, false, PWORKSPACE->m_efFullscreenMode);
- PNODE->pWindow->m_bHidden = true;
+ PNODE->pWindow->setHidden(true);
g_pCompositor->setWindowFullscreen(pNewNode->pWindow, true, PWORKSPACE->m_efFullscreenMode);
pNewNode->pWindow->m_vRealSize.warp();
@@ -1181,7 +1181,7 @@ std::string CHyprDwindleLayout::getLayoutName() {
void CHyprDwindleLayout::onEnable() {
for (auto& w : g_pCompositor->m_vWindows) {
- if (w->m_bIsFloating || !w->m_bMappedX11 || !w->m_bIsMapped || w->m_bHidden)
+ if (w->m_bIsFloating || !w->m_bMappedX11 || !w->m_bIsMapped || w->isHidden())
continue;
onWindowCreatedTiling(w.get());
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index c17c3123..24f066eb 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -47,7 +47,7 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
pWindow->m_vRealSize = Vector2D(PWINDOWSURFACE->current.width, PWINDOWSURFACE->current.height);
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_bIsX11 && pWindow->m_iX11Type == 2) { // XDG windows should be fine. TODO: check for weird atoms?
- pWindow->m_bHidden = true;
+ pWindow->setHidden(true);
return;
}
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
index a06fc147..d2577577 100644
--- a/src/layout/MasterLayout.cpp
+++ b/src/layout/MasterLayout.cpp
@@ -603,7 +603,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
void CHyprMasterLayout::onEnable() {
for (auto& w : g_pCompositor->m_vWindows) {
- if (w->m_bIsFloating || !w->m_bMappedX11 || !w->m_bIsMapped || w->m_bHidden)
+ if (w->m_bIsFloating || !w->m_bMappedX11 || !w->m_bIsMapped || w->isHidden())
continue;
onWindowCreatedTiling(w.get());
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp
index c5d7bb1d..b465a3b5 100644
--- a/src/managers/AnimationManager.cpp
+++ b/src/managers/AnimationManager.cpp
@@ -153,7 +153,7 @@ void CAnimationManager::tick() {
g_pHyprRenderer->damageWindow(PWINDOW);
} else if (PWORKSPACE) {
for (auto& w : g_pCompositor->m_vWindows) {
- if (!w->m_bIsMapped || w->m_bHidden)
+ if (!w->m_bIsMapped || w->isHidden())
continue;
if (w->m_iWorkspaceID != PWORKSPACE->m_iID)
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 1684222a..dabbe35d 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -568,23 +568,21 @@ void CKeybindManager::toggleActiveFloating(std::string args) {
if (!PWINDOW)
return;
- if (g_pCompositor->windowValidMapped(PWINDOW)) {
- // remove drag status
- g_pInputManager->currentlyDraggedWindow = nullptr;
+ // remove drag status
+ g_pInputManager->currentlyDraggedWindow = nullptr;
- if (PWINDOW->m_iWorkspaceID == SPECIAL_WORKSPACE_ID)
- return;
+ if (PWINDOW->m_iWorkspaceID == SPECIAL_WORKSPACE_ID)
+ return;
- PWINDOW->m_bIsFloating = !PWINDOW->m_bIsFloating;
+ PWINDOW->m_bIsFloating = !PWINDOW->m_bIsFloating;
- g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PWINDOW);
- }
+ g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PWINDOW);
}
void CKeybindManager::toggleActivePseudo(std::string args) {
const auto ACTIVEWINDOW = g_pCompositor->m_pLastWindow;
- if (!g_pCompositor->windowValidMapped(ACTIVEWINDOW))
+ if (!ACTIVEWINDOW)
return;
ACTIVEWINDOW->m_bIsPseudotiled = !ACTIVEWINDOW->m_bIsPseudotiled;
@@ -826,7 +824,7 @@ void CKeybindManager::changeworkspace(std::string args) {
void CKeybindManager::fullscreenActive(std::string args) {
const auto PWINDOW = g_pCompositor->m_pLastWindow;
- if (!g_pCompositor->windowValidMapped(PWINDOW))
+ if (!PWINDOW)
return;
if (PWINDOW->m_iWorkspaceID == SPECIAL_WORKSPACE_ID)
@@ -846,7 +844,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
PWINDOW = g_pCompositor->m_pLastWindow;
}
- if (!g_pCompositor->windowValidMapped(PWINDOW))
+ if (!PWINDOW)
return;
const auto OLDWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
@@ -934,7 +932,7 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
PWINDOW = g_pCompositor->m_pLastWindow;
}
- if (!g_pCompositor->windowValidMapped(PWINDOW))
+ if (!PWINDOW)
return;
int workspaceToMoveTo = 0;
@@ -1040,16 +1038,6 @@ void CKeybindManager::moveFocusTo(std::string args) {
}
};
- if (!g_pCompositor->windowValidMapped(PLASTWINDOW)) {
- const auto PWINDOWTOCHANGETO = g_pCompositor->getFirstWindowOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspace);
- if (!PWINDOWTOCHANGETO)
- return;
-
- switchToWindow(PWINDOWTOCHANGETO);
-
- return;
- }
-
const auto PWINDOWTOCHANGETO = g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
if (PWINDOWTOCHANGETO) {
@@ -1094,12 +1082,12 @@ void CKeybindManager::moveActiveTo(std::string args) {
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
- if (!g_pCompositor->windowValidMapped(PLASTWINDOW) || PLASTWINDOW->m_bIsFullscreen)
+ if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
return;
const auto PWINDOWTOCHANGETO = g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
- if (!g_pCompositor->windowValidMapped(PWINDOWTOCHANGETO))
+ if (!PWINDOWTOCHANGETO)
return;
g_pLayoutManager->getCurrentLayout()->switchWindows(PLASTWINDOW, PWINDOWTOCHANGETO);
@@ -1145,7 +1133,7 @@ void CKeybindManager::alterSplitRatio(std::string args) {
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
- if (!g_pCompositor->windowValidMapped(PLASTWINDOW))
+ if (!PLASTWINDOW)
return;
g_pLayoutManager->getCurrentLayout()->alterSplitRatioBy(PLASTWINDOW, splitratio);
@@ -1175,7 +1163,7 @@ void CKeybindManager::moveCursorToCorner(std::string arg) {
const auto PWINDOW = g_pCompositor->m_pLastWindow;
- if (!g_pCompositor->windowValidMapped(PWINDOW))
+ if (!PWINDOW)
return;
switch (CORNER) {
@@ -1377,7 +1365,7 @@ void CKeybindManager::forceRendererReload(std::string args) {
}
void CKeybindManager::resizeActive(std::string args) {
- if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) || g_pCompositor->m_pLastWindow->m_bIsFullscreen)
+ if (!g_pCompositor->m_pLastWindow || g_pCompositor->m_pLastWindow->m_bIsFullscreen)
return;
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(args, g_pCompositor->m_pLastWindow->m_vRealSize.goalv());
@@ -1385,11 +1373,11 @@ void CKeybindManager::resizeActive(std::string args) {
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - g_pCompositor->m_pLastWindow->m_vRealSize.goalv());
if (g_pCompositor->m_pLastWindow->m_vRealSize.goalv().x > 1 && g_pCompositor->m_pLastWindow->m_vRealSize.goalv().y > 1)
- g_pCompositor->m_pLastWindow->m_bHidden = false;
+ g_pCompositor->m_pLastWindow->setHidden(false);
}
void CKeybindManager::moveActive(std::string args) {
- if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) || g_pCompositor->m_pLastWindow->m_bIsFullscreen)
+ if (!g_pCompositor->m_pLastWindow || g_pCompositor->m_pLastWindow->m_bIsFullscreen)
return;
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(args, g_pCompositor->m_pLastWindow->m_vRealPosition.goalv());
@@ -1437,11 +1425,11 @@ void CKeybindManager::resizeWindow(std::string args) {
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PWINDOW->m_vRealSize.goalv(), PWINDOW);
if (PWINDOW->m_vRealSize.goalv().x > 1 && PWINDOW->m_vRealSize.goalv().y > 1)
- PWINDOW->m_bHidden = false;
+ PWINDOW->setHidden(false);
}
void CKeybindManager::circleNext(std::string arg) {
- if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow))
+ if (!g_pCompositor->m_pLastWindow)
return;
auto switchToWindow = [&](CWindow* PWINDOWTOCHANGETO) {
@@ -1592,7 +1580,7 @@ void CKeybindManager::layoutmsg(std::string msg) {
void CKeybindManager::toggleOpaque(std::string unused) {
const auto PWINDOW = g_pCompositor->m_pLastWindow;
- if (!g_pCompositor->windowValidMapped(PWINDOW))
+ if (!PWINDOW)
return;
PWINDOW->m_sAdditionalConfigData.forceOpaque = !PWINDOW->m_sAdditionalConfigData.forceOpaque;
@@ -1632,7 +1620,7 @@ void CKeybindManager::swapnext(std::string arg) {
CWindow* toSwap = nullptr;
- if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow))
+ if (!g_pCompositor->m_pLastWindow)
return;
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
@@ -1673,7 +1661,7 @@ void CKeybindManager::swapActiveWorkspaces(std::string args) {
}
void CKeybindManager::pinActive(std::string args) {
- if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) || !g_pCompositor->m_pLastWindow->m_bIsFloating || g_pCompositor->m_pLastWindow->m_bIsFullscreen)
+ if (!g_pCompositor->m_pLastWindow || !g_pCompositor->m_pLastWindow->m_bIsFloating || g_pCompositor->m_pLastWindow->m_bIsFullscreen)
return;
g_pCompositor->m_pLastWindow->m_bPinned = !g_pCompositor->m_pLastWindow->m_bPinned;
@@ -1726,6 +1714,6 @@ void CKeybindManager::mouse(std::string args) {
}
void CKeybindManager::bringActiveToTop(std::string args) {
- if (g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) && g_pCompositor->m_pLastWindow->m_bIsFloating)
+ if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
g_pCompositor->moveWindowToTop(g_pCompositor->m_pLastWindow);
}
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 5ef257e3..c04c1f3e 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -35,6 +35,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
static auto *const PHOGFOCUS = &g_pConfigManager->getConfigValuePtr("misc:layers_hog_keyboard_focus")->intValue;
static auto *const PFLOATBEHAVIOR = &g_pConfigManager->getConfigValuePtr("input:float_switch_override_focus")->intValue;
+ m_pFoundSurfaceToFocus = nullptr;
+ m_pFoundLSToFocus = nullptr;
+ m_pFoundWindowToFocus = nullptr;
+
if (!g_pCompositor->m_bReadyToProcess)
return;
@@ -159,7 +163,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
// only check floating because tiled cant be over fullscreen
for (auto w = g_pCompositor->m_vWindows.rbegin(); w != g_pCompositor->m_vWindows.rend(); w++) {
wlr_box box = {(*w)->m_vRealPosition.vec().x, (*w)->m_vRealPosition.vec().y, (*w)->m_vRealSize.vec().x, (*w)->m_vRealSize.vec().y};
- if ((((*w)->m_bIsFloating && (*w)->m_bIsMapped && ((*w)->m_bCreatedOverFullscreen || (*w)->m_bPinned)) || ((*w)->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && PMONITOR->specialWorkspaceOpen)) && wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y) && g_pCompositor->isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->m_bHidden) {
+ if ((((*w)->m_bIsFloating && (*w)->m_bIsMapped && ((*w)->m_bCreatedOverFullscreen || (*w)->m_bPinned)) || ((*w)->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && PMONITOR->specialWorkspaceOpen)) && wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y) && g_pCompositor->isWorkspaceVisible((*w)->m_iWorkspaceID) && !(*w)->isHidden()) {
pFoundWindow = (*w).get();
if (!pFoundWindow->m_bIsX11) {
@@ -264,9 +268,16 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
}
}
+ // set the values for use
+ if (refocus) {
+ m_pFoundLSToFocus = pFoundLayerSurface;
+ m_pFoundWindowToFocus = pFoundWindow;
+ m_pFoundSurfaceToFocus = foundSurface;
+ }
+
if (pFoundWindow) {
if (*PFOLLOWMOUSE != 1 && !refocus) {
- if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) && g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR) {
+ if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR) {
// enter if change floating style
if (*PFOLLOWMOUSE != 3 && allowKeyboardRefocus)
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
@@ -396,7 +407,7 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
refocus();
// if clicked on a floating window make it top
- if (g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow) && g_pCompositor->m_pLastWindow->m_bIsFloating)
+ if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
g_pCompositor->moveWindowToTop(g_pCompositor->m_pLastWindow);
break;
@@ -415,7 +426,7 @@ void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) {
case WLR_BUTTON_PRESSED: {
const auto PWINDOW = g_pCompositor->m_pLastWindow;
- if (!g_pCompositor->windowValidMapped(PWINDOW)){
+ if (!PWINDOW) {
Debug::log(ERR, "Cannot kill invalid window!");
break;
}
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index 8e94a5d6..81f84c9b 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -20,6 +20,8 @@ enum eMouseBindMode {
struct STouchData {
CWindow* touchFocusWindow = nullptr;
+ SLayerSurface* touchFocusLS = nullptr;
+ wlr_surface* touchFocusSurface = nullptr;
Vector2D touchSurfaceOrigin;
};
@@ -140,6 +142,11 @@ private:
STabletTool* ensureTabletToolPresent(wlr_tablet_tool*);
void applyConfigToKeyboard(SKeyboard*);
+
+ // this will be set after a refocus()
+ wlr_surface* m_pFoundSurfaceToFocus = nullptr;
+ SLayerSurface* m_pFoundLSToFocus = nullptr;
+ CWindow* m_pFoundWindowToFocus = nullptr;
};
inline std::unique_ptr<CInputManager> g_pInputManager;
diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp
index 173f6961..5253152e 100644
--- a/src/managers/input/Tablets.cpp
+++ b/src/managers/input/Tablets.cpp
@@ -219,7 +219,7 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) {
void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool motion) {
const auto PTOOL = g_pInputManager->ensureTabletToolPresent(pTool);
- if (const auto PWINDOW = g_pCompositor->m_pLastWindow; g_pCompositor->windowValidMapped(PWINDOW)) {
+ if (const auto PWINDOW = g_pCompositor->m_pLastWindow; PWINDOW) {
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal();
const auto LOCAL = CURSORPOS - PWINDOW->m_vRealPosition.goalv();
diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp
index e140d8a1..b5a52c05 100644
--- a/src/managers/input/Touch.cpp
+++ b/src/managers/input/Touch.cpp
@@ -15,32 +15,39 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) {
refocus();
- m_sTouchData.touchFocusWindow = nullptr;
+ m_sTouchData.touchFocusWindow = m_pFoundWindowToFocus;
+ m_sTouchData.touchFocusSurface = m_pFoundSurfaceToFocus;
+ m_sTouchData.touchFocusLS = m_pFoundLSToFocus;
- if (g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow)) {
- Vector2D local;
- if (g_pCompositor->m_pLastWindow->m_bIsX11) {
- local = g_pInputManager->getMouseCoordsInternal() - g_pCompositor->m_pLastWindow->m_vRealPosition.goalv();
+ Vector2D local;
+
+ if (m_sTouchData.touchFocusWindow) {
+ if (m_sTouchData.touchFocusWindow->m_bIsX11) {
+ local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_vRealPosition.goalv();
} else {
- g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), g_pCompositor->m_pLastWindow, local);
+ g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow, local);
}
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
+ } else if (m_sTouchData.touchFocusLS) {
+ local = g_pInputManager->getMouseCoordsInternal() - Vector2D(m_sTouchData.touchFocusLS->geometry.x, m_sTouchData.touchFocusLS->geometry.y) - g_pCompositor->m_pLastMonitor->vecPosition;
- wlr_seat_touch_notify_down(g_pCompositor->m_sSeat.seat, g_pCompositor->m_pLastFocus, e->time_msec, e->touch_id, local.x, local.y);
-
- m_sTouchData.touchFocusWindow = g_pCompositor->m_pLastWindow;
+ m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
+ } else {
+ return; // oops, nothing found.
}
+
+ wlr_seat_touch_notify_down(g_pCompositor->m_sSeat.seat, m_sTouchData.touchFocusSurface, e->time_msec, e->touch_id, local.x, local.y);
}
void CInputManager::onTouchUp(wlr_touch_up_event* e){
- if (m_sTouchData.touchFocusWindow) {
+ if (m_sTouchData.touchFocusSurface) {
wlr_seat_touch_notify_up(g_pCompositor->m_sSeat.seat, e->time_msec, e->touch_id);
}
}
void CInputManager::onTouchMove(wlr_touch_motion_event* e){
- if (g_pCompositor->windowValidMapped(m_sTouchData.touchFocusWindow)) {
+ if (m_sTouchData.touchFocusWindow && g_pCompositor->windowValidMapped(m_sTouchData.touchFocusWindow)) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusWindow->m_iMonitorID);
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PMONITOR->vecPosition.x + e->x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e->y * PMONITOR->vecSize.y);
@@ -48,6 +55,14 @@ void CInputManager::onTouchMove(wlr_touch_motion_event* e){
const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
wlr_seat_touch_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, e->touch_id, local.x, local.y);
+ } else if (m_sTouchData.touchFocusLS) {
+ const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusLS->monitorID);
+
+ wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, PMONITOR->vecPosition.x + e->x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e->y * PMONITOR->vecSize.y);
+
+ const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
+
+ wlr_seat_touch_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, e->touch_id, local.x, local.y);
}
}
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index e0cb28e2..70ba7121 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -642,7 +642,7 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
bool has = false;
for (auto& w : g_pCompositor->m_vWindows) {
- if (w->m_iWorkspaceID == pMonitor->activeWorkspace && w->m_bIsMapped && !w->m_bHidden && !w->m_bIsFloating) {
+ if (w->m_iWorkspaceID == pMonitor->activeWorkspace && w->m_bIsMapped && !w->isHidden() && !w->m_bIsFloating) {
has = true;
break;
}
@@ -685,7 +685,7 @@ void CHyprOpenGLImpl::preWindowPass() {
bool hasWindows = false;
for (auto& w : g_pCompositor->m_vWindows) {
- if (w->m_iWorkspaceID == m_RenderData.pMonitor->activeWorkspace && !w->m_bHidden && w->m_bIsMapped && !w->m_bIsFloating) {
+ if (w->m_iWorkspaceID == m_RenderData.pMonitor->activeWorkspace && !w->isHidden() && w->m_bIsMapped && !w->m_bIsFloating) {
hasWindows = true;
break;
}
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 13d2360b..71bfaab7 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -215,7 +215,7 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWor
}
void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* time, bool decorate, eRenderPassMode mode) {
- if (pWindow->m_bHidden)
+ if (pWindow->isHidden())
return;
if (pWindow->m_bFadingOut) {
@@ -383,7 +383,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
// Non-floating main
for (auto& w : g_pCompositor->m_vWindows) {
- if (w->m_bHidden && !w->m_bIsMapped && !w->m_bFadingOut)
+ if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
continue;
if (w->m_bIsFloating)
@@ -401,7 +401,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
// Non-floating popup
for (auto& w : g_pCompositor->m_vWindows) {
- if (w->m_bHidden && !w->m_bIsMapped && !w->m_bFadingOut)
+ if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
continue;
if (w->m_bIsFloating)
@@ -419,7 +419,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
// floating on top
for (auto& w : g_pCompositor->m_vWindows) {
- if (w->m_bHidden && !w->m_bIsMapped && !w->m_bFadingOut)
+ if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
continue;
if (!w->m_bIsFloating)
@@ -437,7 +437,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
// and then special
for (auto& w : g_pCompositor->m_vWindows) {
- if (w->m_bHidden && !w->m_bIsMapped && !w->m_bFadingOut)
+ if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut)
continue;
if (w->m_iWorkspaceID != SPECIAL_WORKSPACE_ID)
diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp
index eee96947..c3f9047e 100644
--- a/src/render/decorations/CHyprGroupBarDecoration.cpp
+++ b/src/render/decorations/CHyprGroupBarDecoration.cpp
@@ -67,7 +67,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
// get how many bars we will draw
int barsToDraw = m_dwGroupMembers.size();
- if (barsToDraw < 1 || m_pWindow->m_bHidden || !g_pCompositor->windowValidMapped(m_pWindow))
+ if (barsToDraw < 1 || m_pWindow->isHidden() || !g_pCompositor->windowValidMapped(m_pWindow))
return;
if (!m_pWindow->m_sSpecialRenderData.decorate)