summaryrefslogtreecommitdiff
path: root/src/managers/input/InputManager.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2023-10-29 23:37:12 +0000
committerVaxry <vaxry@vaxry.net>2023-10-29 23:37:12 +0000
commit86318ce04f59295175bd3eabedaf5e0f4fa2cc1e (patch)
treea0e586617b42fdffa61dd89e07f11992dbe28f97 /src/managers/input/InputManager.cpp
parent59d6a12a7e06a579a364ea93eca957a70be74081 (diff)
input: let input-grabbing decos have prio over resize on border
Diffstat (limited to 'src/managers/input/InputManager.cpp')
-rw-r--r--src/managers/input/InputManager.cpp93
1 files changed, 57 insertions, 36 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 40d25858..09571291 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -1621,50 +1621,71 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
// give a small leeway (10 px) for corner icon
const auto CORNER = *PROUNDING + BORDERSIZE + 10;
const auto mouseCoords = getMouseCoordsInternal();
- wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
+ wlr_box box = w->getWindowMainSurfaceBox();
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)) {
+ if (w->hasPopupAt(mouseCoords))
direction = BORDERICON_NONE;
- } else if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) {
- if (!w->isInCurvedCorner(mouseCoords.x, mouseCoords.y)) {
+ else if (!wlr_box_contains_point(&boxFullGrabInput, mouseCoords.x, mouseCoords.y) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow))
+ direction = BORDERICON_NONE;
+ else {
+
+ bool onDeco = false;
+
+ for (auto& d : w->m_dWindowDecorations) {
+ if (!d->allowsInput())
+ continue;
+
+ if (d->getWindowDecorationRegion().containsPoint(mouseCoords)) {
+ onDeco = true;
+ break;
+ }
+ }
+
+ if (onDeco)
direction = BORDERICON_NONE;
- } else {
- if (mouseCoords.y < box.y + CORNER) {
- if (mouseCoords.x < box.x + CORNER)
- direction = BORDERICON_UP_LEFT;
- else
- direction = BORDERICON_UP_RIGHT;
+ else {
+ if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) {
+ if (!w->isInCurvedCorner(mouseCoords.x, mouseCoords.y)) {
+ direction = BORDERICON_NONE;
+ } else {
+ if (mouseCoords.y < box.y + CORNER) {
+ if (mouseCoords.x < box.x + CORNER)
+ direction = BORDERICON_UP_LEFT;
+ else
+ direction = BORDERICON_UP_RIGHT;
+ } else {
+ if (mouseCoords.x < box.x + CORNER)
+ direction = BORDERICON_DOWN_LEFT;
+ else
+ direction = BORDERICON_DOWN_RIGHT;
+ }
+ }
} else {
- if (mouseCoords.x < box.x + CORNER)
- direction = BORDERICON_DOWN_LEFT;
- else
- direction = BORDERICON_DOWN_RIGHT;
+ if (mouseCoords.y < box.y + CORNER) {
+ if (mouseCoords.x < box.x + CORNER)
+ direction = BORDERICON_UP_LEFT;
+ else if (mouseCoords.x > box.x + box.width - CORNER)
+ direction = BORDERICON_UP_RIGHT;
+ else
+ direction = BORDERICON_UP;
+ } else if (mouseCoords.y > box.y + box.height - CORNER) {
+ if (mouseCoords.x < box.x + CORNER)
+ direction = BORDERICON_DOWN_LEFT;
+ else if (mouseCoords.x > box.x + box.width - CORNER)
+ direction = BORDERICON_DOWN_RIGHT;
+ else
+ direction = BORDERICON_DOWN;
+ } else {
+ if (mouseCoords.x < box.x + CORNER)
+ direction = BORDERICON_LEFT;
+ else if (mouseCoords.x > box.x + box.width - CORNER)
+ direction = BORDERICON_RIGHT;
+ }
}
}
- } else {
- if (mouseCoords.y < box.y + CORNER) {
- if (mouseCoords.x < box.x + CORNER)
- direction = BORDERICON_UP_LEFT;
- else if (mouseCoords.x > box.x + box.width - CORNER)
- direction = BORDERICON_UP_RIGHT;
- else
- direction = BORDERICON_UP;
- } else if (mouseCoords.y > box.y + box.height - CORNER) {
- if (mouseCoords.x < box.x + CORNER)
- direction = BORDERICON_DOWN_LEFT;
- else if (mouseCoords.x > box.x + box.width - CORNER)
- direction = BORDERICON_DOWN_RIGHT;
- else
- direction = BORDERICON_DOWN;
- } else {
- if (mouseCoords.x < box.x + CORNER)
- direction = BORDERICON_LEFT;
- else if (mouseCoords.x > box.x + box.width - CORNER)
- direction = BORDERICON_RIGHT;
- }
}
if (direction == m_eBorderIconDirection)