hyprbars: invalidate input when overlay and top shell layers are on top (#377)

* ignore hyprbars input on overlay and top layers

* simplify layer check
This commit is contained in:
Khalid 2025-06-10 10:09:40 +03:00 committed by GitHub
parent f58f65b375
commit e8f212e9c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,7 @@
#include <hyprland/src/managers/LayoutManager.hpp>
#include <hyprland/src/config/ConfigManager.hpp>
#include <hyprland/src/managers/AnimationManager.hpp>
#include <hyprland/src/protocols/LayerShell.hpp>
#include <pango/pangocairo.h>
#include "globals.hpp"
@ -92,6 +93,22 @@ bool CHyprBar::inputIsValid() {
if (WINDOWATCURSOR != m_pWindow && m_pWindow != g_pCompositor->m_lastWindow)
return false;
// check if input is on top or overlay shell layers
auto PMONITOR = g_pCompositor->m_lastMonitor.lock();
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)
return false;
return true;
}