[gtk+/wip/otte/gtk4: 20/41] API: Remove gdk_screen_get_width() and gdk_screen_get_height()



commit ea84ddbaffc8145cadc12d54f2f0808a2fc13b8e
Author: Benjamin Otte <otte redhat com>
Date:   Fri Sep 9 14:53:18 2016 +0200

    API: Remove gdk_screen_get_width() and gdk_screen_get_height()
    
    ... and gdk_screen_get_width_mm() and gdk_screen_get_height_mm() and
    the shortcut counterparts that call these functions on the default
    screen.
    
    Modern display servers don't provide an ability to query the size of a
    screen or display so we shouldn't allow that either.

 docs/reference/gdk/gdk3-sections.txt |   10 --
 gdk/broadway/gdkscreen-broadway.c    |   50 ++---------
 gdk/broadway/gdkscreen-broadway.h    |    3 -
 gdk/broadway/gdkwindow-broadway.c    |   18 +++--
 gdk/gdkmain.h                        |   10 --
 gdk/gdkscreen.c                      |  164 ----------------------------------
 gdk/gdkscreen.h                      |    8 --
 gdk/gdkscreenprivate.h               |    4 -
 gdk/wayland/gdkscreen-wayland.c      |   93 +-------------------
 gdk/win32/gdkscreen-win32.c          |   28 ------
 gdk/x11/gdkdnd-x11.c                 |    4 +-
 gdk/x11/gdkscreen-x11.c              |  110 +++++------------------
 gdk/x11/gdkscreen-x11.h              |    3 -
 modules/input/gtkimcontextxim.c      |    2 +-
 14 files changed, 43 insertions(+), 464 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index f26c22d..ea8808b 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -22,12 +22,6 @@ gdk_get_display
 <SUBSECTION>
 gdk_flush
 
-<SUBSECTION>
-gdk_screen_width
-gdk_screen_height
-gdk_screen_width_mm
-gdk_screen_height_mm
-
 
 <SUBSECTION>
 gdk_pointer_grab
@@ -211,10 +205,6 @@ gdk_screen_is_composited
 gdk_screen_get_root_window
 gdk_screen_get_display
 gdk_screen_get_number
-gdk_screen_get_width
-gdk_screen_get_height
-gdk_screen_get_width_mm
-gdk_screen_get_height_mm
 gdk_screen_list_visuals
 gdk_screen_get_toplevel_windows
 gdk_screen_make_display_name
diff --git a/gdk/broadway/gdkscreen-broadway.c b/gdk/broadway/gdkscreen-broadway.c
index c123d98..81e1a58 100644
--- a/gdk/broadway/gdkscreen-broadway.c
+++ b/gdk/broadway/gdkscreen-broadway.c
@@ -40,8 +40,6 @@ G_DEFINE_TYPE (GdkBroadwayScreen, gdk_broadway_screen, GDK_TYPE_SCREEN)
 static void
 gdk_broadway_screen_init (GdkBroadwayScreen *screen)
 {
-  screen->width = 1024;
-  screen->height = 768;
 }
 
 static GdkDisplay *
@@ -51,30 +49,6 @@ gdk_broadway_screen_get_display (GdkScreen *screen)
 }
 
 static gint
