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:
Nikolai Nechaev 2025-11-26 07:44:26 +09:00 committed by GitHub
parent 1c1746de61
commit 40d8fa8491
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 1003 additions and 694 deletions

View file

@ -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();
}