mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 07:30:42 -05:00
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:
parent
ff381d1d52
commit
0dac91cffc
@ -227,7 +227,7 @@ are used for different purposes:
|
|||||||
Examples of where each are used:
|
Examples of where each are used:
|
||||||
|
|
||||||
- If a window is simultaneously moved and resized to the southeast corner
|
- If a window is simultaneously moved and resized to the southeast corner
|
||||||
with SouthEastGravity, but it turns out that the window was sized to
|
with META_GRAVITY_SOUTH_EAST, but it turns out that the window was sized to
|
||||||
something smaller than the minimum size hint, then the size_hints
|
something smaller than the minimum size hint, then the size_hints
|
||||||
constraint should resize the window using the resize_gravity to ensure
|
constraint should resize the window using the resize_gravity to ensure
|
||||||
that the southeast corner doesn't move.
|
that the southeast corner doesn't move.
|
||||||
|
@ -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
|
/* 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
|
* 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
|
* A MOVERESIZE OPERATION (that simplies the routine a little bit as it
|
||||||
* means there's no difference between NorthWestGravity and StaticGravity.
|
* means there's no difference between META_GRAVITY_NORTH_WEST and
|
||||||
* Also, I lied a little bit--technically, you could use it in a MoveResize
|
* META_GRAVITY_STATIC. Also, I lied a little bit--technically, you could use
|
||||||
* operation if you muck with old_rect just right).
|
* it in a MoveResize operation if you muck with old_rect just right).
|
||||||
*/
|
*/
|
||||||
META_EXPORT_TEST
|
META_EXPORT_TEST
|
||||||
void meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
|
void meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
|
||||||
MetaRectangle *rect,
|
MetaRectangle *rect,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
int new_width,
|
int new_width,
|
||||||
int new_height);
|
int new_height);
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ meta_rectangle_contains_rect (const MetaRectangle *outer_rect,
|
|||||||
void
|
void
|
||||||
meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
|
meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
|
||||||
MetaRectangle *rect,
|
MetaRectangle *rect,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
int new_width,
|
int new_width,
|
||||||
int new_height)
|
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
|
* 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.
|
* width and new total width) and you come up with the same formulas.
|
||||||
*
|
*
|
||||||
* Also, note that the reason we can treat NorthWestGravity and
|
* Also, note that the reason we can treat META_GRAVITY_NORTH_WEST and
|
||||||
* StaticGravity the same is because we're not given a location at
|
* META_GRAVITY_STATIC the same is because we're not given a location at
|
||||||
* which to place the window--the window was already placed
|
* 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
|
* 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
|
* just leave the upper left corner of the inner window where it
|
||||||
* already is. But leaving either of those two corners where they
|
* already is. But leaving either of those two corners where they
|
||||||
* already are will ensure that the other corner is fixed as well
|
* 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 */
|
/* First, the x direction */
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
rect->x = old_rect->x;
|
rect->x = old_rect->x;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
/* FIXME: Needing to adjust new_width kind of sucks, but not doing so
|
/* FIXME: Needing to adjust new_width kind of sucks, but not doing so
|
||||||
* would cause drift.
|
* 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;
|
rect->x = old_rect->x + (old_rect->width - new_width)/2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
rect->x = old_rect->x + (old_rect->width - new_width);
|
rect->x = old_rect->x + (old_rect->width - new_width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StaticGravity:
|
case META_GRAVITY_STATIC:
|
||||||
default:
|
default:
|
||||||
rect->x = old_rect->x;
|
rect->x = old_rect->x;
|
||||||
break;
|
break;
|
||||||
@ -390,15 +390,15 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
|
|||||||
/* Next, the y direction */
|
/* Next, the y direction */
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
rect->y = old_rect->y;
|
rect->y = old_rect->y;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
/* FIXME: Needing to adjust new_height kind of sucks, but not doing so
|
/* FIXME: Needing to adjust new_height kind of sucks, but not doing so
|
||||||
* would cause drift.
|
* 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;
|
rect->y = old_rect->y + (old_rect->height - new_height)/2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
rect->y = old_rect->y + (old_rect->height - new_height);
|
rect->y = old_rect->y + (old_rect->height - new_height);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StaticGravity:
|
case META_GRAVITY_STATIC:
|
||||||
default:
|
default:
|
||||||
rect->y = old_rect->y;
|
rect->y = old_rect->y;
|
||||||
break;
|
break;
|
||||||
|
@ -133,7 +133,7 @@ typedef struct
|
|||||||
* explanation of the differences and similarity between resize_gravity
|
* explanation of the differences and similarity between resize_gravity
|
||||||
* and fixed_directions
|
* and fixed_directions
|
||||||
*/
|
*/
|
||||||
int resize_gravity;
|
MetaGravity resize_gravity;
|
||||||
FixedDirections fixed_directions;
|
FixedDirections fixed_directions;
|
||||||
|
|
||||||
/* work_area_monitor - current monitor region minus struts
|
/* 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,
|
static void setup_constraint_info (ConstraintInfo *info,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
int resize_gravity,
|
MetaGravity resize_gravity,
|
||||||
const MetaRectangle *orig,
|
const MetaRectangle *orig,
|
||||||
MetaRectangle *new);
|
MetaRectangle *new);
|
||||||
static void place_window_if_needed (MetaWindow *window,
|
static void place_window_if_needed (MetaWindow *window,
|
||||||
@ -281,7 +281,7 @@ do_all_constraints (MetaWindow *window,
|
|||||||
void
|
void
|
||||||
meta_window_constrain (MetaWindow *window,
|
meta_window_constrain (MetaWindow *window,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
int resize_gravity,
|
MetaGravity resize_gravity,
|
||||||
const MetaRectangle *orig,
|
const MetaRectangle *orig,
|
||||||
MetaRectangle *new,
|
MetaRectangle *new,
|
||||||
int *rel_x,
|
int *rel_x,
|
||||||
@ -336,7 +336,7 @@ static void
|
|||||||
setup_constraint_info (ConstraintInfo *info,
|
setup_constraint_info (ConstraintInfo *info,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
int resize_gravity,
|
MetaGravity resize_gravity,
|
||||||
const MetaRectangle *orig,
|
const MetaRectangle *orig,
|
||||||
MetaRectangle *new)
|
MetaRectangle *new)
|
||||||
{
|
{
|
||||||
@ -1422,19 +1422,19 @@ constrain_aspect_ratio (MetaWindow *window,
|
|||||||
*/
|
*/
|
||||||
switch (info->resize_gravity)
|
switch (info->resize_gravity)
|
||||||
{
|
{
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
fudge = 2;
|
fudge = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
case StaticGravity:
|
case META_GRAVITY_STATIC:
|
||||||
default:
|
default:
|
||||||
fudge = 1;
|
fudge = 1;
|
||||||
break;
|
break;
|
||||||
@ -1454,24 +1454,24 @@ constrain_aspect_ratio (MetaWindow *window,
|
|||||||
|
|
||||||
switch (info->resize_gravity)
|
switch (info->resize_gravity)
|
||||||
{
|
{
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
/* Yeah, I suck for doing implicit rounding -- sue me */
|
/* Yeah, I suck for doing implicit rounding -- sue me */
|
||||||
new_height = CLAMP (new_height, new_width / maxr, new_width / minr);
|
new_height = CLAMP (new_height, new_width / maxr, new_width / minr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
/* Yeah, I suck for doing implicit rounding -- sue me */
|
/* Yeah, I suck for doing implicit rounding -- sue me */
|
||||||
new_width = CLAMP (new_width, new_height * minr, new_height * maxr);
|
new_width = CLAMP (new_width, new_height * minr, new_height * maxr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
case StaticGravity:
|
case META_GRAVITY_STATIC:
|
||||||
default:
|
default:
|
||||||
/* Find what width would correspond to new_height, and what height would
|
/* Find what width would correspond to new_height, and what height would
|
||||||
* correspond to new_width */
|
* correspond to new_width */
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
void meta_window_constrain (MetaWindow *window,
|
void meta_window_constrain (MetaWindow *window,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
int resize_gravity,
|
MetaGravity resize_gravity,
|
||||||
const MetaRectangle *orig,
|
const MetaRectangle *orig,
|
||||||
MetaRectangle *new,
|
MetaRectangle *new,
|
||||||
int *rel_x,
|
int *rel_x,
|
||||||
|
@ -343,7 +343,7 @@ void meta_display_ping_window (MetaWindow *window,
|
|||||||
void meta_display_pong_for_serial (MetaDisplay *display,
|
void meta_display_pong_for_serial (MetaDisplay *display,
|
||||||
guint32 serial);
|
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_moving (MetaGrabOp op);
|
||||||
gboolean meta_grab_op_is_resizing (MetaGrabOp op);
|
gboolean meta_grab_op_is_resizing (MetaGrabOp op);
|
||||||
|
@ -2532,48 +2532,48 @@ meta_display_get_tab_current (MetaDisplay *display,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
MetaGravity
|
||||||
meta_resize_gravity_from_grab_op (MetaGrabOp op)
|
meta_resize_gravity_from_grab_op (MetaGrabOp op)
|
||||||
{
|
{
|
||||||
int gravity;
|
MetaGravity gravity;
|
||||||
|
|
||||||
gravity = -1;
|
gravity = -1;
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case META_GRAB_OP_RESIZING_SE:
|
case META_GRAB_OP_RESIZING_SE:
|
||||||
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
case META_GRAB_OP_KEYBOARD_RESIZING_SE:
|
||||||
gravity = NorthWestGravity;
|
gravity = META_GRAVITY_NORTH_WEST;
|
||||||
break;
|
break;
|
||||||
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
case META_GRAB_OP_KEYBOARD_RESIZING_S:
|
||||||
case META_GRAB_OP_RESIZING_S:
|
case META_GRAB_OP_RESIZING_S:
|
||||||
gravity = NorthGravity;
|
gravity = META_GRAVITY_NORTH;
|
||||||
break;
|
break;
|
||||||
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
case META_GRAB_OP_KEYBOARD_RESIZING_SW:
|
||||||
case META_GRAB_OP_RESIZING_SW:
|
case META_GRAB_OP_RESIZING_SW:
|
||||||
gravity = NorthEastGravity;
|
gravity = META_GRAVITY_NORTH_EAST;
|
||||||
break;
|
break;
|
||||||
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
case META_GRAB_OP_KEYBOARD_RESIZING_N:
|
||||||
case META_GRAB_OP_RESIZING_N:
|
case META_GRAB_OP_RESIZING_N:
|
||||||
gravity = SouthGravity;
|
gravity = META_GRAVITY_SOUTH;
|
||||||
break;
|
break;
|
||||||
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
case META_GRAB_OP_KEYBOARD_RESIZING_NE:
|
||||||
case META_GRAB_OP_RESIZING_NE:
|
case META_GRAB_OP_RESIZING_NE:
|
||||||
gravity = SouthWestGravity;
|
gravity = META_GRAVITY_SOUTH_WEST;
|
||||||
break;
|
break;
|
||||||
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
case META_GRAB_OP_KEYBOARD_RESIZING_NW:
|
||||||
case META_GRAB_OP_RESIZING_NW:
|
case META_GRAB_OP_RESIZING_NW:
|
||||||
gravity = SouthEastGravity;
|
gravity = META_GRAVITY_SOUTH_EAST;
|
||||||
break;
|
break;
|
||||||
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
case META_GRAB_OP_KEYBOARD_RESIZING_E:
|
||||||
case META_GRAB_OP_RESIZING_E:
|
case META_GRAB_OP_RESIZING_E:
|
||||||
gravity = WestGravity;
|
gravity = META_GRAVITY_WEST;
|
||||||
break;
|
break;
|
||||||
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
case META_GRAB_OP_KEYBOARD_RESIZING_W:
|
||||||
case META_GRAB_OP_RESIZING_W:
|
case META_GRAB_OP_RESIZING_W:
|
||||||
gravity = EastGravity;
|
gravity = META_GRAVITY_EAST;
|
||||||
break;
|
break;
|
||||||
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
|
||||||
gravity = CenterGravity;
|
gravity = META_GRAVITY_CENTER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1255,7 +1255,7 @@ void
|
|||||||
meta_window_edge_resistance_for_resize (MetaWindow *window,
|
meta_window_edge_resistance_for_resize (MetaWindow *window,
|
||||||
int *new_width,
|
int *new_width,
|
||||||
int *new_height,
|
int *new_height,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
GSourceFunc timeout_func,
|
GSourceFunc timeout_func,
|
||||||
gboolean snap,
|
gboolean snap,
|
||||||
gboolean is_keyboard_op)
|
gboolean is_keyboard_op)
|
||||||
|
@ -33,7 +33,7 @@ void meta_window_edge_resistance_for_move (MetaWindow *window,
|
|||||||
void meta_window_edge_resistance_for_resize (MetaWindow *window,
|
void meta_window_edge_resistance_for_resize (MetaWindow *window,
|
||||||
int *new_width,
|
int *new_width,
|
||||||
int *new_height,
|
int *new_height,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
GSourceFunc timeout_func,
|
GSourceFunc timeout_func,
|
||||||
gboolean snap,
|
gboolean snap,
|
||||||
gboolean is_keyboard_op);
|
gboolean is_keyboard_op);
|
||||||
|
@ -2625,7 +2625,7 @@ process_keyboard_resize_grab (MetaDisplay *display,
|
|||||||
int width_inc;
|
int width_inc;
|
||||||
int width, height;
|
int width, height;
|
||||||
gboolean smart_snap;
|
gboolean smart_snap;
|
||||||
int gravity;
|
MetaGravity gravity;
|
||||||
|
|
||||||
handled = FALSE;
|
handled = FALSE;
|
||||||
|
|
||||||
@ -2697,23 +2697,25 @@ process_keyboard_resize_grab (MetaDisplay *display,
|
|||||||
case CLUTTER_KEY_KP_Up:
|
case CLUTTER_KEY_KP_Up:
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
/* Move bottom edge up */
|
/* Move bottom edge up */
|
||||||
height -= height_inc;
|
height -= height_inc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
/* Move top edge up */
|
/* Move top edge up */
|
||||||
height += height_inc;
|
height += height_inc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
|
case META_GRAVITY_NONE:
|
||||||
|
case META_GRAVITY_STATIC:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2725,23 +2727,25 @@ process_keyboard_resize_grab (MetaDisplay *display,
|
|||||||
case CLUTTER_KEY_KP_Down:
|
case CLUTTER_KEY_KP_Down:
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
/* Move bottom edge down */
|
/* Move bottom edge down */
|
||||||
height += height_inc;
|
height += height_inc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
/* Move top edge down */
|
/* Move top edge down */
|
||||||
height -= height_inc;
|
height -= height_inc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
|
case META_GRAVITY_NONE:
|
||||||
|
case META_GRAVITY_STATIC:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2753,23 +2757,25 @@ process_keyboard_resize_grab (MetaDisplay *display,
|
|||||||
case CLUTTER_KEY_KP_Left:
|
case CLUTTER_KEY_KP_Left:
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
/* Move left edge left */
|
/* Move left edge left */
|
||||||
width += width_inc;
|
width += width_inc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
/* Move right edge left */
|
/* Move right edge left */
|
||||||
width -= width_inc;
|
width -= width_inc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
|
case META_GRAVITY_NONE:
|
||||||
|
case META_GRAVITY_STATIC:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2781,23 +2787,25 @@ process_keyboard_resize_grab (MetaDisplay *display,
|
|||||||
case CLUTTER_KEY_KP_Right:
|
case CLUTTER_KEY_KP_Right:
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
/* Move left edge right */
|
/* Move left edge right */
|
||||||
width -= width_inc;
|
width -= width_inc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
/* Move right edge right */
|
/* Move right edge right */
|
||||||
width += width_inc;
|
width += width_inc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
|
case META_GRAVITY_NONE:
|
||||||
|
case META_GRAVITY_STATIC:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2940,7 +2948,7 @@ handle_always_on_top (MetaDisplay *display,
|
|||||||
static void
|
static void
|
||||||
handle_move_to_corner_backend (MetaDisplay *display,
|
handle_move_to_corner_backend (MetaDisplay *display,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
int gravity)
|
MetaGravity gravity)
|
||||||
{
|
{
|
||||||
MetaRectangle work_area;
|
MetaRectangle work_area;
|
||||||
MetaRectangle frame_rect;
|
MetaRectangle frame_rect;
|
||||||
@ -2954,18 +2962,18 @@ handle_move_to_corner_backend (MetaDisplay *display,
|
|||||||
|
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
new_x = work_area.x;
|
new_x = work_area.x;
|
||||||
break;
|
break;
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
new_x = frame_rect.x;
|
new_x = frame_rect.x;
|
||||||
break;
|
break;
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
new_x = work_area.x + work_area.width - frame_rect.width;
|
new_x = work_area.x + work_area.width - frame_rect.width;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2974,18 +2982,18 @@ handle_move_to_corner_backend (MetaDisplay *display,
|
|||||||
|
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
new_y = work_area.y;
|
new_y = work_area.y;
|
||||||
break;
|
break;
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
new_y = frame_rect.y;
|
new_y = frame_rect.y;
|
||||||
break;
|
break;
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
new_y = work_area.y + work_area.height - frame_rect.height;
|
new_y = work_area.y + work_area.height - frame_rect.height;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -3005,7 +3013,7 @@ handle_move_to_corner_nw (MetaDisplay *display,
|
|||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
handle_move_to_corner_backend (display, window, NorthWestGravity);
|
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH_WEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3015,7 +3023,7 @@ handle_move_to_corner_ne (MetaDisplay *display,
|
|||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
handle_move_to_corner_backend (display, window, NorthEastGravity);
|
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH_EAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3025,7 +3033,7 @@ handle_move_to_corner_sw (MetaDisplay *display,
|
|||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
handle_move_to_corner_backend (display, window, SouthWestGravity);
|
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH_WEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3035,7 +3043,7 @@ handle_move_to_corner_se (MetaDisplay *display,
|
|||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
handle_move_to_corner_backend (display, window, SouthEastGravity);
|
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH_EAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3045,7 +3053,7 @@ handle_move_to_side_n (MetaDisplay *display,
|
|||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
handle_move_to_corner_backend (display, window, NorthGravity);
|
handle_move_to_corner_backend (display, window, META_GRAVITY_NORTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3055,7 +3063,7 @@ handle_move_to_side_s (MetaDisplay *display,
|
|||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
handle_move_to_corner_backend (display, window, SouthGravity);
|
handle_move_to_corner_backend (display, window, META_GRAVITY_SOUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3065,7 +3073,7 @@ handle_move_to_side_e (MetaDisplay *display,
|
|||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
handle_move_to_corner_backend (display, window, EastGravity);
|
handle_move_to_corner_backend (display, window, META_GRAVITY_EAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3075,7 +3083,7 @@ handle_move_to_side_w (MetaDisplay *display,
|
|||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
handle_move_to_corner_backend (display, window, WestGravity);
|
handle_move_to_corner_backend (display, window, META_GRAVITY_WEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -527,42 +527,42 @@ meta_unsigned_long_hash (gconstpointer v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
meta_gravity_to_string (int gravity)
|
meta_gravity_to_string (MetaGravity gravity)
|
||||||
{
|
{
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthWestGravity:
|
case META_GRAVITY_NORTH_WEST:
|
||||||
return "NorthWestGravity";
|
return "META_GRAVITY_NORTH_WEST";
|
||||||
break;
|
break;
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
return "NorthGravity";
|
return "META_GRAVITY_NORTH";
|
||||||
break;
|
break;
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
return "NorthEastGravity";
|
return "META_GRAVITY_NORTH_EAST";
|
||||||
break;
|
break;
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
return "WestGravity";
|
return "META_GRAVITY_WEST";
|
||||||
break;
|
break;
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
return "CenterGravity";
|
return "META_GRAVITY_CENTER";
|
||||||
break;
|
break;
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
return "EastGravity";
|
return "META_GRAVITY_EAST";
|
||||||
break;
|
break;
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
return "SouthWestGravity";
|
return "META_GRAVITY_SOUTH_WEST";
|
||||||
break;
|
break;
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
return "SouthGravity";
|
return "META_GRAVITY_SOUTH";
|
||||||
break;
|
break;
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
return "SouthEastGravity";
|
return "META_GRAVITY_SOUTH_EAST";
|
||||||
break;
|
break;
|
||||||
case StaticGravity:
|
case META_GRAVITY_STATIC:
|
||||||
return "StaticGravity";
|
return "META_GRAVITY_STATIC";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return "NorthWestGravity";
|
return "META_GRAVITY_NORTH_WEST";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@ struct _MetaWindowClass
|
|||||||
MetaGrabOp op);
|
MetaGrabOp op);
|
||||||
void (*current_workspace_changed) (MetaWindow *window);
|
void (*current_workspace_changed) (MetaWindow *window);
|
||||||
void (*move_resize_internal) (MetaWindow *window,
|
void (*move_resize_internal) (MetaWindow *window,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
MetaRectangle unconstrained_rect,
|
MetaRectangle unconstrained_rect,
|
||||||
MetaRectangle constrained_rect,
|
MetaRectangle constrained_rect,
|
||||||
int rel_x,
|
int rel_x,
|
||||||
@ -668,7 +668,7 @@ void meta_window_resize_frame_with_gravity (MetaWindow *window,
|
|||||||
gboolean user_op,
|
gboolean user_op,
|
||||||
int w,
|
int w,
|
||||||
int h,
|
int h,
|
||||||
int gravity);
|
MetaGravity gravity);
|
||||||
|
|
||||||
/* Return whether the window should be currently mapped */
|
/* Return whether the window should be currently mapped */
|
||||||
gboolean meta_window_should_be_showing (MetaWindow *window);
|
gboolean meta_window_should_be_showing (MetaWindow *window);
|
||||||
@ -681,7 +681,7 @@ void meta_window_update_struts (MetaWindow *window);
|
|||||||
* request.
|
* request.
|
||||||
*/
|
*/
|
||||||
void meta_window_get_gravity_position (MetaWindow *window,
|
void meta_window_get_gravity_position (MetaWindow *window,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
int *x,
|
int *x,
|
||||||
int *y);
|
int *y);
|
||||||
/* Get geometry for saving in the session; x/y are gravity
|
/* 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,
|
void meta_window_move_resize_internal (MetaWindow *window,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
MetaRectangle frame_rect);
|
MetaRectangle frame_rect);
|
||||||
|
|
||||||
void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op);
|
void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op);
|
||||||
|
@ -2366,7 +2366,7 @@ meta_window_force_placement (MetaWindow *window,
|
|||||||
|
|
||||||
meta_window_move_resize_internal (window,
|
meta_window_move_resize_internal (window,
|
||||||
flags,
|
flags,
|
||||||
NorthWestGravity,
|
META_GRAVITY_NORTH_WEST,
|
||||||
window->unconstrained_rect);
|
window->unconstrained_rect);
|
||||||
window->calc_placement = FALSE;
|
window->calc_placement = FALSE;
|
||||||
|
|
||||||
@ -2915,7 +2915,7 @@ meta_window_maximize (MetaWindow *window,
|
|||||||
(META_MOVE_RESIZE_MOVE_ACTION |
|
(META_MOVE_RESIZE_MOVE_ACTION |
|
||||||
META_MOVE_RESIZE_RESIZE_ACTION |
|
META_MOVE_RESIZE_RESIZE_ACTION |
|
||||||
META_MOVE_RESIZE_STATE_CHANGED),
|
META_MOVE_RESIZE_STATE_CHANGED),
|
||||||
NorthWestGravity,
|
META_GRAVITY_NORTH_WEST,
|
||||||
window->unconstrained_rect);
|
window->unconstrained_rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3187,7 +3187,7 @@ meta_window_tile (MetaWindow *window,
|
|||||||
(META_MOVE_RESIZE_MOVE_ACTION |
|
(META_MOVE_RESIZE_MOVE_ACTION |
|
||||||
META_MOVE_RESIZE_RESIZE_ACTION |
|
META_MOVE_RESIZE_RESIZE_ACTION |
|
||||||
META_MOVE_RESIZE_STATE_CHANGED),
|
META_MOVE_RESIZE_STATE_CHANGED),
|
||||||
NorthWestGravity,
|
META_GRAVITY_NORTH_WEST,
|
||||||
window->unconstrained_rect);
|
window->unconstrained_rect);
|
||||||
|
|
||||||
if (window->frame)
|
if (window->frame)
|
||||||
@ -3385,7 +3385,7 @@ meta_window_unmaximize (MetaWindow *window,
|
|||||||
META_MOVE_RESIZE_RESIZE_ACTION |
|
META_MOVE_RESIZE_RESIZE_ACTION |
|
||||||
META_MOVE_RESIZE_STATE_CHANGED |
|
META_MOVE_RESIZE_STATE_CHANGED |
|
||||||
META_MOVE_RESIZE_UNMAXIMIZE),
|
META_MOVE_RESIZE_UNMAXIMIZE),
|
||||||
NorthWestGravity,
|
META_GRAVITY_NORTH_WEST,
|
||||||
target_rect);
|
target_rect);
|
||||||
|
|
||||||
/* When we unmaximize, if we're doing a mouse move also we could
|
/* 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_MOVE_ACTION |
|
||||||
META_MOVE_RESIZE_RESIZE_ACTION |
|
META_MOVE_RESIZE_RESIZE_ACTION |
|
||||||
META_MOVE_RESIZE_STATE_CHANGED),
|
META_MOVE_RESIZE_STATE_CHANGED),
|
||||||
NorthWestGravity,
|
META_GRAVITY_NORTH_WEST,
|
||||||
window->unconstrained_rect);
|
window->unconstrained_rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3547,7 +3547,7 @@ meta_window_unmake_fullscreen (MetaWindow *window)
|
|||||||
META_MOVE_RESIZE_RESIZE_ACTION |
|
META_MOVE_RESIZE_RESIZE_ACTION |
|
||||||
META_MOVE_RESIZE_STATE_CHANGED |
|
META_MOVE_RESIZE_STATE_CHANGED |
|
||||||
META_MOVE_RESIZE_UNFULLSCREEN),
|
META_MOVE_RESIZE_UNFULLSCREEN),
|
||||||
NorthWestGravity,
|
META_GRAVITY_NORTH_WEST,
|
||||||
target_rect);
|
target_rect);
|
||||||
|
|
||||||
meta_display_queue_check_fullscreen (window->display);
|
meta_display_queue_check_fullscreen (window->display);
|
||||||
@ -3804,7 +3804,7 @@ meta_window_reposition (MetaWindow *window)
|
|||||||
meta_window_move_resize_internal (window,
|
meta_window_move_resize_internal (window,
|
||||||
(META_MOVE_RESIZE_MOVE_ACTION |
|
(META_MOVE_RESIZE_MOVE_ACTION |
|
||||||
META_MOVE_RESIZE_RESIZE_ACTION),
|
META_MOVE_RESIZE_RESIZE_ACTION),
|
||||||
NorthWestGravity,
|
META_GRAVITY_NORTH_WEST,
|
||||||
window->rect);
|
window->rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3975,7 +3975,7 @@ meta_window_update_monitor (MetaWindow *window,
|
|||||||
void
|
void
|
||||||
meta_window_move_resize_internal (MetaWindow *window,
|
meta_window_move_resize_internal (MetaWindow *window,
|
||||||
MetaMoveResizeFlags flags,
|
MetaMoveResizeFlags flags,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
MetaRectangle frame_rect)
|
MetaRectangle frame_rect)
|
||||||
{
|
{
|
||||||
/* The rectangle here that's passed in *always* in "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);
|
g_return_if_fail (!window->override_redirect);
|
||||||
|
|
||||||
flags = (user_op ? META_MOVE_RESIZE_USER_ACTION : 0) | META_MOVE_RESIZE_MOVE_ACTION;
|
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
|
static void
|
||||||
@ -4214,7 +4214,7 @@ meta_window_move_between_rects (MetaWindow *window,
|
|||||||
move_resize_flags |
|
move_resize_flags |
|
||||||
META_MOVE_RESIZE_MOVE_ACTION |
|
META_MOVE_RESIZE_MOVE_ACTION |
|
||||||
META_MOVE_RESIZE_RESIZE_ACTION,
|
META_MOVE_RESIZE_RESIZE_ACTION,
|
||||||
NorthWestGravity,
|
META_GRAVITY_NORTH_WEST,
|
||||||
window->unconstrained_rect);
|
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;
|
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,
|
gboolean user_op,
|
||||||
int w,
|
int w,
|
||||||
int h,
|
int h,
|
||||||
int gravity)
|
MetaGravity gravity)
|
||||||
{
|
{
|
||||||
MetaMoveResizeFlags flags;
|
MetaMoveResizeFlags flags;
|
||||||
MetaRectangle rect;
|
MetaRectangle rect;
|
||||||
@ -4399,7 +4399,7 @@ idle_move_resize (gpointer data)
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_window_get_gravity_position (MetaWindow *window,
|
meta_window_get_gravity_position (MetaWindow *window,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
int *root_x,
|
int *root_x,
|
||||||
int *root_y)
|
int *root_y)
|
||||||
{
|
{
|
||||||
@ -4410,7 +4410,7 @@ meta_window_get_gravity_position (MetaWindow *window,
|
|||||||
w = window->rect.width;
|
w = window->rect.width;
|
||||||
h = window->rect.height;
|
h = window->rect.height;
|
||||||
|
|
||||||
if (gravity == StaticGravity)
|
if (gravity == META_GRAVITY_STATIC)
|
||||||
{
|
{
|
||||||
frame_extents = window->rect;
|
frame_extents = window->rect;
|
||||||
if (window->frame)
|
if (window->frame)
|
||||||
@ -4432,18 +4432,18 @@ meta_window_get_gravity_position (MetaWindow *window,
|
|||||||
|
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
/* Find center of frame. */
|
/* Find center of frame. */
|
||||||
x += frame_extents.width / 2;
|
x += frame_extents.width / 2;
|
||||||
/* Center client window on that point. */
|
/* Center client window on that point. */
|
||||||
x -= w / 2;
|
x -= w / 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
/* Find right edge of frame */
|
/* Find right edge of frame */
|
||||||
x += frame_extents.width;
|
x += frame_extents.width;
|
||||||
/* Align left edge of client at that point. */
|
/* Align left edge of client at that point. */
|
||||||
@ -4455,17 +4455,17 @@ meta_window_get_gravity_position (MetaWindow *window,
|
|||||||
|
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
/* Find center of frame. */
|
/* Find center of frame. */
|
||||||
y += frame_extents.height / 2;
|
y += frame_extents.height / 2;
|
||||||
/* Center client window there. */
|
/* Center client window there. */
|
||||||
y -= h / 2;
|
y -= h / 2;
|
||||||
break;
|
break;
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
/* Find south edge of frame */
|
/* Find south edge of frame */
|
||||||
y += frame_extents.height;
|
y += frame_extents.height;
|
||||||
/* Place bottom edge of client there */
|
/* Place bottom edge of client there */
|
||||||
@ -6247,7 +6247,7 @@ update_resize (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
int new_w, new_h;
|
int new_w, new_h;
|
||||||
int gravity;
|
MetaGravity gravity;
|
||||||
MetaRectangle old;
|
MetaRectangle old;
|
||||||
double remaining = 0;
|
double remaining = 0;
|
||||||
|
|
||||||
|
@ -529,4 +529,23 @@ typedef enum
|
|||||||
META_LAYER_LAST = 8
|
META_LAYER_LAST = 8
|
||||||
} MetaStackLayer;
|
} MetaStackLayer;
|
||||||
|
|
||||||
|
/* MetaGravity: (skip)
|
||||||
|
*
|
||||||
|
* Identical to the corresponding gravity value macros from libX11.
|
||||||
|
*/
|
||||||
|
typedef enum _MetaGravity
|
||||||
|
{
|
||||||
|
META_GRAVITY_NONE = 0,
|
||||||
|
META_GRAVITY_NORTH_WEST = 1,
|
||||||
|
META_GRAVITY_NORTH = 2,
|
||||||
|
META_GRAVITY_NORTH_EAST = 3,
|
||||||
|
META_GRAVITY_WEST = 4,
|
||||||
|
META_GRAVITY_CENTER = 5,
|
||||||
|
META_GRAVITY_EAST = 6,
|
||||||
|
META_GRAVITY_SOUTH_WEST = 7,
|
||||||
|
META_GRAVITY_SOUTH = 8,
|
||||||
|
META_GRAVITY_SOUTH_EAST = 9,
|
||||||
|
META_GRAVITY_STATIC = 10,
|
||||||
|
} MetaGravity;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -142,7 +142,7 @@ guint meta_unsigned_long_hash (gconstpointer v);
|
|||||||
META_EXPORT
|
META_EXPORT
|
||||||
const char* meta_frame_type_to_string (MetaFrameType type);
|
const char* meta_frame_type_to_string (MetaFrameType type);
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
const char* meta_gravity_to_string (int gravity);
|
const char* meta_gravity_to_string (MetaGravity gravity);
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
char* meta_external_binding_name_for_action (guint keybinding_action);
|
char* meta_external_binding_name_for_action (guint keybinding_action);
|
||||||
|
@ -1221,7 +1221,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect ( 50, 300, 20, 5);
|
temp = meta_rect ( 50, 300, 20, 5);
|
||||||
meta_rectangle_resize_with_gravity (&oldrect,
|
meta_rectangle_resize_with_gravity (&oldrect,
|
||||||
&rect,
|
&rect,
|
||||||
NorthWestGravity,
|
META_GRAVITY_NORTH_WEST,
|
||||||
20,
|
20,
|
||||||
5);
|
5);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
@ -1230,7 +1230,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect (165, 300, 20, 5);
|
temp = meta_rect (165, 300, 20, 5);
|
||||||
meta_rectangle_resize_with_gravity (&rect,
|
meta_rectangle_resize_with_gravity (&rect,
|
||||||
&rect,
|
&rect,
|
||||||
NorthGravity,
|
META_GRAVITY_NORTH,
|
||||||
20,
|
20,
|
||||||
5);
|
5);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
@ -1239,7 +1239,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect (280, 300, 20, 5);
|
temp = meta_rect (280, 300, 20, 5);
|
||||||
meta_rectangle_resize_with_gravity (&rect,
|
meta_rectangle_resize_with_gravity (&rect,
|
||||||
&rect,
|
&rect,
|
||||||
NorthEastGravity,
|
META_GRAVITY_NORTH_EAST,
|
||||||
20,
|
20,
|
||||||
5);
|
5);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
@ -1248,7 +1248,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect ( 50, 695, 50, 5);
|
temp = meta_rect ( 50, 695, 50, 5);
|
||||||
meta_rectangle_resize_with_gravity (&rect,
|
meta_rectangle_resize_with_gravity (&rect,
|
||||||
&rect,
|
&rect,
|
||||||
SouthWestGravity,
|
META_GRAVITY_SOUTH_WEST,
|
||||||
50,
|
50,
|
||||||
5);
|
5);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
@ -1257,7 +1257,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect (150, 695, 50, 5);
|
temp = meta_rect (150, 695, 50, 5);
|
||||||
meta_rectangle_resize_with_gravity (&rect,
|
meta_rectangle_resize_with_gravity (&rect,
|
||||||
&rect,
|
&rect,
|
||||||
SouthGravity,
|
META_GRAVITY_SOUTH,
|
||||||
50,
|
50,
|
||||||
5);
|
5);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
@ -1266,7 +1266,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect (250, 695, 50, 5);
|
temp = meta_rect (250, 695, 50, 5);
|
||||||
meta_rectangle_resize_with_gravity (&rect,
|
meta_rectangle_resize_with_gravity (&rect,
|
||||||
&rect,
|
&rect,
|
||||||
SouthEastGravity,
|
META_GRAVITY_SOUTH_EAST,
|
||||||
50,
|
50,
|
||||||
5);
|
5);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
@ -1275,7 +1275,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect (167, 1113, 832, 93);
|
temp = meta_rect (167, 1113, 832, 93);
|
||||||
meta_rectangle_resize_with_gravity (&rect,
|
meta_rectangle_resize_with_gravity (&rect,
|
||||||
&rect,
|
&rect,
|
||||||
WestGravity,
|
META_GRAVITY_WEST,
|
||||||
832,
|
832,
|
||||||
93);
|
93);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
@ -1284,7 +1284,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect (-131, 1113, 833, 93);
|
temp = meta_rect (-131, 1113, 833, 93);
|
||||||
meta_rectangle_resize_with_gravity (&rect,
|
meta_rectangle_resize_with_gravity (&rect,
|
||||||
&rect,
|
&rect,
|
||||||
CenterGravity,
|
META_GRAVITY_CENTER,
|
||||||
832,
|
832,
|
||||||
93);
|
93);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
@ -1293,7 +1293,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect (270, 994, 430, 212);
|
temp = meta_rect (270, 994, 430, 212);
|
||||||
meta_rectangle_resize_with_gravity (&rect,
|
meta_rectangle_resize_with_gravity (&rect,
|
||||||
&rect,
|
&rect,
|
||||||
EastGravity,
|
META_GRAVITY_EAST,
|
||||||
430,
|
430,
|
||||||
211);
|
211);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
@ -1302,7 +1302,7 @@ test_gravity_resize (void)
|
|||||||
temp = meta_rect (300, 1000, 430, 211);
|
temp = meta_rect (300, 1000, 430, 211);
|
||||||
meta_rectangle_resize_with_gravity (&rect,
|
meta_rectangle_resize_with_gravity (&rect,
|
||||||
&rect,
|
&rect,
|
||||||
StaticGravity,
|
META_GRAVITY_STATIC,
|
||||||
430,
|
430,
|
||||||
211);
|
211);
|
||||||
g_assert (meta_rectangle_equal (&rect, &temp));
|
g_assert (meta_rectangle_equal (&rect, &temp));
|
||||||
|
@ -217,7 +217,7 @@ meta_window_wayland_grab_op_ended (MetaWindow *window,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_wayland_move_resize_internal (MetaWindow *window,
|
meta_window_wayland_move_resize_internal (MetaWindow *window,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
MetaRectangle unconstrained_rect,
|
MetaRectangle unconstrained_rect,
|
||||||
MetaRectangle constrained_rect,
|
MetaRectangle constrained_rect,
|
||||||
int rel_x,
|
int rel_x,
|
||||||
@ -815,7 +815,7 @@ meta_window_wayland_finish_move_resize (MetaWindow *window,
|
|||||||
MetaDisplay *display = window->display;
|
MetaDisplay *display = window->display;
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
int geometry_scale;
|
int geometry_scale;
|
||||||
int gravity;
|
MetaGravity gravity;
|
||||||
MetaRectangle rect;
|
MetaRectangle rect;
|
||||||
MetaMoveResizeFlags flags;
|
MetaMoveResizeFlags flags;
|
||||||
MetaWaylandWindowConfiguration *acked_configuration;
|
MetaWaylandWindowConfiguration *acked_configuration;
|
||||||
|
@ -746,28 +746,28 @@ window_type_from_string (const char *str)
|
|||||||
static int
|
static int
|
||||||
window_gravity_from_string (const char *str)
|
window_gravity_from_string (const char *str)
|
||||||
{
|
{
|
||||||
if (strcmp (str, "NorthWestGravity") == 0)
|
if (strcmp (str, "META_GRAVITY_NORTH_WEST") == 0)
|
||||||
return NorthWestGravity;
|
return META_GRAVITY_NORTH_WEST;
|
||||||
else if (strcmp (str, "NorthGravity") == 0)
|
else if (strcmp (str, "META_GRAVITY_NORTH") == 0)
|
||||||
return NorthGravity;
|
return META_GRAVITY_NORTH;
|
||||||
else if (strcmp (str, "NorthEastGravity") == 0)
|
else if (strcmp (str, "META_GRAVITY_NORTH_EAST") == 0)
|
||||||
return NorthEastGravity;
|
return META_GRAVITY_NORTH_EAST;
|
||||||
else if (strcmp (str, "WestGravity") == 0)
|
else if (strcmp (str, "META_GRAVITY_WEST") == 0)
|
||||||
return WestGravity;
|
return META_GRAVITY_WEST;
|
||||||
else if (strcmp (str, "CenterGravity") == 0)
|
else if (strcmp (str, "META_GRAVITY_CENTER") == 0)
|
||||||
return CenterGravity;
|
return META_GRAVITY_CENTER;
|
||||||
else if (strcmp (str, "EastGravity") == 0)
|
else if (strcmp (str, "META_GRAVITY_EAST") == 0)
|
||||||
return EastGravity;
|
return META_GRAVITY_EAST;
|
||||||
else if (strcmp (str, "SouthWestGravity") == 0)
|
else if (strcmp (str, "META_GRAVITY_SOUTH_WEST") == 0)
|
||||||
return SouthWestGravity;
|
return META_GRAVITY_SOUTH_WEST;
|
||||||
else if (strcmp (str, "SouthGravity") == 0)
|
else if (strcmp (str, "META_GRAVITY_SOUTH") == 0)
|
||||||
return SouthGravity;
|
return META_GRAVITY_SOUTH;
|
||||||
else if (strcmp (str, "SouthEastGravity") == 0)
|
else if (strcmp (str, "META_GRAVITY_SOUTH_EAST") == 0)
|
||||||
return SouthEastGravity;
|
return META_GRAVITY_SOUTH_EAST;
|
||||||
else if (strcmp (str, "StaticGravity") == 0)
|
else if (strcmp (str, "META_GRAVITY_STATIC") == 0)
|
||||||
return StaticGravity;
|
return META_GRAVITY_STATIC;
|
||||||
else
|
else
|
||||||
return NorthWestGravity;
|
return META_GRAVITY_NORTH_WEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char*
|
static char*
|
||||||
@ -1703,7 +1703,7 @@ session_info_new (void)
|
|||||||
info = g_new0 (MetaWindowSessionInfo, 1);
|
info = g_new0 (MetaWindowSessionInfo, 1);
|
||||||
|
|
||||||
info->type = META_WINDOW_NORMAL;
|
info->type = META_WINDOW_NORMAL;
|
||||||
info->gravity = NorthWestGravity;
|
info->gravity = META_GRAVITY_NORTH_WEST;
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ struct _MetaWindowSessionInfo
|
|||||||
* light of gravity. This preserves semantics of the
|
* light of gravity. This preserves semantics of the
|
||||||
* window size/pos, even if fonts/themes change, etc.
|
* window size/pos, even if fonts/themes change, etc.
|
||||||
*/
|
*/
|
||||||
int gravity;
|
MetaGravity gravity;
|
||||||
MetaRectangle rect;
|
MetaRectangle rect;
|
||||||
MetaRectangle saved_rect;
|
MetaRectangle saved_rect;
|
||||||
guint on_all_workspaces : 1;
|
guint on_all_workspaces : 1;
|
||||||
|
@ -1304,7 +1304,7 @@ meta_set_normal_hints (MetaWindow *window,
|
|||||||
meta_topic (META_DEBUG_GEOMETRY,
|
meta_topic (META_DEBUG_GEOMETRY,
|
||||||
"Window %s doesn't set gravity, using NW\n",
|
"Window %s doesn't set gravity, using NW\n",
|
||||||
window->desc);
|
window->desc);
|
||||||
window->size_hints.win_gravity = NorthWestGravity;
|
window->size_hints.win_gravity = META_GRAVITY_NORTH_WEST;
|
||||||
window->size_hints.flags |= PWinGravity;
|
window->size_hints.flags |= PWinGravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ send_configure_notify (MetaWindow *window)
|
|||||||
static void
|
static void
|
||||||
adjust_for_gravity (MetaWindow *window,
|
adjust_for_gravity (MetaWindow *window,
|
||||||
gboolean coords_assume_border,
|
gboolean coords_assume_border,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
MetaRectangle *rect)
|
MetaRectangle *rect)
|
||||||
{
|
{
|
||||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||||
@ -273,14 +273,14 @@ adjust_for_gravity (MetaWindow *window,
|
|||||||
MetaFrameBorders borders;
|
MetaFrameBorders borders;
|
||||||
|
|
||||||
/* We're computing position to pass to window_move, which is
|
/* We're computing position to pass to window_move, which is
|
||||||
* the position of the client window (StaticGravity basically)
|
* the position of the client window (META_GRAVITY_STATIC basically)
|
||||||
*
|
*
|
||||||
* (see WM spec description of gravity computation, but note that
|
* (see WM spec description of gravity computation, but note that
|
||||||
* their formulas assume we're honoring the border width, rather
|
* their formulas assume we're honoring the border width, rather
|
||||||
* than compensating for having turned it off)
|
* than compensating for having turned it off)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (gravity == StaticGravity)
|
if (gravity == META_GRAVITY_STATIC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (coords_assume_border)
|
if (coords_assume_border)
|
||||||
@ -296,7 +296,7 @@ adjust_for_gravity (MetaWindow *window,
|
|||||||
frame_height = child_y + rect->height + borders.visible.bottom;
|
frame_height = child_y + rect->height + borders.visible.bottom;
|
||||||
|
|
||||||
/* Calculate the the reference point, which is the corner of the
|
/* Calculate the the reference point, which is the corner of the
|
||||||
* outer window specified by the gravity. So, NorthEastGravity
|
* outer window specified by the gravity. So, META_GRAVITY_NORTH_EAST
|
||||||
* would have the reference point as the top-right corner of the
|
* would have the reference point as the top-right corner of the
|
||||||
* outer window. */
|
* outer window. */
|
||||||
ref_x = rect->x;
|
ref_x = rect->x;
|
||||||
@ -304,14 +304,14 @@ adjust_for_gravity (MetaWindow *window,
|
|||||||
|
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
ref_x += rect->width / 2 + bw;
|
ref_x += rect->width / 2 + bw;
|
||||||
break;
|
break;
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
ref_x += rect->width + bw * 2;
|
ref_x += rect->width + bw * 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -320,14 +320,14 @@ adjust_for_gravity (MetaWindow *window,
|
|||||||
|
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
ref_y += rect->height / 2 + bw;
|
ref_y += rect->height / 2 + bw;
|
||||||
break;
|
break;
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
ref_y += rect->height + bw * 2;
|
ref_y += rect->height + bw * 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -342,30 +342,34 @@ adjust_for_gravity (MetaWindow *window,
|
|||||||
|
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case NorthGravity:
|
case META_GRAVITY_NORTH:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
rect->x -= frame_width / 2;
|
rect->x -= frame_width / 2;
|
||||||
break;
|
break;
|
||||||
case NorthEastGravity:
|
case META_GRAVITY_NORTH_EAST:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
rect->x -= frame_width;
|
rect->x -= frame_width;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (gravity)
|
switch (gravity)
|
||||||
{
|
{
|
||||||
case WestGravity:
|
case META_GRAVITY_WEST:
|
||||||
case CenterGravity:
|
case META_GRAVITY_CENTER:
|
||||||
case EastGravity:
|
case META_GRAVITY_EAST:
|
||||||
rect->y -= frame_height / 2;
|
rect->y -= frame_height / 2;
|
||||||
break;
|
break;
|
||||||
case SouthWestGravity:
|
case META_GRAVITY_SOUTH_WEST:
|
||||||
case SouthGravity:
|
case META_GRAVITY_SOUTH:
|
||||||
case SouthEastGravity:
|
case META_GRAVITY_SOUTH_EAST:
|
||||||
rect->y -= frame_height;
|
rect->y -= frame_height;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust to get the top-left corner of the inner window. */
|
/* Adjust to get the top-left corner of the inner window. */
|
||||||
@ -481,7 +485,7 @@ meta_window_apply_session_info (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
MetaRectangle rect;
|
MetaRectangle rect;
|
||||||
MetaMoveResizeFlags flags;
|
MetaMoveResizeFlags flags;
|
||||||
int gravity;
|
MetaGravity gravity;
|
||||||
|
|
||||||
window->placed = TRUE; /* don't do placement algorithms later */
|
window->placed = TRUE; /* don't do placement algorithms later */
|
||||||
|
|
||||||
@ -556,7 +560,7 @@ meta_window_x11_manage (MetaWindow *window)
|
|||||||
{
|
{
|
||||||
MetaRectangle rect;
|
MetaRectangle rect;
|
||||||
MetaMoveResizeFlags flags;
|
MetaMoveResizeFlags flags;
|
||||||
int gravity = window->size_hints.win_gravity;
|
MetaGravity gravity = window->size_hints.win_gravity;
|
||||||
|
|
||||||
rect.x = window->size_hints.x;
|
rect.x = window->size_hints.x;
|
||||||
rect.y = window->size_hints.y;
|
rect.y = window->size_hints.y;
|
||||||
@ -1305,7 +1309,7 @@ meta_window_x11_current_workspace_changed (MetaWindow *window)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_x11_move_resize_internal (MetaWindow *window,
|
meta_window_x11_move_resize_internal (MetaWindow *window,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
MetaRectangle unconstrained_rect,
|
MetaRectangle unconstrained_rect,
|
||||||
MetaRectangle constrained_rect,
|
MetaRectangle constrained_rect,
|
||||||
int rel_x,
|
int rel_x,
|
||||||
@ -1472,9 +1476,9 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
|
|||||||
* Mail from Owen subject "Suggestion: Gravity and resizing from the left"
|
* Mail from Owen subject "Suggestion: Gravity and resizing from the left"
|
||||||
* http://mail.gnome.org/archives/wm-spec-list/1999-November/msg00088.html
|
* http://mail.gnome.org/archives/wm-spec-list/1999-November/msg00088.html
|
||||||
*
|
*
|
||||||
* An annoying fact you need to know in this code is that StaticGravity
|
* An annoying fact you need to know in this code is that META_GRAVITY_STATIC
|
||||||
* does nothing if you _only_ resize or _only_ move the frame;
|
* does nothing if you _only_ resize or _only_ move the frame;
|
||||||
* it must move _and_ resize, otherwise you get NorthWestGravity
|
* it must move _and_ resize, otherwise you get META_GRAVITY_NORTH_WEST
|
||||||
* behavior. The move and resize must actually occur, it is not
|
* behavior. The move and resize must actually occur, it is not
|
||||||
* enough to set CWX | CWWidth but pass in the current size/pos.
|
* enough to set CWX | CWWidth but pass in the current size/pos.
|
||||||
*/
|
*/
|
||||||
@ -2444,7 +2448,7 @@ meta_window_same_client (MetaWindow *window,
|
|||||||
static void
|
static void
|
||||||
meta_window_move_resize_request (MetaWindow *window,
|
meta_window_move_resize_request (MetaWindow *window,
|
||||||
guint value_mask,
|
guint value_mask,
|
||||||
int gravity,
|
MetaGravity gravity,
|
||||||
int new_x,
|
int new_x,
|
||||||
int new_y,
|
int new_y,
|
||||||
int new_width,
|
int new_width,
|
||||||
@ -3220,10 +3224,10 @@ meta_window_x11_client_message (MetaWindow *window,
|
|||||||
else if (event->xclient.message_type ==
|
else if (event->xclient.message_type ==
|
||||||
x11_display->atom__NET_MOVERESIZE_WINDOW)
|
x11_display->atom__NET_MOVERESIZE_WINDOW)
|
||||||
{
|
{
|
||||||
int gravity;
|
MetaGravity gravity;
|
||||||
guint value_mask;
|
guint value_mask;
|
||||||
|
|
||||||
gravity = (event->xclient.data.l[0] & 0xff);
|
gravity = (MetaGravity) (event->xclient.data.l[0] & 0xff);
|
||||||
value_mask = (event->xclient.data.l[0] & 0xf00) >> 8;
|
value_mask = (event->xclient.data.l[0] & 0xf00) >> 8;
|
||||||
/* source = (event->xclient.data.l[0] & 0xf000) >> 12; */
|
/* source = (event->xclient.data.l[0] & 0xf000) >> 12; */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user