mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2025-05-12 21:30:37 +01:00
Hyprbars: disable drag when clicking button (#289)
This commit is contained in:
parent
eefa87d099
commit
557e7b4e11
2 changed files with 6 additions and 6 deletions
|
@ -162,9 +162,8 @@ void CHyprBar::handleDownEvent(SCallbackInfo& info, std::optional<ITouch::SDownE
|
|||
info.cancelled = true;
|
||||
m_bCancelledDown = true;
|
||||
|
||||
doButtonPress(PBARPADDING, PBARBUTTONPADDING, PHEIGHT, COORDS, BUTTONSRIGHT);
|
||||
|
||||
m_bDragPending = true;
|
||||
if (!doButtonPress(PBARPADDING, PBARBUTTONPADDING, PHEIGHT, COORDS, BUTTONSRIGHT))
|
||||
m_bDragPending = true;
|
||||
}
|
||||
|
||||
void CHyprBar::handleUpEvent(SCallbackInfo& info) {
|
||||
|
@ -194,7 +193,7 @@ void CHyprBar::handleMovement() {
|
|||
return;
|
||||
}
|
||||
|
||||
void CHyprBar::doButtonPress(long int* const* PBARPADDING, long int* const* PBARBUTTONPADDING, long int* const* PHEIGHT, Vector2D COORDS, const bool BUTTONSRIGHT) {
|
||||
bool CHyprBar::doButtonPress(long int* const* PBARPADDING, long int* const* PBARBUTTONPADDING, long int* const* PHEIGHT, Vector2D COORDS, const bool BUTTONSRIGHT) {
|
||||
//check if on a button
|
||||
float offset = **PBARPADDING;
|
||||
|
||||
|
@ -205,11 +204,12 @@ void CHyprBar::doButtonPress(long int* const* PBARPADDING, long int* const* PBAR
|
|||
if (VECINRECT(COORDS, currentPos.x, currentPos.y, currentPos.x + b.size + **PBARBUTTONPADDING, currentPos.y + b.size)) {
|
||||
// hit on close
|
||||
g_pKeybindManager->m_mDispatchers["exec"](b.cmd);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
offset += **PBARBUTTONPADDING + b.size;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CHyprBar::renderText(SP<CTexture> out, const std::string& text, const CHyprColor& color, const Vector2D& bufferSize, const float scale, const int fontSize) {
|
||||
|
|
|
@ -78,7 +78,7 @@ class CHyprBar : public IHyprWindowDecoration {
|
|||
void handleDownEvent(SCallbackInfo& info, std::optional<ITouch::SDownEvent> touchEvent);
|
||||
void handleUpEvent(SCallbackInfo& info);
|
||||
void handleMovement();
|
||||
void doButtonPress(long int* const* PBARPADDING, long int* const* PBARBUTTONPADDING, long int* const* PHEIGHT, Vector2D COORDS, bool BUTTONSRIGHT);
|
||||
bool doButtonPress(long int* const* PBARPADDING, long int* const* PBARBUTTONPADDING, long int* const* PHEIGHT, Vector2D COORDS, bool BUTTONSRIGHT);
|
||||
|
||||
CBox assignedBoxGlobal();
|
||||
|
||||
|
|
Loading…
Reference in a new issue