Add MetaGravity and replace X11 equivalent with it

MetaGravity is an enum, where the values match the X11 macros used for
gravity, with the exception that `ForgetGravity` was renamed
`META_GRAVITY_NONE` to have less of a obscure name.

The motivation for this is to rely less on libX11 data types and macros
in generic code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/705
This commit is contained in:
Jonas Ådahl
2020-02-14 09:44:43 +01:00
committed by Carlos Garnacho
parent ff381d1d52
commit 0dac91cffc
21 changed files with 294 additions and 263 deletions

View File

@ -73,14 +73,14 @@ char* meta_rectangle_edge_list_to_string (
/* Resize old_rect to the given new_width and new_height, but store the
* result in rect. NOTE THAT THIS IS RESIZE ONLY SO IT CANNOT BE USED FOR
* A MOVERESIZE OPERATION (that simplies the routine a little bit as it
* means there's no difference between NorthWestGravity and StaticGravity.
* Also, I lied a little bit--technically, you could use it in a MoveResize
* operation if you muck with old_rect just right).
* means there's no difference between META_GRAVITY_NORTH_WEST and
* META_GRAVITY_STATIC. Also, I lied a little bit--technically, you could use
* it in a MoveResize operation if you muck with old_rect just right).
*/
META_EXPORT_TEST
void meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
MetaRectangle *rect,
int gravity,
MetaGravity gravity,
int new_width,
int new_height);

View File

@ -327,7 +327,7 @@ meta_rectangle_contains_rect (const MetaRectangle *outer_rect,
void
meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
MetaRectangle *rect,
int gravity,
MetaGravity gravity,
int new_width,
int new_height)
{
@ -342,12 +342,12 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
* border_width, and old and new client area widths (instead of old total
* width and new total width) and you come up with the same formulas.
*
* Also, note that the reason we can treat NorthWestGravity and
* StaticGravity the same is because we're not given a location at
* Also, note that the reason we can treat META_GRAVITY_NORTH_WEST and
* META_GRAVITY_STATIC the same is because we're not given a location at
* which to place the window--the window was already placed
* appropriately before. So, NorthWestGravity for this function
* appropriately before. So, META_GRAVITY_NORTH_WEST for this function
* means to just leave the upper left corner of the outer window
* where it already is, and StaticGravity for this function means to
* where it already is, and META_GRAVITY_STATIC for this function means to
* just leave the upper left corner of the inner window where it
* already is. But leaving either of those two corners where they
* already are will ensure that the other corner is fixed as well
@ -358,15 +358,15 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
/* First, the x direction */
switch (gravity)
{
case NorthWestGravity:
case WestGravity:
case SouthWestGravity:
case META_GRAVITY_NORTH_WEST:
case META_GRAVITY_WEST:
case META_GRAVITY_SOUTH_WEST:
rect->x = old_rect->x;
break;
case NorthGravity:
case CenterGravity:
case SouthGravity:
case META_GRAVITY_NORTH:
case META_GRAVITY_CENTER:
case META_GRAVITY_SOUTH:
/* FIXME: Needing to adjust new_width kind of sucks, but not doing so
* would cause drift.
*/
@ -374,13 +374,13 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
rect->x = old_rect->x + (old_rect->width - new_width)/2;
break;
case NorthEastGravity:
case EastGravity:
case SouthEastGravity:
case META_GRAVITY_NORTH_EAST:
case META_GRAVITY_EAST:
case META_GRAVITY_SOUTH_EAST:
rect->x = old_rect->x + (old_rect->width - new_width);
break;
case StaticGravity:
case META_GRAVITY_STATIC:
default:
rect->x = old_rect->x;
break;
@ -390,15 +390,15 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
/* Next, the y direction */
switch (gravity)
{
case NorthWestGravity:
case NorthGravity:
case NorthEastGravity:
case META_GRAVITY_NORTH_WEST:
case META_GRAVITY_NORTH:
case META_GRAVITY_NORTH_EAST:
rect->y = old_rect->y;
break;
case WestGravity:
case CenterGravity:
case EastGravity:
case META_GRAVITY_WEST:
case META_GRAVITY_CENTER:
case META_GRAVITY_EAST:
/* FIXME: Needing to adjust new_height kind of sucks, but not doing so
* would cause drift.
*/
@ -406,13 +406,13 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
rect->y = old_rect->y + (old_rect->height - new_height)/2;
break;
case SouthWestGravity:
case SouthGravity:
case SouthEastGravity:
case META_GRAVITY_SOUTH_WEST:
case META_GRAVITY_SOUTH:
case META_GRAVITY_SOUTH_EAST:
rect->y = old_rect->y + (old_rect->height - new_height);
break;
case StaticGravity:
case META_GRAVITY_STATIC:
default:
rect->y = old_rect->y;
break;

View File

@ -133,7 +133,7 @@ typedef struct
* explanation of the differences and similarity between resize_gravity
* and fixed_directions
*/
int resize_gravity;
MetaGravity resize_gravity;
FixedDirections fixed_directions;
/* work_area_monitor - current monitor region minus struts
@ -205,7 +205,7 @@ static gboolean constrain_partially_onscreen (MetaWindow *window,
static void setup_constraint_info (ConstraintInfo *info,
MetaWindow *window,
MetaMoveResizeFlags flags,
int resize_gravity,
MetaGravity resize_gravity,
const MetaRectangle *orig,
MetaRectangle *new);
static void place_window_if_needed (MetaWindow *window,
@ -281,7 +281,7 @@ do_all_constraints (MetaWindow *window,
void
meta_window_constrain (MetaWindow *window,
MetaMoveResizeFlags flags,
int resize_gravity,
MetaGravity resize_gravity,
const MetaRectangle *orig,
MetaRectangle *new,
int *rel_x,
@ -336,7 +336,7 @@ static void
setup_constraint_info (ConstraintInfo *info,
MetaWindow *window,
MetaMoveResizeFlags flags,
int resize_gravity,
MetaGravity resize_gravity,
const MetaRectangle *orig,
MetaRectangle *new)
{
@ -1422,19 +1422,19 @@ constrain_aspect_ratio (MetaWindow *window,
*/
switch (info->resize_gravity)
{
case WestGravity:
case NorthGravity:
case SouthGravity:
case EastGravity:
case META_GRAVITY_WEST:
case META_GRAVITY_NORTH:
case META_GRAVITY_SOUTH:
case META_GRAVITY_EAST:
fudge = 2;
break;
case NorthWestGravity:
case SouthWestGravity:
case CenterGravity:
case NorthEastGravity:
case SouthEastGravity:
case StaticGravity:
case META_GRAVITY_NORTH_WEST:
case META_GRAVITY_SOUTH_WEST:
case META_GRAVITY_CENTER:
case META_GRAVITY_NORTH_EAST:
case META_GRAVITY_SOUTH_EAST:
case META_GRAVITY_STATIC:
default:
fudge = 1;
break;
@ -1454,24 +1454,24 @@ constrain_aspect_ratio (MetaWindow *window,
switch (info->resize_gravity)
{
case WestGravity:
case EastGravity:
case META_GRAVITY_WEST:
case META_GRAVITY_EAST:
/* Yeah, I suck for doing implicit rounding -- sue me */
new_height = CLAMP (new_height, new_width / maxr, new_width / minr);
break;
case NorthGravity:
case SouthGravity:
case META_GRAVITY_NORTH:
case META_GRAVITY_SOUTH:
/* Yeah, I suck for doing implicit rounding -- sue me */
new_width = CLAMP (new_width, new_height * minr, new_height * maxr);
break;
case NorthWestGravity:
case SouthWestGravity:
case CenterGravity:
case NorthEastGravity:
case SouthEastGravity:
case StaticGravity:
case META_GRAVITY_NORTH_WEST:
case META_GRAVITY_SOUTH_WEST:
case META_GRAVITY_CENTER:
case META_GRAVITY_NORTH_EAST:
case META_GRAVITY_SOUTH_EAST:
case META_GRAVITY_STATIC:
default:
/* Find what width would correspond to new_height, and what height would
* correspond to new_width */

View File

@ -29,7 +29,7 @@
void meta_window_constrain (MetaWindow *window,
MetaMoveResizeFlags flags,
int resize_gravity,
MetaGravity resize_gravity,
const MetaRectangle *orig,
MetaRectangle *new,
int *rel_x,

View File

@ -343,7 +343,7 @@ void meta_display_ping_window (MetaWindow *window,
void meta_display_pong_for_serial (MetaDisplay *display,
guint32 serial);
int meta_resize_gravity_from_grab_op (MetaGrabOp op);
MetaGravity meta_resize_gravity_from_grab_op (MetaGrabOp op);
gboolean meta_grab_op_is_moving (MetaGrabOp op);
gboolean meta_grab_op_is_resizing (MetaGrabOp op);

View File

@ -2532,48 +2532,48 @@ meta_display_get_tab_current (MetaDisplay *display,
return NULL;
}
int
MetaGravity
meta_resize_gravity_from_grab_op (MetaGrabOp op)
{
int gravity;
MetaGravity gravity;
gravity = -1;
switch (op)
{
case META_GRAB_OP_RESIZING_SE:
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
gravity = NorthWestGravity;
gravity = META_GRAVITY_NORTH_WEST;
break;
case META_GRAB_OP_KEYBOARD_RESIZING_S:
case META_GRAB_OP_RESIZING_S:
gravity = NorthGravity;
gravity = META_GRAVITY_NORTH;
break;
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
case META_GRAB_OP_RESIZING_SW:
gravity = NorthEastGravity;
gravity = META_GRAVITY_NORTH_EAST;
break;
case META_GRAB_OP_KEYBOARD_RESIZING_N:
case META_GRAB_OP_RESIZING_N:
gravity = SouthGravity;
gravity = META_GRAVITY_SOUTH;
break;
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
case META_GRAB_OP_RESIZING_NE:
gravity = SouthWestGravity;
gravity = META_GRAVITY_SOUTH_WEST;
break;
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
case META_GRAB_OP_RESIZING_NW:
gravity = SouthEastGravity;
gravity = META_GRAVITY_SOUTH_EAST;
break;
case META_GRAB_OP_KEYBOARD_RESIZING_E:
case META_GRAB_OP_RESIZING_E:
gravity = WestGravity;
gravity = META_GRAVITY_WEST;
break;
case META_GRAB_OP_KEYBOARD_RESIZING_W:
case META_GRAB_OP_RESIZING_W:
gravity = EastGravity;
gravity = META_GRAVITY_EAST;
break;
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
gravity = CenterGravity;
gravity = META_GRAVITY_CENTER;
break;
default:
break;

View File

@ -1255,7 +1255,7 @@ void
meta_window_edge_resistance_for_resize (MetaWindow *window,
int *new_width,
int *new_height,
int gravity,
MetaGravity gravity,
GSourceFunc timeout_func,
gboolean snap,
gboolean is_keyboard_op)

View File

@ -33,7 +33,7 @@ void meta_window_edge_resistance_for_move (MetaWindow *window,
void meta_window_edge_resistance_for_resize (MetaWindow *window,
int *new_width,
int *new_height,
int gravity,
MetaGravity gravity,
GSourceFunc timeout_func,
gboolean snap,
gboolean is_keyboard_op);

View File

@ -2625,7 +2625,7 @@ process_keyboard_resize_grab (MetaDisplay *display,
int width_inc;
int width, height;
gboolean smart_snap;
int gravity;
MetaGravity gravity;
handled = FALSE;
@ -2697,23 +2697,25 @@ process_keyboard_resize_grab (MetaDisplay *display,
case CLUTTER_KEY_KP_Up:
switch (gravity)
{
case NorthGravity:
case NorthWestGravity:
case NorthEastGravity:
case META_GRAVITY_NORTH:
case META_GRAVITY_NORTH_WEST:
case META_GRAVITY_NORTH_EAST:
/* Move bottom edge up */
height -= height_inc;
break;
case SouthGravity:
case SouthWestGravity:
case SouthEastGravity:
case META_GRAVITY_SOUTH:
case META_GRAVITY_SOUTH_WEST:
case META_GRAVITY_SOUTH_EAST:
/* Move top edge up */
height += height_inc;
break;
case EastGravity:
case WestGravity:
case CenterGravity:
case META_GRAVITY_EAST:
case META_GRAVITY_WEST:
case META_GRAVITY_CENTER:
case META_GRAVITY_NONE:
case META_GRAVITY_STATIC:
g_assert_not_reached ();
break;
}
@ -2725,23 +2727,25 @@ process_keyboard_resize_grab (MetaDisplay *display,
case CLUTTER_KEY_KP_Down:
switch (gravity)
{
case NorthGravity:
case NorthWestGravity:
case NorthEastGravity:
case META_GRAVITY_NORTH:
case META_GRAVITY_NORTH_WEST:
case META_GRAVITY_NORTH_EAST:
/* Move bottom edge down */
height += height_inc;
break;
case SouthGravity:
case SouthWestGravity:
case SouthEastGravity:
case META_GRAVITY_SOUTH:
case META_GRAVITY_SOUTH_WEST:
case META_GRAVITY_SOUTH_EAST:
/* Move top edge down */
height -= height_inc;
break;
case EastGravity:
case WestGravity:
case CenterGravity:
case META_GRAVITY_EAST:
case META_GRAVITY_WEST:
case META_GRAVITY_CENTER:
case META_GRAVITY_NONE:
case META_GRAVITY_STATIC:
g_assert_not_reached ();
break;
}
@ -2753,23 +2757,25 @@ process_keyboard_resize_grab (MetaDisplay *display,
case CLUTTER_KEY_KP_Left:
switch (gravity)
{
case EastGravity:
case SouthEastGravity:
case NorthEastGravity:
case META_GRAVITY_EAST:
case META_GRAVITY_SOUTH_EAST:
case META_GRAVITY_NORTH_EAST:
/* Move left edge left */
width += width_inc;
break;
case WestGravity:
case SouthWestGravity:
case NorthWestGravity:
case META_GRAVITY_WEST:
case META_GRAVITY_SOUTH_WEST:
case META_GRAVITY_NORTH_WEST:
/* Move right edge left */
width -= width_inc;
break;
case NorthGravity:
case SouthGravity:
case CenterGravity:
case META_GRAVITY_NORTH:
case META_GRAVITY_SOUTH:
case META_GRAVITY_CENTER:
case META_GRAVITY_NONE:
case META_GRAVITY_STATIC:
g_assert_not_reached ();
break;
}
@ -2781,23 +2787,25 @@ process_keyboard_resize_grab (MetaDisplay *display,
case CLUTTER_KEY_KP_Right:
switch (gravity)
{
case EastGravity:
case SouthEastGravity:
case NorthEastGravity:
case META_GRAVITY_EAST:
case META_GRAVITY_SOUTH_EAST:
case META_GRAVITY_NORTH_EAST:
/* Move left edge right */
width -= width_inc;
break;
case WestGravity:
case SouthWestGravity:
case NorthWestGravity:
case META_GRAVITY_WEST:
case META_GRAVITY_SOUTH_WEST:
case META_GRAVITY_NORTH_WEST:
/* Move right edge right */
width += width_inc;
break;
case NorthGravity:
case SouthGravity:
case CenterGravity:
case META_GRAVITY_NORTH:
case META_GRAVITY_SOUTH:
case META_GRAVITY_CENTER:
case META_GRAVITY_NONE:
case META_GRAVITY_STATIC:
g_assert_not_reached ();
break;
}
@ -2940,7 +2948,7 @@ handle_always_on_top (MetaDisplay *display,
static void
handle_move_to_corner_backend (MetaDisplay *display,
MetaWindow *window,
int gravity)
MetaGravity gravity)
{
MetaRectangle work_area;
MetaRectangle frame_rect;
@ -2954,18 +2962,18 @@ handle_move_to_corner_backend (MetaDisplay *display,
switch (gravity)
{
case NorthWestGravity:
case WestGravity:
case SouthWestGravity:
case META_GRAVITY_NORTH_WEST:
case META_GRAVITY_WEST:
case META_GRAVITY_SOUTH_WEST:
new_x = work_area.x;
break;
case NorthGravity:
case SouthGravity:
case META_GRAVITY_NORTH:
case META_GRAVITY_SOUTH:
new_x = frame_rect.x;
break;
case NorthEastGravity:
case EastGravity:
case SouthEastGravity:
case META_GRAVITY_NORTH_EAST:
case META_GRAVITY_EAST:
case META_GRAVITY_SOUTH_EAST:
new_x = work_area.x + work_area.width - frame_rect.width;
break;
default:
@ -2974,18 +2982,18 @@ handle_move_to_corner_backend (MetaDisplay *display,
switch (gravity)
{
case NorthWestGravity:
case NorthGravity:
case NorthEastGravity:
case META_GRAVITY_NORTH_WEST:
case META_GRAVITY_NORTH:
case META_GRAVITY_NORTH_EAST:
new_y = work_area.y;
break;
case WestGravity:
case EastGravity:
case META_GRAVITY_WEST:
case META_GRAVITY_EAST:
new_y = frame_rect.y;
break;
case SouthWestGravity:
case SouthGravity:
case SouthEastGravity:
case META_GRAVITY_SOUTH_WEST:
case META_GRAVITY_SOUTH:
case META_GRAVITY_SOUTH_EAST:
new_y = work_area.y + work_area.height - frame_rect.height;
break;
default:
@ -3005,7 +3013,7 @@ handle_move_to_corner_nw (MetaDisplay *display,
MetaKeyBinding *binding,
gpointer dummy)
{
handle_move_to_corner_backend (display, window, NorthWestGravity);
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH_WEST);
}
static void
@ -3015,7 +3023,7 @@ handle_move_to_corner_ne (MetaDisplay *display,
MetaKeyBinding *binding,
gpointer dummy)
{
handle_move_to_corner_backend (display, window, NorthEastGravity);
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH_EAST);
}
static void
@ -3025,7 +3033,7 @@ handle_move_to_corner_sw (MetaDisplay *display,
MetaKeyBinding *binding,
gpointer dummy)
{
handle_move_to_corner_backend (display, window, SouthWestGravity);
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH_WEST);
}
static void
@ -3035,7 +3043,7 @@ handle_move_to_corner_se (MetaDisplay *display,
MetaKeyBinding *binding,
gpointer dummy)
{
handle_move_to_corner_backend (display, window, SouthEastGravity);
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH_EAST);
}
static void
@ -3045,7 +3053,7 @@ handle_move_to_side_n (MetaDisplay *display,
MetaKeyBinding *binding,
gpointer dummy)
{
handle_move_to_corner_backend (display, window, NorthGravity);
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH);
}
static void
@ -3055,7 +3063,7 @@ handle_move_to_side_s (MetaDisplay *display,
MetaKeyBinding *binding,
gpointer dummy)
{
handle_move_to_corner_backend (display, window, SouthGravity);
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH);
}
static void
@ -3065,7 +3073,7 @@ handle_move_to_side_e (MetaDisplay *display,
MetaKeyBinding *binding,
gpointer dummy)
{
handle_move_to_corner_backend (display, window, EastGravity);
handle_move_to_corner_backend (display, window, META_GRAVITY_EAST);
}
static void
@ -3075,7 +3083,7 @@ handle_move_to_side_w (MetaDisplay *display,
MetaKeyBinding *binding,
gpointer dummy)
{
handle_move_to_corner_backend (display, window, WestGravity);
handle_move_to_corner_backend (display, window, META_GRAVITY_WEST);
}
static void

View File

@ -527,42 +527,42 @@ meta_unsigned_long_hash (gconstpointer v)
}
const char*
meta_gravity_to_string (int gravity)
meta_gravity_to_string (MetaGravity gravity)
{
switch (gravity)
{
case NorthWestGravity:
return "NorthWestGravity";
case META_GRAVITY_NORTH_WEST:
return "META_GRAVITY_NORTH_WEST";
break;
case NorthGravity:
return "NorthGravity";
case META_GRAVITY_NORTH:
return "META_GRAVITY_NORTH";
break;
case NorthEastGravity:
return "NorthEastGravity";
case META_GRAVITY_NORTH_EAST:
return "META_GRAVITY_NORTH_EAST";
break;
case WestGravity:
return "WestGravity";
case META_GRAVITY_WEST:
return "META_GRAVITY_WEST";
break;
case CenterGravity:
return "CenterGravity";
case META_GRAVITY_CENTER:
return "META_GRAVITY_CENTER";
break;
case EastGravity:
return "EastGravity";
case META_GRAVITY_EAST:
return "META_GRAVITY_EAST";
break;
case SouthWestGravity:
return "SouthWestGravity";
case META_GRAVITY_SOUTH_WEST:
return "META_GRAVITY_SOUTH_WEST";
break;
case SouthGravity:
return "SouthGravity";
case META_GRAVITY_SOUTH:
return "META_GRAVITY_SOUTH";
break;
case SouthEastGravity:
return "SouthEastGravity";
case META_GRAVITY_SOUTH_EAST:
return "META_GRAVITY_SOUTH_EAST";
break;
case StaticGravity:
return "StaticGravity";
case META_GRAVITY_STATIC:
return "META_GRAVITY_STATIC";
break;
default:
return "NorthWestGravity";
return "META_GRAVITY_NORTH_WEST";
break;
}
}

View File

@ -566,7 +566,7 @@ struct _MetaWindowClass
MetaGrabOp op);
void (*current_workspace_changed) (MetaWindow *window);
void (*move_resize_internal) (MetaWindow *window,
int gravity,
MetaGravity gravity,
MetaRectangle unconstrained_rect,
MetaRectangle constrained_rect,
int rel_x,
@ -668,7 +668,7 @@ void meta_window_resize_frame_with_gravity (MetaWindow *window,
gboolean user_op,
int w,
int h,
int gravity);
MetaGravity gravity);
/* Return whether the window should be currently mapped */
gboolean meta_window_should_be_showing (MetaWindow *window);
@ -681,7 +681,7 @@ void meta_window_update_struts (MetaWindow *window);
* request.
*/
void meta_window_get_gravity_position (MetaWindow *window,
int gravity,
MetaGravity gravity,
int *x,
int *y);
/* Get geometry for saving in the session; x/y are gravity
@ -840,7 +840,7 @@ void meta_window_update_resize (MetaWindow *window,
void meta_window_move_resize_internal (MetaWindow *window,
MetaMoveResizeFlags flags,
int gravity,
MetaGravity gravity,
MetaRectangle frame_rect);
void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op);

View File

@ -2366,7 +2366,7 @@ meta_window_force_placement (MetaWindow *window,
meta_window_move_resize_internal (window,
flags,
NorthWestGravity,
META_GRAVITY_NORTH_WEST,
window->unconstrained_rect);
window->calc_placement = FALSE;
@ -2915,7 +2915,7 @@ meta_window_maximize (MetaWindow *window,
(META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED),
NorthWestGravity,
META_GRAVITY_NORTH_WEST,
window->unconstrained_rect);
}
}
@ -3187,7 +3187,7 @@ meta_window_tile (MetaWindow *window,
(META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED),
NorthWestGravity,
META_GRAVITY_NORTH_WEST,
window->unconstrained_rect);
if (window->frame)
@ -3385,7 +3385,7 @@ meta_window_unmaximize (MetaWindow *window,
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_UNMAXIMIZE),
NorthWestGravity,
META_GRAVITY_NORTH_WEST,
target_rect);
/* When we unmaximize, if we're doing a mouse move also we could
@ -3502,7 +3502,7 @@ meta_window_make_fullscreen (MetaWindow *window)
(META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED),
NorthWestGravity,
META_GRAVITY_NORTH_WEST,
window->unconstrained_rect);
}
}
@ -3547,7 +3547,7 @@ meta_window_unmake_fullscreen (MetaWindow *window)
META_MOVE_RESIZE_RESIZE_ACTION |
META_MOVE_RESIZE_STATE_CHANGED |
META_MOVE_RESIZE_UNFULLSCREEN),
NorthWestGravity,
META_GRAVITY_NORTH_WEST,
target_rect);
meta_display_queue_check_fullscreen (window->display);
@ -3804,7 +3804,7 @@ meta_window_reposition (MetaWindow *window)
meta_window_move_resize_internal (window,
(META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION),
NorthWestGravity,
META_GRAVITY_NORTH_WEST,
window->rect);
}
@ -3975,7 +3975,7 @@ meta_window_update_monitor (MetaWindow *window,
void
meta_window_move_resize_internal (MetaWindow *window,
MetaMoveResizeFlags flags,
int gravity,
MetaGravity gravity,
MetaRectangle frame_rect)
{
/* The rectangle here that's passed in *always* in "frame rect"
@ -4181,7 +4181,7 @@ meta_window_move_frame (MetaWindow *window,
g_return_if_fail (!window->override_redirect);
flags = (user_op ? META_MOVE_RESIZE_USER_ACTION : 0) | META_MOVE_RESIZE_MOVE_ACTION;
meta_window_move_resize_internal (window, flags, NorthWestGravity, rect);
meta_window_move_resize_internal (window, flags, META_GRAVITY_NORTH_WEST, rect);
}
static void
@ -4214,7 +4214,7 @@ meta_window_move_between_rects (MetaWindow *window,
move_resize_flags |
META_MOVE_RESIZE_MOVE_ACTION |
META_MOVE_RESIZE_RESIZE_ACTION,
NorthWestGravity,
META_GRAVITY_NORTH_WEST,
window->unconstrained_rect);
}
@ -4245,7 +4245,7 @@ meta_window_move_resize_frame (MetaWindow *window,
flags = (user_op ? META_MOVE_RESIZE_USER_ACTION : 0) | META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION;
meta_window_move_resize_internal (window, flags, NorthWestGravity, rect);
meta_window_move_resize_internal (window, flags, META_GRAVITY_NORTH_WEST, rect);
}
/**
@ -4325,7 +4325,7 @@ meta_window_resize_frame_with_gravity (MetaWindow *window,
gboolean user_op,
int w,
int h,
int gravity)
MetaGravity gravity)
{
MetaMoveResizeFlags flags;
MetaRectangle rect;
@ -4399,7 +4399,7 @@ idle_move_resize (gpointer data)
void
meta_window_get_gravity_position (MetaWindow *window,
int gravity,
MetaGravity gravity,
int *root_x,
int *root_y)
{
@ -4410,7 +4410,7 @@ meta_window_get_gravity_position (MetaWindow *window,
w = window->rect.width;
h = window->rect.height;
if (gravity == StaticGravity)
if (gravity == META_GRAVITY_STATIC)
{
frame_extents = window->rect;
if (window->frame)
@ -4432,18 +4432,18 @@ meta_window_get_gravity_position (MetaWindow *window,
switch (gravity)
{
case NorthGravity:
case CenterGravity:
case SouthGravity:
case META_GRAVITY_NORTH:
case META_GRAVITY_CENTER:
case META_GRAVITY_SOUTH:
/* Find center of frame. */
x += frame_extents.width / 2;
/* Center client window on that point. */
x -= w / 2;
break;
case SouthEastGravity:
case EastGravity:
case NorthEastGravity:
case META_GRAVITY_SOUTH_EAST:
case META_GRAVITY_EAST:
case META_GRAVITY_NORTH_EAST:
/* Find right edge of frame */
x += frame_extents.width;
/* Align left edge of client at that point. */
@ -4455,17 +4455,17 @@ meta_window_get_gravity_position (MetaWindow *window,
switch (gravity)
{
case WestGravity:
case CenterGravity:
case EastGravity:
case META_GRAVITY_WEST:
case META_GRAVITY_CENTER:
case META_GRAVITY_EAST:
/* Find center of frame. */
y += frame_extents.height / 2;
/* Center client window there. */
y -= h / 2;
break;
case SouthWestGravity:
case SouthGravity:
case SouthEastGravity:
case META_GRAVITY_SOUTH_WEST:
case META_GRAVITY_SOUTH:
case META_GRAVITY_SOUTH_EAST:
/* Find south edge of frame */
y += frame_extents.height;
/* Place bottom edge of client there */
@ -6247,7 +6247,7 @@ update_resize (MetaWindow *window,
{
int dx, dy;
int new_w, new_h;
int gravity;
MetaGravity gravity;
MetaRectangle old;
double remaining = 0;