diff --git a/src/core/edge-resistance.c b/src/core/edge-resistance.c index 6e348eb4a..1c389a853 100644 --- a/src/core/edge-resistance.c +++ b/src/core/edge-resistance.c @@ -1134,13 +1134,8 @@ compute_resistance_and_snapping_edges (MetaDisplay *display) initialize_grab_edge_resistance_data (display); } -/* Note that old_[xy] and new_[xy] are with respect to inner positions of - * the window. - */ void meta_window_edge_resistance_for_move (MetaWindow *window, - int old_x, - int old_y, int *new_x, int *new_y, GSourceFunc timeout_func, @@ -1153,8 +1148,8 @@ meta_window_edge_resistance_for_move (MetaWindow *window, meta_window_get_frame_rect (window, &old_outer); proposed_outer = old_outer; - proposed_outer.x += (*new_x - old_x); - proposed_outer.y += (*new_y - old_y); + proposed_outer.x = *new_x; + proposed_outer.y = *new_y; new_outer = proposed_outer; window->display->grab_last_user_action_was_snap = snap; @@ -1205,16 +1200,15 @@ meta_window_edge_resistance_for_move (MetaWindow *window, else smaller_y_change = bottom_change; - *new_x = old_x + smaller_x_change + + *new_x = old_outer.x + smaller_x_change + (BOX_LEFT (*reference) - BOX_LEFT (old_outer)); - *new_y = old_y + smaller_y_change + + *new_y = old_outer.y + smaller_y_change + (BOX_TOP (*reference) - BOX_TOP (old_outer)); meta_topic (META_DEBUG_EDGE_RESISTANCE, "outer x & y move-to coordinate changed from %d,%d to %d,%d\n", proposed_outer.x, proposed_outer.y, - old_outer.x + (*new_x - old_x), - old_outer.y + (*new_y - old_y)); + *new_x, *new_y); } } diff --git a/src/core/edge-resistance.h b/src/core/edge-resistance.h index 717f4d9e4..3c14eea12 100644 --- a/src/core/edge-resistance.h +++ b/src/core/edge-resistance.h @@ -25,8 +25,6 @@ #include "window-private.h" void meta_window_edge_resistance_for_move (MetaWindow *window, - int old_x, - int old_y, int *new_x, int *new_y, GSourceFunc timeout_func, diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 940c43e05..22beef28d 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1927,6 +1927,7 @@ process_keyboard_move_grab (MetaDisplay *display, ClutterKeyEvent *event) { gboolean handled; + MetaRectangle frame_rect; int x, y; int incr; gboolean smart_snap; @@ -1941,7 +1942,9 @@ process_keyboard_move_grab (MetaDisplay *display, if (is_modifier (event->keyval)) return TRUE; - meta_window_get_position (window, &x, &y); + meta_window_get_frame_rect (window, &frame_rect); + x = frame_rect.x; + y = frame_rect.y; smart_snap = (event->modifier_state & CLUTTER_SHIFT_MASK) != 0; @@ -2016,23 +2019,18 @@ process_keyboard_move_grab (MetaDisplay *display, if (handled) { - MetaRectangle old_rect; meta_topic (META_DEBUG_KEYBINDINGS, "Computed new window location %d,%d due to keypress\n", x, y); - meta_window_get_client_root_coords (window, &old_rect); - meta_window_edge_resistance_for_move (window, - old_rect.x, - old_rect.y, &x, &y, NULL, smart_snap, TRUE); - meta_window_move (window, TRUE, x, y); + meta_window_move_frame (window, TRUE, x, y); meta_window_update_keyboard_move (window); } diff --git a/src/core/window-private.h b/src/core/window-private.h index 7ac184ec4..280fe7b3b 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -539,10 +539,6 @@ void meta_window_update_fullscreen_monitors (MetaWindow *window, unsigned long left, unsigned long right); -void meta_window_move (MetaWindow *window, - gboolean user_op, - int root_x_nw, - int root_y_nw); void meta_window_move_resize (MetaWindow *window, gboolean user_op, int root_x_nw, diff --git a/src/core/window.c b/src/core/window.c index b5cb0630a..3384cc7a1 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3534,7 +3534,7 @@ maybe_move_attached_dialog (MetaWindow *window, { if (meta_window_is_attached_dialog (window)) /* It ignores x,y for such a dialog */ - meta_window_move (window, FALSE, 0, 0); + meta_window_move_frame (window, FALSE, 0, 0); return FALSE; } @@ -3756,33 +3756,6 @@ meta_window_move_resize_internal (MetaWindow *window, window->screen->active_workspace); } -/** - * meta_window_move: - * @window: a #MetaWindow - * @user_op: bool to indicate whether or not this is a user operation - * @root_x_nw: desired x pos - * @root_y_nw: desired y pos - * - * Moves the window to the desired location on window's assigned workspace. - * NOTE: does NOT place according to the origin of the enclosing - * frame/window-decoration, but according to the origin of the window, - * itself. - */ -void -meta_window_move (MetaWindow *window, - gboolean user_op, - int root_x_nw, - int root_y_nw) -{ - MetaMoveResizeFlags flags; - MetaRectangle rect = { root_x_nw, root_y_nw, 0, 0 }; - - g_return_if_fail (!window->override_redirect); - - flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_MOVE_ACTION; - meta_window_move_resize_internal (window, flags, NorthWestGravity, rect); -} - /** * meta_window_move_frame: * @window: a #MetaWindow @@ -3801,10 +3774,14 @@ meta_window_move_frame (MetaWindow *window, int root_x_nw, int root_y_nw) { + MetaMoveResizeFlags flags; MetaRectangle rect = { root_x_nw, root_y_nw, 0, 0 }; + g_return_if_fail (!window->override_redirect); + + flags = (user_op ? META_IS_USER_ACTION : 0) | META_IS_MOVE_ACTION; meta_window_frame_rect_to_client_rect (window, &rect, &rect); - meta_window_move (window, user_op, rect.x, rect.y); + meta_window_move_resize_internal (window, flags, NorthWestGravity, rect); } static void @@ -5698,7 +5675,7 @@ update_move (MetaWindow *window, meta_screen_update_tile_preview (window->screen, window->tile_mode != META_TILE_NONE); - meta_window_get_client_root_coords (window, &old); + meta_window_get_frame_rect (window, &old); /* Don't allow movement in the maximized directions or while tiled */ if (window->maximized_horizontally || META_WINDOW_TILED_SIDE_BY_SIDE (window)) @@ -5708,15 +5685,13 @@ update_move (MetaWindow *window, /* Do any edge resistance/snapping */ meta_window_edge_resistance_for_move (window, - old.x, - old.y, &new_x, &new_y, update_move_timeout, snap, FALSE); - meta_window_move (window, TRUE, new_x, new_y); + meta_window_move_frame (window, TRUE, new_x, new_y); } /* When resizing a maximized window by using alt-middle-drag (resizing diff --git a/src/meta/window.h b/src/meta/window.h index d0bf608d5..78ae8d105 100644 --- a/src/meta/window.h +++ b/src/meta/window.h @@ -147,7 +147,6 @@ const char * meta_window_get_gtk_window_object_path (MetaWindow *window); const char * meta_window_get_gtk_app_menu_object_path (MetaWindow *window); const char * meta_window_get_gtk_menubar_object_path (MetaWindow *window); -void meta_window_move(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw); void meta_window_move_frame(MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw); void meta_window_move_resize_frame (MetaWindow *window, gboolean user_op, int root_x_nw, int root_y_nw, int w, int h); void meta_window_move_to_monitor (MetaWindow *window, int monitor); diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 2ab26dfb0..e3c88c519 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1018,9 +1018,9 @@ xdg_shell_get_xdg_popup (struct wl_client *client, } window = meta_window_wayland_new (meta_get_display (), surface); - meta_window_move (window, FALSE, - parent_surf->window->rect.x + x, - parent_surf->window->rect.y + y); + meta_window_move_frame (window, FALSE, + parent_surf->window->rect.x + x, + parent_surf->window->rect.y + y); window->showing_for_first_time = FALSE; window->placed = TRUE; meta_window_set_transient_for (window, parent_surf->window); @@ -1212,9 +1212,9 @@ wl_shell_surface_set_transient (struct wl_client *client, wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL); meta_window_set_transient_for (surface->window, parent_surf->window); - meta_window_move (surface->window, FALSE, - parent_surf->window->rect.x + x, - parent_surf->window->rect.y + y); + meta_window_move_frame (surface->window, FALSE, + parent_surf->window->rect.x + x, + parent_surf->window->rect.y + y); surface->window->placed = TRUE; } @@ -1247,9 +1247,9 @@ wl_shell_surface_set_popup (struct wl_client *client, wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL); meta_window_set_transient_for (surface->window, parent_surf->window); - meta_window_move (surface->window, FALSE, - parent_surf->window->rect.x + x, - parent_surf->window->rect.y + y); + meta_window_move_frame (surface->window, FALSE, + parent_surf->window->rect.x + x, + parent_surf->window->rect.y + y); surface->window->placed = TRUE; meta_wayland_pointer_start_popup_grab (&seat->pointer, surface);