[gtk/wip/otte/for-master: 2/3] surface: Remove unused gdk_surface_get_unscaled_size()




commit 97fad4523715ab2493a1a48be896ee6d0efd74e6
Author: Benjamin Otte <otte redhat com>
Date:   Mon Mar 15 02:56:28 2021 +0100

    surface: Remove unused gdk_surface_get_unscaled_size()
    
    Also remove unscaled_width/height members in the win32 backend.
    
    Both of those are unused.

 gdk/gdksurface.c             | 31 -------------------------------
 gdk/gdksurfaceprivate.h      |  6 ------
 gdk/win32/gdksurface-win32.c | 30 ++++--------------------------
 gdk/win32/gdksurface-win32.h |  2 --
 gdk/x11/gdksurface-x11.c     | 15 ---------------
 5 files changed, 4 insertions(+), 80 deletions(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 7a4bf47962..6ad438093a 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -2610,37 +2610,6 @@ gdk_surface_get_scale_factor (GdkSurface *surface)
   return 1;
 }
 
-/* Returns the *real* unscaled size, which may be a fractional size
-   in surface scale coordinates. We need this to properly handle GL
-   coordinates which are y-flipped in the real coordinates. */
-void
-gdk_surface_get_unscaled_size (GdkSurface *surface,
-                               int *unscaled_width,
-                               int *unscaled_height)
-{
-  GdkSurfaceClass *class;
-  int scale;
-
-  g_return_if_fail (GDK_IS_SURFACE (surface));
-
-  class = GDK_SURFACE_GET_CLASS (surface);
-
-  if (class->get_unscaled_size)
-    {
-      class->get_unscaled_size (surface, unscaled_width, unscaled_height);
-      return;
-    }
-
-  scale = gdk_surface_get_scale_factor (surface);
-
-  if (unscaled_width)
-    *unscaled_width = surface->width * scale;
-
-  if (unscaled_height)
-    *unscaled_height = surface->height * scale;
-}
-
-
 /**
  * gdk_surface_set_opaque_region:
  * @surface: a top-level `GdkSurface`
diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h
index 2126371853..90f5bcba2d 100644
--- a/gdk/gdksurfaceprivate.h
+++ b/gdk/gdksurfaceprivate.h
@@ -157,9 +157,6 @@ struct _GdkSurfaceClass
                                          double              dy);
 
   int          (* get_scale_factor)       (GdkSurface      *surface);
-  void         (* get_unscaled_size)      (GdkSurface      *surface,
-                                           int            *unscaled_width,
-                                           int            *unscaled_height);
 
   void         (* set_opaque_region)      (GdkSurface      *surface,
                                            cairo_region_t *region);
@@ -271,9 +268,6 @@ GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface,
                                                  GError   **error);
 GdkGLContext * gdk_surface_get_shared_data_gl_context (GdkSurface *surface);
 
-void gdk_surface_get_unscaled_size (GdkSurface *surface,
-                                    int *unscaled_width,
-                                    int *unscaled_height);
 gboolean gdk_surface_handle_event (GdkEvent       *event);
 GdkSeat * gdk_surface_get_seat_from_event (GdkSurface *surface,
                                            GdkEvent    *event);
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index d600996fe2..03250491d4 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -520,8 +520,6 @@ _gdk_win32_display_create_surface (GdkDisplay     *display,
   surface->height = height;
 
   impl->surface_scale = _gdk_win32_display_get_monitor_scale_factor (display_win32, NULL, NULL, NULL);
-  impl->unscaled_width = width * impl->surface_scale;
-  impl->unscaled_height = height * impl->surface_scale;
 
   dwExStyle = 0;
   owner = NULL;
@@ -3969,12 +3967,9 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window,
         {
           int scale = impl->surface_scale;
 
-          impl->unscaled_width = new_rect.right - new_rect.left;
-          impl->unscaled_height = new_rect.bottom - new_rect.top;
-
           impl->next_layout.configured_rect = new_rect;
-          impl->next_layout.configured_width = (impl->unscaled_width + scale - 1) / scale;
-          impl->next_layout.configured_height = (impl->unscaled_height + scale - 1) / scale;
+          impl->next_layout.configured_width = (new_rect.right - new_rect.left + scale - 1) / scale;
+          impl->next_layout.configured_height = (new_rect.bottom - new_rect.top + scale - 1) / scale;
         }
 
       context->native_move_resize_pending = TRUE;
@@ -4476,19 +4471,6 @@ _gdk_win32_surface_get_scale_factor (GdkSurface *window)
     }
 }
 
-void
-_gdk_win32_surface_get_unscaled_size (GdkSurface *window,
-                                    int       *unscaled_width,
-                                    int       *unscaled_height)
-{
-  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
-
-  if (unscaled_width)
-    *unscaled_width = impl->unscaled_width;
-  if (unscaled_height)
-    *unscaled_height = impl->unscaled_height;
-}
-
 static void
 gdk_win32_surface_set_input_region (GdkSurface     *window,
                                     cairo_region_t *input_region)
@@ -4580,11 +4562,8 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
     {
       _gdk_win32_get_window_rect (surface, &rect);
 
-      impl->unscaled_width = rect.right - rect.left;
-      impl->unscaled_height = rect.bottom - rect.top;
-
-      impl->next_layout.configured_width = (impl->unscaled_width + scale - 1) / scale;
-      impl->next_layout.configured_height = (impl->unscaled_height + scale - 1) / scale;
+      impl->next_layout.configured_width = (rect.right - rect.left + scale - 1) / scale;
+      impl->next_layout.configured_height = (rect.bottom - rect.top + scale - 1) / scale;
       surface->x = rect.left / scale;
       surface->y = rect.top / scale;
     }
@@ -4635,7 +4614,6 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
   impl_class->drag_begin = _gdk_win32_surface_drag_begin;
   impl_class->create_gl_context = _gdk_win32_surface_create_gl_context;
   impl_class->get_scale_factor = _gdk_win32_surface_get_scale_factor;
-  impl_class->get_unscaled_size = _gdk_win32_surface_get_unscaled_size;
   impl_class->request_layout = _gdk_win32_surface_request_layout;
   impl_class->compute_size = _gdk_win32_surface_compute_size;
 }
diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h
index 6be358338b..5f85c50373 100644
--- a/gdk/win32/gdksurface-win32.h
+++ b/gdk/win32/gdksurface-win32.h
@@ -335,8 +335,6 @@ struct _GdkWin32Surface
 
   /* scale of window on HiDPI */
   int surface_scale;
