[gtk/global-coords] Drop gdk_surface_get_frame_extents



commit 52688f4dcc666115bc37cbeebe417d2a1e8fa81f
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed May 29 00:53:10 2019 -0400

    Drop gdk_surface_get_frame_extents
    
    No longer used.

 docs/reference/gdk/gdk4-sections.txt |  1 -
 gdk/broadway/gdksurface-broadway.c   | 61 +++++++++++++-----------------------
 gdk/gdksurface.c                     | 18 -----------
 gdk/gdksurface.h                     |  4 ---
 gdk/wayland/gdksurface-wayland.c     | 13 --------
 gdk/win32/gdksurface-win32.c         | 51 ------------------------------
 gdk/x11/gdksurface-x11.c             |  3 +-
 7 files changed, 23 insertions(+), 128 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 2faede76a7..0ae697f894 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -256,7 +256,6 @@ gdk_surface_set_type_hint
 gdk_surface_get_type_hint
 gdk_surface_set_shadow_width
 gdk_surface_get_position
-gdk_surface_get_frame_extents
 gdk_surface_get_origin
 gdk_surface_get_device_position
 GdkModifierType
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index a0dbc3036b..88f1b9de85 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -559,20 +559,6 @@ gdk_broadway_surface_get_root_coords (GdkSurface *surface,
     *root_y = y + surface->y;
 }
 
