[balsa/gtk4: 206/286] toolbar-factory: Get the popup GdkEvent




commit 609e43013c3fb16f7e8f332e77b38dc6076ddf26
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Oct 19 11:47:55 2020 -0400

    toolbar-factory: Get the popup GdkEvent

 src/toolbar-factory.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/src/toolbar-factory.c b/src/toolbar-factory.c
index b21e0839b..60c714c19 100644
--- a/src/toolbar-factory.c
+++ b/src/toolbar-factory.c
@@ -758,24 +758,21 @@ tm_popup_context_menu(toolbar_info *info, GdkEvent *event)
  * Toolbar callbacks
  */
 static void
-tm_gesture_pressed(GtkGestureClick *click_gesture,
+tm_gesture_pressed(GtkGestureClick *gesture,
                    gint             n_press,
                    gdouble          x,
                    gdouble          y,
                    gpointer         user_data)
 {
-    toolbar_info *info = user_data;
-
     if (n_press == 1) {
-        GtkGesture *gesture;
-        GdkEventSequence *sequence;
+        toolbar_info *info = user_data;
         GdkEvent *event;
 
-        gesture  = GTK_GESTURE(click_gesture);
-        sequence = gtk_gesture_single_get_current_sequence(GTK_GESTURE_SINGLE(gesture));
-        event    = gtk_gesture_get_last_event(gesture, sequence);
+        event = gtk_event_controller_get_current_event(GTK_EVENT_CONTROLLER(gesture));
 
         tm_popup_context_menu(info, event);
+
+        gtk_gesture_set_state(GTK_GESTURE(gesture), GTK_EVENT_SEQUENCE_CLAIMED);
     }
 }
 
@@ -786,10 +783,14 @@ tm_key_pressed(GtkEventControllerKey *controller,
                GdkModifierType        state,
                gpointer               user_data)
 {
-    toolbar_info *info = user_data;
-
     if (keyval == GDK_KEY_F10 && (state & GDK_SHIFT_MASK) != 0) {
-        tm_popup_context_menu(info, NULL);
+        toolbar_info *info = user_data;
+        GdkEvent *event;
+
+        event = gtk_event_controller_get_current_event(GTK_EVENT_CONTROLLER(controller));
+
+        tm_popup_context_menu(info, event);
+
         return TRUE;
     }
 


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