-  int unscaled_width;
-  int unscaled_height;
 
   GdkToplevelLayout *toplevel_layout;
   struct {
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 92a0a23d6c..e07bd15a6d 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -194,20 +194,6 @@ _gdk_x11_surface_update_size (GdkX11Surface *impl)
     }
 }
 
-static void
-gdk_x11_surface_get_unscaled_size (GdkSurface *surface,
-                                  int *unscaled_width,
-                                  int *unscaled_height)
-{
-  GdkX11Surface *impl = GDK_X11_SURFACE (surface);
-
-  if (unscaled_width)
-    *unscaled_width = impl->unscaled_width;
-
-  if (unscaled_height)
-    *unscaled_height = impl->unscaled_height;
-}
-
 static void
 update_shadow_size (GdkSurface *surface,
                     int         shadow_left,
@@ -4802,7 +4788,6 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
   impl_class->get_scale_factor = gdk_x11_surface_get_scale_factor;
   impl_class->set_opaque_region = gdk_x11_surface_set_opaque_region;
   impl_class->create_gl_context = gdk_x11_surface_create_gl_context;
-  impl_class->get_unscaled_size = gdk_x11_surface_get_unscaled_size;
   impl_class->request_layout = gdk_x11_surface_request_layout;
   impl_class->compute_size = gdk_x11_surface_compute_size;
 }


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