diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2017-04-20 14:45:37 +0300 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2017-04-20 14:45:37 +0300 |
commit | eac46ac34f479b24d7cc50eb9e086997830862d2 (patch) | |
tree | 4b3c75596fe42a839652c4566b6d8481e60fd769 | |
parent | 47f4e626a66b59999ef2c5f2eb7857638f379854 (diff) | |
download | metacity-eac46ac34f479b24d7cc50eb9e086997830862d2.tar.gz |
fixedtip: fix build with gtk+ 3.20.x
-rw-r--r-- | 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 1862b7f2..036e680f 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); |