window: Remove meta_window_move as well

Move to meta_window_move_frame everywhere...
This commit is contained in:
Jasper St. Pierre 2014-05-21 08:46:18 -04:00
parent 1c94df2553
commit 626516d12e
7 changed files with 27 additions and 67 deletions

View File

@ -1134,13 +1134,8 @@ compute_resistance_and_snapping_edges (MetaDisplay *display)
initialize_grab_edge_resistance_data (display); initialize_grab_edge_resistance_data (display);
} }
/* Note that old_[xy] and new_[xy] are with respect to inner positions of
* the window.
*/
void void
meta_window_edge_resistance_for_move (MetaWindow *window, meta_window_edge_resistance_for_move (MetaWindow *window,
int old_x,
int old_y,
int *new_x, int *new_x,
int *new_y, int *new_y,
GSourceFunc timeout_func, GSourceFunc timeout_func,
@ -1153,8 +1148,8 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
meta_window_get_frame_rect (window, &old_outer); meta_window_get_frame_rect (window, &old_outer);
proposed_outer = old_outer; proposed_outer = old_outer;
proposed_outer.x += (*new_x - old_x); proposed_outer.x = *new_x;
proposed_outer.y += (*new_y - old_y); proposed_outer.y = *new_y;
new_outer = proposed_outer; new_outer = proposed_outer;
window->display->grab_last_user_action_was_snap = snap; window->display->grab_last_user_action_was_snap = snap;
@ -1205,16 +1200,15 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
else else
smaller_y_change = bottom_change; 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)); (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)); (BOX_TOP (*reference) - BOX_TOP (old_outer));
meta_topic (META_DEBUG_EDGE_RESISTANCE, meta_topic (META_DEBUG_EDGE_RESISTANCE,
"outer x & y move-to coordinate changed from %d,%d to %d,%d\n", "outer x & y move-to coordinate changed from %d,%d to %d,%d\n",
proposed_outer.x, proposed_outer.y, proposed_outer.x, proposed_outer.y,
old_outer.x + (*new_x - old_x), *new_x, *new_y);
old_outer.y + (*new_y - old_y));
} }
} }

View File

