From eb275151c64ee9c528e9f85f27e56e56e45af3ad Mon Sep 17 00:00:00 2001
From: ZenWalker <scow@riseup.net>
Date: Fri, 4 Aug 2017 00:26:09 +0200
Subject: avoid deprecated gdk_screen_get_n_monitors

---
 applets/clock/clock.c          | 8 ++++++++
 mate-panel/panel-multiscreen.c | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index b893b738..a1c16159 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -867,6 +867,9 @@ position_calendar_popup (ClockData *cd)
 {
         GtkRequisition  req;
         GtkAllocation   allocation;
+#if GTK_CHECK_VERSION (3, 22, 0)
+        GdkDisplay     *display;
+#endif
         GdkScreen      *screen;
         GdkRectangle    monitor;
         GdkGravity      gravity = GDK_GRAVITY_NORTH_WEST;
@@ -890,8 +893,13 @@ position_calendar_popup (ClockData *cd)
         button_h = allocation.height;
 
         screen = gtk_window_get_screen (GTK_WINDOW (cd->calendar_popup));
+#if GTK_CHECK_VERSION (3, 22, 0)
+        display = gdk_screen_get_display (screen);
 
+        n = gdk_display_get_n_monitors (display);
+#else
         n = gdk_screen_get_n_monitors (screen);
+#endif
         for (i = 0; i < n; i++) {
                 gdk_screen_get_monitor_geometry (screen, i, &monitor);
                 if (x >= monitor.x && x <= monitor.x + monitor.width &&
diff --git a/mate-panel/panel-multiscreen.c b/mate-panel/panel-multiscreen.c
index afe8c24e..49738270 100644
--- a/mate-panel/panel-multiscreen.c
+++ b/mate-panel/panel-multiscreen.c
@@ -202,11 +202,19 @@ panel_multiscreen_get_gdk_monitors_for_screen (GdkScreen     *screen,
 					       int           *monitors_ret,
 					       GdkRectangle **geometries_ret)
 {
+#if GTK_CHECK_VERSION (3, 22, 0)
+	GdkDisplay   *display;
+#endif
 	int           num_monitors;
 	GdkRectangle *geometries;
 	int           i;
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+	display = gdk_screen_get_display (screen);
+	num_monitors = gdk_display_get_n_monitors (display);
+#else
 	num_monitors = gdk_screen_get_n_monitors (screen);
+#endif
 	geometries = g_new (GdkRectangle, num_monitors);
 
 	for (i = 0; i < num_monitors; i++)
-- 
cgit v1.2.1