backport patches for touch dragging of new-style GNOME windows
This commit is contained in:
parent
133f7433d1
commit
e44aa591b0
@ -0,0 +1,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
|
||||
|
135
0002-x11-Implement-drag-to-top-to-maximize-gesture-on-emu.patch
Normal file
135
0002-x11-Implement-drag-to-top-to-maximize-gesture-on-emu.patch
Normal file
@ -0,0 +1,135 @@
|
||||
From 41b73e409f7e30b8ba3b961013debaaf584b499c Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Garnacho <carlosg@gnome.org>
|
||||
Date: Thu, 13 Mar 2014 21:12:55 +0100
|
||||
Subject: [PATCH 2/3] x11: Implement "drag to top to maximize" gesture on
|
||||
emulated window dragging
|
||||
|
||||
And the counterpart to unmaximize when dragging a maximized window, if
|
||||
touch devices aren't going to use EWMH moveresize, having this one at least
|
||||
makes things feel a bit less awkward.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=709914
|
||||
---
|
||||
gdk/x11/gdkwindow-x11.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 70 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
|
||||
index 08ef713..83b3c7b 100644
|
||||
--- a/gdk/x11/gdkwindow-x11.c
|
||||
+++ b/gdk/x11/gdkwindow-x11.c
|
||||
@@ -4872,12 +4872,58 @@ get_move_resize_data (GdkDisplay *display,
|
||||
}
|
||||
|
||||
static void
|
||||
+check_maximize (MoveResizeData *mv_resize,
|
||||
+ gdouble x_root,
|
||||
+ gdouble y_root)
|
||||
+{
|
||||
+ GdkWindowState state;
|
||||
+ gint y;
|
||||
+
|
||||
+ if (mv_resize->is_resize)
|
||||
+ return;
|
||||
+
|
||||
+ state = gdk_window_get_state (mv_resize->moveresize_window);
|
||||
+
|
||||
+ if (state & GDK_WINDOW_STATE_MAXIMIZED)
|
||||
+ return;
|
||||
+
|
||||
+ y = mv_resize->moveresize_orig_y + (y_root - mv_resize->moveresize_y);
|
||||
+
|
||||
+ if (y < 10)
|
||||
+ gdk_window_maximize (mv_resize->moveresize_window);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+check_unmaximize (MoveResizeData *mv_resize,
|
||||
+ gdouble x_root,
|
||||
+ gdouble y_root)
|
||||
+{
|
||||
+ GdkWindowState state;
|
||||
+ gint dx, dy;
|
||||
+
|
||||
+ if (mv_resize->is_resize)
|
||||
+ return;
|
||||
+
|
||||
+ state = gdk_window_get_state (mv_resize->moveresize_window);
|
||||
+
|
||||
+ if ((state & GDK_WINDOW_STATE_MAXIMIZED) == 0)
|
||||
+ return;
|
||||
+
|
||||
+ dx = x_root - mv_resize->moveresize_x;
|
||||
+ dy = y_root - mv_resize->moveresize_y;
|
||||
+
|
||||
+ if (ABS (dx) > 20 || ABS (dy) > 20)
|
||||
+ gdk_window_unmaximize (mv_resize->moveresize_window);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
update_pos (MoveResizeData *mv_resize,
|
||||
gint new_root_x,
|
||||
gint new_root_y)
|
||||
{
|
||||
gint dx, dy;
|
||||
|
||||
+ check_unmaximize (mv_resize, new_root_x, new_root_y);
|
||||
dx = new_root_x - mv_resize->moveresize_x;
|
||||
dy = new_root_y - mv_resize->moveresize_y;
|
||||
|
||||
@@ -5066,7 +5112,12 @@ _gdk_x11_moveresize_handle_event (XEvent *event)
|
||||
* get a permanently stuck grab.
|
||||
*/
|
||||
if ((event->xmotion.state & button_mask) == 0)
|
||||
- finish_drag (mv_resize);
|
||||
+ {
|
||||
+ check_maximize (mv_resize,
|
||||
+ event->xmotion.x_root / impl->window_scale,
|
||||
+ event->xmotion.y_root / impl->window_scale);
|
||||
+ finish_drag (mv_resize);
|
||||
+ }
|
||||
break;
|
||||
|
||||
case ButtonRelease:
|
||||
@@ -5075,7 +5126,12 @@ _gdk_x11_moveresize_handle_event (XEvent *event)
|
||||
event->xbutton.y_root / impl->window_scale);
|
||||
|
||||
if (event->xbutton.button == mv_resize->moveresize_button)
|
||||
- finish_drag (mv_resize);
|
||||
+ {
|
||||
+ check_maximize (mv_resize,
|
||||
+ event->xmotion.x_root / impl->window_scale,
|
||||
+ event->xmotion.y_root / impl->window_scale);
|
||||
+ finish_drag (mv_resize);
|
||||
+ }
|
||||
break;
|
||||
|
||||
#if defined (HAVE_XGENERICEVENTS) && defined (XINPUT_2)
|
||||
@@ -5091,13 +5147,23 @@ _gdk_x11_moveresize_handle_event (XEvent *event)
|
||||
update_pos (mv_resize, xev->root_x / impl->window_scale, xev->root_y / impl->window_scale);
|
||||
state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
if ((state & button_mask) == 0)
|
||||
- finish_drag (mv_resize);
|
||||
+ {
|
||||
+ check_maximize (mv_resize,
|
||||
+ xev->root_x / impl->window_scale,
|
||||
+ xev->root_y / impl->window_scale);
|
||||
+ finish_drag (mv_resize);
|
||||
+ }
|
||||
break;
|
||||
|
||||
case XI_ButtonRelease:
|
||||
update_pos (mv_resize, xev->root_x / impl->window_scale, xev->root_y / impl->window_scale);
|
||||
if (xev->detail == mv_resize->moveresize_button)
|
||||
- finish_drag (mv_resize);
|
||||
+ {
|
||||
+ check_maximize (mv_resize,
|
||||
+ xev->root_x / impl->window_scale,
|
||||
+ xev->root_y / impl->window_scale);
|
||||
+ finish_drag (mv_resize);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
}
|
||||
--
|
||||
1.9.0
|
||||
|
15
gtk3.spec
15
gtk3.spec
@ -17,13 +17,21 @@
|
||||
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
|
||||
Name: gtk3
|
||||
Version: 3.11.8
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
URL: http://www.gtk.org
|
||||
#VCS: git:git://git.gnome.org/gtk+
|
||||
Source: http://download.gnome.org/sources/gtk+/3.11/gtk+-%{version}.tar.xz
|
||||
|
||||
# Upstream backports for touch dragging of new-style GNOME windows
|
||||
# Will be in 3.11.9 release, drop patches then - adamw 2014/03
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=709914
|
||||
# https://git.gnome.org/browse/gtk+/commit/?id=d1d4c602e09c0038cc8e20f3660859af4378b997
|
||||
Patch0: 0001-x11-Fallback-to-emulated-window-dragging-for-touch-d.patch
|
||||
# https://git.gnome.org/browse/gtk+/commit/?id=41b73e409f7e30b8ba3b961013debaaf584b499c
|
||||
Patch1: 0002-x11-Implement-drag-to-top-to-maximize-gesture-on-emu.patch
|
||||
|
||||
BuildRequires: gnome-common autoconf automake intltool gettext
|
||||
BuildRequires: atk-devel >= %{atk_version}
|
||||
BuildRequires: at-spi2-atk-devel
|
||||
@ -136,6 +144,8 @@ the functionality of the installed %{name} package.
|
||||
|
||||
%prep
|
||||
%setup -q -n gtk+-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
|
||||
@ -298,6 +308,9 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache
|
||||
%{_datadir}/installed-tests
|
||||
|
||||
%changelog
|
||||
* Mon Mar 17 2014 Adam Williamson <awilliam@redhat.com> - 3.11.8-2
|
||||
- backport patches for touch dragging of new-style GNOME windows
|
||||
|
||||
* Tue Mar 04 2014 Richard Hughes <rhughes@redhat.com> - 3.11.8-1
|
||||
- Update to 3.11.8
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user