diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp index 985ba8c39570..724326c92a7c 100644 --- a/src/desktop/LayerSurface.cpp +++ b/src/desktop/LayerSurface.cpp @@ -4,7 +4,6 @@ #include "../protocols/LayerShell.hpp" #include "../protocols/core/Compositor.hpp" #include "../managers/SeatManager.hpp" -#include "managers/input/InputManager.hpp" PHLLS CLayerSurface::create(SP resource) { PHLLS pLS = SP(new CLayerSurface(resource)); @@ -211,7 +210,8 @@ void CLayerSurface::onUnmap() { return; // refocus if needed - if (WASLASTFOCUS) g_pInputManager->refocusLastWindow(PMONITOR); + if (WASLASTFOCUS) + g_pInputManager->refocusLastWindow(PMONITOR); CBox geomFixed = {geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y, geometry.width, geometry.height}; g_pHyprRenderer->damageBox(&geomFixed); @@ -296,11 +296,11 @@ void CLayerSurface::onCommit() { else if (WASEXCLUSIVE && !ISEXCLUSIVE) std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == self.lock(); }); - // if the surface was focused and interactive but now isn't, refocus - if (WASLASTFOCUS && !layerSurface->current.interactivity) { - g_pInputManager->refocusLastWindow(g_pCompositor->getMonitorFromID(monitorID)); - } else if (!WASLASTFOCUS && (ISEXCLUSIVE || (layerSurface->current.interactivity && (g_pSeatManager->mouse.expired() || !g_pInputManager->isConstrained())))) { - // if not focused last and exclusive or accepting input + unconstrained + // if the surface was focused and interactive but now isn't, refocus + if (WASLASTFOCUS && !layerSurface->current.interactivity) { + g_pInputManager->refocusLastWindow(g_pCompositor->getMonitorFromID(monitorID)); + } else if (!WASLASTFOCUS && (ISEXCLUSIVE || (layerSurface->current.interactivity && (g_pSeatManager->mouse.expired() || !g_pInputManager->isConstrained())))) { + // if not focused last and exclusive or accepting input + unconstrained g_pSeatManager->setGrab(nullptr); g_pInputManager->releaseAllMouseButtons(); g_pCompositor->focusSurface(surface->resource()); diff --git a/src/desktop/LayerSurface.hpp b/src/desktop/LayerSurface.hpp index cfcdb324a764..056f66a872cb 100644 --- a/src/desktop/LayerSurface.hpp +++ b/src/desktop/LayerSurface.hpp @@ -35,40 +35,40 @@ class CLayerSurface { wl_list link; // the header providing the enum type cannot be imported here - int interactivity = 0; + int interactivity = 0; - SP surface; + SP surface; - bool mapped = false; - uint32_t layer = 0; + bool mapped = false; + uint32_t layer = 0; - int monitorID = -1; + int monitorID = -1; - bool fadingOut = false; - bool readyToDelete = false; - bool noProcess = false; - bool noAnimations = false; + bool fadingOut = false; + bool readyToDelete = false; + bool noProcess = false; + bool noAnimations = false; - bool forceBlur = false; - bool forceBlurPopups = false; - int xray = -1; - bool ignoreAlpha = false; - float ignoreAlphaValue = 0.f; - bool dimAround = false; + bool forceBlur = false; + bool forceBlurPopups = false; + int xray = -1; + bool ignoreAlpha = false; + float ignoreAlphaValue = 0.f; + bool dimAround = false; - std::optional animationStyle; + std::optional animationStyle; - PHLLSREF self; + PHLLSREF self; - CBox geometry = {0, 0, 0, 0}; - Vector2D position; - std::string szNamespace = ""; - std::unique_ptr popupHead; + CBox geometry = {0, 0, 0, 0}; + Vector2D position; + std::string szNamespace = ""; + std::unique_ptr popupHead; - void onDestroy(); - void onMap(); - void onUnmap(); - void onCommit(); + void onDestroy(); + void onMap(); + void onUnmap(); + void onCommit(); private: struct { diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index a9536268c3c4..9b7e12dc098c 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1410,7 +1410,6 @@ void CInputManager::refocusLastWindow(CMonitor* pMonitor) { if (!foundSurface && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->isWorkspaceVisible(g_pCompositor->m_pLastWindow->m_pWorkspace)) { // then the last focused window if we're on the same workspace as it const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock(); - g_pCompositor->focusWindow(nullptr); g_pCompositor->focusWindow(PLASTWINDOW); } else { // otherwise fall back to a normal refocus. diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index 64e6e1826e3f..000a115ffdd8 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -103,9 +103,9 @@ class CInputManager { bool isConstrained(); Vector2D getMouseCoordsInternal(); - void refocus(); - void refocusLastWindow(CMonitor* pMonitor); - void simulateMouseMovement(); + void refocus(); + void refocusLastWindow(CMonitor* pMonitor); + void simulateMouseMovement(); void sendMotionEventsToFocused(); void setKeyboardLayout(); diff --git a/subprojects/wlroots-hyprland b/subprojects/wlroots-hyprland index 91de8da4b6b9..a336b9b1fb41 160000 --- a/subprojects/wlroots-hyprland +++ b/subprojects/wlroots-hyprland @@ -1 +1 @@ -Subproject commit 91de8da4b6b9b3c5630123d2446cd6de4e80071a +Subproject commit a336b9b1fb415433e849de002df68c45034d0419