compositor: Configurable behavior when window to be focused conflicts with fullscreen (#12033)
Renames `misc:new_window_takes_over_fullscreen` into `misc:on_focus_under_fullscreen` and implements the following behavior: - By default, when a tiling window is being focused on a workspace where a fullscreen/maximized window exists, respect the `misc:on_focus_under_fullscreen` config variable.
This commit is contained in:
parent
1c1746de61
commit
40d8fa8491
51 changed files with 1003 additions and 694 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include "../../config/ConfigManager.hpp"
|
||||
#include "../../desktop/Window.hpp"
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/state/FocusState.hpp"
|
||||
#include "../../protocols/CursorShape.hpp"
|
||||
#include "../../protocols/IdleInhibit.hpp"
|
||||
#include "../../protocols/RelativePointer.hpp"
|
||||
|
|
@ -168,18 +169,18 @@ void CInputManager::simulateMouseMovement() {
|
|||
}
|
||||
|
||||
void CInputManager::sendMotionEventsToFocused() {
|
||||
if (!g_pCompositor->m_lastFocus || isConstrained())
|
||||
if (!Desktop::focusState()->surface() || isConstrained())
|
||||
return;
|
||||
|
||||
// todo: this sucks ass
|
||||
const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock());
|
||||
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock());
|
||||
const auto PWINDOW = g_pCompositor->getWindowFromSurface(Desktop::focusState()->surface());
|
||||
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(Desktop::focusState()->surface());
|
||||
|
||||
const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_realPosition->goal() : (PLS ? Vector2D{PLS->m_geometry.x, PLS->m_geometry.y} : Vector2D{}));
|
||||
|
||||
m_emptyFocusCursorSet = false;
|
||||
|
||||
g_pSeatManager->setPointerFocus(g_pCompositor->m_lastFocus.lock(), LOCAL);
|
||||
g_pSeatManager->setPointerFocus(Desktop::focusState()->surface(), LOCAL);
|
||||
}
|
||||
|
||||
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, std::optional<Vector2D> overridePos) {
|
||||
|
|
@ -223,7 +224,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
m_lastCursorPosFloored = MOUSECOORDSFLOORED;
|
||||
|
||||
const auto PMONITOR = isLocked() && g_pCompositor->m_lastMonitor ? g_pCompositor->m_lastMonitor.lock() : g_pCompositor->getMonitorFromCursor();
|
||||
const auto PMONITOR = isLocked() && Desktop::focusState()->monitor() ? Desktop::focusState()->monitor() : g_pCompositor->getMonitorFromCursor();
|
||||
|
||||
// this can happen if there are no displays hooked up to Hyprland
|
||||
if (PMONITOR == nullptr)
|
||||
|
|
@ -239,7 +240,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
// constraints
|
||||
if (!g_pSeatManager->m_mouse.expired() && isConstrained()) {
|
||||
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_lastFocus.lock());
|
||||
const auto SURF = CWLSurface::fromResource(Desktop::focusState()->surface());
|
||||
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
|
||||
|
||||
if (CONSTRAINT) {
|
||||
|
|
@ -263,8 +264,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", rc<uintptr_t>(SURF.get()), rc<uintptr_t>(CONSTRAINT.get()));
|
||||
}
|
||||
|
||||
if (PMONITOR != g_pCompositor->m_lastMonitor && (*PMOUSEFOCUSMON || refocus) && m_forcedFocus.expired())
|
||||
g_pCompositor->setActiveMonitor(PMONITOR);
|
||||
if (PMONITOR != Desktop::focusState()->monitor() && (*PMOUSEFOCUSMON || refocus) && m_forcedFocus.expired())
|
||||
Desktop::focusState()->rawMonitorFocus(PMONITOR);
|
||||
|
||||
// check for windows that have focus priority like our permission popups
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, FOCUS_PRIORITY);
|
||||
|
|
@ -277,7 +278,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
const auto PSESSIONLOCKSURFACE = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->m_id);
|
||||
const auto foundLockSurface = PSESSIONLOCKSURFACE ? PSESSIONLOCKSURFACE->surface->surface() : nullptr;
|
||||
|
||||
g_pCompositor->focusSurface(foundLockSurface);
|
||||
Desktop::focusState()->rawSurfaceFocus(foundLockSurface);
|
||||
|
||||
// search for interactable abovelock surfaces for pointer focus, or use session lock surface if not found
|
||||
for (auto& lsl : PMONITOR->m_layerSurfaceLayers | std::views::reverse) {
|
||||
|
|
@ -317,7 +318,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
// if we are holding a pointer button,
|
||||
// and we're not dnd-ing, don't refocus. Keep focus on last surface.
|
||||
if (!PROTO::data->dndActive() && !m_currentlyHeldButtons.empty() && g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->m_mapped &&
|
||||
if (!PROTO::data->dndActive() && !m_currentlyHeldButtons.empty() && Desktop::focusState()->surface() && Desktop::focusState()->surface()->m_mapped &&
|
||||
g_pSeatManager->m_state.pointerFocus && !m_hardInput) {
|
||||
foundSurface = g_pSeatManager->m_state.pointerFocus.lock();
|
||||
|
||||
|
|
@ -339,7 +340,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
surfacePos = BOX->pos();
|
||||
pFoundLayerSurface = HLSurface->getLayer();
|
||||
if (!pFoundLayerSurface)
|
||||
pFoundWindow = !PWINDOW || PWINDOW->isHidden() ? g_pCompositor->m_lastWindow.lock() : PWINDOW;
|
||||
pFoundWindow = !PWINDOW || PWINDOW->isHidden() ? Desktop::focusState()->window() : PWINDOW;
|
||||
} else // reset foundSurface, find one normally
|
||||
foundSurface = nullptr;
|
||||
} else // reset foundSurface, find one normally
|
||||
|
|
@ -461,7 +462,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface);
|
||||
|
||||
if (g_pPointerManager->softwareLockedFor(PMONITOR->m_self.lock()) > 0 && !skipFrameSchedule)
|
||||
g_pCompositor->scheduleFrameForMonitor(g_pCompositor->m_lastMonitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
|
||||
g_pCompositor->scheduleFrameForMonitor(Desktop::focusState()->monitor(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
|
||||
|
||||
// FIXME: This will be disabled during DnD operations because we do not exactly follow the spec
|
||||
// xdg-popup grabs should be keyboard-only, while they are absolute in our case...
|
||||
|
|
@ -492,8 +493,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
g_pSeatManager->setPointerFocus(nullptr, {});
|
||||
|
||||
if (refocus || g_pCompositor->m_lastWindow.expired()) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too!
|
||||
g_pCompositor->focusWindow(nullptr);
|
||||
if (refocus || !Desktop::focusState()->window()) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too!
|
||||
Desktop::focusState()->rawWindowFocus(nullptr);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -514,8 +515,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
bool allowKeyboardRefocus = true;
|
||||
|
||||
if (!refocus && g_pCompositor->m_lastFocus) {
|
||||
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock());
|
||||
if (!refocus && Desktop::focusState()->surface()) {
|
||||
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(Desktop::focusState()->surface());
|
||||
|
||||
if (PLS && PLS->m_layerSurface->m_current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
||||
allowKeyboardRefocus = false;
|
||||
|
|
@ -556,19 +557,19 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
}
|
||||
|
||||
if (FOLLOWMOUSE != 1 && !refocus) {
|
||||
if (pFoundWindow != g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow.lock() &&
|
||||
((pFoundWindow->m_isFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_lastWindow->m_isFloating != pFoundWindow->m_isFloating && *PFLOATBEHAVIOR != 0))) {
|
||||
if (pFoundWindow != Desktop::focusState()->window() && Desktop::focusState()->window() &&
|
||||
((pFoundWindow->m_isFloating && *PFLOATBEHAVIOR == 2) || (Desktop::focusState()->window()->m_isFloating != pFoundWindow->m_isFloating && *PFLOATBEHAVIOR != 0))) {
|
||||
// enter if change floating style
|
||||
if (FOLLOWMOUSE != 3 && allowKeyboardRefocus)
|
||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||
Desktop::focusState()->rawWindowFocus(pFoundWindow, foundSurface);
|
||||
g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal);
|
||||
} else if (FOLLOWMOUSE == 2 || FOLLOWMOUSE == 3)
|
||||
g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal);
|
||||
|
||||
if (pFoundWindow == g_pCompositor->m_lastWindow)
|
||||
if (pFoundWindow == Desktop::focusState()->window())
|
||||
g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal);
|
||||
|
||||
if (FOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_lastWindow)
|
||||
if (FOLLOWMOUSE != 0 || pFoundWindow == Desktop::focusState()->window())
|
||||
g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal);
|
||||
|
||||
if (g_pSeatManager->m_state.pointerFocus == foundSurface)
|
||||
|
|
@ -578,26 +579,26 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
return; // don't enter any new surfaces
|
||||
} else {
|
||||
if (allowKeyboardRefocus && ((FOLLOWMOUSE != 3 && (*PMOUSEREFOCUS || m_lastMouseFocus.lock() != pFoundWindow)) || refocus)) {
|
||||
if (m_lastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_lastWindow.lock() != pFoundWindow || g_pCompositor->m_lastFocus != foundSurface || refocus) {
|
||||
if (m_lastMouseFocus.lock() != pFoundWindow || Desktop::focusState()->window() != pFoundWindow || Desktop::focusState()->surface() != foundSurface || refocus) {
|
||||
m_lastMouseFocus = pFoundWindow;
|
||||
|
||||
// TODO: this looks wrong. When over a popup, it constantly is switching.
|
||||
// Temp fix until that's figured out. Otherwise spams windowrule lookups and other shit.
|
||||
if (m_lastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_lastWindow.lock() != pFoundWindow) {
|
||||
if (m_lastMouseFocus.lock() != pFoundWindow || Desktop::focusState()->window() != pFoundWindow) {
|
||||
if (m_mousePosDelta > *PFOLLOWMOUSETHRESHOLD || refocus) {
|
||||
const bool hasNoFollowMouse = pFoundWindow && pFoundWindow->m_ruleApplicator->noFollowMouse().valueOrDefault();
|
||||
|
||||
if (refocus || !hasNoFollowMouse)
|
||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||
Desktop::focusState()->rawWindowFocus(pFoundWindow, foundSurface);
|
||||
}
|
||||
} else
|
||||
g_pCompositor->focusSurface(foundSurface, pFoundWindow);
|
||||
Desktop::focusState()->rawSurfaceFocus(foundSurface, pFoundWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_pSeatManager->m_state.keyboardFocus == nullptr)
|
||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||
Desktop::focusState()->rawWindowFocus(pFoundWindow, foundSurface);
|
||||
|
||||
m_lastFocusOnLS = false;
|
||||
} else {
|
||||
|
|
@ -608,7 +609,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
if (pFoundLayerSurface && (pFoundLayerSurface->m_layerSurface->m_current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE) && FOLLOWMOUSE != 3 &&
|
||||
(allowKeyboardRefocus || pFoundLayerSurface->m_layerSurface->m_current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)) {
|
||||
g_pCompositor->focusSurface(foundSurface);
|
||||
Desktop::focusState()->rawSurfaceFocus(foundSurface);
|
||||
}
|
||||
|
||||
if (pFoundLayerSurface)
|
||||
|
|
@ -762,7 +763,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
break;
|
||||
|
||||
if ((g_pSeatManager->m_mouse.expired() || !isConstrained()) /* No constraints */
|
||||
&& (w && g_pCompositor->m_lastWindow.lock() != w) /* window should change */) {
|
||||
&& (w && Desktop::focusState()->window() != w) /* window should change */) {
|
||||
// a bit hacky
|
||||
// if we only pressed one button, allow us to refocus. m_lCurrentlyHeldButtons.size() > 0 will stick the focus
|
||||
if (m_currentlyHeldButtons.size() == 1) {
|
||||
|
|
@ -791,8 +792,8 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
// notify app if we didn't handle it
|
||||
g_pSeatManager->sendPointerButton(e.timeMs, e.button, e.state);
|
||||
|
||||
if (const auto PMON = g_pCompositor->getMonitorFromVector(mouseCoords); PMON != g_pCompositor->m_lastMonitor && PMON)
|
||||
g_pCompositor->setActiveMonitor(PMON);
|
||||
if (const auto PMON = g_pCompositor->getMonitorFromVector(mouseCoords); PMON != Desktop::focusState()->monitor() && PMON)
|
||||
Desktop::focusState()->rawMonitorFocus(PMON);
|
||||
|
||||
if (g_pSeatManager->m_seatGrab && e.state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
||||
m_hardInput = true;
|
||||
|
|
@ -1022,8 +1023,8 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||
keeb->updateLEDs();
|
||||
|
||||
// in case m_lastFocus was set without a keyboard
|
||||
if (m_keyboards.size() == 1 && g_pCompositor->m_lastFocus)
|
||||
g_pSeatManager->setKeyboardFocus(g_pCompositor->m_lastFocus.lock());
|
||||
if (m_keyboards.size() == 1 && Desktop::focusState()->surface())
|
||||
g_pSeatManager->setKeyboardFocus(Desktop::focusState()->surface());
|
||||
}
|
||||
|
||||
void CInputManager::setKeyboardLayout() {
|
||||
|
|
@ -1577,16 +1578,16 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
|
|||
foundSurface = nullptr;
|
||||
}
|
||||
|
||||
if (!foundSurface && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_workspace && g_pCompositor->m_lastWindow->m_workspace->isVisibleNotCovered()) {
|
||||
if (!foundSurface && Desktop::focusState()->window() && Desktop::focusState()->window()->m_workspace && Desktop::focusState()->window()->m_workspace->isVisibleNotCovered()) {
|
||||
// then the last focused window if we're on the same workspace as it
|
||||
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
|
||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||
const auto PLASTWINDOW = Desktop::focusState()->window();
|
||||
Desktop::focusState()->fullWindowFocus(PLASTWINDOW);
|
||||
} else {
|
||||
// otherwise fall back to a normal refocus.
|
||||
|
||||
if (foundSurface && !foundSurface->m_hlSurface->keyboardFocusable()) {
|
||||
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
|
||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||
const auto PLASTWINDOW = Desktop::focusState()->window();
|
||||
Desktop::focusState()->fullWindowFocus(PLASTWINDOW);
|
||||
}
|
||||
|
||||
refocus();
|
||||
|
|
@ -1615,7 +1616,7 @@ void CInputManager::unconstrainMouse() {
|
|||
bool CInputManager::isConstrained() {
|
||||
return std::ranges::any_of(m_constraints, [](auto const& c) {
|
||||
const auto constraint = c.lock();
|
||||
return constraint && constraint->isActive() && constraint->owner()->resource() == g_pCompositor->m_lastFocus;
|
||||
return constraint && constraint->isActive() && constraint->owner()->resource() == Desktop::focusState()->surface();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1623,7 +1624,7 @@ bool CInputManager::isLocked() {
|
|||
if (!isConstrained())
|
||||
return false;
|
||||
|
||||
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_lastFocus.lock());
|
||||
const auto SURF = CWLSurface::fromResource(Desktop::focusState()->surface());
|
||||
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
|
||||
|
||||
return CONSTRAINT && CONSTRAINT->isLocked();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "InputMethodRelay.hpp"
|
||||
#include "InputManager.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../desktop/state/FocusState.hpp"
|
||||
#include "../../protocols/TextInputV3.hpp"
|
||||
#include "../../protocols/TextInputV1.hpp"
|
||||
#include "../../protocols/InputMethodV2.hpp"
|
||||
|
|
@ -54,17 +53,17 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
|
|||
Debug::log(LOG, "New input popup");
|
||||
});
|
||||
|
||||
if (!g_pCompositor->m_lastFocus)
|
||||
if (!Desktop::focusState()->surface())
|
||||
return;
|
||||
|
||||
for (auto const& ti : m_textInputs) {
|
||||
if (ti->client() != g_pCompositor->m_lastFocus->client())
|
||||
if (ti->client() != Desktop::focusState()->surface()->client())
|
||||
continue;
|
||||
|
||||
if (ti->isV3())
|
||||
ti->enter(g_pCompositor->m_lastFocus.lock());
|
||||
ti->enter(Desktop::focusState()->surface());
|
||||
else
|
||||
ti->onEnabled(g_pCompositor->m_lastFocus.lock());
|
||||
ti->onEnabled(Desktop::focusState()->surface());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -73,11 +72,11 @@ void CInputMethodRelay::removePopup(CInputPopup* pPopup) {
|
|||
}
|
||||
|
||||
CTextInput* CInputMethodRelay::getFocusedTextInput() {
|
||||
if (!g_pCompositor->m_lastFocus)
|
||||
if (!Desktop::focusState()->surface())
|
||||
return nullptr;
|
||||
|
||||
for (auto const& ti : m_textInputs) {
|
||||
if (ti->focusedSurface() == g_pCompositor->m_lastFocus)
|
||||
if (ti->focusedSurface() == Desktop::focusState()->surface())
|
||||
return ti.get();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#include "TextInput.hpp"
|
||||
#include "../../defines.hpp"
|
||||
#include "InputManager.hpp"
|
||||
#include "../../protocols/TextInputV1.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../desktop/state/FocusState.hpp"
|
||||
#include "../../protocols/TextInputV3.hpp"
|
||||
#include "../../protocols/InputMethodV2.hpp"
|
||||
#include "../../protocols/core/Compositor.hpp"
|
||||
|
|
@ -31,8 +30,8 @@ void CTextInput::initCallbacks() {
|
|||
g_pInputManager->m_relay.deactivateIME(this);
|
||||
});
|
||||
|
||||
if (!g_pCompositor->m_lastFocus.expired() && g_pCompositor->m_lastFocus->client() == INPUT->client())
|
||||
enter(g_pCompositor->m_lastFocus.lock());
|
||||
if (Desktop::focusState()->surface() && Desktop::focusState()->surface()->client() == INPUT->client())
|
||||
enter(Desktop::focusState()->surface());
|
||||
} else {
|
||||
const auto INPUT = m_v1Input.lock();
|
||||
|
||||
|
|
@ -60,7 +59,7 @@ void CTextInput::onEnabled(SP<CWLSurfaceResource> surfV1) {
|
|||
|
||||
// v1 only, map surface to PTI
|
||||
if (!isV3()) {
|
||||
if (g_pCompositor->m_lastFocus != surfV1 || !m_v1Input->m_active)
|
||||
if (Desktop::focusState()->surface() != surfV1 || !m_v1Input->m_active)
|
||||
return;
|
||||
|
||||
enter(surfV1);
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
#include "../../protocols/SessionLock.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/state/FocusState.hpp"
|
||||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../helpers/Monitor.hpp"
|
||||
#include "../../devices/ITouch.hpp"
|
||||
#include "../SeatManager.hpp"
|
||||
#include "managers/animation/AnimationManager.hpp"
|
||||
#include "../HookSystemManager.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "UnifiedWorkspaceSwipeGesture.hpp"
|
||||
|
|
@ -26,7 +26,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
|||
|
||||
auto PMONITOR = g_pCompositor->getMonitorFromName(!e.device->m_boundOutput.empty() ? e.device->m_boundOutput : "");
|
||||
|
||||
PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_lastMonitor.lock();
|
||||
PMONITOR = PMONITOR ? PMONITOR : Desktop::focusState()->monitor();
|
||||
|
||||
const auto TOUCH_COORDS = PMONITOR->m_position + (e.pos * PMONITOR->m_size);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "UnifiedWorkspaceSwipeGesture.hpp"
|
||||
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../desktop/state/FocusState.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
#include "InputManager.hpp"
|
||||
|
||||
|
|
@ -12,18 +13,18 @@ void CUnifiedWorkspaceSwipeGesture::begin() {
|
|||
if (isGestureInProgress())
|
||||
return;
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->m_activeWorkspace;
|
||||
const auto PWORKSPACE = Desktop::focusState()->monitor()->m_activeWorkspace;
|
||||
|
||||
Debug::log(LOG, "CUnifiedWorkspaceSwipeGesture::begin: Starting a swipe from {}", PWORKSPACE->m_name);
|
||||
|
||||
m_workspaceBegin = PWORKSPACE;
|
||||
m_delta = 0;
|
||||
m_monitor = g_pCompositor->m_lastMonitor;
|
||||
m_monitor = Desktop::focusState()->monitor();
|
||||
m_avgSpeed = 0;
|
||||
m_speedPoints = 0;
|
||||
|
||||
if (PWORKSPACE->m_hasFullscreenWindow) {
|
||||
for (auto const& ls : g_pCompositor->m_lastMonitor->m_layerSurfaceLayers[2]) {
|
||||
for (auto const& ls : Desktop::focusState()->monitor()->m_layerSurfaceLayers[2]) {
|
||||
*ls->m_alpha = 1.f;
|
||||
}
|
||||
}
|
||||
|
|
@ -307,7 +308,7 @@ void CUnifiedWorkspaceSwipeGesture::end() {
|
|||
g_pInputManager->refocus();
|
||||
|
||||
// apply alpha
|
||||
for (auto const& ls : g_pCompositor->m_lastMonitor->m_layerSurfaceLayers[2]) {
|
||||
for (auto const& ls : Desktop::focusState()->monitor()->m_layerSurfaceLayers[2]) {
|
||||
*ls->m_alpha = pSwitchedTo->m_hasFullscreenWindow && pSwitchedTo->m_fullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
#include "../../../../managers/eventLoop/EventLoopManager.hpp"
|
||||
#include "../../../../managers/eventLoop/EventLoopTimer.hpp"
|
||||
#include "../../../../config/ConfigValue.hpp"
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
|
||||
constexpr const float MAX_DISTANCE = 200.F;
|
||||
|
||||
|
|
@ -27,7 +28,7 @@ static float lerpVal(const float& from, const float& to, const float& t) {
|
|||
void CCloseTrackpadGesture::begin(const ITrackpadGesture::STrackpadGestureBegin& e) {
|
||||
ITrackpadGesture::begin(e);
|
||||
|
||||
m_window = g_pCompositor->m_lastWindow;
|
||||
m_window = Desktop::focusState()->window();
|
||||
|
||||
if (!m_window)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#include "FloatGesture.hpp"
|
||||
|
||||
#include "../../../../Compositor.hpp"
|
||||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../desktop/Window.hpp"
|
||||
|
||||
constexpr const float MAX_DISTANCE = 250.F;
|
||||
|
||||
|
|
@ -29,7 +30,7 @@ CFloatTrackpadGesture::CFloatTrackpadGesture(const std::string_view& data) {
|
|||
void CFloatTrackpadGesture::begin(const ITrackpadGesture::STrackpadGestureBegin& e) {
|
||||
ITrackpadGesture::begin(e);
|
||||
|
||||
m_window = g_pCompositor->m_lastWindow;
|
||||
m_window = Desktop::focusState()->window();
|
||||
|
||||
if (!m_window)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "FullscreenGesture.hpp"
|
||||
|
||||
#include "../../../../Compositor.hpp"
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
#include "../../../animation/DesktopAnimationManager.hpp"
|
||||
|
||||
|
|
@ -29,7 +30,7 @@ CFullscreenTrackpadGesture::CFullscreenTrackpadGesture(const std::string_view& m
|
|||
void CFullscreenTrackpadGesture::begin(const ITrackpadGesture::STrackpadGestureBegin& e) {
|
||||
ITrackpadGesture::begin(e);
|
||||
|
||||
m_window = g_pCompositor->m_lastWindow;
|
||||
m_window = Desktop::focusState()->window();
|
||||
|
||||
if (!m_window)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
#include "MoveGesture.hpp"
|
||||
|
||||
#include "../../../../Compositor.hpp"
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../desktop/Window.hpp"
|
||||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
|
||||
void CMoveTrackpadGesture::begin(const ITrackpadGesture::STrackpadGestureBegin& e) {
|
||||
ITrackpadGesture::begin(e);
|
||||
|
||||
m_window = g_pCompositor->m_lastWindow;
|
||||
m_window = Desktop::focusState()->window();
|
||||
m_lastDelta = {};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
#include "ResizeGesture.hpp"
|
||||
|
||||
#include "../../../../Compositor.hpp"
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../desktop/Window.hpp"
|
||||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
|
||||
void CResizeTrackpadGesture::begin(const ITrackpadGesture::STrackpadGestureBegin& e) {
|
||||
ITrackpadGesture::begin(e);
|
||||
|
||||
m_window = g_pCompositor->m_lastWindow;
|
||||
m_window = Desktop::focusState()->window();
|
||||
}
|
||||
|
||||
void CResizeTrackpadGesture::update(const ITrackpadGesture::STrackpadGestureUpdate& e) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "SpecialWorkspaceGesture.hpp"
|
||||
|
||||
#include "../../../../Compositor.hpp"
|
||||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
|
||||
#include <hyprutils/memory/Casts.hpp>
|
||||
|
|
@ -36,7 +36,7 @@ void CSpecialWorkspaceGesture::begin(const ITrackpadGesture::STrackpadGestureBeg
|
|||
|
||||
if (m_specialWorkspace) {
|
||||
m_animatingOut = m_specialWorkspace->isVisible();
|
||||
m_monitor = m_animatingOut ? m_specialWorkspace->m_monitor : g_pCompositor->m_lastMonitor;
|
||||
m_monitor = m_animatingOut ? m_specialWorkspace->m_monitor : Desktop::focusState()->monitor();
|
||||
|
||||
if (!m_monitor)
|
||||
return;
|
||||
|
|
@ -44,7 +44,7 @@ void CSpecialWorkspaceGesture::begin(const ITrackpadGesture::STrackpadGestureBeg
|
|||
if (!m_animatingOut)
|
||||
m_monitor->setSpecialWorkspace(m_specialWorkspace);
|
||||
} else {
|
||||
m_monitor = g_pCompositor->m_lastMonitor;
|
||||
m_monitor = Desktop::focusState()->monitor();
|
||||
|
||||
if (!m_monitor)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "WorkspaceSwipeGesture.hpp"
|
||||
|
||||
#include "../../../../Compositor.hpp"
|
||||
#include "../../../../managers/input/InputManager.hpp"
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
|
||||
#include "../../UnifiedWorkspaceSwipeGesture.hpp"
|
||||
|
|
@ -16,7 +16,7 @@ void CWorkspaceSwipeGesture::begin(const ITrackpadGesture::STrackpadGestureBegin
|
|||
|
||||
int onMonitor = 0;
|
||||
for (auto const& w : g_pCompositor->getWorkspaces()) {
|
||||
if (w->m_monitor == g_pCompositor->m_lastMonitor && !g_pCompositor->isWorkspaceSpecial(w->m_id))
|
||||
if (w->m_monitor == Desktop::focusState()->monitor() && !g_pCompositor->isWorkspaceSpecial(w->m_id))
|
||||
onMonitor++;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue