From aba0f25cb0b79bf2452572fde6c527622f81cdfb Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 3 Oct 2013 16:43:05 +0100 Subject: [PATCH] Add a touch move binding When holding the compositor super key the touch events can now be used to move a window. --- src/shell.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/shell.c b/src/shell.c index 4a0c1224..2822a2b5 100644 --- a/src/shell.c +++ b/src/shell.c @@ -2773,6 +2773,26 @@ move_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *dat surface_move(shsurf, (struct weston_seat *) seat); } +static void +touch_move_binding(struct weston_seat *seat, uint32_t time, void *data) +{ + struct weston_surface *focus = + (struct weston_surface *) seat->touch->focus; + struct weston_surface *surface; + struct shell_surface *shsurf; + + surface = weston_surface_get_main_surface(focus); + if (surface == NULL) + return; + + shsurf = get_shell_surface(surface); + if (shsurf == NULL || shsurf->type == SHELL_SURFACE_FULLSCREEN || + shsurf->type == SHELL_SURFACE_MAXIMIZED) + return; + + surface_touch_move(shsurf, (struct weston_seat *) seat); +} + static void resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data) { @@ -4531,6 +4551,7 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) zoom_key_binding, NULL); weston_compositor_add_button_binding(ec, BTN_LEFT, mod, move_binding, shell); + weston_compositor_add_touch_binding(ec, mod, touch_move_binding, shell); weston_compositor_add_button_binding(ec, BTN_MIDDLE, mod, resize_binding, shell);