-gdk_broadway_screen_get_width (GdkScreen *screen)
-{
-  return GDK_BROADWAY_SCREEN (screen)->width;
-}
-
-static gint
-gdk_broadway_screen_get_height (GdkScreen *screen)
-{
-  return GDK_BROADWAY_SCREEN (screen)->height;
-}
-
-static gint
-gdk_broadway_screen_get_width_mm (GdkScreen *screen)
-{
-  return gdk_screen_get_width (screen) * 25.4 / 96;
-}
-
-static gint
-gdk_broadway_screen_get_height_mm (GdkScreen *screen)
-{
-  return gdk_screen_get_height (screen) * 25.4 / 96;
-}
-
-static gint
 gdk_broadway_screen_get_number (GdkScreen *screen)
 {
   return 0;
@@ -92,25 +66,19 @@ _gdk_broadway_screen_size_changed (GdkScreen                       *screen,
 {
   GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
   GdkMonitor *monitor;
-  gint width, height;
+  GdkRectangle size;
   GList *toplevels, *l;
 
-  width = gdk_screen_get_width (screen);
-  height = gdk_screen_get_height (screen);
-
-  broadway_screen->width   = msg->width;
-  broadway_screen->height  = msg->height;
+  monitor = GDK_BROADWAY_DISPLAY (broadway_screen->display)->monitor;
+  gdk_monitor_get_geometry (monitor, &size);
 
-  if (width == gdk_screen_get_width (screen) &&
-      height == gdk_screen_get_height (screen))
+  if (msg->width == size.width &&
+      msg->height == size.height)
     return;
 
-  monitor = GDK_BROADWAY_DISPLAY (broadway_screen->display)->monitor;
-
   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);
 
-  g_signal_emit_by_name (screen, "size-changed");
   toplevels = gdk_screen_get_toplevel_windows (screen);
   for (l = toplevels; l != NULL; l = l->next)
     {
@@ -118,9 +86,7 @@ _gdk_broadway_screen_size_changed (GdkScreen                       *screen,
       GdkWindowImplBroadway *toplevel_impl = GDK_WINDOW_IMPL_BROADWAY (toplevel->impl);
 
       if (toplevel_impl->maximized)
-       gdk_window_move_resize (toplevel, 0, 0,
-                               gdk_screen_get_width (screen),
-                               gdk_screen_get_height (screen));
+       gdk_window_move_resize (toplevel, 0, 0, msg->width, msg->height);
     }
 }
 
@@ -241,10 +207,6 @@ gdk_broadway_screen_class_init (GdkBroadwayScreenClass *klass)
   object_class->finalize = gdk_broadway_screen_finalize;
 
   screen_class->get_display = gdk_broadway_screen_get_display;
-  screen_class->get_width = gdk_broadway_screen_get_width;
-  screen_class->get_height = gdk_broadway_screen_get_height;
-  screen_class->get_width_mm = gdk_broadway_screen_get_width_mm;
-  screen_class->get_height_mm = gdk_broadway_screen_get_height_mm;
   screen_class->get_number = gdk_broadway_screen_get_number;
   screen_class->get_root_window = gdk_broadway_screen_get_root_window;
   screen_class->is_composited = gdk_broadway_screen_is_composited;
diff --git a/gdk/broadway/gdkscreen-broadway.h b/gdk/broadway/gdkscreen-broadway.h
index 45dd36d..12c7f2f 100644
--- a/gdk/broadway/gdkscreen-broadway.h
+++ b/gdk/broadway/gdkscreen-broadway.h
@@ -47,9 +47,6 @@ struct _GdkBroadwayScreen
   GdkDisplay *display;
   GdkWindow *root_window;
 
-  int width;
-  int height;
-
   /* Visual Part */
   GdkVisual **visuals;
   gint nvisuals;
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 32d1a07..e6b878f 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -231,8 +231,8 @@ _gdk_broadway_screen_init_root_window (GdkScreen * screen)
   window->y = 0;
   window->abs_x = 0;
   window->abs_y = 0;
-  window->width = gdk_screen_get_width (screen);
-  window->height = gdk_screen_get_height (screen);
+  window->width = 1024;
+  window->height = 768;
   window->viewable = TRUE;
 
   _gdk_window_update_size (broadway_screen->root_window);
@@ -887,7 +887,9 @@ static void
 gdk_broadway_window_maximize (GdkWindow *window)
 {
   GdkWindowImplBroadway *impl;
-  GdkScreen *screen;
+  GdkDisplay *display;
+  GdkMonitor *monitor;
+  GdkRectangle geom;
 
   if (GDK_WINDOW_DESTROYED (window) ||
       !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
@@ -907,11 +909,13 @@ gdk_broadway_window_maximize (GdkWindow *window)
   impl->pre_maximize_width = window->width;
   impl->pre_maximize_height = window->height;
 
-  screen = gdk_window_get_screen (window);
+  display = gdk_window_get_display (window);
+  monitor = gdk_display_get_primary_monitor (display);
+  gdk_monitor_get_geometry (monitor, &geom);
 
-  gdk_window_move_resize (window, 0, 0,
-                         gdk_screen_get_width (screen),
-                         gdk_screen_get_height (screen));
+  gdk_window_move_resize (window,
+                          geom.x, geom.y,
+                          geom.width, geom.height);
 }
 
 static void
diff --git a/gdk/gdkmain.h b/gdk/gdkmain.h
index 09e0873..e623dbd 100644
--- a/gdk/gdkmain.h
+++ b/gdk/gdkmain.h
@@ -105,16 +105,6 @@ gboolean      gdk_pointer_is_grabbed (void);
 #endif /* GDK_MULTIDEVICE_SAFE */
 
 GDK_AVAILABLE_IN_ALL
-gint gdk_screen_width  (void) G_GNUC_CONST;
-GDK_AVAILABLE_IN_ALL
-gint gdk_screen_height (void) G_GNUC_CONST;
-
-GDK_AVAILABLE_IN_ALL
-gint gdk_screen_width_mm  (void) G_GNUC_CONST;
-GDK_AVAILABLE_IN_ALL
-gint gdk_screen_height_mm (void) G_GNUC_CONST;
-
-GDK_AVAILABLE_IN_ALL
 void gdk_set_double_click_time (guint msec);
 
 GDK_AVAILABLE_IN_ALL
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c
index 6432fce..d198afc 100644
--- a/gdk/gdkscreen.c
+++ b/gdk/gdkscreen.c
@@ -105,25 +105,6 @@ gdk_screen_class_init (GdkScreenClass *klass)
                                                        G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
 
   /**
-   * GdkScreen::size-changed:
-   * @screen: the object on which the signal is emitted
-   * 
-   * The ::size-changed signal is emitted when the pixel width or 
-   * height of a screen changes.
-   *
-   * Since: 2.2
-   */
-  signals[SIZE_CHANGED] =
-    g_signal_new (g_intern_static_string ("size-changed"),
-                  G_OBJECT_CLASS_TYPE (klass),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (GdkScreenClass, size_changed),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE,
-                  0);
-
-  /**
    * GdkScreen::composited-changed:
    * @screen: the object on which the signal is emitted
    *
@@ -195,66 +176,6 @@ _gdk_screen_close (GdkScreen *screen)
 }
 
 /**
- * gdk_screen_width:
- *
- * Gets the width of the default screen in pixels. The returned
- * size is in ”application pixels”, not in ”device pixels” (see
- * gdk_screen_get_monitor_scale_factor()).
- *
- * Returns: the width of the default screen in pixels.
- **/
-gint
-gdk_screen_width (void)
-{
-  return gdk_screen_get_width (gdk_screen_get_default ());
-}
-
-/**
- * gdk_screen_height:
- *
- * Gets the height of the default screen in pixels. The returned
- * size is in ”application pixels”, not in ”device pixels” (see
- * gdk_screen_get_monitor_scale_factor()).
- *
- * Returns: the height of the default screen in pixels.
- **/
-gint
-gdk_screen_height (void)
-{
-  return gdk_screen_get_height (gdk_screen_get_default ());
-}
-
-/**
- * gdk_screen_width_mm:
- *
- * Returns the width of the default screen in millimeters.
- * Note that on many X servers this value will not be correct.
- *
- * Returns: the width of the default screen in millimeters,
- * though it is not always correct.
- **/
-gint
-gdk_screen_width_mm (void)
-{
-  return gdk_screen_get_width_mm (gdk_screen_get_default ());
-}
-
-/**
- * gdk_screen_height_mm:
- *
- * Returns the height of the default screen in millimeters.
- * Note that on many X servers this value will not be correct.
- *
- * Returns: the height of the default screen in millimeters,
- * though it is not always correct.
- **/
-gint
-gdk_screen_height_mm (void)
-{
-  return gdk_screen_get_height_mm (gdk_screen_get_default ());
-}
-
-/**
  * gdk_screen_set_font_options:
  * @screen: a #GdkScreen
  * @options: (allow-none): a #cairo_font_options_t, or %NULL to unset any
@@ -444,91 +365,6 @@ gdk_screen_get_display (GdkScreen *screen)
   return GDK_SCREEN_GET_CLASS (screen)->get_display (screen);
 }
 
-
-/**
- * gdk_screen_get_width:
- * @screen: a #GdkScreen
- *
- * Gets the width of @screen in pixels. The returned size is in
- * ”application pixels”, not in ”device pixels” (see
- * gdk_screen_get_monitor_scale_factor()).
- *
- * Returns: the width of @screen in pixels.
- *
- * Since: 2.2
- **/
-gint
-gdk_screen_get_width (GdkScreen *screen)
-{
-  g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
-  return GDK_SCREEN_GET_CLASS (screen)->get_width (screen);
-}
-
-/**
- * gdk_screen_get_height:
- * @screen: a #GdkScreen
- *
- * Gets the height of @screen in pixels. The returned size is in
- * ”application pixels”, not in ”device pixels” (see
- * gdk_screen_get_monitor_scale_factor()).
- *
- * Returns: the height of @screen in pixels.
- *
- * Since: 2.2
- **/
-gint
-gdk_screen_get_height (GdkScreen *screen)
-{
-  g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
-  return GDK_SCREEN_GET_CLASS (screen)->get_height (screen);
-}
-
-/**
- * gdk_screen_get_width_mm:
- * @screen: a #GdkScreen
- *
- * Gets the width of @screen in millimeters.
- *
- * Note that this value is somewhat ill-defined when the screen
- * has multiple monitors of different resolution. It is recommended
- * to use the monitor dimensions instead.
- *
- * Returns: the width of @screen in millimeters.
- *
- * Since: 2.2
- **/
-gint
-gdk_screen_get_width_mm (GdkScreen *screen)
-{
-  g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
-  return GDK_SCREEN_GET_CLASS (screen)->get_width_mm (screen);
-}
-
-/**
- * gdk_screen_get_height_mm:
- * @screen: a #GdkScreen
- *
- * Returns the height of @screen in millimeters.
- *
- * Note that this value is somewhat ill-defined when the screen
- * has multiple monitors of different resolution. It is recommended
- * to use the monitor dimensions instead.
- *
- * Returns: the heigth of @screen in millimeters.
- *
- * Since: 2.2
- **/
-gint
-gdk_screen_get_height_mm (GdkScreen *screen)
-{
-  g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
-  return GDK_SCREEN_GET_CLASS (screen)->get_height_mm (screen);
-}
-
 /**
  * gdk_screen_get_number:
  * @screen: a #GdkScreen
diff --git a/gdk/gdkscreen.h b/gdk/gdkscreen.h
index 52df2ad..5f1d7a1 100644
--- a/gdk/gdkscreen.h
+++ b/gdk/gdkscreen.h
@@ -54,14 +54,6 @@ GDK_AVAILABLE_IN_ALL
 GdkDisplay * gdk_screen_get_display           (GdkScreen   *screen);
 GDK_AVAILABLE_IN_ALL
 gint         gdk_screen_get_number            (GdkScreen   *screen);
-GDK_AVAILABLE_IN_ALL
-gint         gdk_screen_get_width             (GdkScreen   *screen);
-GDK_AVAILABLE_IN_ALL
-gint         gdk_screen_get_height            (GdkScreen   *screen);
-GDK_AVAILABLE_IN_ALL
-gint         gdk_screen_get_width_mm          (GdkScreen   *screen);
-GDK_AVAILABLE_IN_ALL
-gint         gdk_screen_get_height_mm         (GdkScreen   *screen);
 
 GDK_AVAILABLE_IN_ALL
 GList *      gdk_screen_list_visuals          (GdkScreen   *screen);
diff --git a/gdk/gdkscreenprivate.h b/gdk/gdkscreenprivate.h
index 15c4056..05a18aa 100644
--- a/gdk/gdkscreenprivate.h
+++ b/gdk/gdkscreenprivate.h
@@ -44,10 +44,6 @@ struct _GdkScreenClass
   GObjectClass parent_class;
 
   GdkDisplay * (* get_display)           (GdkScreen *screen);
-  gint         (* get_width)             (GdkScreen *screen);
-  gint         (* get_height)            (GdkScreen *screen);
-  gint         (* get_width_mm)          (GdkScreen *screen);
-  gint         (* get_height_mm)         (GdkScreen *screen);
   gint         (* get_number)            (GdkScreen *screen);
   GdkWindow *  (* get_root_window)       (GdkScreen *screen);
   gint         (* get_n_monitors)        (GdkScreen *screen);
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 6c8b8b9..8d0a19b 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -58,9 +58,6 @@ struct _GdkWaylandScreen
   GdkDisplay *display;
   GdkWindow *root_window;
 
-  int width, height;
-  int width_mm, height_mm;
-
   /* Visual Part */
   GdkVisual *visual;
 
@@ -115,30 +112,6 @@ gdk_wayland_screen_get_display (GdkScreen *screen)
 }
 
 static gint
-gdk_wayland_screen_get_width (GdkScreen *screen)
-{
-  return GDK_WAYLAND_SCREEN (screen)->width;
-}
-
-static gint
-gdk_wayland_screen_get_height (GdkScreen *screen)
-{
-  return GDK_WAYLAND_SCREEN (screen)->height;
-}
-
-static gint
-gdk_wayland_screen_get_width_mm (GdkScreen *screen)
-{
-  return GDK_WAYLAND_SCREEN (screen)->width_mm;
-}
-
-static gint
-gdk_wayland_screen_get_height_mm (GdkScreen *screen)
-{
-  return GDK_WAYLAND_SCREEN (screen)->height_mm;
-}
-
-static gint
 gdk_wayland_screen_get_number (GdkScreen *screen)
 {
   return 0;
@@ -826,15 +799,11 @@ _gdk_wayland_screen_new (GdkDisplay *display)
 
   screen_wayland = GDK_WAYLAND_SCREEN (screen);
   screen_wayland->display = display;
-  screen_wayland->width = 0;
-  screen_wayland->height = 0;
 
   screen_wayland->visual = gdk_wayland_visual_new (screen);
 
   screen_wayland->root_window =
-    _gdk_wayland_screen_create_root_window (screen,
-                                            screen_wayland->width,
-                                            screen_wayland->height);
+    _gdk_wayland_screen_create_root_window (screen, 0, 0);
 
   init_settings (screen);
 
@@ -851,10 +820,6 @@ _gdk_wayland_screen_class_init (GdkWaylandScreenClass *klass)
   object_class->finalize = gdk_wayland_screen_finalize;
 
   screen_class->get_display = gdk_wayland_screen_get_display;
-  screen_class->get_width = gdk_wayland_screen_get_width;
-  screen_class->get_height = gdk_wayland_screen_get_height;
-  screen_class->get_width_mm = gdk_wayland_screen_get_width_mm;
-  screen_class->get_height_mm = gdk_wayland_screen_get_height_mm;
   screen_class->get_number = gdk_wayland_screen_get_number;
   screen_class->get_root_window = gdk_wayland_screen_get_root_window;
   screen_class->get_system_visual = gdk_wayland_screen_get_system_visual;
@@ -881,58 +846,6 @@ _gdk_wayland_screen_init (GdkWaylandScreen *screen_wayland)
 {
 }
 
-static void
-update_screen_size (GdkWaylandScreen *screen_wayland)
-{
-  GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (screen_wayland->display);
-  gboolean emit_changed = FALSE;
-  gint width, height;
-  gint width_mm, height_mm;
-  int i;
-
-  width = height = 0;
-  width_mm = height_mm = 0;
-  for (i = 0; i < display_wayland->monitors->len; i++)
-    {
-      GdkMonitor *monitor = display_wayland->monitors->pdata[i];
-
-      /* XXX: Largely assuming here that monitor areas
-       * are contiguous and never overlap.
-       */
-      if (monitor->geometry.x > 0)
-        width_mm += monitor->width_mm;
-      else
-        width_mm = MAX (width_mm, monitor->width_mm);
-
-      if (monitor->geometry.y > 0)
-        height_mm += monitor->height_mm;
-      else
-        height_mm = MAX (height_mm, monitor->height_mm);
-
-      width = MAX (width, monitor->geometry.x + monitor->geometry.width);
-      height = MAX (height, monitor->geometry.y + monitor->geometry.height);
-    }
-
-  if (screen_wayland->width_mm != width_mm ||
-      screen_wayland->height_mm != height_mm)
-    {
-      emit_changed = TRUE;
-      screen_wayland->width_mm = width_mm;
-      screen_wayland->height_mm = height_mm;
-    }
-
-  if (screen_wayland->width != width ||
-      screen_wayland->height != height)
-    {
-      emit_changed = TRUE;
-      screen_wayland->width = width;
-      screen_wayland->height = height;
-    }
-
-  if (emit_changed)
-    g_signal_emit_by_name (screen_wayland, "size-changed");
-}
-
 #ifdef G_ENABLE_DEBUG
 
 static const char *
@@ -1012,7 +925,6 @@ output_handle_geometry (void             *data,
       GdkDisplay *display = GDK_MONITOR (monitor)->display;
       GdkWaylandScreen *screen = GDK_WAYLAND_SCREEN (gdk_display_get_default_screen (display));
       g_signal_emit_by_name (screen, "monitors-changed");
-      update_screen_size (screen);
     }
 }
 
@@ -1035,7 +947,6 @@ output_handle_done (void             *data,
     }
 
   g_signal_emit_by_name (screen_wayland, "monitors-changed");
-  update_screen_size (screen_wayland);
 }
 
 static void
@@ -1081,7 +992,6 @@ output_handle_mode (void             *data,
     {
       GdkScreen *screen = gdk_display_get_default_screen (GDK_MONITOR (monitor)->display);
       g_signal_emit_by_name (screen, "monitors-changed");
-      update_screen_size (GDK_WAYLAND_SCREEN (screen));
     }
 }
 
@@ -1183,7 +1093,6 @@ _gdk_wayland_screen_remove_output (GdkScreen *screen,
       gdk_display_monitor_removed (GDK_DISPLAY (display_wayland), GDK_MONITOR (monitor));
       g_object_unref (monitor);
       g_signal_emit_by_name (screen_wayland, "monitors-changed");
-      update_screen_size (screen_wayland);
     }
 }
 
diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c
index 0b5d104..de6e5ae 100644
--- a/gdk/win32/gdkscreen-win32.c
+++ b/gdk/win32/gdkscreen-win32.c
@@ -380,30 +380,6 @@ gdk_win32_screen_get_display (GdkScreen *screen)
   return _gdk_display;
 }
 
-static gint
-gdk_win32_screen_get_width (GdkScreen *screen)
-{
-  return GDK_WIN32_SCREEN (screen)->root_window->width;
-}
-
-static gint
-gdk_win32_screen_get_height (GdkScreen *screen)
-{
-  return GDK_WIN32_SCREEN (screen)->root_window->height;
-}
-
-static gint
-gdk_win32_screen_get_width_mm (GdkScreen *screen)
-{
-  return (double) gdk_screen_get_width (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSX) * 25.4;
-}
-
-static gint
-gdk_win32_screen_get_height_mm (GdkScreen *screen)
-{
-  return (double) gdk_screen_get_height (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSY) * 25.4;
-}
-
 static GdkWindow *
 gdk_win32_screen_get_root_window (GdkScreen *screen)
 {
@@ -573,10 +549,6 @@ gdk_win32_screen_class_init (GdkWin32ScreenClass *klass)
   object_class->finalize = gdk_win32_screen_finalize;
 
   screen_class->get_display = gdk_win32_screen_get_display;
-  screen_class->get_width = gdk_win32_screen_get_width;
-  screen_class->get_height = gdk_win32_screen_get_height;
-  screen_class->get_width_mm = gdk_win32_screen_get_width_mm;
-  screen_class->get_height_mm = gdk_win32_screen_get_height_mm;
   screen_class->get_number = gdk_win32_screen_get_number;
   screen_class->get_root_window = gdk_win32_screen_get_root_window;
   screen_class->is_composited = gdk_win32_screen_is_composited;
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 4399818..bb322c4 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -638,8 +638,8 @@ gdk_window_cache_new (GdkScreen *screen)
     {
       cow = XCompositeGetOverlayWindow (xdisplay, GDK_WINDOW_XID (root_window));
       gdk_window_cache_add (result, cow, 0, 0, 
-                           gdk_screen_get_width (screen) * GDK_X11_SCREEN(screen)->window_scale, 
-                           gdk_screen_get_height (screen) * GDK_X11_SCREEN(screen)->window_scale, 
+                           gdk_window_get_width (root_window) * GDK_X11_SCREEN(screen)->window_scale, 
+                           gdk_window_get_height (root_window) * GDK_X11_SCREEN(screen)->window_scale, 
                            TRUE);
       XCompositeReleaseOverlayWindow (xdisplay, GDK_WINDOW_XID (root_window));
     }
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 43e9705..37bc397 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -80,30 +80,6 @@ gdk_x11_screen_get_display (GdkScreen *screen)
 }
 
 static gint
-gdk_x11_screen_get_width (GdkScreen *screen)
-{
-  return GDK_X11_SCREEN (screen)->width / GDK_X11_SCREEN (screen)->window_scale;
-}
-
-static gint
-gdk_x11_screen_get_height (GdkScreen *screen)
-{
-  return GDK_X11_SCREEN (screen)->height / GDK_X11_SCREEN (screen)->window_scale;
-}
-
-static gint
-gdk_x11_screen_get_width_mm (GdkScreen *screen)
-{
-  return WidthMMOfScreen (GDK_X11_SCREEN (screen)->xscreen);
-}
-
-static gint
-gdk_x11_screen_get_height_mm (GdkScreen *screen)
-{
-  return HeightMMOfScreen (GDK_X11_SCREEN (screen)->xscreen);
-}
-
-static gint
 gdk_x11_screen_get_number (GdkScreen *screen)
 {
   return GDK_X11_SCREEN (screen)->screen_num;
@@ -238,6 +214,7 @@ gdk_x11_screen_get_work_area (GdkScreen    *screen,
                               GdkRectangle *area)
 {
   GdkX11Screen   *x11_screen = GDK_X11_SCREEN (screen);
+  GdkWindow      *root_window;
   Atom            workarea;
   Atom            type;
   Window          win;
@@ -254,13 +231,14 @@ gdk_x11_screen_get_work_area (GdkScreen    *screen,
 
   display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
   disp_screen = GDK_SCREEN_XNUMBER (screen);
+  root_window = gdk_screen_get_root_window (screen);
   workarea = XInternAtom (display, "_NET_WORKAREA", True);
 
   /* Defaults in case of error */
   area->x = 0;
   area->y = 0;
-  area->width = gdk_screen_get_width (screen);
-  area->height = gdk_screen_get_height (screen);
+  area->width = gdk_window_get_width (root_window);
+  area->height = gdk_window_get_height (root_window);
 
   if (!gdk_x11_screen_supports_net_wm_hint (screen,
                                             gdk_atom_intern_static_string ("_NET_WORKAREA")))
@@ -788,9 +766,13 @@ 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 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];
@@ -811,23 +793,24 @@ init_no_multihead (GdkScreen *screen, gboolean *changed)
       g_ptr_array_add (x11_display->monitors, monitor);
     }
 
+  width_mm = WidthMMOfScreen (x11_screen->xscreen);
+  height_mm = HeightMMOfScreen (x11_screen->xscreen);
+
   gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry);
   if (0 != geometry.x ||
       0 != geometry.y ||
-      gdk_screen_get_width (screen) != geometry.width ||
-      gdk_screen_get_height (screen) != geometry.height ||
-      gdk_screen_get_width_mm (screen) != gdk_monitor_get_width_mm (GDK_MONITOR (monitor)) ||
-      gdk_screen_get_height_mm (screen) != gdk_monitor_get_height_mm (GDK_MONITOR (monitor)))
+      gdk_window_get_width (root_window) != geometry.width ||
+      gdk_window_get_height (root_window) != 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_screen_get_width (screen),
-                        gdk_screen_get_height (screen));
+                        gdk_window_get_width (root_window),
+                        gdk_window_get_height (root_window));
   g_object_notify (G_OBJECT (monitor), "workarea");
-  gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
-                                 gdk_screen_get_width_mm (screen),
-                                 gdk_screen_get_height_mm (screen));
+  gdk_monitor_set_physical_size (GDK_MONITOR (monitor), width_mm, height_mm);
   gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->window_scale);
 
   if (x11_display->primary_monitor != 0)
@@ -865,32 +848,6 @@ init_multihead (GdkScreen *screen)
   return any_changed;
 }
 
-static void
-update_bounding_box (GdkScreen *screen)
-{
-  GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
-  GdkX11Display *x11_display = GDK_X11_DISPLAY (x11_screen->display);
-  gint i, x1, y1, x2, y2;
-
-  x1 = y1 = G_MAXINT;
-  x2 = y2 = G_MININT;
-
-  for (i = 0; i < x11_display->monitors->len; i++)
-    {
-      GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
-      GdkRectangle geometry;
-
-      gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry);
-      x1 = MIN (x1, geometry.x);
-      y1 = MIN (y1, geometry.y);
-      x2 = MAX (x2, geometry.x + geometry.width);
-      y2 = MAX (y2, geometry.y + geometry.height);
-    }
-
-  x11_screen->width = x2 - x1;
-  x11_screen->height = y2 - y1;
-}
-
 GdkScreen *
 _gdk_x11_screen_new (GdkDisplay *display,
                     gint        screen_number) 
