Provide wrapper for gtk_menu_popup_at_pointer.
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 5 Oct 2017 08:16:08 +0000 (10:16 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 5 Oct 2017 16:35:24 +0000 (18:35 +0200)
This should keep older versions of Gtk+ happy.  Tested on Gtk+-3.18

src/ui/gui/include/gtk/gtk.in.h
src/ui/gui/psppire-dictview.c

index 29fc7d5a968d28d0aec16cf21607744fd0702b9c..8df67cd0cc88aaaa5e1121988650a07fa0d84717 100644 (file)
@@ -1,5 +1,5 @@
 /* Wrapper for <gtk/gtk.h>.
-   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012, 2017 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 
 #if (GTK_CHECK_VERSION(3,8,0) == 0)
-#define gtk_widget_register_window(widget, window) gdk_window_set_user_data (window, widget);
+#define gtk_widget_register_window(widget, window) gdk_window_set_user_data (window, widget)
 #endif
 
+#if (GTK_CHECK_VERSION(3,22,0) == 0)
+static inline void
+gtk_menu_popup_at_pointer (GtkMenu *menu, const GdkEvent *trigger)
+{
+  const GdkEventButton *be = trigger;
+  gtk_menu_popup (menu, NULL, NULL, NULL, NULL, be ? be->button : 0, be ?  be->time : 0);
+}
+#endif
+
+
 
 #endif /* PSPP_GTK_GTK_H */
index 7893dcf34d5cc902fcdc9c7f3d5af6cc6b9464f9..f09cb57ad7dbd2e5984de0898663b22cca8fa7d4 100644 (file)
@@ -517,8 +517,7 @@ show_menu (PsppireDictView *dv, GdkEventButton *event, gpointer data)
   if (event->button != 3)
     return FALSE;
 
-  gtk_menu_popup (GTK_MENU (dv->menu), NULL, NULL, NULL, NULL,
-                 event->button, event->time);
+  gtk_menu_popup_at_pointer (GTK_MENU (dv->menu), event);
 
   return TRUE;
 }