summaryrefslogtreecommitdiff
path: root/src/managers/input/InputManager.cpp
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/InputManager.cpp
parent7a5234a0cca2508b7a5ede1fc60dc3ae8b72a51c (diff)
input: handle mouse on decorations (#3560)
Diffstat (limited to 'src/managers/input/InputManager.cpp')
-rw-r--r--src/managers/input/InputManager.cpp19
1 files changed, 9 insertions, 10 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;