summaryrefslogtreecommitdiff
path: root/src/managers/input
diff options
context:
space:
mode:
authorMightyPlaza <123664421+MightyPlaza@users.noreply.github.com>2023-10-29 20:14:47 +0000
committerGitHub <noreply@github.com>2023-10-29 20:14:47 +0000
commit9abfa9efc627df0765652f862887626af02b5ae1 (patch)
tree31258fc1d4fe3fbf5a34d8a6bd5670b0f0e398bc /src/managers/input
parent7a5234a0cca2508b7a5ede1fc60dc3ae8b72a51c (diff)
input: handle mouse on decorations (#3560)
Diffstat (limited to 'src/managers/input')
-rw-r--r--src/managers/input/InputManager.cpp19
-rw-r--r--src/managers/input/InputManager.hpp10
2 files changed, 13 insertions, 16 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index b19a929c..40d25858 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -583,16 +583,15 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
const auto mouseCoords = g_pInputManager->getMouseCoordsInternal();
const auto w = g_pCompositor->vectorToWindowIdeal(mouseCoords);
- if (w && !w->m_bIsFullscreen && !w->hasPopupAt(mouseCoords) && w->m_sGroupData.pNextWindow) {
- const wlr_box box = w->getDecorationByType(DECORATION_GROUPBAR)->getWindowDecorationRegion().getExtents();
- if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) {
- if (e->state == WLR_BUTTON_PRESSED) {
- const int SIZE = w->getGroupSize();
- CWindow* pWindow = w->getGroupWindowByIndex((mouseCoords.x - box.x) * SIZE / box.width);
- if (w != pWindow)
- w->setGroupCurrent(pWindow);
+ if (w && !w->m_bIsFullscreen && !w->hasPopupAt(mouseCoords)) {
+ for (auto& wd : w->m_dWindowDecorations) {
+ if (!wd->allowsInput())
+ continue;
+
+ if (wd->getWindowDecorationRegion().containsPoint(mouseCoords)) {
+ wd->onMouseButtonOnDeco(mouseCoords, e);
+ return;
}
- return;
}
}
@@ -1625,7 +1624,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
eBorderIconDirection direction = BORDERICON_NONE;
wlr_box boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE),
- box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
+ box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
if (!wlr_box_contains_point(&boxFullGrabInput, mouseCoords.x, mouseCoords.y) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow)) {
direction = BORDERICON_NONE;
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index b4d365ee..554f91db 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -7,14 +7,12 @@
#include "../../helpers/Timer.hpp"
#include "InputMethodRelay.hpp"
-enum eClickBehaviorMode
-{
+enum eClickBehaviorMode {
CLICKMODE_DEFAULT = 0,
CLICKMODE_KILL
};
-enum eMouseBindMode
-{
+enum eMouseBindMode {
MBIND_INVALID = -1,
MBIND_MOVE = 0,
MBIND_RESIZE = 1,
@@ -22,8 +20,7 @@ enum eMouseBindMode
MBIND_RESIZE_FORCE_RATIO = 3
};
-enum eBorderIconDirection
-{
+enum eBorderIconDirection {
BORDERICON_NONE,
BORDERICON_UP,
BORDERICON_DOWN,
@@ -118,6 +115,7 @@ class CInputManager {
// for dragging floating windows
CWindow* currentlyDraggedWindow = nullptr;
eMouseBindMode dragMode = MBIND_INVALID;
+ bool m_bWasDraggingWindow = false;
// for refocus to be forced
CWindow* m_pForcedFocus = nullptr;