[gnome-panel/wip/geiger/geometry: 5/8] panel-multiscreen: replace deprecated functions



commit 85256e8eddfd1db5685ccdb71fd92bf60d23f3ab
Author: Sebastian Geiger <sbastig gmx net>
Date:   Sat Jan 6 15:14:44 2018 +0100

    panel-multiscreen: replace deprecated functions

 gnome-panel/panel-multiscreen.c |   23 ++++++++++++-----------
 gnome-panel/panel-multiscreen.h |   11 +++++------
 gnome-panel/panel-struts.c      |   11 +++++------
 3 files changed, 22 insertions(+), 23 deletions(-)
---
diff --git a/gnome-panel/panel-multiscreen.c b/gnome-panel/panel-multiscreen.c
index e4dd6f3..a955a7a 100644
--- a/gnome-panel/panel-multiscreen.c
+++ b/gnome-panel/panel-multiscreen.c
@@ -170,33 +170,34 @@ get_monitor_bounds (int            n_monitor,
  * edge of the logical screen.
  */
 void
-panel_multiscreen_is_at_visible_extreme (GdkScreen *screen,
-                                        int        n_monitor,
-                                        gboolean  *leftmost,
-                                        gboolean  *rightmost,
-                                        gboolean  *topmost,
-                                        gboolean  *bottommost)
+panel_multiscreen_is_at_visible_extreme (int        monitor_index,
+                                         gboolean  *leftmost,
+                                         gboolean  *rightmost,
+                                         gboolean  *topmost,
+                                         gboolean  *bottommost)
 {
        MonitorBounds monitor;
-       int i;
+       int i, n_monitors;
+
+       n_monitors = gdk_display_get_n_monitors(gdk_display_get_default());
 
        *leftmost   = TRUE;
        *rightmost  = TRUE;
        *topmost    = TRUE;
        *bottommost = TRUE;
 
-       g_return_if_fail (n_monitor >= 0 && n_monitor < gdk_screen_get_n_monitors (screen));
+       g_return_if_fail (monitor_index >= 0 && monitor_index < n_monitors);
 
-       get_monitor_bounds (n_monitor, &monitor);
+       get_monitor_bounds (monitor_index, &monitor);
 
        /* go through each monitor and try to find one either right,
         * below, above, or left of the specified monitor
         */
 
-       for (i = 0; i < gdk_screen_get_n_monitors (screen); i++) {
+       for (i = 0; i < n_monitors; i++) {
                MonitorBounds iter;
 
-               if (i == n_monitor) continue;
+               if (i == monitor_index) continue;
 
                get_monitor_bounds (i, &iter);
 
diff --git a/gnome-panel/panel-multiscreen.h b/gnome-panel/panel-multiscreen.h
index 209b0d2..71c767f 100644
--- a/gnome-panel/panel-multiscreen.h
+++ b/gnome-panel/panel-multiscreen.h
@@ -39,11 +39,10 @@ int panel_multiscreen_width                 (GdkScreen *screen,
 int    panel_multiscreen_height                (GdkScreen *screen,
                                                 int        monitor);
 
-void    panel_multiscreen_is_at_visible_extreme (GdkScreen *screen,
-                                                int        monitor,
-                                                gboolean  *leftmost,
-                                                gboolean  *rightmost,
-                                                gboolean  *topmost,
-                                                gboolean  *bottommost);
+void    panel_multiscreen_is_at_visible_extreme (int        monitor_index,
+                                                 gboolean  *leftmost,
+                                                 gboolean  *rightmost,
+                                                 gboolean  *topmost,
+                                                 gboolean  *bottommost);
 
 #endif /* __PANEL_MULTISCREEN_H__ */
diff --git a/gnome-panel/panel-struts.c b/gnome-panel/panel-struts.c
index 2bc4bda..3fd92bf 100644
--- a/gnome-panel/panel-struts.c
+++ b/gnome-panel/panel-struts.c
@@ -276,12 +276,11 @@ panel_struts_set_window_hint (PanelToplevel *toplevel)
                                           &monitor_width,
                                           &monitor_height);
 
-        panel_multiscreen_is_at_visible_extreme (strut->screen,
-                                                 strut->monitor,
-                                                 &leftmost,
-                                                 &rightmost,
-                                                 &topmost,
-                                                 &bottommost);
+       panel_multiscreen_is_at_visible_extreme (strut->monitor,
+                                                &leftmost,
+                                                &rightmost,
+                                                &topmost,
+                                                &bottommost);
 
        switch (strut->orientation) {
        case PANEL_ORIENTATION_TOP:


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