[metacity] fixedtip: fix build with gtk+ 3.20.x



commit eac46ac34f479b24d7cc50eb9e086997830862d2
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Apr 20 14:45:37 2017 +0300

    fixedtip: fix build with gtk+ 3.20.x

 src/ui/fixedtip.c |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/src/ui/fixedtip.c b/src/ui/fixedtip.c
index 1862b7f..036e680 100644
--- a/src/ui/fixedtip.c
+++ b/src/ui/fixedtip.c
@@ -30,19 +30,39 @@
  */
 static GtkWidget *tip = NULL;
 
+static void
+get_monitor_geometry (gint          root_x,
+                      gint          root_y,
+                      GdkRectangle *geometry)
+{
+#if GTK_CHECK_VERSION(3, 22, 0)
+  GdkDisplay *display;
+  GdkMonitor *monitor;
+
+  display = gdk_display_get_default ();
+  monitor = gdk_display_get_monitor_at_point (display, root_x, root_y);
+
+  gdk_monitor_get_geometry (monitor, geometry);
+#else
+  GdkScreen *screen;
+  gint monitor;
+
+  screen = gdk_screen_get_default ();
+  monitor = gdk_screen_get_monitor_at_point (screen, root_x, root_y);
+
+  gdk_screen_get_monitor_geometry (screen, monitor, geometry);
+#endif
+}
+
 void
 meta_fixed_tip_show (int root_x, int root_y,
                      const char *markup_text)
 {
-  GdkDisplay *display;
-  GdkMonitor *monitor;
   gint w;
   gint h;
   GdkRectangle rect;
   gint screen_right_edge;
 
-  display = gdk_display_get_default ();
-
   if (tip == NULL)
     {
       tip = meta_tooltip_new ();
@@ -51,8 +71,7 @@ meta_fixed_tip_show (int root_x, int root_y,
                        G_CALLBACK (gtk_widget_destroyed), &tip);
     }
 
-  monitor = gdk_display_get_monitor_at_point (display, root_x, root_y);
-  gdk_monitor_get_geometry (monitor, &rect);
+  get_monitor_geometry (root_x, root_y, &rect);
   screen_right_edge = rect.x + rect.width;
 
   meta_tooltip_set_label_markup (META_TOOLTIP (tip), markup_text);


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