diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2019-07-15 11:32:35 +0200 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2019-07-25 10:24:50 +0200 |
commit | b329090e69e3c4697029aa14d1f471736b2ed2a8 (patch) | |
tree | 7466522affc8b3d66b6fbdb28de6bc75f9994ae5 /gdk | |
parent | 6314ebd435ec42adb9692611147a155245551298 (diff) | |
download | gtk+-b329090e69e3c4697029aa14d1f471736b2ed2a8.tar.gz |
gdk: Remove gdk_surface_move()
Generic gdk code now uses the internal helper; backends use their own
private implementations when necessary.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/broadway/gdksurface-broadway.c | 10 | ||||
-rw-r--r-- | gdk/gdkinternals.h | 4 | ||||
-rw-r--r-- | gdk/gdksurface.c | 34 | ||||
-rw-r--r-- | gdk/win32/gdkdrag-win32.c | 17 | ||||
-rw-r--r-- | gdk/win32/gdksurface-win32.c | 14 | ||||
-rw-r--r-- | gdk/win32/gdksurface-win32.h | 3 | ||||
-rw-r--r-- | gdk/x11/gdkdrag-x11.c | 12 | ||||
-rw-r--r-- | gdk/x11/gdksurface-x11.c | 12 | ||||
-rw-r--r-- | gdk/x11/gdksurface-x11.h | 4 |
9 files changed, 62 insertions, 48 deletions
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c index 097b53facf..d3da074030 100644 --- a/gdk/broadway/gdksurface-broadway.c +++ b/gdk/broadway/gdksurface-broadway.c @@ -433,6 +433,14 @@ gdk_broadway_surface_toplevel_resize (GdkSurface *surface, } static void +gdk_broadway_surface_move (GdkSurface *surface, + gint x, + gint y) +{ + gdk_broadway_surface_move_resize (surface, TRUE, x, y, -1, -1); +} + +static void gdk_broadway_surface_raise (GdkSurface *surface) { } @@ -952,7 +960,7 @@ update_pos (MoveResizeData *mv_resize, x = mv_resize->moveresize_orig_x + dx; y = mv_resize->moveresize_orig_y + dy; - gdk_surface_move (mv_resize->moveresize_surface, x, y); + gdk_broadway_surface_move (mv_resize->moveresize_surface, x, y); } } diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index 13b139f5ce..236799d2bf 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -264,10 +264,6 @@ void gdk_surface_get_geometry (GdkSurface *surface, gint *width, gint *height); -void gdk_surface_move (GdkSurface *surface, - gint x, - gint y); - void gdk_surface_move_resize (GdkSurface *surface, gint x, gint y, diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index 6a29aa6ddf..e5c41e68c4 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -108,6 +108,13 @@ 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, }; @@ -365,7 +372,7 @@ gdk_surface_real_move_to_rect (GdkSurface *surface, if (final_rect.width != surface->width || final_rect.height != surface->height) gdk_surface_move_resize (surface, final_rect.x, final_rect.y, final_rect.width, final_rect.height); else - gdk_surface_move (surface, final_rect.x, final_rect.y); + gdk_surface_move_resize_internal (surface, TRUE, final_rect.x, final_rect.y, -1, -1); gdk_surface_get_origin (toplevel, &x, &y); final_rect.x -= x; @@ -2100,31 +2107,6 @@ gdk_surface_move_resize_internal (GdkSurface *surface, gdk_surface_move_resize_toplevel (surface, with_move, x, y, width, height); } - - -/* - * gdk_surface_move: - * @surface: a #GdkSurface - * @x: X coordinate relative to surface’s parent - * @y: Y coordinate relative to surface’s parent - * - * Repositions a surface relative to its parent surface. - * For toplevel surfaces, window managers may ignore or modify the move; - * you should probably use gtk_window_move() on a #GtkWindow widget - * anyway, instead of using GDK functions. For child surfaces, - * the move will reliably succeed. - * - * If you’re also planning to resize the surface, use gdk_surface_move_resize() - * to both move and resize simultaneously, for a nicer visual effect. - **/ -void -gdk_surface_move (GdkSurface *surface, - gint x, - gint y) -{ - gdk_surface_move_resize_internal (surface, TRUE, x, y, -1, -1); -} - /** * gdk_surface_resize: * @surface: a #GdkSurface diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c index 1e8ecf3474..f8e1ce7648 100644 --- a/gdk/win32/gdkdrag-win32.c +++ b/gdk/win32/gdkdrag-win32.c @@ -736,9 +736,9 @@ move_drag_surface (GdkDrag *drag, g_assert (_win32_main_thread == NULL || _win32_main_thread == g_thread_self ()); - gdk_surface_move (drag_win32->drag_surface, - x_root - drag_win32->hot_x, - y_root - drag_win32->hot_y); + gdk_win32_surface_move (drag_win32->drag_surface, + x_root - drag_win32->hot_x, + y_root - drag_win32->hot_y); gdk_surface_raise (drag_win32->drag_surface); } @@ -2090,6 +2090,7 @@ gdk_drag_anim_timeout (gpointer data) gint64 current_time; double f; double t; + gint x, y; if (!frame_clock) return G_SOURCE_REMOVE; @@ -2104,9 +2105,13 @@ gdk_drag_anim_timeout (gpointer data) t = ease_out_cubic (f); gdk_surface_show (drag->drag_surface); - gdk_surface_move (drag->drag_surface, - drag->util_data.last_x + (drag->start_x - drag->util_data.last_x) * t - drag->hot_x, - drag->util_data.last_y + (drag->start_y - drag->util_data.last_y) * t - drag->hot_y); + x = (drag->util_data.last_x + + (drag->start_x - drag->util_data.last_x) * t - + drag->hot_x); + y = (drag->util_data.last_y + + (drag->start_y - drag->util_data.last_y) * t - + drag->hot_y); + gdk_win32_surface_move (drag->drag_surface, x, y); gdk_surface_set_opacity (drag->drag_surface, 1.0 - f); return G_SOURCE_CONTINUE; diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 720426583f..32d853b8d7 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -1098,8 +1098,8 @@ gdk_win32_surface_withdraw (GdkSurface *window) } static void -gdk_win32_surface_move (GdkSurface *window, - gint x, gint y) +gdk_win32_surface_do_move (GdkSurface *window, + gint x, gint y) { RECT outer_rect; GdkWin32Surface *impl; @@ -1242,7 +1242,7 @@ gdk_win32_surface_move_resize (GdkSurface *window, if (with_move && (width < 0 && height < 0)) { - gdk_win32_surface_move (window, x, y); + gdk_win32_surface_do_move (window, x, y); } else { @@ -1270,6 +1270,14 @@ gdk_win32_surface_toplevel_resize (GdkSurface *surface, gdk_win32_surface_move_resize (surface, FALSE, 0, 0, width, height); } +void +gdk_win32_surface_move (GdkSurface *surface, + gint x, + gint y) +{ + gdk_win32_surface_move_resize (surface, TRUE, x, y, -1, -1); +} + static void gdk_win32_surface_raise (GdkSurface *window) { diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h index 1d6c4b3626..89860617b7 100644 --- a/gdk/win32/gdksurface-win32.h +++ b/gdk/win32/gdksurface-win32.h @@ -361,6 +361,9 @@ void _gdk_win32_update_layered_window_from_cache (GdkSurface *window, gboolean do_resize, gboolean do_paint); +void gdk_win32_surface_move (GdkSurface *surface, + gint x, + gint y); void gdk_win32_surface_get_queued_window_rect (GdkSurface *surface, diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c index 65b2b71075..3bfb04121c 100644 --- a/gdk/x11/gdkdrag-x11.c +++ b/gdk/x11/gdkdrag-x11.c @@ -1459,9 +1459,9 @@ move_drag_surface (GdkDrag *drag, { GdkX11Drag *drag_x11 = GDK_X11_DRAG (drag); - gdk_surface_move (drag_x11->drag_surface, - x_root - drag_x11->hot_x, - y_root - drag_x11->hot_y); + gdk_x11_surface_move (drag_x11->drag_surface, + x_root - drag_x11->hot_x, + y_root - drag_x11->hot_y); gdk_surface_raise (drag_x11->drag_surface); } @@ -1841,9 +1841,9 @@ gdk_drag_anim_timeout (gpointer data) t = ease_out_cubic (f); gdk_surface_show (drag->drag_surface); - gdk_surface_move (drag->drag_surface, - drag->last_x + (drag->start_x - drag->last_x) * t, - drag->last_y + (drag->start_y - drag->last_y) * t); + gdk_x11_surface_move (drag->drag_surface, + drag->last_x + (drag->start_x - drag->last_x) * t, + drag->last_y + (drag->start_y - drag->last_y) * t); gdk_surface_set_opacity (drag->drag_surface, 1.0 - f); return G_SOURCE_CONTINUE; diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c index 9859518e8b..1ad97c2f7f 100644 --- a/gdk/x11/gdksurface-x11.c +++ b/gdk/x11/gdksurface-x11.c @@ -1400,6 +1400,14 @@ gdk_x11_surface_toplevel_resize (GdkSurface *surface, x11_surface_resize (surface, width, height); } +void +gdk_x11_surface_move (GdkSurface *surface, + gint x, + gint y) +{ + gdk_x11_surface_move_resize (surface, TRUE, x, y, -1, -1); +} + static void gdk_x11_surface_restack_toplevel (GdkSurface *surface, GdkSurface *sibling, gboolean above); @@ -3253,7 +3261,7 @@ gdk_x11_surface_fullscreen_on_monitor (GdkSurface *surface, return; gdk_monitor_get_geometry (monitor, &geom); - gdk_surface_move (surface, geom.x, geom.y); + gdk_x11_surface_move (surface, geom.x, geom.y); gdk_surface_set_fullscreen_mode (surface, GDK_FULLSCREEN_ON_CURRENT_MONITOR); gdk_x11_surface_fullscreen (surface); @@ -3904,7 +3912,7 @@ update_pos (MoveResizeData *mv_resize, x = mv_resize->moveresize_orig_x + dx; y = mv_resize->moveresize_orig_y + dy; - gdk_surface_move (mv_resize->moveresize_surface, x, y); + gdk_x11_surface_move (mv_resize->moveresize_surface, x, y); } } diff --git a/gdk/x11/gdksurface-x11.h b/gdk/x11/gdksurface-x11.h index c890d6c13f..fe0ece1c19 100644 --- a/gdk/x11/gdksurface-x11.h +++ b/gdk/x11/gdksurface-x11.h @@ -183,6 +183,10 @@ void _gdk_x11_surface_set_surface_scale (GdkSurface *window, void gdk_x11_surface_pre_damage (GdkSurface *surface); +void gdk_x11_surface_move (GdkSurface *surface, + gint x, + gint y); + G_END_DECLS #endif /* __GDK_X11_SURFACE__ */ |