From 03144a3812f8867b41d3ba8346c13fd725072434 Mon Sep 17 00:00:00 2001 From: LionHeartP Date: Mon, 29 Jun 2026 18:23:49 +0300 Subject: [PATCH 1/3] all: chase Hyprland --- borders-plus-plus/main.cpp | 3 ++- csgo-vulkan-fix/main.cpp | 4 +++- hyprbars/barDeco.cpp | 38 +++++++------------------------------- hyprbars/main.cpp | 3 ++- hyprfocus/main.cpp | 5 +++-- 5 files changed, 17 insertions(+), 36 deletions(-) diff --git a/borders-plus-plus/main.cpp b/borders-plus-plus/main.cpp index c58ad80a..bae756cc 100644 --- a/borders-plus-plus/main.cpp +++ b/borders-plus-plus/main.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -63,7 +64,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { static auto P = Event::bus()->m_events.window.open.listen([&](PHLWINDOW w) { onNewWindow(w); }); // add deco to existing windows - for (auto& w : g_pCompositor->m_windows) { + for (auto& w : Desktop::windowState()->windows()) { if (w->isHidden() || !w->m_isMapped) continue; diff --git a/csgo-vulkan-fix/main.cpp b/csgo-vulkan-fix/main.cpp index 910ddb97..b3da8914 100644 --- a/csgo-vulkan-fix/main.cpp +++ b/csgo-vulkan-fix/main.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -80,7 +81,8 @@ void hkSetWindowSize(CXWaylandSurface* surface, const CBox& box) { } const auto SURF = surface->m_surface.lock(); - const auto PWINDOW = g_pCompositor->getWindowFromSurface(SURF); + const auto CWLSURF = Desktop::View::CWLSurface::fromResource(SURF); + const auto PWINDOW = CWLSURF ? Desktop::View::CWindow::fromView(CWLSURF->view()) : nullptr; CBox newBox = box; diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index d073489a..5b545aa5 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -2,7 +2,11 @@ #include #include +#include +#include +#include #include +#include #include #include #include @@ -80,38 +84,10 @@ std::string CHyprBar::getDisplayName() { } bool CHyprBar::inputIsValid() { - if (!g_pGlobalState->config.enabled->value()) + if (m_hidden) return false; - if (!m_pWindow->m_workspace || !m_pWindow->m_workspace->isVisible() || !g_pInputManager->m_exclusiveLSes.empty() || - (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_pWindow->wlSurface()->resource()))) - return false; - - const auto WINDOWATCURSOR = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), - Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING); - - auto focusState = Desktop::focusState(); - auto window = focusState->window(); - auto monitor = focusState->monitor(); - - if (WINDOWATCURSOR != m_pWindow && m_pWindow != window) - return false; - - // check if input is on top or overlay shell layers - auto PMONITOR = monitor; - PHLLS foundSurface = nullptr; - Vector2D surfaceCoords; - - // check top layer - g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &foundSurface); - - if (foundSurface) - return false; - // check overlay layer - g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, - &foundSurface); - - if (foundSurface) + if (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_pWindow->wlSurface()->resource())) return false; return true; @@ -223,7 +199,7 @@ void CHyprBar::handleDownEvent(Event::SCallbackInfo& info, std::optionalfullWindowFocus(PWINDOW, Desktop::FOCUS_REASON_CLICK); if (PWINDOW->m_isFloating) - g_pCompositor->changeWindowZOrder(PWINDOW, true); + Desktop::windowState()->raise(PWINDOW); info.cancelled = true; m_bCancelledDown = true; diff --git a/hyprbars/main.cpp b/hyprbars/main.cpp index e422f037..ae9c90be 100644 --- a/hyprbars/main.cpp +++ b/hyprbars/main.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -259,7 +260,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { static auto P5 = Event::bus()->m_events.config.reloaded.listen([&] { onConfigReloaded(); }); // add deco to existing windows - for (auto& w : g_pCompositor->m_windows) { + for (auto& w : Desktop::windowState()->windows()) { if (w->isHidden() || !w->m_isMapped) continue; diff --git a/hyprfocus/main.cpp b/hyprfocus/main.cpp index 85d6c2c5..e44b5b55 100644 --- a/hyprfocus/main.cpp +++ b/hyprfocus/main.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #undef private #include "globals.hpp" @@ -182,8 +183,8 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { APICALL EXPORT void PLUGIN_EXIT() { // reset the callbacks to avoid crashes - for (const auto& w : g_pCompositor->m_windows) { - if (!validMapped(w)) + for (const auto& w : Desktop::windowState()->windows()) { + if (!Desktop::View::validMapped(w)) continue; w->m_realSize->setCallbackOnEnd(nullptr); From 9e2975c45085baaa0d17910cafdcda830cfd825d Mon Sep 17 00:00:00 2001 From: LionHeartP Date: Mon, 29 Jun 2026 20:48:37 +0300 Subject: [PATCH 2/3] bars: add back layer and hit detection --- hyprbars/barDeco.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index 5b545aa5..80149e77 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -90,6 +90,46 @@ bool CHyprBar::inputIsValid() { if (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_pWindow->wlSurface()->resource())) return false; + const auto MOUSE = g_pInputManager->getMouseCoordsInternal(); + auto PMONITOR = Desktop::focusState()->monitor(); + + if (!PMONITOR) + return false; + + Desktop::CViewHitTester hitTester{*Desktop::viewState()}; + + const auto WINDOWATCURSOR = hitTester.windowAt( + MOUSE, + Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING + ); + + auto focusState = Desktop::focusState(); + auto window = focusState->window(); + + if (WINDOWATCURSOR != m_pWindow && m_pWindow != window) + return false; + + PHLLS foundSurface = nullptr; + Vector2D surfaceCoords; + + // Check Top Layer + hitTester.layerSurfaceAt( + MOUSE, + &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], + &surfaceCoords, + &foundSurface + ); + if (foundSurface) return false; + + // Check Overlay Layer + hitTester.layerSurfaceAt( + MOUSE, + &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], + &surfaceCoords, + &foundSurface + ); + if (foundSurface) return false; + return true; } From 6e732869bcac00172648817628fce3ebad1e35cd Mon Sep 17 00:00:00 2001 From: LionHeartP Date: Mon, 29 Jun 2026 21:51:12 +0300 Subject: [PATCH 3/3] hyprbars/barDeco.cpp clang-format --- hyprbars/barDeco.cpp | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index 80149e77..b9240ee9 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -90,7 +90,7 @@ bool CHyprBar::inputIsValid() { if (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_pWindow->wlSurface()->resource())) return false; - const auto MOUSE = g_pInputManager->getMouseCoordsInternal(); + const auto MOUSE = g_pInputManager->getMouseCoordsInternal(); auto PMONITOR = Desktop::focusState()->monitor(); if (!PMONITOR) @@ -98,13 +98,10 @@ bool CHyprBar::inputIsValid() { Desktop::CViewHitTester hitTester{*Desktop::viewState()}; - const auto WINDOWATCURSOR = hitTester.windowAt( - MOUSE, - Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING - ); + const auto WINDOWATCURSOR = hitTester.windowAt(MOUSE, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING); - auto focusState = Desktop::focusState(); - auto window = focusState->window(); + auto focusState = Desktop::focusState(); + auto window = focusState->window(); if (WINDOWATCURSOR != m_pWindow && m_pWindow != window) return false; @@ -113,22 +110,14 @@ bool CHyprBar::inputIsValid() { Vector2D surfaceCoords; // Check Top Layer - hitTester.layerSurfaceAt( - MOUSE, - &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], - &surfaceCoords, - &foundSurface - ); - if (foundSurface) return false; + hitTester.layerSurfaceAt(MOUSE, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &foundSurface); + if (foundSurface) + return false; // Check Overlay Layer - hitTester.layerSurfaceAt( - MOUSE, - &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], - &surfaceCoords, - &foundSurface - ); - if (foundSurface) return false; + hitTester.layerSurfaceAt(MOUSE, &PMONITOR->m_layerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &foundSurface); + if (foundSurface) + return false; return true; } @@ -201,15 +190,15 @@ void CHyprBar::handleDownEvent(Event::SCallbackInfo& info, std::optionalmonitors()) { - if(m->m_name == (!e.device->m_boundOutput.empty() ? e.device->m_boundOutput : "")) { + PHLMONITOR PMONITOR = nullptr; + for (auto& m : State::monitorState()->monitors()) { + if (m->m_name == (!e.device->m_boundOutput.empty() ? e.device->m_boundOutput : "")) { PMONITOR = m; break; } } - PMONITOR = PMONITOR ? PMONITOR : Desktop::focusState()->monitor(); - COORDS = Vector2D(PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y) - assignedBoxGlobal().pos(); + PMONITOR = PMONITOR ? PMONITOR : Desktop::focusState()->monitor(); + COORDS = Vector2D(PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y) - assignedBoxGlobal().pos(); } const auto HEIGHT = g_pGlobalState->config.barHeight->value();