Drop gdk_surface_get_frame_extents

No longer used.
This commit is contained in:
Matthias Clasen 2019-05-29 00:53:10 -04:00
parent f0ef5332be
commit 987e7878a2
7 changed files with 23 additions and 128 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;