[gtk+] x11: Init no-multihead monitor without root window



commit 4b88b81e67081ffe039573123cf8dd0507e929b7
Author: Benjamin Otte <otte redhat com>
Date:   Fri Nov 4 00:33:13 2016 +0100

    x11: Init no-multihead monitor without root window
    
    Previous code gave warnings because the root window wasn't initialized
    yet.

 gdk/x11/gdkscreen-x11.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 6a06b62..5011155 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -702,13 +702,11 @@ init_no_multihead (GdkScreen *screen, gboolean *changed)
   GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
   GdkX11Display *x11_display = GDK_X11_DISPLAY (x11_screen->display);
   GdkX11Monitor *monitor;
-  GdkWindow *root_window;
   GdkRectangle geometry;
   int width_mm, height_mm;
+  int width, height;
   int i;
 
-  root_window = gdk_screen_get_root_window (screen);
-
   for (i = 0; i < x11_display->monitors->len; i++)
     {
       GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
@@ -731,20 +729,20 @@ init_no_multihead (GdkScreen *screen, gboolean *changed)
 
   width_mm = WidthMMOfScreen (x11_screen->xscreen);
   height_mm = HeightMMOfScreen (x11_screen->xscreen);
+  width = WidthOfScreen (x11_screen->xscreen);
+  height = HeightOfScreen (x11_screen->xscreen);
 
   gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry);
   if (0 != geometry.x ||
       0 != geometry.y ||
-      gdk_window_get_width (root_window) != geometry.width ||
-      gdk_window_get_height (root_window) != geometry.height ||
+      width != geometry.width ||
+      height != geometry.height ||
       width_mm != gdk_monitor_get_width_mm (GDK_MONITOR (monitor)) ||
       height_mm != gdk_monitor_get_height_mm (GDK_MONITOR (monitor)))
     *changed = TRUE;
 
   gdk_monitor_set_position (GDK_MONITOR (monitor), 0, 0);
-  gdk_monitor_set_size (GDK_MONITOR (monitor),
-                        gdk_window_get_width (root_window),
-                        gdk_window_get_height (root_window));
+  gdk_monitor_set_size (GDK_MONITOR (monitor), width, height);
   g_object_notify (G_OBJECT (monitor), "workarea");
   gdk_monitor_set_physical_size (GDK_MONITOR (monitor), width_mm, height_mm);
   gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->window_scale);


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