From 03144a3812f8867b41d3ba8346c13fd725072434 Mon Sep 17 00:00:00 2001 From: LionHeartP Date: Mon, 29 Jun 2026 18:23:49 +0300 Subject: [PATCH] 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);