From 7b049d6eea7912d17d6f9d6609d7e9008e576c37 Mon Sep 17 00:00:00 2001 From: caffeine01 Date: Fri, 13 Dec 2024 00:33:03 +0000 Subject: [PATCH] remove redundant window locking code --- hyprbars/barDeco.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index e71a314..2345933 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -58,6 +58,9 @@ std::string CHyprBar::getDisplayName() { } void CHyprBar::onMouseDown(SCallbackInfo& info, IPointer::SButtonEvent e) { + if (m_pWindow.lock() != g_pCompositor->m_pLastWindow.lock()) + return; + const auto PWINDOW = m_pWindow.lock(); const auto COORDS = cursorRelativeToBar(); @@ -110,9 +113,6 @@ void CHyprBar::onMouseDown(SCallbackInfo& info, IPointer::SButtonEvent e) { } void CHyprBar::onTouchDown(SCallbackInfo& info) { - if (m_pWindow.lock() != g_pCompositor->m_pLastWindow.lock()) - return; - const auto COORDS = cursorRelativeToBar(); static auto* const PHEIGHT = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_height")->getDataStaticPtr(); if (!VECINRECT(COORDS, 0, 0, assignedBoxGlobal().w, **PHEIGHT - 1)) @@ -121,11 +121,6 @@ void CHyprBar::onTouchDown(SCallbackInfo& info) { } void CHyprBar::doButtonPress(Vector2D coords) { - if (m_pWindow.lock() != g_pCompositor->m_pLastWindow.lock()) - return; - - const auto PWINDOW = m_pWindow.lock(); - static auto* const PHEIGHT = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_height")->getDataStaticPtr(); static auto* const PBARBUTTONPADDING = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_button_padding")->getDataStaticPtr(); static auto* const PBARPADDING = (Hyprlang::INT* const*)HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_padding")->getDataStaticPtr();