[gtk+] Use gdk_event_triggers_context_menu() instead of checking for event->button == 3



commit 90e938bf15c8adcd6535d3a1254b56c9708af3e7
Author: Javier JardÃn <jjardon gnome org>
Date:   Mon Mar 12 14:49:48 2012 +0000

    Use gdk_event_triggers_context_menu() instead of checking for event->button == 3

 docs/reference/gtk/migrating-checklist.sgml |    3 ++-
 tests/testiconview.c                        |    3 ++-
 tests/testmerge.c                           |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/docs/reference/gtk/migrating-checklist.sgml b/docs/reference/gtk/migrating-checklist.sgml
index 04089c4..659dad9 100644
--- a/docs/reference/gtk/migrating-checklist.sgml
+++ b/docs/reference/gtk/migrating-checklist.sgml
@@ -88,7 +88,8 @@ static gboolean
 my_widget_button_press_event_handler (GtkWidget *widget, GdkEventButton *event)
 {
   /* Ignore double-clicks and triple-clicks */
-  if (event->button == 3 &amp;&amp; event->type == GDK_BUTTON_PRESS)
+  if (gdk_event_triggers_context_menu ((GdkEvent *) event) &amp;&amp;
+      event->type == GDK_BUTTON_PRESS)
     {
       do_popup_menu (widget, event);
       return TRUE;
diff --git a/tests/testiconview.c b/tests/testiconview.c
index 3256228..ea1af1a 100644
--- a/tests/testiconview.c
+++ b/tests/testiconview.c
@@ -389,7 +389,8 @@ button_press_event_handler (GtkWidget      *widget,
 			    GdkEventButton *event)
 {
   /* Ignore double-clicks and triple-clicks */
-  if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
+  if (gdk_event_triggers_context_menu ((GdkEvent *) event) &&
+      event->type == GDK_BUTTON_PRESS)
     {
       do_popup_menu (widget, event);
       return TRUE;
diff --git a/tests/testmerge.c b/tests/testmerge.c
index db9a430..ee0b38f 100644
--- a/tests/testmerge.c
+++ b/tests/testmerge.c
@@ -459,7 +459,7 @@ area_press (GtkWidget      *drawing_area,
 {
   gtk_widget_grab_focus (drawing_area);
 
-  if (event->button == 3 &&
+  if (gdk_event_triggers_context_menu ((GdkEvent *) event) &&
       event->type == GDK_BUTTON_PRESS)
     {
       GtkWidget *menu = gtk_ui_manager_get_widget (merge, "/FileMenu");



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