[gssdp/wip/gtk4: 2/2] Enable context menu
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp/wip/gtk4: 2/2] Enable context menu
- Date: Sat, 5 Jun 2021 23:05:34 +0000 (UTC)
commit 5f24aa7aaf17b4d174f02ddf5aa2199a48515679
Author: Jens Georg <mail jensge org>
Date: Wed Jun 2 19:46:22 2021 +0200
Enable context menu
tools/main-window.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/tools/main-window.c b/tools/main-window.c
index 427420b..18bb93d 100644
--- a/tools/main-window.c
+++ b/tools/main-window.c
@@ -695,22 +695,28 @@ on_popup_menu (GtkWidget *widget, gpointer user_data)
static void
on_button_release (GtkGesture *click,
int n_press,
- int x,
- int y,
+ gdouble x,
+ gdouble y,
gpointer user_data)
{
GSSDPDeviceSnifferMainWindow *self =
GSSDP_DEVICE_SNIFFER_MAIN_WINDOW (user_data);
- GdkEvent *event = gtk_gesture_get_last_event (
- click,
- gtk_gesture_single_get_current_sequence (
- GTK_GESTURE_SINGLE (click)));
+ GdkEventSequence *sequence = gtk_gesture_single_get_current_sequence (
+ GTK_GESTURE_SINGLE (click));
+
+ GdkEvent *event = gtk_gesture_get_last_event (click, sequence);
+
+ if (n_press != 1) {
+ return;
+ }
if (!gdk_event_triggers_context_menu (event)) {
return;
}
+ gtk_gesture_set_sequence_state (GTK_GESTURE (click), sequence,
+ GTK_EVENT_SEQUENCE_CLAIMED);
GtkTreeModel *model;
GtkTreeIter iter;
@@ -760,7 +766,7 @@ gssdp_device_sniffer_main_window_init (GSSDPDeviceSnifferMainWindow *self)
self);
g_signal_connect (G_OBJECT (click),
- "released",
+ "pressed",
G_CALLBACK (on_button_release),
self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]