mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-31 07:11:09 -04:00
input: start window move right away if user starts dragging the window
When the user left-clicks the title-bar, we start a timer. When the timer has elapsed, we initiate a 'move' operation. However, if the user clicked, and then started dragging right away, there was a very visible lag since we waited for the timeout before starting the move. Now, on a pointer motion event we detect a running 'move' timer, and abort it and instead start the 'move' operation right away.
This commit is contained in:
parent
33744ebe63
commit
ea2d7f8b8c
1 changed files with 19 additions and 0 deletions
19
input.c
19
input.c
|
|
@ -758,6 +758,7 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
|
||||||
{
|
{
|
||||||
struct wayland *wayl = data;
|
struct wayland *wayl = data;
|
||||||
struct terminal *term = wayl->mouse_focus;
|
struct terminal *term = wayl->mouse_focus;
|
||||||
|
struct wl_window *win = term->window;
|
||||||
|
|
||||||
/* Workaround buggy Sway 1.2 */
|
/* Workaround buggy Sway 1.2 */
|
||||||
if (term == NULL) {
|
if (term == NULL) {
|
||||||
|
|
@ -787,7 +788,17 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
|
||||||
switch (term->active_surface) {
|
switch (term->active_surface) {
|
||||||
case TERM_SURF_NONE:
|
case TERM_SURF_NONE:
|
||||||
case TERM_SURF_SEARCH:
|
case TERM_SURF_SEARCH:
|
||||||
|
break;
|
||||||
|
|
||||||
case TERM_SURF_TITLE:
|
case TERM_SURF_TITLE:
|
||||||
|
/* We've started a 'move' timer, but user started dragging
|
||||||
|
* right away - abort the timer and initiate the actual move
|
||||||
|
* right away */
|
||||||
|
if (wayl->mouse.button == BTN_LEFT && win->csd.move_timeout_fd != -1) {
|
||||||
|
fdm_del(wayl->fdm, win->csd.move_timeout_fd);
|
||||||
|
win->csd.move_timeout_fd = -1;
|
||||||
|
xdg_toplevel_move(win->xdg_toplevel, wayl->seat, win->csd.serial);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TERM_SURF_BORDER_LEFT:
|
case TERM_SURF_BORDER_LEFT:
|
||||||
|
|
@ -922,6 +933,14 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
||||||
|
struct wl_window *win = term->window;
|
||||||
|
if (win->csd.move_timeout_fd != -1) {
|
||||||
|
fdm_del(wayl->fdm, win->csd.move_timeout_fd);
|
||||||
|
win->csd.move_timeout_fd = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case TERM_SURF_BORDER_LEFT:
|
case TERM_SURF_BORDER_LEFT:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue