[epiphany/gnome-3-26] ephy-location-entry: Add touch support for primary/secondary icon



commit 2efd3ef20d028174cc3f32551eff5f8653078d09
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Wed Jan 24 19:51:17 2018 +0100

    ephy-location-entry: Add touch support for primary/secondary icon
    
    Currently it is neither possible to open the certificate information nor adding a bookmark using a touch 
device.
    
    Adding a check for GDK_TOUCH_BEGIN within the item callback fixes it.
    
    Closes: https://bugzilla.gnome.org/show_bug.cgi?id=792876

 lib/widgets/ephy-location-entry.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index ad17b84..cb7ac4b 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -718,16 +718,14 @@ entry_populate_popup_cb (GtkEntry          *entry,
 }
 
 static gboolean
-icon_button_press_event_cb (GtkWidget           *entry,
-                            GtkEntryIconPosition position,
-                            GdkEventButton      *event,
-                            EphyLocationEntry   *lentry)
+icon_button_icon_press_event_cb (GtkWidget           *entry,
+                                 GtkEntryIconPosition position,
+                                 GdkEventButton      *event,
+                                 EphyLocationEntry   *lentry)
 {
-  guint state = event->state & gtk_accelerator_get_default_mod_mask ();
-
-  if (event->type == GDK_BUTTON_PRESS &&
-      event->button == 1 &&
-      state == 0 /* left */) {
+  if (((event->type == GDK_BUTTON_PRESS &&
+        event->button == 1) ||
+       (event->type == GDK_TOUCH_BEGIN))) {
     if (position == GTK_ENTRY_ICON_PRIMARY) {
       GdkRectangle lock_position;
       gtk_entry_get_icon_area (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY, &lock_position);
@@ -753,7 +751,7 @@ ephy_location_entry_construct_contents (EphyLocationEntry *lentry)
                                      "non-starred-symbolic");
 
   g_object_connect (entry,
-                    "signal::icon-press", G_CALLBACK (icon_button_press_event_cb), lentry,
+                    "signal::icon-press", G_CALLBACK (icon_button_icon_press_event_cb), lentry,
                     "signal::populate-popup", G_CALLBACK (entry_populate_popup_cb), lentry,
                     "signal::key-press-event", G_CALLBACK (entry_key_press_cb), lentry,
                     "signal::changed", G_CALLBACK (editable_changed_cb), lentry,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]