[balsa/popover: 37/37] mime-widget-text: Connect to the "pressed" signal
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/popover: 37/37] mime-widget-text: Connect to the "pressed" signal
- Date: Thu, 4 Jun 2020 21:57:12 +0000 (UTC)
commit 8d256c737d8b69e2793fea2523a713b5c80107d3
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Jun 4 17:53:18 2020 -0400
mime-widget-text: Connect to the "pressed" signal
of a GtkGestureMultiPress, instead of the "button-press" widget event.
src/balsa-mime-widget-text.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/src/balsa-mime-widget-text.c b/src/balsa-mime-widget-text.c
index 5fe9ac455..911057e2f 100644
--- a/src/balsa-mime-widget-text.c
+++ b/src/balsa-mime-widget-text.c
@@ -1316,12 +1316,24 @@ balsa_gtk_html_popup(GtkWidget * html, BalsaMessage * bm)
return TRUE;
}
-static gboolean
-balsa_gtk_html_button_press_cb(GtkWidget * html, GdkEventButton * event,
- BalsaMessage * bm)
+static void
+balsa_gtk_html_button_press_cb(GtkGestureMultiPress *multi_press,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ gpointer user_data)
{
- return(gdk_event_triggers_context_menu((GdkEvent *) event)
- ? balsa_gtk_html_popup(html, bm) : GDK_EVENT_PROPAGATE);
+ BalsaMessage *bm = user_data;
+ GtkGesture *gesture;
+ const GdkEvent *event;
+
+ gesture = GTK_GESTURE(multi_press);
+ event = gtk_gesture_get_last_event(gesture, gtk_gesture_get_last_updated_sequence(gesture));
+
+ if (gdk_event_triggers_context_menu(event)) {
+ GtkWidget *html = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture));
+ balsa_gtk_html_popup(html, bm) ;
+ }
}
static BalsaMimeWidget *
@@ -1330,6 +1342,7 @@ bm_widget_new_html(BalsaMessage * bm, LibBalsaMessageBody * mime_body)
BalsaMimeWidget *mw = g_object_new(BALSA_TYPE_MIME_WIDGET, NULL);
GtkWidget *widget;
GtkEventController *key_controller;
+ GtkGesture *gesture;
widget =
libbalsa_html_new(mime_body,
@@ -1343,8 +1356,14 @@ bm_widget_new_html(BalsaMessage * bm, LibBalsaMessageBody * mime_body)
g_signal_connect(key_controller, "key-pressed",
G_CALLBACK(balsa_mime_widget_key_pressed), bm);
+#if 0
g_signal_connect(widget, "button-press-event",
G_CALLBACK(balsa_gtk_html_button_press_cb), bm);
+#else
+ gesture = gtk_gesture_multi_press_new(widget);
+ g_signal_connect(gesture, "pressed",
+ G_CALLBACK(balsa_gtk_html_button_press_cb), bm);
+#endif
g_signal_connect(widget, "popup-menu",
G_CALLBACK(balsa_gtk_html_popup), bm);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]