diff options
author | vaxerski <[email protected]> | 2022-05-23 22:07:29 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-05-23 22:07:29 +0200 |
commit | f522c597efb3ef3efc01fd6fba9a2b4ef4cadbcc (patch) | |
tree | eb32ee9c32607ed0d9180469af74d9afb18b6030 | |
parent | e924cd95fde26bf776951800a595662bba0b9326 (diff) | |
download | Hyprland-f522c597efb3ef3efc01fd6fba9a2b4ef4cadbcc.tar.gz Hyprland-f522c597efb3ef3efc01fd6fba9a2b4ef4cadbcc.zip |
Fix fullscreen focus detection and configure requests
-rw-r--r-- | src/events/Windows.cpp | 21 | ||||
-rw-r--r-- | src/managers/InputManager.cpp | 29 |
2 files changed, 30 insertions, 20 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 89f359e6..716c5ee1 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -315,23 +315,34 @@ void Events::listener_configureX11(void* owner, void* data) { return; const auto E = (wlr_xwayland_surface_configure_event*)data; + g_pHyprRenderer->damageWindow(PWINDOW); if (!PWINDOW->m_bIsFloating) { g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.vec()); g_pInputManager->refocus(); + g_pHyprRenderer->damageWindow(PWINDOW); + return; + } + + if (!PWINDOW->m_uSurface.xwayland->mapped) { + wlr_xwayland_surface_configure(PWINDOW->m_uSurface.xwayland, E->x, E->y, E->width, E->height); return; } - wlr_xwayland_surface_configure(PWINDOW->m_uSurface.xwayland, E->x, E->y, E->width, E->height); - wlr_xwayland_surface_restack(PWINDOW->m_uSurface.xwayland, NULL, XCB_STACK_MODE_ABOVE); PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(E->x, E->y)); PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(E->width, E->height)); - PWINDOW->m_vPosition = PWINDOW->m_vPosition; - PWINDOW->m_vSize = PWINDOW->m_vSize; + PWINDOW->m_vPosition = PWINDOW->m_vRealPosition.vec(); + PWINDOW->m_vSize = PWINDOW->m_vRealSize.vec(); - wlr_seat_pointer_clear_focus(g_pCompositor->m_sSeat.seat); + wlr_xwayland_surface_configure(PWINDOW->m_uSurface.xwayland, E->x, E->y, E->width, E->height); + + g_pCompositor->moveWindowToTop(PWINDOW); + + PWINDOW->m_bCreatedOverFullscreen = true; g_pInputManager->refocus(); + + g_pHyprRenderer->damageWindow(PWINDOW); } void Events::listener_surfaceXWayland(wl_listener* listener, void* data) { diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp index 2818ae89..6c689c23 100644 --- a/src/managers/InputManager.cpp +++ b/src/managers/InputManager.cpp @@ -103,24 +103,23 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace); if (PWORKSPACE->m_bHasFullscreenWindow && !foundSurface) { pFoundWindow = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID); + foundSurface = g_pXWaylandManager->getWindowSurface(pFoundWindow); + surfacePos = pFoundWindow->m_vRealPosition.vec(); - for (auto w = g_pCompositor->m_lWindows.rbegin(); w != g_pCompositor->m_lWindows.rend(); ++w) { + // only check floating because tiled cant be over fullscreen + for (auto w = g_pCompositor->m_lWindows.rbegin(); w != g_pCompositor->m_lWindows.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_iWorkspaceID == pFoundWindow->m_iWorkspaceID && w->m_bIsMapped && w->m_bCreatedOverFullscreen && wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) { - foundSurface = g_pXWaylandManager->getWindowSurface(&(*w)); - if (foundSurface) - surfacePos = w->m_vRealPosition.vec(); - break; - } - } - - if (pFoundWindow && !foundSurface) { - if (pFoundWindow->m_bIsX11) { - foundSurface = g_pXWaylandManager->getWindowSurface(pFoundWindow); - if (foundSurface) + if (w->m_bIsFloating && w->m_bIsMapped && w->m_bCreatedOverFullscreen && wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y) && g_pCompositor->isWorkspaceVisible(w->m_iWorkspaceID) && !w->m_bHidden) { + pFoundWindow = &(*w); + + if (!pFoundWindow->m_bIsX11) { + foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords); + } else { + foundSurface = g_pXWaylandManager->getWindowSurface(pFoundWindow); surfacePos = pFoundWindow->m_vRealPosition.vec(); - } else { - foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords); + } + + break; } } } |