decorations: fix groupbar input (#5963)

modified:   src/render/decorations/CHyprGroupBarDecoration.cpp
modified:   src/render/decorations/CHyprGroupBarDecoration.hpp
This commit is contained in:
MightyPlaza 2024-05-09 18:19:32 +00:00 committed by GitHub
parent fe4737fb9d
commit 85f7f69046
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 11 deletions

View file

@ -422,7 +422,7 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
return true;
}
bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_pointer_button_event* e) {
bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, const IPointer::SButtonEvent& e) {
if (m_pWindow->m_bIsFullscreen && m_pWindow->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL)
return true;
@ -431,18 +431,18 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
// close window on middle click
if (e->button == 274) {
if (e.button == 274) {
static Vector2D pressedCursorPos;
if (e->state == WL_POINTER_BUTTON_STATE_PRESSED)
if (e.state == WL_POINTER_BUTTON_STATE_PRESSED)
pressedCursorPos = pos;
else if (e->state == WL_POINTER_BUTTON_STATE_RELEASED && pressedCursorPos == pos)
else if (e.state == WL_POINTER_BUTTON_STATE_RELEASED && pressedCursorPos == pos)
g_pXWaylandManager->sendCloseWindow(m_pWindow->getGroupWindowByIndex(WINDOWINDEX));
return true;
}
if (e->state != WL_POINTER_BUTTON_STATE_PRESSED)
if (e.state != WL_POINTER_BUTTON_STATE_PRESSED)
return true;
// click on padding
@ -466,13 +466,13 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point
return true;
}
bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, wlr_pointer_axis_event* e) {
bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, const IPointer::SAxisEvent e) {
static auto PGROUPBARSCROLLING = CConfigValue<Hyprlang::INT>("group:groupbar:scrolling");
if (!*PGROUPBARSCROLLING || m_pWindow->m_sGroupData.pNextWindow.expired())
return false;
if (e->delta > 0)
if (e.delta > 0)
m_pWindow->setGroupCurrent(m_pWindow->m_sGroupData.pNextWindow.lock());
else
m_pWindow->setGroupCurrent(m_pWindow->getGroupPrevious());
@ -482,8 +482,8 @@ bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, wlr_pointer_ax
bool CHyprGroupBarDecoration::onInputOnDeco(const eInputType type, const Vector2D& mouseCoords, std::any data) {
switch (type) {
case INPUT_TYPE_AXIS: return onScrollOnDeco(mouseCoords, std::any_cast<wlr_pointer_axis_event*>(data));
case INPUT_TYPE_BUTTON: return onMouseButtonOnDeco(mouseCoords, std::any_cast<wlr_pointer_button_event*>(data));
case INPUT_TYPE_AXIS: return onScrollOnDeco(mouseCoords, std::any_cast<const IPointer::SAxisEvent>(data));
case INPUT_TYPE_BUTTON: return onMouseButtonOnDeco(mouseCoords, std::any_cast<const IPointer::SButtonEvent&>(data));
case INPUT_TYPE_DRAG_START: return onBeginWindowDragOnDeco(mouseCoords);
case INPUT_TYPE_DRAG_END: return onEndWindowDragOnDeco(mouseCoords, std::any_cast<PHLWINDOW>(data));
default: return false;

View file

@ -1,6 +1,7 @@
#pragma once
#include "IHyprWindowDecoration.hpp"
#include "../../devices/IPointer.hpp"
#include <deque>
#include "../Texture.hpp"
#include <string>
@ -61,8 +62,8 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
bool onBeginWindowDragOnDeco(const Vector2D&);
bool onEndWindowDragOnDeco(const Vector2D&, PHLWINDOW);
bool onMouseButtonOnDeco(const Vector2D&, wlr_pointer_button_event*);
bool onScrollOnDeco(const Vector2D&, wlr_pointer_axis_event*);
bool onMouseButtonOnDeco(const Vector2D&, const IPointer::SButtonEvent&);
bool onScrollOnDeco(const Vector2D&, const IPointer::SAxisEvent);
struct STitleTexs {
// STitleTexs* overriden = nullptr; // TODO: make shit shared in-group to decrease VRAM usage.