@@ -928,7 +885,6 @@ _gdk_x11_screen_new (GdkDisplay *display,
 
   _gdk_x11_screen_init_visuals (screen);
   _gdk_x11_screen_init_root_window (screen);
-  update_bounding_box (screen);
 
   return screen;
 }
@@ -1019,7 +975,6 @@ process_monitors_change (GdkScreen *screen)
 {
   if (init_multihead (screen))
     {
-      update_bounding_box (screen);
       g_signal_emit_by_name (screen, "monitors-changed");
     }
 }
@@ -1028,15 +983,9 @@ void
 _gdk_x11_screen_size_changed (GdkScreen *screen,
                              XEvent    *event)
 {
-  gint width, height;
 #ifdef HAVE_RANDR
   GdkX11Display *display_x11;
-#endif
 
-  width = gdk_screen_get_width (screen);
-  height = gdk_screen_get_height (screen);
-
-#ifdef HAVE_RANDR
   display_x11 = GDK_X11_DISPLAY (gdk_screen_get_display (screen));
 
   if (display_x11->have_randr13 && event->type == ConfigureNotify)
@@ -1044,23 +993,11 @@ _gdk_x11_screen_size_changed (GdkScreen *screen,
 
   XRRUpdateConfiguration (event);
 #else
-  if (event->type == ConfigureNotify)
-    {
-      XConfigureEvent *rcevent = (XConfigureEvent *) event;
-      Screen       *xscreen = gdk_x11_screen_get_xscreen (screen);
-
-      xscreen->width   = rcevent->width;
-      xscreen->height  = rcevent->height;
-    }
-  else
+  if (event->type != ConfigureNotify)
     return;
 #endif
 
   process_monitors_change (screen);
-
-  if (width != gdk_screen_get_width (screen) ||
-      height != gdk_screen_get_height (screen))
-    g_signal_emit_by_name (screen, "size-changed");
 }
 
 void
@@ -1071,8 +1008,9 @@ _gdk_x11_screen_get_edge_monitors (GdkScreen *screen,
                                    gint      *right)
 {
   GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
-  gint          top_most_pos = x11_screen->height;
-  gint          left_most_pos = x11_screen->width;
+  GdkWindow    *root_window = gdk_screen_get_root_window (screen);
+  gint          top_most_pos = gdk_window_get_height (root_window);
+  gint          left_most_pos = gdk_window_get_width (root_window);
   gint          bottom_most_pos = 0;
   gint          right_most_pos = 0;
   gint          i;
@@ -1569,10 +1507,6 @@ gdk_x11_screen_class_init (GdkX11ScreenClass *klass)
   object_class->finalize = gdk_x11_screen_finalize;
 
   screen_class->get_display = gdk_x11_screen_get_display;
-  screen_class->get_width = gdk_x11_screen_get_width;
-  screen_class->get_height = gdk_x11_screen_get_height;
-  screen_class->get_width_mm = gdk_x11_screen_get_width_mm;
-  screen_class->get_height_mm = gdk_x11_screen_get_height_mm;
   screen_class->get_number = gdk_x11_screen_get_number;
   screen_class->get_root_window = gdk_x11_screen_get_root_window;
   screen_class->get_system_visual = _gdk_x11_screen_get_system_visual;
diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h
index 3b0fb35..d94d14a 100644
--- a/gdk/x11/gdkscreen-x11.h
+++ b/gdk/x11/gdkscreen-x11.h
@@ -43,9 +43,6 @@ struct _GdkX11Screen
   GdkWindow *root_window;
   gint screen_num;
 
-  gint width;
-  gint height;
-
   gint window_scale;
   gboolean fixed_window_scale;
 
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c
index 9a152b5..4519d13 100644
--- a/modules/input/gtkimcontextxim.c
+++ b/modules/input/gtkimcontextxim.c
@@ -1624,7 +1624,7 @@ on_status_toplevel_configure (GtkWidget         *toplevel,
 
   if (status_window->window)
     {
-      height = gdk_screen_get_height (gtk_widget_get_screen (toplevel));
+      height = gdk_window_get_height (gdk_screen_get_root_window (gtk_widget_get_screen (toplevel)));
 
       gdk_window_get_frame_extents (gtk_widget_get_window (toplevel),
                                     &rect);


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