summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-18 19:18:51 +0200
committerraveit65 <[email protected]>2017-08-25 23:03:59 +0200
commit2ff07dcba10019455d0d8c2762c897de6247ac4d (patch)
treefba9112997eae0815d531f3a2604f636a55af559 /src
parent2a424fca8bd928223e92570fa692266c471a52b3 (diff)
downloadcaja-2ff07dcba10019455d0d8c2762c897de6247ac4d.tar.bz2
caja-2ff07dcba10019455d0d8c2762c897de6247ac4d.tar.xz
gtk 3.22: avoid deprecated gdk_screen_get_monitor... functions:
avoid deprecated: gdk_screen_get_monitor_geometry gdk_screen_get_monitor_at_window
Diffstat (limited to 'src')
-rw-r--r--src/caja-zoom-control.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/caja-zoom-control.c b/src/caja-zoom-control.c
index 24ac8fce..c0d5da20 100644
--- a/src/caja-zoom-control.c
+++ b/src/caja-zoom-control.c
@@ -144,8 +144,13 @@ menu_position_under_widget (GtkMenu *menu,
GtkRequisition req;
GtkRequisition menu_req;
GdkRectangle monitor;
+#if GTK_CHECK_VERSION (3, 22, 0)
+ GdkMonitor *monitor_num;
+ GdkDisplay *display;
+#else
int monitor_num;
GdkScreen *screen;
+#endif
GtkAllocation allocation;
widget = GTK_WIDGET (user_data);
@@ -158,6 +163,13 @@ menu_position_under_widget (GtkMenu *menu,
gtk_widget_get_preferred_size (widget, &req, NULL);
gtk_widget_get_allocation (widget, &allocation);
+#if GTK_CHECK_VERSION (3, 22, 0)
+ display = gtk_widget_get_display (GTK_WIDGET (menu));
+ monitor_num = gdk_display_get_monitor_at_window (display, gtk_widget_get_window (widget));
+ if (monitor_num == NULL)
+ monitor_num = gdk_display_get_monitor (display, 0);
+ gdk_monitor_get_geometry (monitor_num, &monitor);
+#else
screen = gtk_widget_get_screen (GTK_WIDGET (menu));
monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
if (monitor_num < 0)
@@ -165,6 +177,7 @@ menu_position_under_widget (GtkMenu *menu,
monitor_num = 0;
}
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+#endif
gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
if (!gtk_widget_get_has_window (widget))