gdk/surface: Add toplevel_resize vfunc

To separate how toplevels and popups are configured, a first step is to
introduce a resize-only vfunc for backends to implement. It's meant to
only configure toplevel windows, i.e. popups. Currently it's used for
both types, but introducing the resize-only API is a first step.
This commit is contained in:
Jonas Ådahl 2019-07-15 10:54:44 +02:00
parent b062dea1aa
commit 6314ebd435
7 changed files with 53 additions and 1 deletions

View File

@ -424,6 +424,14 @@ gdk_broadway_surface_move_resize (GdkSurface *surface,
} }
} }
static void
gdk_broadway_surface_toplevel_resize (GdkSurface *surface,
gint width,
gint height)
{
gdk_broadway_surface_move_resize (surface, FALSE, 0, 0, width, height);
}
static void static void
gdk_broadway_surface_raise (GdkSurface *surface) gdk_broadway_surface_raise (GdkSurface *surface)
{ {
@ -1312,6 +1320,7 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
impl_class->lower = gdk_broadway_surface_lower; impl_class->lower = gdk_broadway_surface_lower;
impl_class->restack_toplevel = gdk_broadway_surface_restack_toplevel; impl_class->restack_toplevel = gdk_broadway_surface_restack_toplevel;
impl_class->move_resize = gdk_broadway_surface_move_resize; impl_class->move_resize = gdk_broadway_surface_move_resize;
impl_class->toplevel_resize = gdk_broadway_surface_toplevel_resize;
impl_class->get_geometry = gdk_broadway_surface_get_geometry; impl_class->get_geometry = gdk_broadway_surface_get_geometry;
impl_class->get_root_coords = gdk_broadway_surface_get_root_coords; impl_class->get_root_coords = gdk_broadway_surface_get_root_coords;
impl_class->get_device_state = gdk_broadway_surface_get_device_state; impl_class->get_device_state = gdk_broadway_surface_get_device_state;

View File

@ -2142,7 +2142,7 @@ gdk_surface_resize (GdkSurface *surface,
gint width, gint width,
gint height) gint height)
{ {
gdk_surface_move_resize_internal (surface, FALSE, 0, 0, width, height); GDK_SURFACE_GET_CLASS (surface)->toplevel_resize (surface, width, height);
} }

View File

@ -119,6 +119,9 @@ struct _GdkSurfaceClass
gint y, gint y,
gint width, gint width,
gint height); gint height);
void (* toplevel_resize) (GdkSurface *surface,
gint width,
gint height);
void (* move_to_rect) (GdkSurface *surface, void (* move_to_rect) (GdkSurface *surface,
const GdkRectangle *rect, const GdkRectangle *rect,
GdkGravity rect_anchor, GdkGravity rect_anchor,

View File

@ -1255,6 +1255,14 @@ gdk_surface_quartz_move_resize (GdkSurface *window,
} }
} }
static void
gdk_surface_quartz_toplevel_resize (GdkSurface *surface,
gint width,
gint height)
{
window_quartz_resize (window, width, height);
}
/* Get the toplevel ordering from NSApp and update our own list. We do /* Get the toplevel ordering from NSApp and update our own list. We do
* this on demand since the NSApps list is not up to date directly * this on demand since the NSApps list is not up to date directly
* after we get windowDidBecomeMain. * after we get windowDidBecomeMain.
@ -2642,6 +2650,7 @@ gdk_surface_impl_quartz_class_init (GdkSurfaceImplQuartzClass *klass)
impl_class->lower = gdk_surface_quartz_lower; impl_class->lower = gdk_surface_quartz_lower;
impl_class->restack_toplevel = gdk_surface_quartz_restack_toplevel; impl_class->restack_toplevel = gdk_surface_quartz_restack_toplevel;
impl_class->move_resize = gdk_surface_quartz_move_resize; impl_class->move_resize = gdk_surface_quartz_move_resize;
impl_class->toplevel_resize = gdk_surface_quartz_toplevel_resize;
impl_class->get_geometry = gdk_surface_quartz_get_geometry; impl_class->get_geometry = gdk_surface_quartz_get_geometry;
impl_class->get_root_coords = gdk_surface_quartz_get_root_coords; impl_class->get_root_coords = gdk_surface_quartz_get_root_coords;
impl_class->get_device_state = gdk_surface_quartz_get_device_state; impl_class->get_device_state = gdk_surface_quartz_get_device_state;

View File

@ -2734,6 +2734,18 @@ gdk_wayland_surface_move_resize (GdkSurface *surface,
gdk_wayland_surface_maybe_resize (surface, width, height, impl->scale); gdk_wayland_surface_maybe_resize (surface, width, height, impl->scale);
} }
static void
gdk_wayland_surface_toplevel_resize (GdkSurface *surface,
gint width,
gint height)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
gdk_wayland_surface_maybe_resize (surface,
width, height,
impl->scale);
}
/* Avoid zero width/height as this is a protocol error */ /* Avoid zero width/height as this is a protocol error */
static void static void
sanitize_anchor_rect (GdkSurface *surface, sanitize_anchor_rect (GdkSurface *surface,
@ -3810,6 +3822,7 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
impl_class->lower = gdk_wayland_surface_lower; impl_class->lower = gdk_wayland_surface_lower;
impl_class->restack_toplevel = gdk_wayland_surface_restack_toplevel; impl_class->restack_toplevel = gdk_wayland_surface_restack_toplevel;
impl_class->move_resize = gdk_wayland_surface_move_resize; impl_class->move_resize = gdk_wayland_surface_move_resize;
impl_class->toplevel_resize = gdk_wayland_surface_toplevel_resize;
impl_class->move_to_rect = gdk_wayland_surface_move_to_rect; impl_class->move_to_rect = gdk_wayland_surface_move_to_rect;
impl_class->get_geometry = gdk_wayland_surface_get_geometry; impl_class->get_geometry = gdk_wayland_surface_get_geometry;
impl_class->get_root_coords = gdk_wayland_surface_get_root_coords; impl_class->get_root_coords = gdk_wayland_surface_get_root_coords;

View File

@ -1262,6 +1262,14 @@ gdk_win32_surface_move_resize (GdkSurface *window,
_gdk_win32_emit_configure_event (window); _gdk_win32_emit_configure_event (window);
} }
static void
gdk_win32_surface_toplevel_resize (GdkSurface *surface,
gint width,
gint height)
{
gdk_win32_surface_move_resize (surface, FALSE, 0, 0, width, height);
}
static void static void
gdk_win32_surface_raise (GdkSurface *window) gdk_win32_surface_raise (GdkSurface *window)
{ {
@ -5083,6 +5091,7 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
impl_class->lower = gdk_win32_surface_lower; impl_class->lower = gdk_win32_surface_lower;
impl_class->restack_toplevel = gdk_win32_surface_restack_toplevel; impl_class->restack_toplevel = gdk_win32_surface_restack_toplevel;
impl_class->move_resize = gdk_win32_surface_move_resize; impl_class->move_resize = gdk_win32_surface_move_resize;
impl_class->toplevel_resize = gdk_win32_surface_toplevel_resize;
impl_class->get_geometry = gdk_win32_surface_get_geometry; impl_class->get_geometry = gdk_win32_surface_get_geometry;
impl_class->get_device_state = gdk_surface_win32_get_device_state; impl_class->get_device_state = gdk_surface_win32_get_device_state;
impl_class->get_root_coords = gdk_win32_surface_get_root_coords; impl_class->get_root_coords = gdk_win32_surface_get_root_coords;

View File

@ -1392,6 +1392,14 @@ gdk_x11_surface_move_resize (GdkSurface *surface,
} }
} }
static void
gdk_x11_surface_toplevel_resize (GdkSurface *surface,
gint width,
gint height)
{
x11_surface_resize (surface, width, height);
}
static void gdk_x11_surface_restack_toplevel (GdkSurface *surface, static void gdk_x11_surface_restack_toplevel (GdkSurface *surface,
GdkSurface *sibling, GdkSurface *sibling,
gboolean above); gboolean above);
@ -4590,6 +4598,7 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
impl_class->lower = gdk_x11_surface_lower; impl_class->lower = gdk_x11_surface_lower;
impl_class->restack_toplevel = gdk_x11_surface_restack_toplevel; impl_class->restack_toplevel = gdk_x11_surface_restack_toplevel;
impl_class->move_resize = gdk_x11_surface_move_resize; impl_class->move_resize = gdk_x11_surface_move_resize;
impl_class->toplevel_resize = gdk_x11_surface_toplevel_resize;
impl_class->get_geometry = gdk_x11_surface_get_geometry; impl_class->get_geometry = gdk_x11_surface_get_geometry;
impl_class->get_root_coords = gdk_x11_surface_get_root_coords; impl_class->get_root_coords = gdk_x11_surface_get_root_coords;
impl_class->get_device_state = gdk_x11_surface_get_device_state; impl_class->get_device_state = gdk_x11_surface_get_device_state;