[gtk+] Drop gdk_window_get_screen



commit 2d6bd1ae6df83f2ac0a760351f185c80f5d7f48e
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 31 17:23:15 2017 -0400

    Drop gdk_window_get_screen
    
    This includes removing the GdkScreen argument from the
    create_window_impl display vfunc.

 gdk/broadway/gdkwindow-broadway.c   |    1 -
 gdk/gdkdisplay.c                    |    2 --
 gdk/gdkdisplayprivate.h             |    2 --
 gdk/gdkwindow.c                     |   30 +++---------------------------
 gdk/gdkwindow.h                     |    2 --
 gdk/mir/gdkmirdisplay.c             |    1 -
 gdk/quartz/gdkwindow-quartz.c       |    1 -
 gdk/wayland/gdkprivate-wayland.h    |    1 -
 gdk/wayland/gdkwindow-wayland.c     |    8 ++++----
 gdk/win32/gdkwindow-win32.c         |    1 -
 gdk/x11/gdkdevice-xi2.c             |    2 +-
 gdk/x11/gdkdevicemanager-core-x11.c |    2 +-
 gdk/x11/gdkdnd-x11.c                |    6 +++---
 gdk/x11/gdkeventsource.c            |    2 +-
 gdk/x11/gdkglcontext-x11.c          |    2 +-
 gdk/x11/gdkprivate-x11.h            |    3 +--
 gdk/x11/gdkwindow-x11.c             |    7 +++----
 modules/input/gtkimcontextxim.c     |   17 ++++++++---------
 18 files changed, 26 insertions(+), 64 deletions(-)
