[gssdp/wip/gtk4: 15/17] Enable context menu
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp/wip/gtk4: 15/17] Enable context menu
- Date: Sat, 19 Jun 2021 12:27:42 +0000 (UTC)
commit 1eeb3c7c0935a94fa3090cec79eda4fc49736e76
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 e4c1b1b..34879d2 100644
--- a/tools/main-window.c
+++ b/tools/main-window.c
@@ -721,22 +721,28 @@ static GActionEntry actions[] = { { "clear-capture", on_clear_capture },
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;
@@ -786,7 +792,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]