mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-13 04:27:47 -05:00
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
This commit is contained in:
parent
803f712332
commit
7ec9ca2b95
2 changed files with 19 additions and 3 deletions
|
|
@ -64,6 +64,11 @@
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
* CSD buttons now activate on mouse button **release**, rather than
|
||||||
|
press ([#1787][1787]).
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
17
input.c
17
input.c
|
|
@ -2577,12 +2577,19 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
}
|
}
|
||||||
|
|
||||||
case TERM_SURF_BUTTON_MINIMIZE:
|
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);
|
xdg_toplevel_set_minimized(term->window->xdg_toplevel);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TERM_SURF_BUTTON_MAXIMIZE:
|
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)
|
if (term->window->is_maximized)
|
||||||
xdg_toplevel_unset_maximized(term->window->xdg_toplevel);
|
xdg_toplevel_unset_maximized(term->window->xdg_toplevel);
|
||||||
else
|
else
|
||||||
|
|
@ -2591,8 +2598,12 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TERM_SURF_BUTTON_CLOSE:
|
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);
|
term_shutdown(term);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TERM_SURF_GRID: {
|
case TERM_SURF_GRID: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue