mirror of
https://github.com/hyprwm/Hyprland
synced 2025-02-17 00:42:11 +01:00
decorations: fix groupbar input (#5963)
modified: src/render/decorations/CHyprGroupBarDecoration.cpp modified: src/render/decorations/CHyprGroupBarDecoration.hpp
This commit is contained in:
parent
fe4737fb9d
commit
85f7f69046
2 changed files with 12 additions and 11 deletions
|
@ -422,7 +422,7 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
|
||||||
return true;
|
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)
|
if (m_pWindow->m_bIsFullscreen && m_pWindow->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -431,18 +431,18 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point
|
||||||
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
|
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
|
||||||
|
|
||||||
// close window on middle click
|
// close window on middle click
|
||||||
if (e->button == 274) {
|
if (e.button == 274) {
|
||||||
static Vector2D pressedCursorPos;
|
static Vector2D pressedCursorPos;
|
||||||
|
|
||||||
if (e->state == WL_POINTER_BUTTON_STATE_PRESSED)
|
if (e.state == WL_POINTER_BUTTON_STATE_PRESSED)
|
||||||
pressedCursorPos = pos;
|
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));
|
g_pXWaylandManager->sendCloseWindow(m_pWindow->getGroupWindowByIndex(WINDOWINDEX));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->state != WL_POINTER_BUTTON_STATE_PRESSED)
|
if (e.state != WL_POINTER_BUTTON_STATE_PRESSED)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// click on padding
|
// click on padding
|
||||||
|
@ -466,13 +466,13 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point
|
||||||
return true;
|
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");
|
static auto PGROUPBARSCROLLING = CConfigValue<Hyprlang::INT>("group:groupbar:scrolling");
|
||||||
|
|
||||||
if (!*PGROUPBARSCROLLING || m_pWindow->m_sGroupData.pNextWindow.expired())
|
if (!*PGROUPBARSCROLLING || m_pWindow->m_sGroupData.pNextWindow.expired())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (e->delta > 0)
|
if (e.delta > 0)
|
||||||
m_pWindow->setGroupCurrent(m_pWindow->m_sGroupData.pNextWindow.lock());
|
m_pWindow->setGroupCurrent(m_pWindow->m_sGroupData.pNextWindow.lock());
|
||||||
else
|
else
|
||||||
m_pWindow->setGroupCurrent(m_pWindow->getGroupPrevious());
|
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) {
|
bool CHyprGroupBarDecoration::onInputOnDeco(const eInputType type, const Vector2D& mouseCoords, std::any data) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case INPUT_TYPE_AXIS: return onScrollOnDeco(mouseCoords, std::any_cast<wlr_pointer_axis_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<wlr_pointer_button_event*>(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_START: return onBeginWindowDragOnDeco(mouseCoords);
|
||||||
case INPUT_TYPE_DRAG_END: return onEndWindowDragOnDeco(mouseCoords, std::any_cast<PHLWINDOW>(data));
|
case INPUT_TYPE_DRAG_END: return onEndWindowDragOnDeco(mouseCoords, std::any_cast<PHLWINDOW>(data));
|
||||||
default: return false;
|
default: return false;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "IHyprWindowDecoration.hpp"
|
#include "IHyprWindowDecoration.hpp"
|
||||||
|
#include "../../devices/IPointer.hpp"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "../Texture.hpp"
|
#include "../Texture.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -61,8 +62,8 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
|
||||||
|
|
||||||
bool onBeginWindowDragOnDeco(const Vector2D&);
|
bool onBeginWindowDragOnDeco(const Vector2D&);
|
||||||
bool onEndWindowDragOnDeco(const Vector2D&, PHLWINDOW);
|
bool onEndWindowDragOnDeco(const Vector2D&, PHLWINDOW);
|
||||||
bool onMouseButtonOnDeco(const Vector2D&, wlr_pointer_button_event*);
|
bool onMouseButtonOnDeco(const Vector2D&, const IPointer::SButtonEvent&);
|
||||||
bool onScrollOnDeco(const Vector2D&, wlr_pointer_axis_event*);
|
bool onScrollOnDeco(const Vector2D&, const IPointer::SAxisEvent);
|
||||||
|
|
||||||
struct STitleTexs {
|
struct STitleTexs {
|
||||||
// STitleTexs* overriden = nullptr; // TODO: make shit shared in-group to decrease VRAM usage.
|
// STitleTexs* overriden = nullptr; // TODO: make shit shared in-group to decrease VRAM usage.
|
||||||
|
|
Loading…
Add table
Reference in a new issue