[gtk+] Use gdk_display_get_toplevel_windows



commit 8f129ddd13f8504d21f5a86ddecd9d963e101e3e
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 31 20:47:57 2017 -0400

    Use gdk_display_get_toplevel_windows
    
    This replaces the GdkScreen api of the same name.

 gdk/broadway/gdkscreen-broadway.c |    4 +++-
 gdk/quartz/GdkQuartzNSWindow.c    |   10 ++++++----
 gdk/quartz/gdkscreen-quartz.c     |    2 +-
 gdk/x11/gdkdevice-core-x11.c      |    5 ++---
 gdk/x11/gdkdevice-xi2.c           |    3 +--
 gdk/x11/gdkdnd-x11.c              |    8 ++++----
 gdk/x11/gdkmonitor-x11.c          |    3 +--
 gdk/x11/gdkscreen-x11.c           |    4 +++-
 8 files changed, 21 insertions(+), 18 deletions(-)
---
diff --git a/gdk/broadway/gdkscreen-broadway.c b/gdk/broadway/gdkscreen-broadway.c
index c528ca9..207e27b 100644
--- a/gdk/broadway/gdkscreen-broadway.c
+++ b/gdk/broadway/gdkscreen-broadway.c
@@ -73,7 +73,7 @@ _gdk_broadway_screen_size_changed (GdkScreen                       *screen,
   gdk_monitor_set_size (monitor, msg->width, msg->height);
   gdk_monitor_set_physical_size (monitor, msg->width * 25.4 / 96, msg->height * 25.4 / 96);
 
-  toplevels = gdk_screen_get_toplevel_windows (screen);
+  toplevels = gdk_display_get_toplevel_windows (broadway_screen->display);
   for (l = toplevels; l != NULL; l = l->next)
     {
       GdkWindow *toplevel = l->data;
@@ -82,6 +82,8 @@ _gdk_broadway_screen_size_changed (GdkScreen                       *screen,
       if (toplevel_impl->maximized)
        gdk_window_move_resize (toplevel, 0, 0, msg->width, msg->height);
     }
+
+  g_list_free (toplevels);
 }
 
 static void
diff --git a/gdk/quartz/GdkQuartzNSWindow.c b/gdk/quartz/GdkQuartzNSWindow.c
index bef52a8..bf366c0 100644
--- a/gdk/quartz/GdkQuartzNSWindow.c
+++ b/gdk/quartz/GdkQuartzNSWindow.c
@@ -708,7 +708,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
 - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
 {
   GdkEvent *event;
-  GdkScreen *screen;
+  GdkDisplay *display;
   GdkDevice *device;
 
   g_assert (_gdk_quartz_drag_source_context != NULL);
@@ -718,16 +718,16 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
   event->dnd.send_event = FALSE;
   event->dnd.context = g_object_ref (_gdk_quartz_drag_source_context);
 
-  screen = gdk_window_get_screen (event->dnd.window);
+  display = gdk_window_get_display (event->dnd.window);
 
-  if (screen)
+  if (display)
     {
       GList* windows, *list;
       gint gx, gy;
 
       event->dnd.context->dest_window = NULL;
 
-      windows = gdk_screen_get_toplevel_windows (screen);
+      windows = gdk_display_get_toplevel_windows (display);
       _gdk_quartz_window_nspoint_to_gdk_xy (aPoint, &gx, &gy);
 
       for (list = windows; list; list = list->next)
@@ -743,6 +743,8 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
           if (gx > wx && gy > wy && gx <= wx + ww && gy <= wy + wh)
             event->dnd.context->dest_window = win;
         }
+
+      g_list_free (windows);
     }
 
   device = gdk_drag_context_get_device (_gdk_quartz_drag_source_context);
diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c
index c737776..f8cd58f 100644
--- a/gdk/quartz/gdkscreen-quartz.c
+++ b/gdk/quartz/gdkscreen-quartz.c
@@ -214,7 +214,7 @@ _gdk_quartz_screen_update_window_sizes (GdkScreen *screen)
   _gdk_root->abs_x = 0;
   _gdk_root->abs_y = 0;
 
-  windows = gdk_screen_get_toplevel_windows (screen);
+  windows = gdk_display_get_toplevel_windows (gdk_screen_get_display (screen));
 
   for (list = windows; list; list = list->next)
     _gdk_quartz_window_update_position (list->data);
diff --git a/gdk/x11/gdkdevice-core-x11.c b/gdk/x11/gdkdevice-core-x11.c
index 09d3150..4f001e7 100644
--- a/gdk/x11/gdkdevice-core-x11.c
+++ b/gdk/x11/gdkdevice-core-x11.c
@@ -426,9 +426,9 @@ gdk_x11_device_core_window_at_position (GdkDevice       *device,
 {
   GdkWindowImplX11 *impl;
   GdkDisplay *display;
-  GdkScreen *screen;
   Display *xdisplay;
   GdkWindow *window;
+  GdkScreen *screen;
   Window xwindow, root, child, last;
   int xroot_x, xroot_y, xwin_x, xwin_y;
   unsigned int xmask;
@@ -470,8 +470,7 @@ gdk_x11_device_core_window_at_position (GdkDevice       *device,
 
       /* FIXME: untrusted clients case not multidevice-safe */
       pointer_window = None;
-      screen = gdk_display_get_default_screen (display);
-      toplevels = gdk_screen_get_toplevel_windows (screen);
+      toplevels = gdk_display_get_toplevel_windows (display);
       for (list = toplevels; list != NULL; list = list->next)
         {
           window = GDK_WINDOW (list->data);
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index 63f52d8..83d865e 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -545,8 +545,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice       *device,
       /* FIXME: untrusted clients case not multidevice-safe */
       pointer_window = None;
 
-      screen = gdk_display_get_default_screen (display);
-      toplevels = gdk_screen_get_toplevel_windows (screen);
+      toplevels = gdk_display_get_toplevel_windows (display);
       for (list = toplevels; list != NULL; list = list->next)
         {
           window = GDK_WINDOW (list->data);
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 28a86f8..918d5e9 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -581,14 +581,14 @@ gdk_window_cache_new (GdkDisplay *display)
   XGetWindowAttributes (xdisplay, GDK_WINDOW_XID (root_window), &xwa);
   result->old_event_mask = xwa.your_event_mask;
 
-  if (G_UNLIKELY (!GDK_X11_DISPLAY (GDK_X11_SCREEN (screen)->display)->trusted_client))
+  if (G_UNLIKELY (!GDK_X11_DISPLAY (display)->trusted_client))
     {
       GList *toplevel_windows, *list;
       GdkWindow *window;
       GdkWindowImplX11 *impl;
       gint x, y, width, height;
 
-      toplevel_windows = gdk_screen_get_toplevel_windows (screen);
+      toplevel_windows = gdk_display_get_toplevel_windows (display);
       for (list = toplevel_windows; list; list = list->next)
         {
           window = GDK_WINDOW (list->data);
@@ -609,7 +609,7 @@ gdk_window_cache_new (GdkDisplay *display)
   gdk_window_add_filter (root_window, gdk_window_cache_filter, result);
   gdk_window_add_filter (NULL, gdk_window_cache_shape_filter, result);
 
-  if (!_gdk_x11_get_window_child_info (gdk_screen_get_display (screen),
+  if (!_gdk_x11_get_window_child_info (display,
                                        GDK_WINDOW_XID (root_window),
                                        FALSE, NULL,
                                        &children, &nchildren))
@@ -632,7 +632,7 @@ gdk_window_cache_new (GdkDisplay *display)
    * the COW. We assume that the CM is using the COW (which is true for pretty
    * much any CM currently in use).
    */
-  if (gdk_display_is_composited (gdk_screen_get_display (screen)))
+  if (gdk_display_is_composited (display))
     {
       cow = XCompositeGetOverlayWindow (xdisplay, GDK_WINDOW_XID (root_window));
       gdk_window_cache_add (result, cow, 0, 0, 
diff --git a/gdk/x11/gdkmonitor-x11.c b/gdk/x11/gdkmonitor-x11.c
index 899511a..a2d5caa 100644
--- a/gdk/x11/gdkmonitor-x11.c
+++ b/gdk/x11/gdkmonitor-x11.c
@@ -29,12 +29,11 @@ G_DEFINE_TYPE (GdkX11Monitor, gdk_x11_monitor, GDK_TYPE_MONITOR)
 static gboolean
 gdk_monitor_has_fullscreen_window (GdkMonitor *monitor)
 {
-  GdkScreen *screen = gdk_display_get_default_screen (monitor->display);
   GList *toplevels, *l;
   GdkWindow *window;
   gboolean has_fullscreen;
 
-  toplevels = gdk_screen_get_toplevel_windows (screen);
+  toplevels = gdk_display_get_toplevel_windows (monitor->display);
 
   has_fullscreen = FALSE;
   for (l = toplevels; l; l = l->next)
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 9ae1408..6130308 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -841,7 +841,7 @@ _gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen,
   root = x11_screen->root_window;
   GDK_WINDOW_IMPL_X11 (root->impl)->window_scale = scale;
 
-  toplevels = gdk_screen_get_toplevel_windows (GDK_SCREEN (x11_screen));
+  toplevels = gdk_display_get_toplevel_windows (x11_screen->display);
 
   for (l = toplevels; l != NULL; l = l->next)
     {
@@ -850,6 +850,8 @@ _gdk_x11_screen_set_window_scale (GdkX11Screen *x11_screen,
       _gdk_x11_window_set_window_scale (window, scale);
     }
 
+  g_list_free (toplevels);
+
   for (i = 0; i < x11_display->monitors->len; i++)
     {
       GdkMonitor *monitor = GDK_MONITOR (x11_display->monitors->pdata[i]);


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