-static void
-gdk_broadway_surface_get_frame_extents (GdkSurface   *surface,
-                                        GdkRectangle *rect)
-{
-  g_return_if_fail (rect != NULL);
-
-  /* TODO: This should take wm frame into account */
-
-  rect->x = surface->x;
-  rect->y = surface->y;
-  rect->width = surface->width;
-  rect->height = surface->height;
-}
-
 static gboolean
 gdk_broadway_surface_get_device_state (GdkSurface      *surface,
                                        GdkDevice       *device,
@@ -1132,8 +1118,7 @@ create_moveresize_surface (MoveResizeData *mv_resize,
 static void
 calculate_unmoving_origin (MoveResizeData *mv_resize)
 {
-  GdkRectangle rect;
-  gint width, height;
+  gint x, y, width, height;
 
   if (mv_resize->moveresize_geom_mask & GDK_HINT_WIN_GRAVITY &&
       mv_resize->moveresize_geometry.win_gravity == GDK_GRAVITY_STATIC)
@@ -1144,52 +1129,51 @@ calculate_unmoving_origin (MoveResizeData *mv_resize)
     }
   else
     {
-      gdk_surface_get_frame_extents (mv_resize->moveresize_surface, &rect);
       gdk_surface_get_geometry (mv_resize->moveresize_surface,
-                               NULL, NULL, &width, &height);
+                                &x, &y, &width, &height);
 
       switch (mv_resize->moveresize_geometry.win_gravity)
         {
         case GDK_GRAVITY_NORTH_WEST:
-          mv_resize->moveresize_orig_x = rect.x;
-          mv_resize->moveresize_orig_y = rect.y;
+          mv_resize->moveresize_orig_x = x;
+          mv_resize->moveresize_orig_y = y;
           break;
         case GDK_GRAVITY_NORTH:
-          mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
-          mv_resize->moveresize_orig_y = rect.y;
+          mv_resize->moveresize_orig_x = x + width / 2;
+          mv_resize->moveresize_orig_y = y;
           break;
         case GDK_GRAVITY_NORTH_EAST:
-          mv_resize->moveresize_orig_x = rect.x + rect.width - width;
-          mv_resize->moveresize_orig_y = rect.y;
+          mv_resize->moveresize_orig_x = x = width;
+          mv_resize->moveresize_orig_y = y;
           break;
         case GDK_GRAVITY_WEST:
-          mv_resize->moveresize_orig_x = rect.x;
-          mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
+          mv_resize->moveresize_orig_x = x;
+          mv_resize->moveresize_orig_y = y + height / 2;
           break;
         case GDK_GRAVITY_CENTER:
-          mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
-          mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
+          mv_resize->moveresize_orig_x = x + width / 2;
+          mv_resize->moveresize_orig_y = y + height / 2;
           break;
         case GDK_GRAVITY_EAST:
-          mv_resize->moveresize_orig_x = rect.x + rect.width - width;
-          mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
+          mv_resize->moveresize_orig_x = x + width;
+          mv_resize->moveresize_orig_y = y + height / 2;
           break;
         case GDK_GRAVITY_SOUTH_WEST:
-          mv_resize->moveresize_orig_x = rect.x;
-          mv_resize->moveresize_orig_y = rect.y + rect.height - height;
+          mv_resize->moveresize_orig_x = x + width;
+          mv_resize->moveresize_orig_y = y + height;
           break;
         case GDK_GRAVITY_SOUTH:
-          mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
-          mv_resize->moveresize_orig_y = rect.y + rect.height - height;
+          mv_resize->moveresize_orig_x = x + width / 2;
+          mv_resize->moveresize_orig_y = y + height;
           break;
         case GDK_GRAVITY_SOUTH_EAST:
-          mv_resize->moveresize_orig_x = rect.x + rect.width - width;
-          mv_resize->moveresize_orig_y = rect.y + rect.height - height;
+          mv_resize->moveresize_orig_x = x;
+          mv_resize->moveresize_orig_y = y + height;
           break;
         case GDK_GRAVITY_STATIC:
         default:
-          mv_resize->moveresize_orig_x = rect.x;
-          mv_resize->moveresize_orig_y = rect.y;
+          mv_resize->moveresize_orig_x = x;
+          mv_resize->moveresize_orig_y = y;
           break;
         }
     }
@@ -1343,7 +1327,6 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
   impl_class->set_title = gdk_broadway_surface_set_title;
   impl_class->set_startup_id = gdk_broadway_surface_set_startup_id;
   impl_class->set_transient_for = gdk_broadway_surface_set_transient_for;
-  impl_class->get_frame_extents = gdk_broadway_surface_get_frame_extents;
   impl_class->set_accept_focus = gdk_broadway_surface_set_accept_focus;
   impl_class->set_focus_on_map = gdk_broadway_surface_set_focus_on_map;
   impl_class->set_icon_list = gdk_broadway_surface_set_icon_list;
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 8016dddd57..a65e5bcaea 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -3022,24 +3022,6 @@ gdk_surface_set_transient_for (GdkSurface *surface,
   GDK_SURFACE_GET_CLASS (surface)->set_transient_for (surface, parent);
 }
 
-/**
- * gdk_surface_get_frame_extents:
- * @surface: a toplevel #GdkSurface
- * @rect: (out): rectangle to fill with bounding box of the surface frame
- *
- * Obtains the bounding box of the surface, including window manager
- * titlebar/borders if any. The frame position is given in root window
- * coordinates. To get the position of the surface itself (rather than
- * the frame) in root window coordinates, use gdk_surface_get_origin().
- *
- **/
-void
-gdk_surface_get_frame_extents (GdkSurface    *surface,
-                               GdkRectangle *rect)
-{
-  GDK_SURFACE_GET_CLASS (surface)->get_frame_extents (surface, rect);
-}
-
 /**
  * gdk_surface_set_accept_focus:
  * @surface: a toplevel #GdkSurface
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index acca090683..5d0463da0a 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -562,10 +562,6 @@ gboolean gdk_surface_translate_coordinates (GdkSurface *from,
                                             double     *x,
                                             double     *y);
 
-GDK_AVAILABLE_IN_ALL
-void          gdk_surface_get_frame_extents (GdkSurface     *surface,
-                                             GdkRectangle  *rect);
-
 GDK_AVAILABLE_IN_ALL
 gint          gdk_surface_get_scale_factor  (GdkSurface     *surface);
 
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 0d1f1ba584..658b3569f6 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -3180,18 +3180,6 @@ gdk_wayland_surface_set_transient_for (GdkSurface *surface,
   gdk_wayland_surface_sync_parent (surface, NULL);
 }
 
-static void
-gdk_wayland_surface_get_frame_extents (GdkSurface   *surface,
-                                       GdkRectangle *rect)
-{
-  *rect = (GdkRectangle) {
-    .x = surface->x,
-    .y = surface->y,
-    .width = surface->width,
-    .height = surface->height
-  };
-}
-
 static void
 gdk_wayland_surface_set_accept_focus (GdkSurface *surface,
                                       gboolean    accept_focus)
@@ -3774,7 +3762,6 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
   impl_class->set_title = gdk_wayland_surface_set_title;
   impl_class->set_startup_id = gdk_wayland_surface_set_startup_id;
   impl_class->set_transient_for = gdk_wayland_surface_set_transient_for;
-  impl_class->get_frame_extents = gdk_wayland_surface_get_frame_extents;
   impl_class->set_accept_focus = gdk_wayland_surface_set_accept_focus;
   impl_class->set_focus_on_map = gdk_wayland_surface_set_focus_on_map;
   impl_class->set_icon_list = gdk_wayland_surface_set_icon_list;
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 89402d576d..4336dcbbc7 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -1763,56 +1763,6 @@ gdk_win32_surface_restack_toplevel (GdkSurface *window,
        // ### TODO
 }
 
-static void
-gdk_win32_surface_get_frame_extents (GdkSurface    *window,
-                              GdkRectangle *rect)
-{
-  HWND hwnd;
-  RECT r;
-  GdkWin32Surface *impl;
-
-  g_return_if_fail (GDK_IS_SURFACE (window));
-  g_return_if_fail (rect != NULL);
-
-  rect->x = 0;
-  rect->y = 0;
-  rect->width = 1;
-  rect->height = 1;
-
-  if (GDK_SURFACE_DESTROYED (window))
-    return;
-
-  /* FIXME: window is documented to be a toplevel GdkSurface, so is it really
-   * necessary to walk its parent chain?
-   */
-  while (window->parent && window->parent->parent)
-    window = window->parent;
-
-  impl = GDK_WIN32_SURFACE (window);
-  hwnd = GDK_SURFACE_HWND (window);
-  API_CALL (GetWindowRect, (hwnd, &r));
-
-  /* Initialize to real, unscaled size */
-  rect->x = r.left + _gdk_offset_x * impl->surface_scale;
-  rect->y = r.top + _gdk_offset_y * impl->surface_scale;
-  rect->width = (r.right - r.left);
-  rect->height = (r.bottom - r.top);
-
-  /* Extend width and height to ensure that they cover the real size when de-scaled,
-   * and replace everyting with scaled values
-   */
-  rect->width = (rect->width + rect->x % impl->surface_scale + impl->surface_scale - 1) / 
impl->surface_scale;
-  rect->height = (rect->height + rect->y % impl->surface_scale + impl->surface_scale - 1) / 
impl->surface_scale;
-  rect->x = r.left / impl->surface_scale + _gdk_offset_x;
-  rect->y = r.top / impl->surface_scale + _gdk_offset_y;
-
-  GDK_NOTE (MISC, g_print ("gdk_surface_get_frame_extents: %p: %dx%d@%+d%+d\n",
-                           GDK_SURFACE_HWND (window),
-                           rect->width,
-                           rect->height,
-                           rect->x, rect->y));
-}
-
 static gboolean
 gdk_surface_win32_get_device_state (GdkSurface       *window,
                                    GdkDevice       *device,
@@ -5084,7 +5034,6 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
   impl_class->set_title = gdk_win32_surface_set_title;
   //impl_class->set_startup_id = gdk_x11_surface_set_startup_id;
   impl_class->set_transient_for = gdk_win32_surface_set_transient_for;
-  impl_class->get_frame_extents = gdk_win32_surface_get_frame_extents;
   impl_class->set_accept_focus = gdk_win32_surface_set_accept_focus;
   impl_class->set_focus_on_map = gdk_win32_surface_set_focus_on_map;
   impl_class->set_icon_list = gdk_win32_surface_set_icon_list;
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index aa5082f6bf..f792cd0061 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -4134,7 +4134,7 @@ calculate_unmoving_origin (MoveResizeData *mv_resize)
     }
   else
     {
-      gdk_surface_get_frame_extents (mv_resize->moveresize_surface, &rect);
+      gdk_x11_surface_get_frame_extents (mv_resize->moveresize_surface, &rect);
       gdk_surface_get_geometry (mv_resize->moveresize_surface, 
                               NULL, NULL, &width, &height);
       
@@ -4597,7 +4597,6 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
   impl_class->set_title = gdk_x11_surface_set_title;
   impl_class->set_startup_id = gdk_x11_surface_set_startup_id;
   impl_class->set_transient_for = gdk_x11_surface_set_transient_for;
-  impl_class->get_frame_extents = gdk_x11_surface_get_frame_extents;
   impl_class->set_accept_focus = gdk_x11_surface_set_accept_focus;
   impl_class->set_focus_on_map = gdk_x11_surface_set_focus_on_map;
   impl_class->set_icon_list = gdk_x11_surface_set_icon_list;


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