hyprbars: chase hyprland

fixes #168
This commit is contained in:
Vaxry 2024-05-14 22:40:06 +01:00
parent c2c70332a1
commit c28d1011f4
2 changed files with 5 additions and 4 deletions

View file

@ -13,7 +13,7 @@ CHyprBar::CHyprBar(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) {
PMONITOR->scheduledRecalc = true;
m_pMouseButtonCallback = HyprlandAPI::registerCallbackDynamic(
PHANDLE, "mouseButton", [&](void* self, SCallbackInfo& info, std::any param) { onMouseDown(info, std::any_cast<wlr_pointer_button_event*>(param)); });
PHANDLE, "mouseButton", [&](void* self, SCallbackInfo& info, std::any param) { onMouseDown(info, std::any_cast<IPointer::SButtonEvent>(param)); });
m_pMouseMoveCallback =
HyprlandAPI::registerCallbackDynamic(PHANDLE, "mouseMove", [&](void* self, SCallbackInfo& info, std::any param) { onMouseMove(std::any_cast<Vector2D>(param)); });
@ -50,7 +50,7 @@ std::string CHyprBar::getDisplayName() {
return "Hyprbar";
}
void CHyprBar::onMouseDown(SCallbackInfo& info, wlr_pointer_button_event* e) {
void CHyprBar::onMouseDown(SCallbackInfo& info, IPointer::SButtonEvent e) {
if (m_pWindow.lock() != g_pCompositor->m_pLastWindow.lock())
return;
@ -77,7 +77,7 @@ void CHyprBar::onMouseDown(SCallbackInfo& info, wlr_pointer_button_event* e) {
return;
}
if (e->state != WLR_BUTTON_PRESSED) {
if (e.state != WLR_BUTTON_PRESSED) {
if (m_bCancelledDown)
info.cancelled = true;

View file

@ -4,6 +4,7 @@
#include <hyprland/src/render/decorations/IHyprWindowDecoration.hpp>
#include <hyprland/src/render/OpenGL.hpp>
#include <hyprland/src/devices/IPointer.hpp>
#include "globals.hpp"
class CHyprBar : public IHyprWindowDecoration {
@ -54,7 +55,7 @@ class CHyprBar : public IHyprWindowDecoration {
void renderText(CTexture& out, const std::string& text, const CColor& color, const Vector2D& bufferSize, const float scale, const int fontSize);
void renderBarButtons(const Vector2D& bufferSize, const float scale);
void renderBarButtonsText(CBox* barBox, const float scale, const float a);
void onMouseDown(SCallbackInfo& info, wlr_pointer_button_event* e);
void onMouseDown(SCallbackInfo& info, IPointer::SButtonEvent e);
void onMouseMove(Vector2D coords);
CBox assignedBoxGlobal();