window: Implement single-touch window dragging

On X11 this works because only emulated pointer events are listened for. On
wayland, the single touch behavior must be enforced in touch events, ignoring
every other sequence.

https://bugzilla.gnome.org/show_bug.cgi?id=733631
This commit is contained in:
Carlos Garnacho 2014-07-22 01:17:40 +02:00
parent 41fdc4ac2e
commit f28f5dc0b6

View File

@ -6121,6 +6121,7 @@ gboolean
meta_window_handle_mouse_grab_op_event (MetaWindow *window,
const ClutterEvent *event)
{
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
ClutterModifierType modifier_state;
gfloat x, y;
@ -6141,6 +6142,12 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
}
return TRUE;
case CLUTTER_TOUCH_END:
if (meta_display_is_pointer_emulating_sequence (window->display, sequence))
end_grab_op (window, event);
return TRUE;
case CLUTTER_BUTTON_RELEASE:
if (event->button.button == 1 ||
event->button.button == (unsigned int) meta_prefs_get_mouse_button_resize ())
@ -6150,6 +6157,17 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
}
return TRUE;
case CLUTTER_TOUCH_BEGIN:
/* This will only catch the keybinding and menu cases, just deal with this
* like a CLUTTER_TOUCH_UPDATE rather than a CLUTTER_BUTTON_PRESS, and
* wait until CLUTTER_TOUCH_END to undo the grab, just so the window
* doesn't warp below the finger and remain there.
*/
case CLUTTER_TOUCH_UPDATE:
if (!meta_display_is_pointer_emulating_sequence (window->display, sequence))
return FALSE;
/* Fall through */
case CLUTTER_MOTION:
modifier_state = clutter_event_get_state (event);
clutter_event_get_coords (event, &x, &y);