mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 01:46:00 +01:00
Implement proper z-system
This commit is contained in:
parent
462781b16f
commit
c21881be25
3 changed files with 27 additions and 7 deletions
|
@ -242,8 +242,7 @@ bool CCompositor::windowExists(CWindow* pWindow) {
|
||||||
|
|
||||||
CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
|
CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
|
||||||
const auto PMONITOR = getMonitorFromVector(pos);
|
const auto PMONITOR = getMonitorFromVector(pos);
|
||||||
// first loop over floating cuz they're above
|
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
|
||||||
// TODO: make an actual Z-system
|
|
||||||
for (auto& w : m_lWindows) {
|
for (auto& w : m_lWindows) {
|
||||||
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
||||||
if (wlr_box_contains_point(&box, pos.x, pos.y) && w.m_bIsMapped && w.m_bIsFloating && isWorkspaceVisible(w.m_iWorkspaceID))
|
if (wlr_box_contains_point(&box, pos.x, pos.y) && w.m_bIsMapped && w.m_bIsFloating && isWorkspaceVisible(w.m_iWorkspaceID))
|
||||||
|
@ -272,8 +271,7 @@ CWindow* CCompositor::vectorToWindowTiled(const Vector2D& pos) {
|
||||||
|
|
||||||
CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
|
CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
|
||||||
const auto PMONITOR = getMonitorFromVector(pos);
|
const auto PMONITOR = getMonitorFromVector(pos);
|
||||||
// first loop over floating cuz they're above
|
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
|
||||||
// TODO: make an actual Z-system
|
|
||||||
for (auto& w : m_lWindows) {
|
for (auto& w : m_lWindows) {
|
||||||
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
||||||
if (w.m_bIsFloating && w.m_bIsMapped && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && isWorkspaceVisible(w.m_iWorkspaceID))
|
if (w.m_bIsFloating && w.m_bIsMapped && wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && isWorkspaceVisible(w.m_iWorkspaceID))
|
||||||
|
@ -292,8 +290,7 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
|
||||||
CWindow* CCompositor::windowFromCursor() {
|
CWindow* CCompositor::windowFromCursor() {
|
||||||
const auto PMONITOR = getMonitorFromCursor();
|
const auto PMONITOR = getMonitorFromCursor();
|
||||||
|
|
||||||
// first loop over floating cuz they're above
|
// first loop over floating cuz they're above, m_lWindows should be sorted bottom->top, for tiled it doesn't matter.
|
||||||
// TODO: make an actual Z-system
|
|
||||||
for (auto& w : m_lWindows) {
|
for (auto& w : m_lWindows) {
|
||||||
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
wlr_box box = {w.m_vRealPosition.x, w.m_vRealPosition.y, w.m_vRealSize.x, w.m_vRealSize.y};
|
||||||
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w.m_bIsMapped && w.m_bIsFloating && isWorkspaceVisible(w.m_iWorkspaceID))
|
if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y) && w.m_bIsMapped && w.m_bIsFloating && isWorkspaceVisible(w.m_iWorkspaceID))
|
||||||
|
@ -533,3 +530,15 @@ bool CCompositor::isWindowActive(CWindow* pWindow) {
|
||||||
|
|
||||||
return PSURFACE == m_pLastFocus || pWindow == m_pLastWindow;
|
return PSURFACE == m_pLastFocus || pWindow == m_pLastWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCompositor::moveWindowToTop(CWindow* pWindow) {
|
||||||
|
if (!windowValidMapped(pWindow))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (auto it = m_lWindows.begin(); it != m_lWindows.end(); ++it) {
|
||||||
|
if (&(*it) == pWindow) {
|
||||||
|
m_lWindows.splice(m_lWindows.end(), m_lWindows, it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,6 +94,7 @@ public:
|
||||||
CWindow* getFullscreenWindowOnWorkspace(const int&);
|
CWindow* getFullscreenWindowOnWorkspace(const int&);
|
||||||
bool doesSeatAcceptInput(wlr_surface*);
|
bool doesSeatAcceptInput(wlr_surface*);
|
||||||
bool isWindowActive(CWindow*);
|
bool isWindowActive(CWindow*);
|
||||||
|
void moveWindowToTop(CWindow*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAllSignals();
|
void initAllSignals();
|
||||||
|
|
|
@ -304,6 +304,8 @@ void CHyprDwindleLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
||||||
pWindow->m_vRealSize = PSAVEDSIZE;
|
pWindow->m_vRealSize = PSAVEDSIZE;
|
||||||
} else {
|
} else {
|
||||||
onWindowRemoved(pWindow);
|
onWindowRemoved(pWindow);
|
||||||
|
|
||||||
|
g_pCompositor->moveWindowToTop(pWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,6 +329,7 @@ void CHyprDwindleLayout::onBeginDragWindow() {
|
||||||
if (!DRAGGINGWINDOW->m_bIsFloating) {
|
if (!DRAGGINGWINDOW->m_bIsFloating) {
|
||||||
DRAGGINGWINDOW->m_bDraggingTiled = true;
|
DRAGGINGWINDOW->m_bDraggingTiled = true;
|
||||||
changeWindowFloatingMode(DRAGGINGWINDOW);
|
changeWindowFloatingMode(DRAGGINGWINDOW);
|
||||||
|
DRAGGINGWINDOW->m_bIsFloating = true;
|
||||||
} else {
|
} else {
|
||||||
DRAGGINGWINDOW->m_bDraggingTiled = false;
|
DRAGGINGWINDOW->m_bDraggingTiled = false;
|
||||||
}
|
}
|
||||||
|
@ -339,8 +342,11 @@ void CHyprDwindleLayout::onBeginDragWindow() {
|
||||||
void CHyprDwindleLayout::onEndDragWindow() {
|
void CHyprDwindleLayout::onEndDragWindow() {
|
||||||
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
|
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
|
||||||
|
|
||||||
if (DRAGGINGWINDOW->m_bDraggingTiled)
|
if (DRAGGINGWINDOW->m_bDraggingTiled) {
|
||||||
|
DRAGGINGWINDOW->m_bIsFloating = false;
|
||||||
changeWindowFloatingMode(DRAGGINGWINDOW);
|
changeWindowFloatingMode(DRAGGINGWINDOW);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::onMouseMove(const Vector2D& mousePos) {
|
void CHyprDwindleLayout::onMouseMove(const Vector2D& mousePos) {
|
||||||
|
@ -419,6 +425,8 @@ void CHyprDwindleLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
||||||
|
|
||||||
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize);
|
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize);
|
||||||
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
|
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
|
||||||
|
|
||||||
|
g_pCompositor->moveWindowToTop(pWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) {
|
void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) {
|
||||||
|
@ -466,6 +474,8 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) {
|
||||||
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize);
|
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_pCompositor->moveWindowToTop(pWindow);
|
||||||
|
|
||||||
// we need to fix XWayland windows by sending them to NARNIA
|
// we need to fix XWayland windows by sending them to NARNIA
|
||||||
// because otherwise they'd still be recieving mouse events
|
// because otherwise they'd still be recieving mouse events
|
||||||
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
|
g_pCompositor->fixXWaylandWindowsOnWorkspace(PMONITOR->activeWorkspace);
|
||||||
|
|
Loading…
Reference in a new issue