From 147e962370069e6e3ec8054ef4243fc3fd69c9e8 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Sat, 3 Jun 2023 12:20:23 +0200 Subject: [PATCH] deps: update wlroots --- src/Compositor.cpp | 2 +- src/Window.cpp | 3 ++- src/Window.hpp | 2 ++ src/events/Events.hpp | 2 ++ src/events/Layers.cpp | 14 +++++--------- src/events/Misc.cpp | 4 ++-- src/events/Popups.cpp | 4 ++-- src/events/Windows.cpp | 21 +++++++++++++++++---- src/helpers/SubsurfaceTree.cpp | 6 +++--- src/managers/SessionLockManager.cpp | 2 +- src/managers/input/InputMethodRelay.cpp | 8 ++++---- subprojects/wlroots | 2 +- 12 files changed, 42 insertions(+), 28 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index cfbc11b5..27b4c9cf 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -986,7 +986,7 @@ CWindow* CCompositor::getWindowForPopup(wlr_xdg_popup* popup) { wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector>* layerSurfaces, Vector2D* sCoords, SLayerSurface** ppLayerSurfaceFound) { for (auto& ls : *layerSurfaces | std::views::reverse) { - if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->mapped) || ls->alpha.fl() == 0.f) + if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha.fl() == 0.f) continue; auto SURFACEAT = wlr_layer_surface_v1_surface_at(ls->layerSurface, pos.x - ls->geometry.x, pos.y - ls->geometry.y, &sCoords->x, &sCoords->y); diff --git a/src/Window.cpp b/src/Window.cpp index a9598615..a1746fbc 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -397,7 +397,8 @@ void CWindow::onMap() { g_pCompositor->m_vWindowFocusHistory.push_back(this); - hyprListener_unmapWindow.initCallback(m_bIsX11 ? &m_uSurface.xwayland->events.unmap : &m_uSurface.xdg->events.unmap, &Events::listener_unmapWindow, this, "CWindow"); + hyprListener_unmapWindow.initCallback(m_bIsX11 ? &m_uSurface.xwayland->surface->events.unmap : &m_uSurface.xdg->surface->events.unmap, &Events::listener_unmapWindow, this, + "CWindow"); } void CWindow::onBorderAngleAnimEnd(void* ptr) { diff --git a/src/Window.hpp b/src/Window.hpp index 660abb61..d609f91b 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -159,6 +159,8 @@ class CWindow { DYNLISTENER(toplevelActivate); DYNLISTENER(toplevelFullscreen); DYNLISTENER(setOverrideRedirect); + DYNLISTENER(associateX11); + DYNLISTENER(dissociateX11); // DYNLISTENER(newSubsurfaceWindow); CWLSurface m_pWLSurface; diff --git a/src/events/Events.hpp b/src/events/Events.hpp index e0f44727..472d7cb5 100644 --- a/src/events/Events.hpp +++ b/src/events/Events.hpp @@ -59,6 +59,8 @@ namespace Events { DYNLISTENFUNC(requestMinimize); DYNLISTENFUNC(requestMaximize); DYNLISTENFUNC(setOverrideRedirect); + DYNLISTENFUNC(associateX11); + DYNLISTENFUNC(dissociateX11); // Window subsurfaces // LISTENER(newSubsurfaceWindow); diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp index 88f9a70b..bc01bc5e 100644 --- a/src/events/Layers.cpp +++ b/src/events/Layers.cpp @@ -44,8 +44,8 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) { layerSurface->hyprListener_commitLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.commit, &Events::listener_commitLayerSurface, layerSurface, "layerSurface"); layerSurface->hyprListener_destroyLayerSurface.initCallback(&WLRLAYERSURFACE->events.destroy, &Events::listener_destroyLayerSurface, layerSurface, "layerSurface"); - layerSurface->hyprListener_mapLayerSurface.initCallback(&WLRLAYERSURFACE->events.map, &Events::listener_mapLayerSurface, layerSurface, "layerSurface"); - layerSurface->hyprListener_unmapLayerSurface.initCallback(&WLRLAYERSURFACE->events.unmap, &Events::listener_unmapLayerSurface, layerSurface, "layerSurface"); + layerSurface->hyprListener_mapLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.map, &Events::listener_mapLayerSurface, layerSurface, "layerSurface"); + layerSurface->hyprListener_unmapLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.unmap, &Events::listener_unmapLayerSurface, layerSurface, "layerSurface"); layerSurface->hyprListener_newPopup.initCallback(&WLRLAYERSURFACE->events.new_popup, &Events::listener_newPopup, layerSurface, "layerSurface"); layerSurface->layerSurface = WLRLAYERSURFACE; @@ -109,10 +109,9 @@ void Events::listener_mapLayerSurface(void* owner, void* data) { Debug::log(LOG, "LayerSurface %lx mapped", layersurface->layerSurface); - layersurface->layerSurface->mapped = true; - layersurface->mapped = true; - layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive; - layersurface->surface = layersurface->layerSurface->surface; + layersurface->mapped = true; + layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive; + layersurface->surface = layersurface->layerSurface->surface; // anim layersurface->alpha.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn")); @@ -204,9 +203,6 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) { g_pCompositor->addToFadingOutSafe(layersurface); - if (layersurface->layerSurface->mapped) - layersurface->layerSurface->mapped = false; - const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output); const bool WASLASTFOCUS = g_pCompositor->m_pLastFocus == layersurface->layerSurface->surface; diff --git a/src/events/Misc.cpp b/src/events/Misc.cpp index 853d37c9..a360090f 100644 --- a/src/events/Misc.cpp +++ b/src/events/Misc.cpp @@ -110,8 +110,8 @@ void Events::listener_startDrag(wl_listener* listener, void* data) { g_pInputManager->m_sDrag.dragIcon = wlrDrag->icon; wlrDrag->icon->data = g_pInputManager->m_sDrag.dragIcon; - g_pInputManager->m_sDrag.hyprListener_mapIcon.initCallback(&wlrDrag->icon->events.map, &Events::listener_mapDragIcon, &g_pInputManager->m_sDrag, "DragIcon"); - g_pInputManager->m_sDrag.hyprListener_unmapIcon.initCallback(&wlrDrag->icon->events.unmap, &Events::listener_unmapDragIcon, &g_pInputManager->m_sDrag, "DragIcon"); + g_pInputManager->m_sDrag.hyprListener_mapIcon.initCallback(&wlrDrag->icon->surface->events.map, &Events::listener_mapDragIcon, &g_pInputManager->m_sDrag, "DragIcon"); + g_pInputManager->m_sDrag.hyprListener_unmapIcon.initCallback(&wlrDrag->icon->surface->events.unmap, &Events::listener_unmapDragIcon, &g_pInputManager->m_sDrag, "DragIcon"); g_pInputManager->m_sDrag.hyprListener_destroyIcon.initCallback(&wlrDrag->icon->events.destroy, &Events::listener_destroyDragIcon, &g_pInputManager->m_sDrag, "DragIcon"); g_pInputManager->m_sDrag.hyprListener_commitIcon.initCallback(&wlrDrag->icon->surface->events.commit, &Events::listener_commitDragIcon, &g_pInputManager->m_sDrag, "DragIcon"); diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp index f2af2a79..e3370534 100644 --- a/src/events/Popups.cpp +++ b/src/events/Popups.cpp @@ -56,8 +56,8 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) { pHyprPopup->popup = popup; pHyprPopup->hyprListener_destroyPopupXDG.initCallback(&popup->base->events.destroy, &Events::listener_destroyPopupXDG, pHyprPopup, "HyprPopup"); - pHyprPopup->hyprListener_mapPopupXDG.initCallback(&popup->base->events.map, &Events::listener_mapPopupXDG, pHyprPopup, "HyprPopup"); - pHyprPopup->hyprListener_unmapPopupXDG.initCallback(&popup->base->events.unmap, &Events::listener_unmapPopupXDG, pHyprPopup, "HyprPopup"); + pHyprPopup->hyprListener_mapPopupXDG.initCallback(&popup->base->surface->events.map, &Events::listener_mapPopupXDG, pHyprPopup, "HyprPopup"); + pHyprPopup->hyprListener_unmapPopupXDG.initCallback(&popup->base->surface->events.unmap, &Events::listener_unmapPopupXDG, pHyprPopup, "HyprPopup"); pHyprPopup->hyprListener_newPopupFromPopupXDG.initCallback(&popup->base->events.new_popup, &Events::listener_newPopupFromPopupXDG, pHyprPopup, "HyprPopup"); pHyprPopup->hyprListener_commitPopupXDG.initCallback(&popup->base->surface->events.commit, &Events::listener_commitPopupXDG, pHyprPopup, "HyprPopup"); diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index f36a7116..c4111291 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -861,7 +861,7 @@ void Events::listener_fullscreenWindow(void* owner, void* data) { wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg); } else { - if (!PWINDOW->m_uSurface.xwayland->mapped) + if (!PWINDOW->m_uSurface.xwayland->surface->mapped) return; if (!PWINDOW->m_bFakeFullscreenState) @@ -956,7 +956,7 @@ void Events::listener_configureX11(void* owner, void* data) { const auto E = (wlr_xwayland_surface_configure_event*)data; - if (!PWINDOW->m_uSurface.xwayland->mapped || !PWINDOW->m_bMappedX11) { + if (!PWINDOW->m_uSurface.xwayland->surface || !PWINDOW->m_uSurface.xwayland->surface->mapped || !PWINDOW->m_bMappedX11) { wlr_xwayland_surface_configure(PWINDOW->m_uSurface.xwayland, E->x, E->y, E->width, E->height); return; } @@ -1043,6 +1043,18 @@ void Events::listener_setOverrideRedirect(void* owner, void* data) { //} } +void Events::listener_associateX11(void* owner, void* data) { + const auto PWINDOW = (CWindow*)owner; + + PWINDOW->hyprListener_mapWindow.initCallback(&PWINDOW->m_uSurface.xwayland->surface->events.map, &Events::listener_mapWindow, PWINDOW, "XWayland Window"); +} + +void Events::listener_dissociateX11(void* owner, void* data) { + const auto PWINDOW = (CWindow*)owner; + + PWINDOW->hyprListener_mapWindow.removeCallback(); +} + void Events::listener_surfaceXWayland(wl_listener* listener, void* data) { const auto XWSURFACE = (wlr_xwayland_surface*)data; @@ -1058,7 +1070,8 @@ void Events::listener_surfaceXWayland(wl_listener* listener, void* data) { PNEWWINDOW->m_pX11Parent = g_pCompositor->getX11Parent(PNEWWINDOW); - PNEWWINDOW->hyprListener_mapWindow.initCallback(&XWSURFACE->events.map, &Events::listener_mapWindow, PNEWWINDOW, "XWayland Window"); + PNEWWINDOW->hyprListener_associateX11.initCallback(&XWSURFACE->events.associate, &Events::listener_associateX11, PNEWWINDOW, "XWayland Window"); + PNEWWINDOW->hyprListener_dissociateX11.initCallback(&XWSURFACE->events.dissociate, &Events::listener_dissociateX11, PNEWWINDOW, "XWayland Window"); PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XWSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW, "XWayland Window"); PNEWWINDOW->hyprListener_setOverrideRedirect.initCallback(&XWSURFACE->events.set_override_redirect, &Events::listener_setOverrideRedirect, PNEWWINDOW, "XWayland Window"); PNEWWINDOW->hyprListener_configureX11.initCallback(&XWSURFACE->events.request_configure, &Events::listener_configureX11, PNEWWINDOW, "XWayland Window"); @@ -1076,7 +1089,7 @@ void Events::listener_newXDGSurface(wl_listener* listener, void* data) { const auto PNEWWINDOW = g_pCompositor->m_vWindows.emplace_back(std::make_unique()).get(); PNEWWINDOW->m_uSurface.xdg = XDGSURFACE; - PNEWWINDOW->hyprListener_mapWindow.initCallback(&XDGSURFACE->events.map, &Events::listener_mapWindow, PNEWWINDOW, "XDG Window"); + PNEWWINDOW->hyprListener_mapWindow.initCallback(&XDGSURFACE->surface->events.map, &Events::listener_mapWindow, PNEWWINDOW, "XDG Window"); PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XDGSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW, "XDG Window"); } diff --git a/src/helpers/SubsurfaceTree.cpp b/src/helpers/SubsurfaceTree.cpp index df725cbd..40cda642 100644 --- a/src/helpers/SubsurfaceTree.cpp +++ b/src/helpers/SubsurfaceTree.cpp @@ -150,13 +150,13 @@ void Events::listener_newSubsurfaceNode(void* owner, void* data) { PNEWSUBSURFACE->pSubsurface = PSUBSURFACE; PNEWSUBSURFACE->pParent = pNode; - PNEWSUBSURFACE->hyprListener_map.initCallback(&PSUBSURFACE->events.map, &Events::listener_mapSubsurface, PNEWSUBSURFACE, "Subsurface"); - PNEWSUBSURFACE->hyprListener_unmap.initCallback(&PSUBSURFACE->events.unmap, &Events::listener_unmapSubsurface, PNEWSUBSURFACE, "Subsurface"); + PNEWSUBSURFACE->hyprListener_map.initCallback(&PSUBSURFACE->surface->events.map, &Events::listener_mapSubsurface, PNEWSUBSURFACE, "Subsurface"); + PNEWSUBSURFACE->hyprListener_unmap.initCallback(&PSUBSURFACE->surface->events.unmap, &Events::listener_unmapSubsurface, PNEWSUBSURFACE, "Subsurface"); PNEWSUBSURFACE->hyprListener_destroy.initCallback(&PSUBSURFACE->events.destroy, &Events::listener_destroySubsurface, PNEWSUBSURFACE, "Subsurface"); PNEWSUBSURFACE->pWindowOwner = pNode->pWindowOwner; - if (PSUBSURFACE->mapped) + if (PSUBSURFACE->surface->mapped) listener_mapSubsurface(PNEWSUBSURFACE, nullptr); wlr_subsurface* existingWlrSubsurface; diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index df284c04..9a27e36b 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -77,7 +77,7 @@ void CSessionLockManager::onNewSessionLock(wlr_session_lock_v1* pWlrLock) { wlr_session_lock_surface_v1_configure(PWLRSURFACE, PMONITOR->vecSize.x, PMONITOR->vecSize.y); - PSURFACE->hyprListener_map.initCallback(&PWLRSURFACE->events.map, &handleSurfaceMap, PSURFACE, "SSessionLockSurface"); + PSURFACE->hyprListener_map.initCallback(&PWLRSURFACE->surface->events.map, &handleSurfaceMap, PSURFACE, "SSessionLockSurface"); PSURFACE->hyprListener_destroy.initCallback(&PWLRSURFACE->events.destroy, &handleSurfaceDestroy, PSURFACE, "SSessionLockSurface"); PSURFACE->hyprListener_commit.initCallback(&PWLRSURFACE->surface->events.commit, &handleSurfaceCommit, PSURFACE, "SSessionLockSurface"); }, diff --git a/src/managers/input/InputMethodRelay.cpp b/src/managers/input/InputMethodRelay.cpp index d9105447..99949fce 100644 --- a/src/managers/input/InputMethodRelay.cpp +++ b/src/managers/input/InputMethodRelay.cpp @@ -140,8 +140,8 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) { PNEWPOPUP->pSurface = (wlr_input_popup_surface_v2*)data; PNEWPOPUP->hyprListener_commitPopup.initCallback(&PNEWPOPUP->pSurface->surface->events.commit, &Events::listener_commitInputPopup, PNEWPOPUP, "IME Popup"); - PNEWPOPUP->hyprListener_mapPopup.initCallback(&PNEWPOPUP->pSurface->events.map, &Events::listener_mapInputPopup, PNEWPOPUP, "IME Popup"); - PNEWPOPUP->hyprListener_unmapPopup.initCallback(&PNEWPOPUP->pSurface->events.unmap, &Events::listener_unmapInputPopup, PNEWPOPUP, "IME Popup"); + PNEWPOPUP->hyprListener_mapPopup.initCallback(&PNEWPOPUP->pSurface->surface->events.map, &Events::listener_mapInputPopup, PNEWPOPUP, "IME Popup"); + PNEWPOPUP->hyprListener_unmapPopup.initCallback(&PNEWPOPUP->pSurface->surface->events.unmap, &Events::listener_unmapInputPopup, PNEWPOPUP, "IME Popup"); PNEWPOPUP->hyprListener_destroyPopup.initCallback(&PNEWPOPUP->pSurface->events.destroy, &Events::listener_destroyInputPopup, PNEWPOPUP, "IME Popup"); Debug::log(LOG, "New input popup"); @@ -165,7 +165,7 @@ wlr_surface* CInputMethodRelay::focusedSurface(STextInput* pTI) { } void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) { - if (!pPopup->pSurface->mapped) + if (!pPopup->pSurface->surface->mapped) return; // damage last known pos & size @@ -280,7 +280,7 @@ void CInputMethodRelay::removePopup(SIMEPopup* pPopup) { } void CInputMethodRelay::damagePopup(SIMEPopup* pPopup) { - if (!pPopup->pSurface->mapped) + if (!pPopup->pSurface->surface->mapped) return; const auto PFOCUSEDTI = getFocusedTextInput(); diff --git a/subprojects/wlroots b/subprojects/wlroots index 6668c822..52b93f7e 160000 --- a/subprojects/wlroots +++ b/subprojects/wlroots @@ -1 +1 @@ -Subproject commit 6668c822b3bf58ca5af5d370ef03b075be3e4d27 +Subproject commit 52b93f7eb41bd96870c935013fe6d1e36facba5c