From 66e3679ba3dd1412f47e08c52872b7583deff291 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 21 Feb 2023 20:47:02 +0000 Subject: [PATCH] Conform to X11 OR surfaces wanting focus --- src/Compositor.cpp | 2 +- src/events/Windows.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index d4b67a89..8ab741da 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -632,7 +632,7 @@ CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) { if (wlr_box_contains_point(&box, m_sWLRCursor->x, m_sWLRCursor->y)) { - if ((*w)->m_iX11Type == 2) { + if ((*w)->m_bIsX11 && (*w)->m_iX11Type == 2 && !wlr_xwayland_or_surface_wants_focus((*w)->m_uSurface.xwayland)) { // Override Redirect return g_pCompositor->m_pLastWindow; // we kinda trick everything here. // TODO: this is wrong, we should focus the parent, but idk how to get it considering it's nullptr in most cases. diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 7e6e2ca7..58273d96 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -88,7 +88,8 @@ void Events::listener_mapWindow(void* owner, void* data) { PWINDOW->m_bRequestsFloat = true; } - PWINDOW->m_bX11ShouldntFocus = PWINDOW->m_bX11ShouldntFocus || (PWINDOW->m_bIsX11 && PWINDOW->m_iX11Type == 2); + PWINDOW->m_bX11ShouldntFocus = + PWINDOW->m_bX11ShouldntFocus || (PWINDOW->m_bIsX11 && PWINDOW->m_iX11Type == 2 && !wlr_xwayland_or_surface_wants_focus(PWINDOW->m_uSurface.xwayland)); if (PWORKSPACE->m_bDefaultFloating) PWINDOW->m_bIsFloating = true; @@ -417,7 +418,8 @@ void Events::listener_mapWindow(void* owner, void* data) { if (PLSFROMFOCUS && PLSFROMFOCUS->layerSurface->current.keyboard_interactive) PWINDOW->m_bNoInitialFocus = true; - if (!PWINDOW->m_bNoFocus && !PWINDOW->m_bNoInitialFocus && PWINDOW->m_iX11Type != 2 && !workspaceSilent) { + if (!PWINDOW->m_bNoFocus && !PWINDOW->m_bNoInitialFocus && + (PWINDOW->m_iX11Type != 2 || (PWINDOW->m_bIsX11 && wlr_xwayland_or_surface_wants_focus(PWINDOW->m_uSurface.xwayland))) && !workspaceSilent) { g_pCompositor->focusWindow(PWINDOW); PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PACTIVEALPHA); PWINDOW->m_fDimPercent.setValueAndWarp(*PDIMSTRENGTH);