aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-08-02 15:12:12 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-08-09 06:20:36 +0000
commit7ec9ca2b9528126bf11dda37cfea9687b6bc66a3 (patch)
tree1d347bb5b35a896116d1c6824136973970e42c1f
parentmeson: add "prefix: '#include <unistd.h>" to cc.has_function() (diff)
input: CSD buttons are now triggered when releasing the mouse button
This is how most UIs work. Note that we (at least on River) don't get any surface enter/leave events while a button is held. This means we can't detect if the user pressed the mouse button while on a CSD button, but then moves the mouse outside. Releasing the mouse button will still activate the CSD button. Closes #1787
Diffstat (limited to '')
-rw-r--r--CHANGELOG.md5
-rw-r--r--input.c17
2 files changed, 19 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 258940d4..6d7d6614 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -64,6 +64,11 @@
### Changed
+
+* CSD buttons now activate on mouse button **release**, rather than
+ press ([#1787][1787]).
+
+
### Deprecated
### Removed
### Fixed
diff --git a/input.c b/input.c
index 98f5c89c..4aa410c4 100644
--- a/input.c
+++ b/input.c
@@ -2577,12 +2577,19 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
}
case TERM_SURF_BUTTON_MINIMIZE:
- if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED)
+ if (button == BTN_LEFT &&
+ term->active_surface == TERM_SURF_BUTTON_MINIMIZE &&
+ state == WL_POINTER_BUTTON_STATE_RELEASED)
+ {
xdg_toplevel_set_minimized(term->window->xdg_toplevel);
+ }
break;
case TERM_SURF_BUTTON_MAXIMIZE:
- if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED) {
+ if (button == BTN_LEFT &&
+ term->active_surface == TERM_SURF_BUTTON_MAXIMIZE &&
+ state == WL_POINTER_BUTTON_STATE_RELEASED)
+ {
if (term->window->is_maximized)
xdg_toplevel_unset_maximized(term->window->xdg_toplevel);
else
@@ -2591,8 +2598,12 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
break;
case TERM_SURF_BUTTON_CLOSE:
- if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED)
+ if (button == BTN_LEFT &&
+ term->active_surface == TERM_SURF_BUTTON_CLOSE &&
+ state == WL_POINTER_BUTTON_STATE_RELEASED)
+ {
term_shutdown(term);
+ }
break;
case TERM_SURF_GRID: {