diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c index c9ffa25d27..d02ea887b0 100644 --- a/gdk/broadway/gdkdisplay-broadway.c +++ b/gdk/broadway/gdkdisplay-broadway.c @@ -98,7 +98,9 @@ _gdk_broadway_display_size_changed (GdkDisplay *display, GdkBroadwaySurface *toplevel = l->data; if (toplevel->maximized) - gdk_surface_move_resize (GDK_SURFACE (toplevel), 0, 0, msg->width, msg->height); + gdk_broadway_surface_move_resize (GDK_SURFACE (toplevel), + 0, 0, + msg->width, msg->height); } } diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h index 9fd41bcc53..c001978fc0 100644 --- a/gdk/broadway/gdkprivate-broadway.h +++ b/gdk/broadway/gdkprivate-broadway.h @@ -70,6 +70,12 @@ void _gdk_broadway_surface_grab_check_unmap (GdkSurface *surface, gulong serial); void gdk_broadway_surface_update_popups (GdkSurface *surface); +void gdk_broadway_surface_move_resize (GdkSurface *surface, + gint x, + gint y, + gint width, + gint height); + void _gdk_keymap_keys_changed (GdkDisplay *display); gint _gdk_broadway_get_group_for_state (GdkDisplay *display, GdkModifierType state); diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c index 90f14563c5..428d877dc7 100644 --- a/gdk/broadway/gdksurface-broadway.c +++ b/gdk/broadway/gdksurface-broadway.c @@ -368,12 +368,12 @@ gdk_broadway_surface_withdraw (GdkSurface *surface) } static void -gdk_broadway_surface_move_resize (GdkSurface *surface, - gboolean with_move, - gint x, - gint y, - gint width, - gint height) +gdk_broadway_surface_move_resize_internal (GdkSurface *surface, + gboolean with_move, + gint x, + gint y, + gint width, + gint height) { GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface); GdkBroadwayDisplay *broadway_display; @@ -424,12 +424,26 @@ gdk_broadway_surface_move_resize (GdkSurface *surface, } } +void +gdk_broadway_surface_move_resize (GdkSurface *surface, + gint x, + gint y, + gint width, + gint height) +{ + gdk_broadway_surface_move_resize_internal (surface, TRUE, + x, y, + width, height); +} + static void gdk_broadway_surface_toplevel_resize (GdkSurface *surface, gint width, gint height) { - gdk_broadway_surface_move_resize (surface, FALSE, 0, 0, width, height); + gdk_broadway_surface_move_resize_internal (surface, FALSE, + 0, 0, + width, height); } static void @@ -437,7 +451,7 @@ gdk_broadway_surface_move (GdkSurface *surface, gint x, gint y) { - gdk_broadway_surface_move_resize (surface, TRUE, x, y, -1, -1); + gdk_broadway_surface_move_resize_internal (surface, TRUE, x, y, -1, -1); } static void @@ -460,7 +474,6 @@ gdk_broadway_surface_moved_to_rect (GdkSurface *surface, final_rect.height != surface->height) { gdk_broadway_surface_move_resize (surface, - TRUE, x, y, final_rect.width, final_rect.height); } @@ -760,9 +773,9 @@ gdk_broadway_surface_maximize (GdkSurface *surface) monitor = gdk_display_get_primary_monitor (display); gdk_monitor_get_geometry (monitor, &geom); - gdk_surface_move_resize (surface, - geom.x, geom.y, - geom.width, geom.height); + gdk_broadway_surface_move_resize (surface, + geom.x, geom.y, + geom.width, geom.height); } static void @@ -783,11 +796,11 @@ gdk_broadway_surface_unmaximize (GdkSurface *surface) gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_MAXIMIZED, 0); - gdk_surface_move_resize (surface, - impl->pre_maximize_x, - impl->pre_maximize_y, - impl->pre_maximize_width, - impl->pre_maximize_height); + gdk_broadway_surface_move_resize (surface, + impl->pre_maximize_x, + impl->pre_maximize_y, + impl->pre_maximize_width, + impl->pre_maximize_height); } static void @@ -878,7 +891,9 @@ gdk_broadway_surface_update_popups (GdkSurface *parent) int new_y = parent->y + popup_impl->offset_y; if (new_x != popup->x || new_y != popup->y) - gdk_broadway_surface_move_resize (popup, TRUE, new_x, new_y, popup->width, popup->height); + gdk_broadway_surface_move_resize (popup, + new_x, new_y, + popup->width, popup->height); gdk_broadway_surface_restack_toplevel (popup, parent, TRUE); } } @@ -1000,7 +1015,8 @@ update_pos (MoveResizeData *mv_resize, w, h, &w, &h); } - gdk_surface_move_resize (mv_resize->moveresize_surface, x, y, w, h); + gdk_broadway_surface_move_resize (mv_resize->moveresize_surface, + x, y, w, h); } else { @@ -1376,7 +1392,6 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass) impl_class->raise = gdk_broadway_surface_raise; impl_class->lower = gdk_broadway_surface_lower; impl_class->restack_toplevel = gdk_broadway_surface_restack_toplevel; - impl_class->move_resize = gdk_broadway_surface_move_resize; impl_class->toplevel_resize = gdk_broadway_surface_toplevel_resize; impl_class->move_to_rect = gdk_broadway_surface_move_to_rect; impl_class->get_geometry = gdk_broadway_surface_get_geometry; diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index 236799d2bf..7a0322965d 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -264,12 +264,6 @@ void gdk_surface_get_geometry (GdkSurface *surface, gint *width, gint *height); -void gdk_surface_move_resize (GdkSurface *surface, - gint x, - gint y, - gint width, - gint height); - GdkGLContext *gdk_surface_get_shared_data_gl_context (GdkSurface *surface); G_END_DECLS diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index 8c52953972..a77193fc99 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -108,13 +108,6 @@ static void update_cursor (GdkDisplay *display, static void gdk_surface_set_frame_clock (GdkSurface *surface, GdkFrameClock *clock); -static void gdk_surface_move_resize_internal (GdkSurface *surface, - gboolean with_move, - gint x, - gint y, - gint width, - gint height); - static guint signals[LAST_SIGNAL] = { 0 }; static GParamSpec *properties[LAST_PROP] = { NULL, }; @@ -2076,34 +2069,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS GDK_SURFACE_GET_CLASS (surface)->hide (surface); } -static void -gdk_surface_move_resize_toplevel (GdkSurface *surface, - gboolean with_move, - gint x, - gint y, - gint width, - gint height) -{ - GDK_SURFACE_GET_CLASS (surface)->move_resize (surface, with_move, x, y, width, height); -} - - -static void -gdk_surface_move_resize_internal (GdkSurface *surface, - gboolean with_move, - gint x, - gint y, - gint width, - gint height) -{ - g_return_if_fail (GDK_IS_SURFACE (surface)); - - if (surface->destroyed) - return; - - gdk_surface_move_resize_toplevel (surface, with_move, x, y, width, height); -} - /** * gdk_surface_resize: * @surface: a #GdkSurface @@ -2124,30 +2089,6 @@ gdk_surface_resize (GdkSurface *surface, GDK_SURFACE_GET_CLASS (surface)->toplevel_resize (surface, width, height); } - -/* - * gdk_surface_move_resize: - * @surface: a #GdkSurface - * @x: new X position relative to surface’s parent - * @y: new Y position relative to surface’s parent - * @width: new width - * @height: new height - * - * Equivalent to calling gdk_surface_move() and gdk_surface_resize(), - * except that both operations are performed at once, avoiding strange - * visual effects. (i.e. the user may be able to see the surface first - * move, then resize, if you don’t use gdk_surface_move_resize().) - **/ -void -gdk_surface_move_resize (GdkSurface *surface, - gint x, - gint y, - gint width, - gint height) -{ - gdk_surface_move_resize_internal (surface, TRUE, x, y, width, height); -} - /** * gdk_surface_move_to_rect: * @surface: the #GdkSurface to move @@ -2942,8 +2883,7 @@ gdk_surface_set_modal_hint (GdkSurface *surface, * this is to constrain user resizing, but the windowing system * will typically (but is not required to) also constrain the * current size of the surface to the provided values and - * constrain programatic resizing via gdk_surface_resize() or - * gdk_surface_move_resize(). + * constrain programatic resizing via gdk_surface_resize(). * * Note that on X11, this effect has no effect on surfaces * of type %GDK_SURFACE_TEMP since these surfaces are not resizable diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h index c6d9134ffc..f0c195b8b0 100644 --- a/gdk/gdksurfaceprivate.h +++ b/gdk/gdksurfaceprivate.h @@ -113,12 +113,6 @@ struct _GdkSurfaceClass GdkSurface *sibling, gboolean above); - void (* move_resize) (GdkSurface *surface, - gboolean with_move, - gint x, - gint y, - gint width, - gint height); void (* toplevel_resize) (GdkSurface *surface, gint width, gint height); diff --git a/gdk/quartz/gdksurface-quartz.c b/gdk/quartz/gdksurface-quartz.c index 5d7240a52f..7dd03b6f77 100644 --- a/gdk/quartz/gdksurface-quartz.c +++ b/gdk/quartz/gdksurface-quartz.c @@ -1236,25 +1236,6 @@ window_quartz_move_resize (GdkSurface *window, move_resize_window_internal (window, x, y, width, height); } -static void -gdk_surface_quartz_move_resize (GdkSurface *window, - gboolean with_move, - gint x, - gint y, - gint width, - gint height) -{ - if (with_move && (width < 0 && height < 0)) - window_quartz_move (window, x, y); - else - { - if (with_move) - window_quartz_move_resize (window, x, y, width, height); - else - window_quartz_resize (window, width, height); - } -} - static void gdk_surface_quartz_toplevel_resize (GdkSurface *surface, gint width, @@ -2697,7 +2678,6 @@ gdk_surface_impl_quartz_class_init (GdkSurfaceImplQuartzClass *klass) impl_class->raise = gdk_surface_quartz_raise; impl_class->lower = gdk_surface_quartz_lower; impl_class->restack_toplevel = gdk_surface_quartz_restack_toplevel; - impl_class->move_resize = gdk_surface_quartz_move_resize; impl_class->toplevel_resize = gdk_surface_quartz_toplevel_resize; impl_class->move_to_rect = gdk_surface_quartz_move_to_rect; impl_class->get_geometry = gdk_surface_quartz_get_geometry; diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index d9e63c3453..0a8043b16e 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -197,6 +197,12 @@ static void gdk_wayland_surface_sync_opaque_region (GdkSurface *surface); static void unset_transient_for_exported (GdkSurface *surface); +static void gdk_wayland_surface_move_resize (GdkSurface *surface, + gint x, + gint y, + gint width, + gint height); + static void calculate_moved_to_rect_result (GdkSurface *surface, int x, int y, @@ -1963,9 +1969,9 @@ calculate_moved_to_rect_result (GdkSurface *surface, surface_width = width + surface->shadow_left + surface->shadow_right; surface_height = height + surface->shadow_top + surface->shadow_bottom; - gdk_surface_move_resize (surface, - surface_x, surface_y, - surface_width, surface_height); + gdk_wayland_surface_move_resize (surface, + surface_x, surface_y, + surface_width, surface_height); calculate_popup_rect (surface, impl->pending_move_to_rect.rect_anchor, @@ -2708,7 +2714,6 @@ gdk_wayland_surface_restack_toplevel (GdkSurface *surface, static void gdk_wayland_surface_move_resize (GdkSurface *surface, - gboolean with_move, gint x, gint y, gint width, @@ -2716,22 +2721,9 @@ gdk_wayland_surface_move_resize (GdkSurface *surface, { GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); - if (with_move) - { - /* Each toplevel has in its own "root" coordinate system */ - if (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_TOPLEVEL) - { - surface->x = x; - surface->y = y; - impl->position_method = POSITION_METHOD_MOVE_RESIZE; - } - } - - /* If this function is called with width and height = -1 then that means - * just move the surface - don't update its size - */ - if (width > 0 && height > 0) - gdk_wayland_surface_maybe_resize (surface, width, height, impl->scale); + surface->x = x; + surface->y = y; + gdk_wayland_surface_maybe_resize (surface, width, height, impl->scale); } static void @@ -3821,7 +3813,6 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass) impl_class->raise = gdk_wayland_surface_raise; impl_class->lower = gdk_wayland_surface_lower; impl_class->restack_toplevel = gdk_wayland_surface_restack_toplevel; - 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->get_geometry = gdk_wayland_surface_get_geometry; diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 8f0ef549d7..bd9773c4e9 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -1588,7 +1588,9 @@ handle_dpi_changed (GdkSurface *window, _gdk_win32_adjust_client_rect (window, rect); if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE) - gdk_surface_move_resize (window, window->x, window->y, window->width, window->height); + gdk_win32_surface_move_resize (window, + window->x, window->y, + window->width, window->height); else gdk_surface_resize (window, window->width, window->height); } diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index b6b739ba9a..877a90361a 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -1174,11 +1174,11 @@ gdk_win32_surface_resize (GdkSurface *window, } static void -gdk_win32_surface_move_resize_internal (GdkSurface *window, - gint x, - gint y, - gint width, - gint height) +gdk_win32_surface_do_move_resize (GdkSurface *window, + gint x, + gint y, + gint width, + gint height) { RECT outer_rect; GdkWin32Surface *impl; @@ -1224,12 +1224,12 @@ gdk_win32_surface_move_resize_internal (GdkSurface *window, } static void -gdk_win32_surface_move_resize (GdkSurface *window, - gboolean with_move, - gint x, - gint y, - gint width, - gint height) +gdk_win32_surface_move_resize_internal (GdkSurface *window, + gboolean with_move, + gint x, + gint y, + gint width, + gint height) { GdkWin32Surface *surface = GDK_WIN32_SURFACE (window); @@ -1248,7 +1248,7 @@ gdk_win32_surface_move_resize (GdkSurface *window, { if (with_move) { - gdk_win32_surface_move_resize_internal (window, x, y, width, height); + gdk_win32_surface_do_move_resize (window, x, y, width, height); } else { @@ -1262,12 +1262,22 @@ gdk_win32_surface_move_resize (GdkSurface *window, _gdk_win32_emit_configure_event (window); } +void +gdk_win32_surface_move_resize (GdkSurface *window, + gint x, + gint y, + gint width, + gint height) +{ + gdk_win32_surface_move_resize_internal (window, TRUE, x, y, width, height); +} + static void gdk_win32_surface_toplevel_resize (GdkSurface *surface, gint width, gint height) { - gdk_win32_surface_move_resize (surface, FALSE, 0, 0, width, height); + gdk_win32_surface_move_resize_internal (surface, FALSE, 0, 0, width, height); } void @@ -1275,7 +1285,7 @@ gdk_win32_surface_move (GdkSurface *surface, gint x, gint y) { - gdk_win32_surface_move_resize (surface, TRUE, x, y, -1, -1); + gdk_win32_surface_move_resize_internal (surface, TRUE, x, y, -1, -1); } static void @@ -1298,7 +1308,6 @@ gdk_win32_surface_moved_to_rect (GdkSurface *surface, final_rect.height != surface->height) { gdk_win32_surface_move_resize (surface, - TRUE, x, y, final_rect.width, final_rect.height); } @@ -2583,8 +2592,8 @@ unsnap (GdkSurface *window, GDK_NOTE (MISC, g_print ("Unsnapped window size %d x %d @ %d : %d\n", rect.width, rect.height, rect.x, rect.y)); - gdk_surface_move_resize (window, rect.x, rect.y, - rect.width, rect.height); + gdk_win32_surface_move_resize (window, rect.x, rect.y, + rect.width, rect.height); g_clear_pointer (&impl->snap_stash, g_free); g_clear_pointer (&impl->snap_stash_int, g_free); @@ -2689,7 +2698,7 @@ snap_up (GdkSurface *window) width += impl->margins_x; height += impl->margins_y; - gdk_surface_move_resize (window, x, y, width, height); + gdk_win32_surface_move_resize (window, x, y, width, height); } static void @@ -2715,7 +2724,9 @@ snap_left (GdkSurface *window, rect.width = rect.width + impl->margins_x; rect.height = rect.height + impl->margins_y; - gdk_surface_move_resize (window, rect.x, rect.y, rect.width, rect.height); + gdk_win32_surface_move_resize (window, + rect.x, rect.y, + rect.width, rect.height); } static void @@ -2742,7 +2753,9 @@ snap_right (GdkSurface *window, rect.width = rect.width + impl->margins_x; rect.height = rect.height + impl->margins_y; - gdk_surface_move_resize (window, rect.x, rect.y, rect.width, rect.height); + gdk_win32_surface_move_resize (window, + rect.x, rect.y, + rect.width, rect.height); } void @@ -3993,8 +4006,8 @@ setup_drag_move_resize_context (GdkSurface *window, GDK_NOTE (MISC, g_print ("Unsnapped window to %d : %d\n", new_pos.x, new_pos.y)); discard_snapinfo (window); - gdk_surface_move_resize (window, new_pos.x, new_pos.y, - new_pos.width, new_pos.height); + gdk_win32_surface_move_resize (window, new_pos.x, new_pos.y, + new_pos.width, new_pos.height); } @@ -5147,7 +5160,6 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass) impl_class->raise = gdk_win32_surface_raise; impl_class->lower = gdk_win32_surface_lower; impl_class->restack_toplevel = gdk_win32_surface_restack_toplevel; - impl_class->move_resize = gdk_win32_surface_move_resize; impl_class->toplevel_resize = gdk_win32_surface_toplevel_resize; impl_class->move_to_rect = gdk_win32_surface_move_to_rect; impl_class->get_geometry = gdk_win32_surface_get_geometry; diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h index 89860617b7..061463dd9a 100644 --- a/gdk/win32/gdksurface-win32.h +++ b/gdk/win32/gdksurface-win32.h @@ -365,6 +365,12 @@ void gdk_win32_surface_move (GdkSurface *surface, gint x, gint y); +void gdk_win32_surface_move_resize (GdkSurface *window, + gint x, + gint y, + gint width, + gint height); + void gdk_win32_surface_get_queued_window_rect (GdkSurface *surface, gint scale, diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c index 690b72faaf..9c2fb1f2d3 100644 --- a/gdk/x11/gdksurface-x11.c +++ b/gdk/x11/gdksurface-x11.c @@ -3952,7 +3952,8 @@ update_pos (MoveResizeData *mv_resize, w, h, &w, &h); } - gdk_surface_move_resize (mv_resize->moveresize_surface, x, y, w, h); + gdk_x11_surface_move_resize (mv_resize->moveresize_surface, TRUE, + x, y, w, h); } else { @@ -4654,7 +4655,6 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass) impl_class->raise = gdk_x11_surface_raise; impl_class->lower = gdk_x11_surface_lower; impl_class->restack_toplevel = gdk_x11_surface_restack_toplevel; - impl_class->move_resize = gdk_x11_surface_move_resize; impl_class->toplevel_resize = gdk_x11_surface_toplevel_resize; impl_class->move_to_rect = gdk_x11_surface_move_to_rect; impl_class->get_geometry = gdk_x11_surface_get_geometry;