---
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index d66dd47..4106884 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -254,7 +254,6 @@ void
 _gdk_broadway_display_create_window_impl (GdkDisplay    *display,
                                          GdkWindow     *window,
                                          GdkWindow     *real_parent,
-                                         GdkScreen     *screen,
                                          GdkEventMask   event_mask,
                                          GdkWindowAttr *attributes)
 {
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index febd9ab..8ac1826 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -1655,14 +1655,12 @@ void
 _gdk_display_create_window_impl (GdkDisplay       *display,
                                  GdkWindow        *window,
                                  GdkWindow        *real_parent,
-                                 GdkScreen        *screen,
                                  GdkEventMask      event_mask,
                                  GdkWindowAttr    *attributes)
 {
   GDK_DISPLAY_GET_CLASS (display)->create_window_impl (display,
                                                        window,
                                                        real_parent,
-                                                       screen,
                                                        event_mask,
                                                        attributes);
 }
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index cc13008..c0b9aa5 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -169,7 +169,6 @@ struct _GdkDisplayClass
   void                       (*create_window_impl) (GdkDisplay    *display,
                                                     GdkWindow     *window,
                                                     GdkWindow     *real_parent,
-                                                    GdkScreen     *screen,
                                                     GdkEventMask   event_mask,
                                                     GdkWindowAttr *attributes);
 
@@ -283,7 +282,6 @@ void                _gdk_display_event_data_free      (GdkDisplay       *display
 void                _gdk_display_create_window_impl   (GdkDisplay       *display,
                                                        GdkWindow        *window,
                                                        GdkWindow        *real_parent,
-                                                       GdkScreen        *screen,
                                                        GdkEventMask      event_mask,
                                                        GdkWindowAttr    *attributes);
 GdkWindow *         _gdk_display_create_window        (GdkDisplay       *display);
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index c2ee515..016b20d 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -977,19 +977,13 @@ gdk_window_new (GdkDisplay    *display,
                GdkWindowAttr *attributes)
 {
   GdkWindow *window;
-  GdkScreen *screen;
   gboolean native;
   GdkEventMask event_mask;
 
   g_return_val_if_fail (attributes != NULL, NULL);
 
   if (!parent)
-    {
-      screen = gdk_display_get_default_screen (display);
-      parent = gdk_screen_get_root_window (screen);
-    }
-  else
-    screen = gdk_window_get_screen (parent);
+    parent = gdk_screen_get_root_window (gdk_display_get_default_screen (display));
 
   g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
 
@@ -1093,7 +1087,7 @@ gdk_window_new (GdkDisplay    *display,
       event_mask = get_native_event_mask (window);
 
       /* Create the impl */
-      _gdk_display_create_window_impl (display, window, parent, screen, event_mask, attributes);
+      _gdk_display_create_window_impl (display, window, parent, event_mask, attributes);
       window->impl_window = window;
     }
   else
@@ -1377,7 +1371,7 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
     return;
 
   display = gdk_window_get_display (window);
-  screen = gdk_window_get_screen (window);
+  screen = gdk_display_get_default_screen (display);
   temp_window = g_object_get_qdata (G_OBJECT (screen), quark_pointer_window);
   if (temp_window == window)
     g_object_set_qdata (G_OBJECT (screen), quark_pointer_window, NULL);
@@ -1584,24 +1578,6 @@ gdk_window_get_window_type (GdkWindow *window)
 }
 
 /**
- * gdk_window_get_screen:
- * @window: a #GdkWindow
- * 
- * Gets the #GdkScreen associated with a #GdkWindow.
- * 
- * Returns: (transfer none): the #GdkScreen associated with @window
- *
- * Since: 2.24
- **/
-GdkScreen*
-gdk_window_get_screen (GdkWindow *window)
-{
-  g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
-
-  return gdk_display_get_default_screen (window->display);
-}
-
-/**
  * gdk_window_get_display:
  * @window: a #GdkWindow
  * 
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 72156e1..d115ad8 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -422,8 +422,6 @@ GDK_AVAILABLE_IN_ALL
 gboolean      gdk_window_is_destroyed          (GdkWindow     *window);
 
 GDK_AVAILABLE_IN_ALL
-GdkScreen *   gdk_window_get_screen            (GdkWindow     *window);
-GDK_AVAILABLE_IN_ALL
 GdkDisplay *  gdk_window_get_display           (GdkWindow     *window);
 GDK_AVAILABLE_IN_ALL
 void          gdk_window_show                  (GdkWindow     *window);
diff --git a/gdk/mir/gdkmirdisplay.c b/gdk/mir/gdkmirdisplay.c
index ce7fa5d..95802c9 100644
--- a/gdk/mir/gdkmirdisplay.c
+++ b/gdk/mir/gdkmirdisplay.c
@@ -474,7 +474,6 @@ static void
 gdk_mir_display_create_window_impl (GdkDisplay    *display,
                                     GdkWindow     *window,
                                     GdkWindow     *real_parent,
-                                    GdkScreen     *screen,
                                     GdkEventMask   event_mask,
                                     GdkWindowAttr *attributes)
 {
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 387b38c..77113dc 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -734,7 +734,6 @@ void
 _gdk_quartz_display_create_window_impl (GdkDisplay    *display,
                                         GdkWindow     *window,
                                         GdkWindow     *real_parent,
-                                        GdkScreen     *screen,
                                         GdkEventMask   event_mask,
                                         GdkWindowAttr *attributes)
 {
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 62d20b7..6bf9925 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -139,7 +139,6 @@ void gdk_wayland_drop_context_update_targets (GdkDragContext *context);
 void _gdk_wayland_display_create_window_impl (GdkDisplay    *display,
                                              GdkWindow     *window,
                                              GdkWindow     *real_parent,
-                                             GdkScreen     *screen,
                                              GdkEventMask   event_mask,
                                              GdkWindowAttr *attributes);
 
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 298435e..f501e09 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -655,7 +655,6 @@ void
 _gdk_wayland_display_create_window_impl (GdkDisplay    *display,
                                          GdkWindow     *window,
                                          GdkWindow     *real_parent,
-                                         GdkScreen     *screen,
                                          GdkEventMask   event_mask,
                                          GdkWindowAttr *attributes)
 {
@@ -709,7 +708,7 @@ _gdk_wayland_display_create_window_impl (GdkDisplay    *display,
   g_signal_connect (frame_clock, "after-paint",
                     G_CALLBACK (on_frame_clock_after_paint), window);
 
-  g_signal_connect (screen, "monitors-changed",
+  g_signal_connect (gdk_display_get_default_screen (display), "monitors-changed",
                     G_CALLBACK (on_monitors_changed), window);
 }
 
@@ -1501,7 +1500,7 @@ gdk_wayland_window_create_xdg_toplevel (GdkWindow *window)
   struct wl_output *fullscreen_output = NULL;
   if (impl->initial_fullscreen_monitor >= 0 &&
       impl->initial_fullscreen_monitor < gdk_display_get_n_monitors (display))
-      fullscreen_output = _gdk_wayland_screen_get_wl_output (gdk_window_get_screen (window), 
impl->initial_fullscreen_monitor);
+      fullscreen_output = _gdk_wayland_screen_get_wl_output (gdk_display_get_default_screen 
(gdk_window_get_display (window)), impl->initial_fullscreen_monitor);
 
   impl->display_server.xdg_surface =
     zxdg_shell_v6_get_xdg_surface (display_wayland->xdg_shell,
@@ -3326,7 +3325,8 @@ static void
 gdk_wayland_window_fullscreen_on_monitor (GdkWindow *window, gint monitor)
 {
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
-  GdkScreen *screen = gdk_window_get_screen (window);
+  GdkDisplay *display = gdk_window_get_display (window);
+  GdkScreen *screen = gdk_display_get_default_screen (display);
   struct wl_output *fullscreen_output =
     _gdk_wayland_screen_get_wl_output (screen, monitor);
 
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 2d54ef9..2e98e0c 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -686,7 +686,6 @@ void
 _gdk_win32_display_create_window_impl (GdkDisplay    *display,
                                       GdkWindow     *window,
                                       GdkWindow     *real_parent,
-                                      GdkScreen     *screen,
                                       GdkEventMask   event_mask,
                                       GdkWindowAttr *attributes)
 {
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index 82eed04..63f52d8 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -244,7 +244,7 @@ gdk_x11_device_xi2_get_state (GdkDevice       *device,
                   GdkWindow *root_window;
                   gint root_x, root_y;
 
-                  root_window = gdk_screen_get_root_window (gdk_window_get_screen (window));
+                  root_window = gdk_screen_get_root_window (gdk_display_get_default_screen 
(gdk_window_get_display (window)));
                   /* FIXME: Maybe root coords chaching should happen here */
                   gdk_window_get_origin (window, &root_x, &root_y);
                   _gdk_device_translate_screen_coord (device, window,
diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c
index 11ab5c2..d487bb7 100644
--- a/gdk/x11/gdkdevicemanager-core-x11.c
+++ b/gdk/x11/gdkdevicemanager-core-x11.c
@@ -808,7 +808,7 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
     return;
 
   had_focus = HAS_FOCUS (toplevel);
-  x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (window));
+  x11_screen = GDK_X11_SCREEN (GDK_WINDOW_SCREEN (window));
 
   switch (detail)
     {
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 1236beb..28a86f8 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -2678,7 +2678,7 @@ drag_context_grab (GdkDragContext *context)
   if (!x11_context->ipc_window)
     return FALSE;
 
-  root = gdk_screen_get_root_window (gdk_window_get_screen (x11_context->ipc_window));
+  root = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (x11_context->ipc_window));
   seat = gdk_device_get_seat (gdk_drag_context_get_device (context));
 
 #ifdef XINPUT_2
@@ -2767,7 +2767,7 @@ drag_context_ungrab (GdkDragContext *context)
   gdk_seat_ungrab (x11_context->grab_seat);
 
   keyboard = gdk_seat_get_keyboard (x11_context->grab_seat);
-  root = gdk_screen_get_root_window (gdk_window_get_screen (x11_context->ipc_window));
+  root = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (x11_context->ipc_window));
   g_clear_object (&x11_context->grab_seat);
 
   for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
@@ -3030,7 +3030,7 @@ gdk_dnd_handle_key_event (GdkDragContext    *context,
    * to query it here. We could use XGetModifierMapping, but
    * that would be overkill.
    */
-  root_window = gdk_screen_get_root_window (gdk_window_get_screen (x11_context->ipc_window));
+  root_window = gdk_screen_get_root_window (GDK_WINDOW_SCREEN (x11_context->ipc_window));
   gdk_window_get_device_position (root_window, pointer, NULL, NULL, &state);
 
   if (dx != 0 || dy != 0)
diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c
index ae465db..a088cb0 100644
--- a/gdk/x11/gdkeventsource.c
+++ b/gdk/x11/gdkeventsource.c
@@ -136,7 +136,7 @@ handle_focus_change (GdkEventCrossing *event)
   gboolean focus_in, had_focus;
 
   toplevel = _gdk_x11_window_get_toplevel (event->window);
-  x11_screen = GDK_X11_SCREEN (gdk_window_get_screen (event->window));
+  x11_screen = GDK_X11_SCREEN (GDK_WINDOW_SCREEN (event->window));
   focus_in = (event->type == GDK_ENTER_NOTIFY);
 
   if (x11_screen->wmspec_check_window)
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 5a28f58..76ea3fc 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -1209,7 +1209,7 @@ gdk_x11_window_create_gl_context (GdkWindow    *window,
 
   display = gdk_window_get_display (window);
 
-  if (!gdk_x11_screen_init_gl (gdk_window_get_screen (window)))
+  if (!gdk_x11_screen_init_gl (GDK_WINDOW_SCREEN (window)))
     {
       g_set_error_literal (error, GDK_GL_ERROR,
                            GDK_GL_ERROR_NOT_AVAILABLE,
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 30a388f..59b5e36 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -250,7 +250,6 @@ void       _gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display,
 void       _gdk_x11_display_create_window_impl     (GdkDisplay    *display,
                                                     GdkWindow     *window,
                                                     GdkWindow     *real_parent,
-                                                    GdkScreen     *screen,
                                                     GdkEventMask   event_mask,
                                                     GdkWindowAttr *attributes);
 
@@ -297,7 +296,7 @@ extern const gint        _gdk_x11_event_mask_table_size;
 
 #define GDK_SCREEN_DISPLAY(screen)    (GDK_X11_SCREEN (screen)->display)
 #define GDK_SCREEN_XROOTWIN(screen)   (GDK_X11_SCREEN (screen)->xroot_window)
-#define GDK_WINDOW_SCREEN(win)        (gdk_window_get_screen (win))
+#define GDK_WINDOW_SCREEN(win)        (gdk_display_get_default_screen (gdk_window_get_display (win)))
 #define GDK_WINDOW_DISPLAY(win)       (GDK_X11_SCREEN (GDK_WINDOW_SCREEN (win))->display)
 #define GDK_WINDOW_XROOTWIN(win)      (GDK_X11_SCREEN (GDK_WINDOW_SCREEN (win))->xroot_window)
 #define GDK_GC_DISPLAY(gc)            (GDK_SCREEN_DISPLAY (GDK_GC_X11(gc)->screen))
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index ad27a45..c565198 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -437,7 +437,7 @@ gdk_x11_window_end_frame (GdkWindow *window)
                       impl->toplevel->current_counter_value);
 
       if (impl->frame_sync_enabled &&
-          gdk_x11_screen_supports_net_wm_hint (gdk_window_get_screen (window),
+          gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
                                               gdk_atom_intern_static_string ("_NET_WM_FRAME_DRAWN")))
         {
           impl->toplevel->frame_pending = TRUE;
@@ -904,7 +904,6 @@ void
 _gdk_x11_display_create_window_impl (GdkDisplay    *display,
                                      GdkWindow     *window,
                                      GdkWindow     *real_parent,
-                                     GdkScreen     *screen,
                                      GdkEventMask   event_mask,
                                      GdkWindowAttr *attributes)
 {
@@ -925,7 +924,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay    *display,
 
   display_x11 = GDK_X11_DISPLAY (display);
   xparent = GDK_WINDOW_XID (real_parent);
-  x11_screen = GDK_X11_SCREEN (screen);
+  x11_screen = GDK_X11_SCREEN (gdk_display_get_default_screen (display));
 
   impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL);
   window->impl = GDK_WINDOW_IMPL (impl);
@@ -948,7 +947,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay    *display,
       if (GDK_WINDOW_TYPE (window->parent) != GDK_WINDOW_ROOT)
         {
           /* The common code warns for this case */
-          xparent = GDK_SCREEN_XROOTWIN (screen);
+          xparent = GDK_SCREEN_XROOTWIN (x11_screen);
         }
       break;
 
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c
index 0c2c375..027fc44 100644
--- a/modules/input/gtkimcontextxim.c
+++ b/modules/input/gtkimcontextxim.c
@@ -74,7 +74,7 @@ struct _GtkIMContextXIM
 
 struct _GtkXIMInfo
 {
-  GdkScreen *screen;
+  GdkDisplay *display;
   XIM im;
   char *locale;
   XIMStyle preedit_style_setting;
@@ -310,7 +310,7 @@ setup_im (GtkXIMInfo *info)
   setup_styles (info);
   reinitialize_all_ics (info);
 
-  display = gdk_screen_get_display (info->screen);
+  display = info->display;
   info->display_closed_cb = g_signal_connect (display, "closed",
                                              G_CALLBACK (xim_info_display_closed), info);
 }
@@ -374,8 +374,7 @@ xim_instantiate_callback (Display *display, XPointer client_data,
 static void
 xim_info_try_im (GtkXIMInfo *info)
 {
-  GdkScreen *screen = info->screen;
-  GdkDisplay *display = gdk_screen_get_display (screen);
+  GdkDisplay *display = info->display;
 
   g_assert (info->im == NULL);
   if (info->reconnecting)
@@ -424,14 +423,14 @@ get_im (GdkWindow *client_window,
 {
   GSList *tmp_list;
   GtkXIMInfo *info;
-  GdkScreen *screen = gdk_window_get_screen (client_window);
+  GdkDisplay *display = gdk_window_get_display (client_window);
 
   info = NULL;
   tmp_list = open_ims;
   while (tmp_list)
     {
       GtkXIMInfo *tmp_info = tmp_list->data;
-      if (tmp_info->screen == screen &&
+      if (tmp_info->display == display &&
          strcmp (tmp_info->locale, locale) == 0)
        {
          if (tmp_info->im)
@@ -452,7 +451,7 @@ get_im (GdkWindow *client_window,
       info = g_new (GtkXIMInfo, 1);
       open_ims = g_slist_prepend (open_ims, info);
 
-      info->screen = screen;
+      info->display = display;
       info->locale = g_strdup (locale);
       info->xim_styles = NULL;
       info->preedit_style_setting = 0;
@@ -512,7 +511,7 @@ gtk_im_context_xim_finalize (GObject *obj)
        {
          GdkDisplay *display;
 
-         display = gdk_screen_get_display (context_xim->im_info->screen);
+         display = context_xim->im_info->display;
          XUnregisterIMInstantiateCallback (GDK_DISPLAY_XDISPLAY (display),
                                            NULL, NULL, NULL,
                                            xim_instantiate_callback,
@@ -1787,7 +1786,7 @@ gtk_im_context_xim_shutdown (void)
   while (open_ims)
     {
       GtkXIMInfo *info = open_ims->data;
-      GdkDisplay *display = gdk_screen_get_display (info->screen);
+      GdkDisplay *display = info->display;
 
       xim_info_display_closed (display, FALSE, info);
       open_ims = g_slist_remove_link (open_ims, open_ims);


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