[gnome-builder] gui: hide three-finger-swipe gesture behind shift check
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gui: hide three-finger-swipe gesture behind shift check
- Date: Wed, 23 Dec 2020 23:44:34 +0000 (UTC)
commit 0e10207bc01e86e429d9a5e0e362d234f016e966
Author: Christian Hergert <chergert redhat com>
Date: Wed Dec 23 15:43:55 2020 -0800
gui: hide three-finger-swipe gesture behind shift check
In GNOME 40 Shell will have three-finger-swipe gestures that collide with
applications. This switches this to a shift+three finger swipe gesture
for now to move frames.
Given that Builder is the only applications using this we are probably
better off to let the Shell own three-finger gestures.
We can still improve on two-finger swipes once we go to GTK 4 for moving
between frame stacks quickly.
Fixes #1371
src/libide/gui/ide-frame.c | 27 ++++++++------
src/libide/gui/ide-shortcuts-window.ui | 64 ++++++++++------------------------
2 files changed, 36 insertions(+), 55 deletions(-)
---
diff --git a/src/libide/gui/ide-frame.c b/src/libide/gui/ide-frame.c
index 6a2ac9dfd..26f681c8e 100644
--- a/src/libide/gui/ide-frame.c
+++ b/src/libide/gui/ide-frame.c
@@ -455,12 +455,14 @@ ide_frame_pan_begin (IdeFrame *self,
IdeFramePrivate *priv = ide_frame_get_instance_private (self);
GtkAllocation alloc;
cairo_surface_t *surface = NULL;
+ GdkDevice *device;
IdePage *page;
GdkWindow *window;
GtkWidget *grid;
cairo_t *cr;
gdouble x, y;
gboolean enable_animations;
+ GdkModifierType state = 0;
IDE_ENTRY;
@@ -468,28 +470,27 @@ ide_frame_pan_begin (IdeFrame *self,
g_assert (GTK_IS_GESTURE_PAN (gesture));
g_assert (priv->pan_theatric == NULL);
- page = ide_frame_get_visible_child (self);
- if (page != NULL)
- gtk_widget_get_allocation (GTK_WIDGET (page), &alloc);
+ if (!(page = ide_frame_get_visible_child (self)) ||
+ !(device = gtk_gesture_get_device (GTK_GESTURE (gesture))) ||
+ !(window = gtk_widget_get_window (GTK_WIDGET (page))))
+ goto failure;
+
+ gtk_widget_get_allocation (GTK_WIDGET (page), &alloc);
+ gdk_device_get_state (device, window, NULL, &state);
g_object_get (gtk_settings_get_default (),
"gtk-enable-animations", &enable_animations,
NULL);
if (sequence != NULL ||
- page == NULL ||
!enable_animations ||
+ (state & GDK_SHIFT_MASK) == 0 ||
is_uninitialized (&alloc) ||
- NULL == (window = gtk_widget_get_window (GTK_WIDGET (page))) ||
NULL == (surface = gdk_window_create_similar_surface (window,
CAIRO_CONTENT_COLOR,
alloc.width,
alloc.height)))
- {
- if (sequence != NULL)
- gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
- IDE_RETURN (FALSE);
- }
+ goto failure;
gtk_gesture_drag_get_offset (GTK_GESTURE_DRAG (gesture), &x, &y);
@@ -526,6 +527,12 @@ ide_frame_pan_begin (IdeFrame *self,
ide_frame_set_cursor (self, "none");
IDE_RETURN (TRUE);
+
+failure:
+ if (sequence != NULL)
+ gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
+
+ IDE_RETURN (FALSE);
}
static void
diff --git a/src/libide/gui/ide-shortcuts-window.ui b/src/libide/gui/ide-shortcuts-window.ui
index ab9f9c973..f756b776c 100644
--- a/src/libide/gui/ide-shortcuts-window.ui
+++ b/src/libide/gui/ide-shortcuts-window.ui
@@ -482,62 +482,36 @@
</child>
</object>
</child>
- <child>
- <object class="GtkShortcutsGroup">
- <property name="visible">true</property>
- <property name="title" translatable="yes" context="shortcut window">Build and Run</property>
- <child>
- <object class="GtkShortcutsShortcut">
- <property name="visible">true</property>
- <property name="accelerator"><ctrl>F7</property>
- <property name="title" translatable="yes" context="shortcut window">Build</property>
- </object>
- </child>
- <child>
- <object class="GtkShortcutsShortcut">
- <property name="visible">true</property>
- <property name="accelerator"><ctrl><shift>F7</property>
- <property name="title" translatable="yes" context="shortcut window">Rebuild</property>
- </object>
- </child>
- <child>
- <object class="GtkShortcutsShortcut">
- <property name="visible">true</property>
- <property name="accelerator"><ctrl>F5</property>
- <property name="title" translatable="yes" context="shortcut window">Run</property>
- </object>
- </child>
- <child>
- <object class="GtkShortcutsShortcut">
- <property name="visible">true</property>
- <property name="accelerator"><ctrl>F8</property>
- <property name="title" translatable="yes" context="shortcut window">Profile</property>
- </object>
- </child>
- </object>
- </child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">true</property>
- <property name="title" translatable="yes" context="shortcut window">Touchpad gestures</property>
+ <property name="title" translatable="yes" context="shortcut window">Build and Run</property>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="accelerator"><ctrl>F7</property>
+ <property name="title" translatable="yes" context="shortcut window">Build</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">true</property>
+ <property name="accelerator"><ctrl><shift>F7</property>
+ <property name="title" translatable="yes" context="shortcut window">Rebuild</property>
+ </object>
+ </child>
<child>
<object class="GtkShortcutsShortcut">
- <!-- work around no access to three-finger-swipe -->
- <property name="shortcut-type">gesture-two-finger-swipe-right</property>
<property name="visible">true</property>
- <property name="icon">swipe_right</property>
- <property name="title" translatable="yes" context="shortcut window">Move page to the
right</property>
- <property name="subtitle" translatable="yes" context="shortcut window">Three finger swipe
right</property>
+ <property name="accelerator"><ctrl>F5</property>
+ <property name="title" translatable="yes" context="shortcut window">Run</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <!-- work around no access to three-finger-swipe -->
- <property name="shortcut-type">gesture-two-finger-swipe-left</property>
<property name="visible">true</property>
- <property name="icon">swipe_left</property>
- <property name="title" translatable="yes" context="shortcut window">Move page to the
left</property>
- <property name="subtitle" translatable="yes" context="shortcut window">Three finger swipe
left</property>
+ <property name="accelerator"><ctrl>F8</property>
+ <property name="title" translatable="yes" context="shortcut window">Profile</property>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]