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
|
|
@ -3,6 +3,7 @@
|
|||
#include <hyprland-focus-grab-v1.hpp>
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
#include <cstdint>
|
||||
#include <wayland-server.h>
|
||||
|
|
@ -104,7 +105,7 @@ void CFocusGrab::refocusKeyboard() {
|
|||
}
|
||||
|
||||
if (surface)
|
||||
g_pCompositor->focusSurface(surface);
|
||||
Desktop::focusState()->rawSurfaceFocus(surface);
|
||||
else
|
||||
LOGM(ERR, "CFocusGrab::refocusKeyboard called with no committed surfaces. This should never happen.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
#include "ForeignToplevelWlr.hpp"
|
||||
#include "core/Output.hpp"
|
||||
#include <algorithm>
|
||||
#include "../Compositor.hpp"
|
||||
#include "managers/input/InputManager.hpp"
|
||||
#include "protocols/core/Output.hpp"
|
||||
#include "render/Renderer.hpp"
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "../managers/EventManager.hpp"
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
|||
|
||||
if (PWINDOW->m_workspace != monitor->m_activeWorkspace) {
|
||||
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, monitor->m_activeWorkspace);
|
||||
g_pCompositor->setActiveMonitor(monitor);
|
||||
Desktop::focusState()->rawMonitorFocus(monitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -178,7 +179,7 @@ void CForeignToplevelHandleWlr::sendState() {
|
|||
wl_array state;
|
||||
wl_array_init(&state);
|
||||
|
||||
if (PWINDOW == g_pCompositor->m_lastWindow) {
|
||||
if (PWINDOW == Desktop::focusState()->window()) {
|
||||
auto p = sc<uint32_t*>(wl_array_add(&state, sizeof(uint32_t)));
|
||||
*p = ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED;
|
||||
}
|
||||
|
|
@ -216,7 +217,7 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa
|
|||
onMap(w);
|
||||
}
|
||||
|
||||
m_lastFocus = g_pCompositor->m_lastWindow;
|
||||
m_lastFocus = Desktop::focusState()->window();
|
||||
}
|
||||
|
||||
void CForeignToplevelWlrManager::onMap(PHLWINDOW pWindow) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#include "InputMethodV2.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
#include "../devices/IKeyboard.hpp"
|
||||
#include "../helpers/MiscFunctions.hpp"
|
||||
#include <sys/mman.h>
|
||||
#include "core/Compositor.hpp"
|
||||
#include <cstring>
|
||||
|
|
@ -96,8 +97,8 @@ CInputMethodPopupV2::CInputMethodPopupV2(SP<CZwpInputPopupSurfaceV2> resource_,
|
|||
m_listeners.destroySurface.reset();
|
||||
m_listeners.commitSurface.reset();
|
||||
|
||||
if (g_pCompositor->m_lastFocus == m_surface)
|
||||
g_pCompositor->m_lastFocus.reset();
|
||||
if (Desktop::focusState()->surface() == m_surface)
|
||||
Desktop::focusState()->surface().reset();
|
||||
|
||||
m_surface.reset();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "PointerConstraints.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
|
|
@ -242,7 +243,7 @@ void CPointerConstraintsProtocol::onNewConstraint(SP<CPointerConstraint> constra
|
|||
|
||||
g_pInputManager->m_constraints.emplace_back(constraint);
|
||||
|
||||
if (g_pCompositor->m_lastFocus == OWNER->resource())
|
||||
if (Desktop::focusState()->surface() == OWNER->resource())
|
||||
constraint->activate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "SessionLock.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
#include "FractionalScale.hpp"
|
||||
#include "LockNotify.hpp"
|
||||
|
|
@ -7,6 +6,7 @@
|
|||
#include "core/Output.hpp"
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
|
||||
CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_, SP<CWLSurfaceResource> surface_, PHLMONITOR pMonitor_, WP<CSessionLock> owner_) :
|
||||
m_resource(resource_), m_sessionLock(owner_), m_surface(surface_), m_monitor(pMonitor_) {
|
||||
|
|
@ -51,8 +51,8 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
|
|||
m_surface->unmap();
|
||||
m_listeners.surfaceCommit.reset();
|
||||
m_listeners.surfaceDestroy.reset();
|
||||
if (g_pCompositor->m_lastFocus == m_surface)
|
||||
g_pCompositor->m_lastFocus.reset();
|
||||
if (Desktop::focusState()->surface() == m_surface)
|
||||
Desktop::focusState()->surface().reset();
|
||||
|
||||
m_surface.reset();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "ShortcutsInhibit.hpp"
|
||||
#include <algorithm>
|
||||
#include "../Compositor.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "core/Compositor.hpp"
|
||||
|
||||
CKeyboardShortcutsInhibitor::CKeyboardShortcutsInhibitor(SP<CZwpKeyboardShortcutsInhibitorV1> resource_, SP<CWLSurfaceResource> surf) : m_resource(resource_), m_surface(surf) {
|
||||
|
|
@ -67,14 +68,14 @@ void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitMa
|
|||
}
|
||||
|
||||
bool CKeyboardShortcutsInhibitProtocol::isInhibited() {
|
||||
if (!g_pCompositor->m_lastFocus)
|
||||
if (!Desktop::focusState()->surface())
|
||||
return false;
|
||||
|
||||
if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); PWINDOW && PWINDOW->m_ruleApplicator->noShortcutsInhibit().valueOrDefault())
|
||||
if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(Desktop::focusState()->surface()); PWINDOW && PWINDOW->m_ruleApplicator->noShortcutsInhibit().valueOrDefault())
|
||||
return false;
|
||||
|
||||
for (auto const& in : m_inhibitors) {
|
||||
if (in->surface() != g_pCompositor->m_lastFocus)
|
||||
if (in->surface() != Desktop::focusState()->surface())
|
||||
continue;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue