mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
sync
This commit is contained in:
parent
1af2020151
commit
98c3b06ffd
@ -24,13 +24,13 @@
|
|||||||
/* The way this code works was suggested by Owen Taylor.
|
/* The way this code works was suggested by Owen Taylor.
|
||||||
*
|
*
|
||||||
* For any move_resize, we determine which variables are "free
|
* For any move_resize, we determine which variables are "free
|
||||||
* variables" - stated another way, which edges of the window are
|
* variables" and apply constraints in terms of those. During the move
|
||||||
* moving. During the move resize, we only want to modify those
|
* resize, we only want to modify those variables; otherwise the
|
||||||
* variables; otherwise the constraint process can have peculiar side
|
* constraint process can have peculiar side effects when the size and
|
||||||
* effects when the size and position constraints interact. For
|
* position constraints interact. For example, resizing a window from
|
||||||
* example, resizing a window from the top might go wrong when
|
* the top might go wrong when position constraints apply to the top
|
||||||
* position constraints apply to the top edge, and result in the
|
* edge, and result in the bottom edge moving downward while the top
|
||||||
* bottom edge moving downward while the top stays fixed.
|
* stays fixed.
|
||||||
*
|
*
|
||||||
* After selecting the variables we plan to vary, we define
|
* After selecting the variables we plan to vary, we define
|
||||||
* each constraint on the window in terms of those variables.
|
* each constraint on the window in terms of those variables.
|
||||||
@ -96,16 +96,25 @@
|
|||||||
* This method applies to any ConfigureRequest that does a simultaneous
|
* This method applies to any ConfigureRequest that does a simultaneous
|
||||||
* move/resize.
|
* move/resize.
|
||||||
*
|
*
|
||||||
|
* We use the same method to e.g. maximize a window; if the window is
|
||||||
|
* maximized, we want to MOVE_VERTICAL/MOVE_HORIZONTAL to the top
|
||||||
|
* center of the screen, then RESIZE_BOTTOM and
|
||||||
|
* RESIZE_HORIZONTAL_CENTER. i.e. essentially NorthGravity.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Clamps the delta to nearest permitted.
|
||||||
|
* delta is the "free variable" in any given operation.
|
||||||
|
*/
|
||||||
typedef void (* MetaConstraintFunc) (MetaWindow *window,
|
typedef void (* MetaConstraintFunc) (MetaWindow *window,
|
||||||
MetaFrameGeometry *fgeom,
|
MetaFrameGeometry *fgeom,
|
||||||
const MetaRectangle *orig,
|
const MetaRectangle *orig,
|
||||||
MetaRectangle *new);
|
int *x_delta,
|
||||||
|
int *y_delta);
|
||||||
|
|
||||||
|
|
||||||
/* Things we can move, constraints apply
|
/* This enum marks what x_delta and y_delta mean, i.e. it
|
||||||
* in the context of these dimensions
|
* identifies the current free variables.
|
||||||
*/
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -116,8 +125,10 @@ enum
|
|||||||
RESIZE_VERTICAL_CENTER,
|
RESIZE_VERTICAL_CENTER,
|
||||||
RESIZE_HORIZONTAL_CENTER,
|
RESIZE_HORIZONTAL_CENTER,
|
||||||
MOVE_VERTICAL,
|
MOVE_VERTICAL,
|
||||||
MOVE_HORIZONTAL
|
MOVE_HORIZONTAL,
|
||||||
};
|
LAST_MOVE_CONTEXT
|
||||||
|
} MoveContext;
|
||||||
|
|
||||||
|
|
||||||
/* Maximization constraint:
|
/* Maximization constraint:
|
||||||
*
|
*
|
||||||
@ -180,11 +191,32 @@ enum
|
|||||||
*
|
*
|
||||||
* RESIZE_VERTICAL_CENTER:
|
* RESIZE_VERTICAL_CENTER:
|
||||||
*
|
*
|
||||||
*
|
* RESIZE_HORIZONTAL_CENTER is like vertical
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* MOVE_VERTICAL:
|
||||||
|
* new_height = orig_height
|
||||||
|
* new_y = orig_y + dy
|
||||||
|
*
|
||||||
|
* new_y >= nw_y + top_height
|
||||||
|
*
|
||||||
|
* Min negative dy (nw_y + top_height - orig_y) just as with RESIZE_TOP
|
||||||
|
* Max positive dy has to be computed from se_y and given less priority than the
|
||||||
|
* min negative:
|
||||||
|
*
|
||||||
|
* new_y < se_y
|
||||||
|
* orig_y + dy = se_y
|
||||||
|
* so max dy is (se_y - orig_y)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* MOVE_HORIZONTAL:
|
||||||
|
* works out same as vertical in the other direction
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_window_constrain (MetaWindow *window,
|
meta_window_constrain (MetaWindow *window,
|
||||||
MetaFrameGeometry *orig_fgeom,
|
MetaFrameGeometry *orig_fgeom,
|
||||||
|
@ -5347,6 +5347,10 @@ constrain_position (MetaWindow *window,
|
|||||||
/* find furthest northwest point the window can occupy */
|
/* find furthest northwest point the window can occupy */
|
||||||
nw_x = work_area.x;
|
nw_x = work_area.x;
|
||||||
nw_y = work_area.y;
|
nw_y = work_area.y;
|
||||||
|
|
||||||
|
/* FIXME note this means framed windows can go off the left
|
||||||
|
* but not unframed windows.
|
||||||
|
*/
|
||||||
if (window->frame)
|
if (window->frame)
|
||||||
{
|
{
|
||||||
/* Must keep TITLEBAR_LENGTH_ONSCREEN onscreen when moving left */
|
/* Must keep TITLEBAR_LENGTH_ONSCREEN onscreen when moving left */
|
||||||
|
Loading…
Reference in New Issue
Block a user