@ -25,8 +25,6 @@
#include "window-private.h" #include "window-private.h"
void meta_window_edge_resistance_for_move (MetaWindow *window, void meta_window_edge_resistance_for_move (MetaWindow *window,
int old_x,
int old_y,
int *new_x, int *new_x,
int *new_y, int *new_y,
GSourceFunc timeout_func, GSourceFunc timeout_func,

View File

@ -1927,6 +1927,7 @@ process_keyboard_move_grab (MetaDisplay *display,
ClutterKeyEvent *event) ClutterKeyEvent *event)
{ {
gboolean handled; gboolean handled;
MetaRectangle frame_rect;
int x, y; int x, y;
int incr; int incr;
gboolean smart_snap; gboolean smart_snap;
@ -1941,7 +1942,9 @@ process_keyboard_move_grab (MetaDisplay *display,
if (is_modifier (event->keyval)) if (is_modifier (event->keyval))
return TRUE; 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; smart_snap = (event->modifier_state & CLUTTER_SHIFT_MASK) != 0;
@ -2016,23 +2019,18 @@ process_keyboard_move_grab (MetaDisplay *display,
if (handled) if (handled)
{ {
MetaRectangle old_rect;
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Computed new window location %d,%d due to keypress\n", "Computed new window location %d,%d due to keypress\n",
x, y); x, y);
meta_window_get_client_root_coords (window, &old_rect);
meta_window_edge_resistance_for_move (window, meta_window_edge_resistance_for_move (window,
old_rect.x,
old_rect.y,
&x, &x,
&y, &y,
NULL, NULL,
smart_snap, smart_snap,
TRUE); TRUE);
meta_window_move (window, TRUE, x, y); meta_window_move_frame (window, TRUE, x, y);
meta_window_update_keyboard_move (window); meta_window_update_keyboard_move (window);
} }

View File

@ -539,10 +539,6 @@ void meta_window_update_fullscreen_monitors (MetaWindow *window,
unsigned long left, unsigned long left,
unsigned long right); 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, void meta_window_move_resize (MetaWindow *window,
gboolean user_op, gboolean user_op,
int root_x_nw, int root_x_nw,

View File

@ -3534,7 +3534,7 @@ maybe_move_attached_dialog (MetaWindow *window,
{ {
if (meta_window_is_attached_dialog (window)) if (meta_window_is_attached_dialog (window))
/* It ignores x,y for such a dialog */ /* 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; return FALSE;
} }
@ -3756,33 +3756,6 @@ meta_window_move_resize_internal (MetaWindow *window,
window->screen->active_workspace); 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: * meta_window_move_frame:
* @window: a #MetaWindow * @window: a #MetaWindow
@ -3801,10 +3774,14 @@ meta_window_move_frame (MetaWindow *window,
int root_x_nw, int root_x_nw,
int root_y_nw) int root_y_nw)
{ {
MetaMoveResizeFlags flags;
MetaRectangle rect = { root_x_nw, root_y_nw, 0, 0 }; 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_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 static void
@ -5698,7 +5675,7 @@ update_move (MetaWindow *window,
meta_screen_update_tile_preview (window->screen, meta_screen_update_tile_preview (window->screen,
window->tile_mode != META_TILE_NONE); 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 */ /* Don't allow movement in the maximized directions or while tiled */
if (window->maximized_horizontally || META_WINDOW_TILED_SIDE_BY_SIDE (window)) if (window->maximized_horizontally || META_WINDOW_TILED_SIDE_BY_SIDE (window))
@ -5708,15 +5685,13 @@ update_move (MetaWindow *window,
/* Do any edge resistance/snapping */ /* Do any edge resistance/snapping */
meta_window_edge_resistance_for_move (window, meta_window_edge_resistance_for_move (window,
old.x,
old.y,
&new_x, &new_x,
&new_y, &new_y,
update_move_timeout, update_move_timeout,
snap, snap,
FALSE); 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 /* When resizing a maximized window by using alt-middle-drag (resizing

View File

@ -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_app_menu_object_path (MetaWindow *window);
const char * meta_window_get_gtk_menubar_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_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_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); void meta_window_move_to_monitor (MetaWindow *window, int monitor);

View File

@ -1018,7 +1018,7 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
} }
window = meta_window_wayland_new (meta_get_display (), surface); window = meta_window_wayland_new (meta_get_display (), surface);
meta_window_move (window, FALSE, meta_window_move_frame (window, FALSE,
parent_surf->window->rect.x + x, parent_surf->window->rect.x + x,
parent_surf->window->rect.y + y); parent_surf->window->rect.y + y);
window->showing_for_first_time = FALSE; window->showing_for_first_time = FALSE;
@ -1212,7 +1212,7 @@ wl_shell_surface_set_transient (struct wl_client *client,
wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL); wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL);
meta_window_set_transient_for (surface->window, parent_surf->window); meta_window_set_transient_for (surface->window, parent_surf->window);
meta_window_move (surface->window, FALSE, meta_window_move_frame (surface->window, FALSE,
parent_surf->window->rect.x + x, parent_surf->window->rect.x + x,
parent_surf->window->rect.y + y); parent_surf->window->rect.y + y);
surface->window->placed = TRUE; surface->window->placed = TRUE;
@ -1247,7 +1247,7 @@ wl_shell_surface_set_popup (struct wl_client *client,
wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL); wl_shell_surface_set_state (surface, SURFACE_STATE_TOPLEVEL);
meta_window_set_transient_for (surface->window, parent_surf->window); meta_window_set_transient_for (surface->window, parent_surf->window);
meta_window_move (surface->window, FALSE, meta_window_move_frame (surface->window, FALSE,
parent_surf->window->rect.x + x, parent_surf->window->rect.x + x,
parent_surf->window->rect.y + y); parent_surf->window->rect.y + y);
surface->window->placed = TRUE; surface->window->placed = TRUE;