[gnome-panel/wip-warnings-next: 3/20] multiscreen: rename local geometry variables



commit 849bb705f5d596a7b21e1db3e70aea5e8c087fdd
Author: Sebastian Geiger <sbastig gmx net>
Date:   Tue Feb 25 00:04:49 2020 +0100

    multiscreen: rename local geometry variables
    
    This avoids warnings that the local  variables shadow
    the global  variable.

 gnome-panel/panel-multiscreen.c | 48 ++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/gnome-panel/panel-multiscreen.c b/gnome-panel/panel-multiscreen.c
index c5c507ded..be815088e 100644
--- a/gnome-panel/panel-multiscreen.c
+++ b/gnome-panel/panel-multiscreen.c
@@ -91,7 +91,7 @@ panel_multiscreen_get_randr_monitors_for_screen (int           *monitors_ret,
        Window              xroot;
        XRRScreenResources *resources;
        RROutput            primary;
-       GArray             *geometries;
+       GArray             *geometry_array;
        int                 i;
        gboolean            driver_is_pre_randr_1_2;
 
@@ -145,7 +145,7 @@ panel_multiscreen_get_randr_monitors_for_screen (int           *monitors_ret,
        if (have_randr_1_3)
                primary = XRRGetOutputPrimary (xdisplay, xroot);
 
-       geometries = g_array_sized_new (FALSE, FALSE,
+       geometry_array = g_array_sized_new (FALSE, FALSE,
                                        sizeof (GdkRectangle),
                                        resources->noutput);
 
@@ -180,9 +180,9 @@ panel_multiscreen_get_randr_monitors_for_screen (int           *monitors_ret,
                        if (_panel_multiscreen_output_should_be_first (xdisplay,
                                                                       resources->outputs[i],
                                                                       output, primary))
-                               g_array_prepend_vals (geometries, &rect, 1);
+                               g_array_prepend_vals (geometry_array, &rect, 1);
                        else
-                               g_array_append_vals (geometries, &rect, 1);
+                               g_array_append_vals (geometry_array, &rect, 1);
                }
 
                XRRFreeOutputInfo (output);
@@ -193,23 +193,23 @@ panel_multiscreen_get_randr_monitors_for_screen (int           *monitors_ret,
        if (driver_is_pre_randr_1_2) {
                /* Drivers before RANDR 1.2 don't provide useful info about
                 * outputs */
-               g_array_free (geometries, TRUE);
+               g_array_free (geometry_array, TRUE);
                return FALSE;
        }
 
-       if (geometries->len == 0) {
+       if (geometry_array->len == 0) {
                /* This can happen in at least one case:
                 * https://bugzilla.novell.com/show_bug.cgi?id=543876 where all
                 * monitors appear disconnected (possibly because the  screen
                 * is behing a KVM switch) -- see comment #8.
                 * There might be other cases too, so we stay on the safe side.
                 */
-               g_array_free (geometries, TRUE);
+               g_array_free (geometry_array, TRUE);
                return FALSE;
        }
 
-       *monitors_ret = geometries->len;
-       *geometries_ret = (GdkRectangle *) g_array_free (geometries, FALSE);
+       *monitors_ret = geometry_array->len;
+       *geometries_ret = (GdkRectangle *) g_array_free (geometry_array, FALSE);
 
        return TRUE;
 }
@@ -220,22 +220,22 @@ panel_multiscreen_get_gdk_monitors_for_screen (int           *monitors_ret,
 {
        GdkDisplay   *display;
        int           num_monitors;
-       GdkRectangle *geometries;
+       GdkRectangle *monitor_geometries;
        int           i;
 
        display = gdk_display_get_default ();
        num_monitors = gdk_display_get_n_monitors (display);
-       geometries = g_new (GdkRectangle, num_monitors);
+       monitor_geometries = g_new (GdkRectangle, num_monitors);
 
        for (i = 0; i < num_monitors; i++) {
          GdkMonitor * monitor;
 
          monitor = gdk_display_get_monitor (display, i);
-         gdk_monitor_get_geometry (monitor, &(geometries[i]));
+         gdk_monitor_get_geometry (monitor, &(monitor_geometries[i]));
        }
 
        *monitors_ret = num_monitors;
-       *geometries_ret = geometries;
+       *geometries_ret = monitor_geometries;
 }
 
 static void
@@ -274,11 +274,11 @@ panel_multiscreen_compress_overlapping_monitors (int           *num_monitors_ino
                                                 GdkRectangle **geometries_inout)
 {
        int           num_monitors;
-       GdkRectangle *geometries;
+       GdkRectangle *monitor_geometries;
        int           i;
 
        num_monitors = *num_monitors_inout;
-       geometries = *geometries_inout;
+       monitor_geometries = *geometries_inout;
 
        /* http://bugzilla.gnome.org/show_bug.cgi?id=530969
         * https://bugzilla.novell.com/show_bug.cgi?id=310208
@@ -329,27 +329,27 @@ panel_multiscreen_compress_overlapping_monitors (int           *num_monitors_ino
                long max_pixels;
                int  j;
 
-               max_pixels = pixels_in_rectangle (&geometries[i]);
+               max_pixels = pixels_in_rectangle (&monitor_geometries[i]);
 
                j = i + 1;
 
                while (j < num_monitors) {
-                       if (rectangle_overlaps (&geometries[i],
-                                               &geometries[j])) {
+                       if (rectangle_overlaps (&monitor_geometries[i],
+                                               &monitor_geometries[j])) {
                                long pixels;
 
-                               pixels = pixels_in_rectangle (&geometries[j]);
+                               pixels = pixels_in_rectangle (&monitor_geometries[j]);
                                if (pixels > max_pixels) {
                                        max_pixels = pixels;
                                        /* keep the maximum */
-                                       geometries[i] = geometries[j];
+                                       monitor_geometries[i] = monitor_geometries[j];
                                }
 
                                /* Shift the remaining monitors to the left */
                                if (num_monitors - j - 1 > 0)
-                                       memmove (&geometries[j],
-                                                &geometries[j + 1],
-                                                sizeof (geometries[0]) * (num_monitors - j - 1));
+                                       memmove (&monitor_geometries[j],
+                                                &monitor_geometries[j + 1],
+                                                sizeof (monitor_geometries[0]) * (num_monitors - j - 1));
 
                                num_monitors--;
                                g_assert (num_monitors > 0);
@@ -359,7 +359,7 @@ panel_multiscreen_compress_overlapping_monitors (int           *num_monitors_ino
        }
 
        *num_monitors_inout = num_monitors;
-       *geometries_inout = geometries;
+       *geometries_inout = monitor_geometries;
 }
 
 static void


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