1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
From d1d4c602e09c0038cc8e20f3660859af4378b997 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 13 Mar 2014 20:19:26 +0100
Subject: [PATCH 1/3] x11: Fallback to emulated window dragging for touch
devices
Sadly, EWMH moveresize mechanism can't work with touch devices for two
reasons:
1) As a mutter implementation detail, the device is queried in order
to check whether the dragging button is still pressed. Touch devices
won't report the button 1 being pressed through pointer emulation.
2) Even bypassing that check, on X11 touch events are selected prior
to sequences being started, either through XISelectEvents or
XIGrabTouchBegin, no late registering through active grabs is allowed,
as WMs do on reaction to EWMH moveresize messages.
So for the time being, make touch devices fallback on emulated window
dragging, which at least allows for moving windows.
https://bugzilla.gnome.org/show_bug.cgi?id=709914
---
gdk/x11/gdkwindow-x11.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 5696e95..08ef713 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -5303,6 +5303,24 @@ emulate_move_drag (GdkWindow *window,
create_moveresize_window (mv_resize, timestamp);
}
+static gboolean
+_should_perform_ewmh_drag (GdkWindow *window,
+ GdkDevice *device)
+{
+ GdkPointerWindowInfo *info;
+ GdkDisplay *display;
+
+ display = gdk_window_get_display (window);
+ info = _gdk_display_get_pointer_info (display, device);
+
+ if ((!info->last_slave || gdk_device_get_source (info->last_slave) != GDK_SOURCE_TOUCHSCREEN) &&
+ gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
+ gdk_atom_intern_static_string ("_NET_WM_MOVERESIZE")))
+ return TRUE;
+
+ return FALSE;
+}
+
static void
gdk_x11_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
@@ -5316,8 +5334,8 @@ gdk_x11_window_begin_resize_drag (GdkWindow *window,
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
return;
- if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
- gdk_atom_intern_static_string ("_NET_WM_MOVERESIZE")))
+ /* Avoid EWMH for touch devices */
+ if (_should_perform_ewmh_drag (window, device))
wmspec_resize_drag (window, edge, device, button, root_x, root_y, timestamp);
else
emulate_resize_drag (window, edge, device, button, root_x, root_y, timestamp);
@@ -5341,8 +5359,8 @@ gdk_x11_window_begin_move_drag (GdkWindow *window,
else
direction = _NET_WM_MOVERESIZE_MOVE;
- if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
- gdk_atom_intern_static_string ("_NET_WM_MOVERESIZE")))
+ /* Avoid EWMH for touch devices */
+ if (_should_perform_ewmh_drag (window, device))
wmspec_moveresize (window, direction, device, button, root_x, root_y, timestamp);
else
emulate_move_drag (window, device, button, root_x, root_y, timestamp);
--
1.9.0
|