Compare commits

...

4 Commits

Author SHA1 Message Date
ea901abd61 frame: Don't allow resizing of edges that are constrained
https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-04-04 14:51:56 -07:00
4e5e6aa7f8 window: Add new tiling code
The new tiling code, instead of based around "tiling states", is instead
based around constrained edges. This allows us to have windows that have
three constrained edges, but keep one free-floating, e.g. a window tiled
to the left has the left, top, and bottom edges constrained, but the
right edge can be left resizable.

This system also is easily extended to support corner tiling. We also,
using the new "size state" system, also keep normal, tiled, and
maximized sizes independently, allowing the maximize button to bounce
between maximized and tiled states without reverting to normal in
between. Dragging from the top will always restore the normal state,
though.

https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-04-04 14:50:57 -07:00
8e587e2e42 Add "size states" which save window size information
https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-04-04 14:50:56 -07:00
93901dc32f window: Remove old tiling code
We'll soon replace this with a better scheme

https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-04-04 14:50:56 -07:00
18 changed files with 594 additions and 718 deletions

View File

@ -817,13 +817,6 @@ meta_window_actor_has_shadow (MetaWindowActor *self)
meta_window_is_fullscreen (priv->window))
return FALSE;
/*
* If we have two snap-tiled windows, we don't want the shadow to obstruct
* the other window.
*/
if (meta_window_get_tile_match (priv->window))
return FALSE;
/*
* Always put a shadow around windows with a frame - This should override
* the restriction about not putting a shadow around ARGB windows.

View File

@ -97,7 +97,7 @@ typedef enum
PRIORITY_ENTIRELY_VISIBLE_ON_WORKAREA = 1,
PRIORITY_SIZE_HINTS_INCREMENTS = 1,
PRIORITY_MAXIMIZATION = 2,
PRIORITY_TILING = 2,
PRIORITY_CONSTRAINED_EDGES = 2,
PRIORITY_FULLSCREEN = 2,
PRIORITY_SIZE_HINTS_LIMITS = 3,
PRIORITY_TITLEBAR_VISIBLE = 4,
@ -152,7 +152,7 @@ static gboolean constrain_maximization (MetaWindow *window,
ConstraintInfo *info,
ConstraintPriority priority,
gboolean check_only);
static gboolean constrain_tiling (MetaWindow *window,
static gboolean constrain_constrained_edges (MetaWindow *window,
ConstraintInfo *info,
ConstraintPriority priority,
gboolean check_only);
@ -213,7 +213,7 @@ typedef struct {
static const Constraint all_constraints[] = {
{constrain_modal_dialog, "constrain_modal_dialog"},
{constrain_maximization, "constrain_maximization"},
{constrain_tiling, "constrain_tiling"},
{constrain_constrained_edges, "constrain_constrained_edges"},
{constrain_fullscreen, "constrain_fullscreen"},
{constrain_size_increments, "constrain_size_increments"},
{constrain_size_limits, "constrain_size_limits"},
@ -701,16 +701,11 @@ constrain_maximization (MetaWindow *window,
return TRUE;
/* Determine whether constraint applies; exit if it doesn't */
if ((!window->maximized_horizontally && !window->maximized_vertically) ||
META_WINDOW_TILED_SIDE_BY_SIDE (window))
if (!window->maximized_horizontally && !window->maximized_vertically)
return TRUE;
/* Calculate target_size = maximized size of (window + frame) */
if (META_WINDOW_TILED_MAXIMIZED (window))
{
meta_window_get_current_tile_area (window, &target_size);
}
else if (META_WINDOW_MAXIMIZED (window))
if (META_WINDOW_MAXIMIZED (window))
{
target_size = info->work_area_monitor;
}
@ -773,58 +768,6 @@ constrain_maximization (MetaWindow *window,
return TRUE;
}
static gboolean
constrain_tiling (MetaWindow *window,
ConstraintInfo *info,
ConstraintPriority priority,
gboolean check_only)
{
MetaRectangle target_size;
MetaRectangle min_size, max_size;
gboolean hminbad, vminbad;
gboolean horiz_equal, vert_equal;
gboolean constraint_already_satisfied;
if (priority > PRIORITY_TILING)
return TRUE;
/* Determine whether constraint applies; exit if it doesn't */
if (!META_WINDOW_TILED_SIDE_BY_SIDE (window))
return TRUE;
/* Calculate target_size - as the tile previews need this as well, we
* use an external function for the actual calculation
*/
meta_window_get_current_tile_area (window, &target_size);
/* Check min size constraints; max size constraints are ignored as for
* maximized windows.
*/
get_size_limits (window, &min_size, &max_size);
hminbad = target_size.width < min_size.width;
vminbad = target_size.height < min_size.height;
if (hminbad || vminbad)
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is */
horiz_equal = target_size.x == info->current.x &&
target_size.width == info->current.width;
vert_equal = target_size.y == info->current.y &&
target_size.height == info->current.height;
constraint_already_satisfied = horiz_equal && vert_equal;
if (check_only || constraint_already_satisfied)
return constraint_already_satisfied;
/*** Enforce constraint ***/
info->current.x = target_size.x;
info->current.width = target_size.width;
info->current.y = target_size.y;
info->current.height = target_size.height;
return TRUE;
}
static gboolean
constrain_fullscreen (MetaWindow *window,
ConstraintInfo *info,
@ -860,6 +803,45 @@ constrain_fullscreen (MetaWindow *window,
return TRUE;
}
static gboolean
constrain_constrained_edges (MetaWindow *window,
ConstraintInfo *info,
ConstraintPriority priority,
gboolean check_only)
{
MetaRectangle monitor, new_rectangle;
gboolean constraint_already_satisfied;
if (priority > PRIORITY_CONSTRAINED_EDGES)
return TRUE;
/* Determine whether constraint applies; exit if it doesn't */
if (!window->constrained_edges)
return TRUE;
new_rectangle = info->current;
monitor = info->work_area_monitor;
if (window->constrained_edges & META_DIRECTION_LEFT)
new_rectangle.x = monitor.x;
if (window->constrained_edges & META_DIRECTION_RIGHT)
new_rectangle.x = monitor.x + monitor.width - new_rectangle.width;
if (window->constrained_edges & META_DIRECTION_TOP)
new_rectangle.y = monitor.y;
if (window->constrained_edges & META_DIRECTION_BOTTOM)
new_rectangle.y = monitor.y + monitor.height - new_rectangle.height;
constraint_already_satisfied =
meta_rectangle_equal (&info->current, &new_rectangle);
if (check_only || constraint_already_satisfied)
return constraint_already_satisfied;
/*** Enforce constraint ***/
info->current = new_rectangle;
return TRUE;
}
static gboolean
constrain_size_increments (MetaWindow *window,
ConstraintInfo *info,
@ -877,7 +859,6 @@ constrain_size_increments (MetaWindow *window,
/* Determine whether constraint applies; exit if it doesn't */
if (META_WINDOW_MAXIMIZED (window) || window->fullscreen ||
META_WINDOW_TILED_SIDE_BY_SIDE (window) ||
info->action_type == ACTION_MOVE)
return TRUE;
@ -1020,7 +1001,6 @@ constrain_aspect_ratio (MetaWindow *window,
constraints_are_inconsistent = minr > maxr;
if (constraints_are_inconsistent ||
META_WINDOW_MAXIMIZED (window) || window->fullscreen ||
META_WINDOW_TILED_SIDE_BY_SIDE (window) ||
info->action_type == ACTION_MOVE)
return TRUE;

View File

@ -74,13 +74,6 @@ typedef enum {
*/
#define N_IGNORED_CROSSING_SERIALS 10
typedef enum {
META_TILE_NONE,
META_TILE_LEFT,
META_TILE_RIGHT,
META_TILE_MAXIMIZED
} MetaTileMode;
typedef enum {
/* Normal interaction where you're interacting with windows.
* Events go to windows normally. */
@ -211,8 +204,6 @@ struct _MetaDisplay
int grab_anchor_root_x;
int grab_anchor_root_y;
MetaRectangle grab_anchor_window_pos;
MetaTileMode grab_tile_mode;
int grab_tile_monitor_number;
int grab_latest_motion_x;
int grab_latest_motion_y;
guint grab_have_pointer : 1;

View File

@ -649,8 +649,6 @@ meta_display_open (void)
display->grab_op = META_GRAB_OP_NONE;
display->grab_window = NULL;
display->grab_tile_mode = META_TILE_NONE;
display->grab_tile_monitor_number = -1;
display->grab_edge_resistance_data = NULL;
@ -1894,8 +1892,6 @@ meta_display_begin_grab_op (MetaDisplay *display,
display->grab_op = op;
display->grab_window = grab_window;
display->grab_button = button;
display->grab_tile_mode = grab_window->tile_mode;
display->grab_tile_monitor_number = grab_window->tile_monitor_number;
display->grab_anchor_root_x = root_x;
display->grab_anchor_root_y = root_y;
display->grab_latest_motion_x = root_x;
@ -1993,8 +1989,6 @@ meta_display_end_grab_op (MetaDisplay *display,
display->event_route = META_EVENT_ROUTE_NORMAL;
display->grab_window = NULL;
display->grab_tile_mode = META_TILE_NONE;
display->grab_tile_monitor_number = -1;
meta_display_update_cursor (display);

View File

@ -274,12 +274,6 @@ meta_frame_get_flags (MetaFrame *frame)
if (META_WINDOW_MAXIMIZED (frame->window))
flags |= META_FRAME_MAXIMIZED;
if (META_WINDOW_TILED_LEFT (frame->window))
flags |= META_FRAME_TILED_LEFT;
if (META_WINDOW_TILED_RIGHT (frame->window))
flags |= META_FRAME_TILED_RIGHT;
if (frame->window->fullscreen)
flags |= META_FRAME_FULLSCREEN;
@ -289,6 +283,18 @@ meta_frame_get_flags (MetaFrame *frame)
if (frame->window->wm_state_above)
flags |= META_FRAME_ABOVE;
if (frame->window->constrained_edges & META_DIRECTION_LEFT)
flags |= META_FRAME_CONSTRAINED_LEFT_EDGE;
if (frame->window->constrained_edges & META_DIRECTION_RIGHT)
flags |= META_FRAME_CONSTRAINED_RIGHT_EDGE;
if (frame->window->constrained_edges & META_DIRECTION_TOP)
flags |= META_FRAME_CONSTRAINED_TOP_EDGE;
if (frame->window->constrained_edges & META_DIRECTION_BOTTOM)
flags |= META_FRAME_CONSTRAINED_BOTTOM_EDGE;
return flags;
}

View File

@ -2001,23 +2001,13 @@ process_mouse_move_resize_grab (MetaDisplay *display,
if (event->keyval == CLUTTER_KEY_Escape)
{
/* Hide the tiling preview if necessary */
if (window->tile_mode != META_TILE_NONE)
meta_screen_hide_tile_preview (screen);
/* Restore the original tile mode */
window->tile_mode = display->grab_tile_mode;
window->tile_monitor_number = display->grab_tile_monitor_number;
/* End move or resize and restore to original state. If the
* window was a maximized window that had been "shaken loose" we
* need to remaximize it. In normal cases, we need to do a
* moveresize now to get the position back to the original.
*/
if (window->shaken_loose || window->tile_mode == META_TILE_MAXIMIZED)
if (window->shaken_loose)
meta_window_maximize (window, META_MAXIMIZE_BOTH);
else if (window->tile_mode != META_TILE_NONE)
meta_window_tile (window);
else
meta_window_move_resize_frame (display->grab_window,
TRUE,
@ -2939,41 +2929,25 @@ handle_toggle_above (MetaDisplay *display,
}
static void
handle_toggle_tiled (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
handle_toggle_tiled_left (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
MetaTileMode mode = binding->handler->data;
meta_window_toggle_tile (window, META_TILE_ZONE_W);
}
if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
(META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
{
window->tile_monitor_number = window->saved_maximize ? window->monitor->number
: -1;
window->tile_mode = window->saved_maximize ? META_TILE_MAXIMIZED
: META_TILE_NONE;
if (window->saved_maximize)
meta_window_maximize (window, META_MAXIMIZE_BOTH);
else
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
}
else if (meta_window_can_tile_side_by_side (window))
{
window->tile_monitor_number = window->monitor->number;
window->tile_mode = mode;
/* Maximization constraints beat tiling constraints, so if the window
* is maximized, tiling won't have any effect unless we unmaximize it
* horizontally first; rather than calling meta_window_unmaximize(),
* we just set the flag and rely on meta_window_tile() syncing it to
* save an additional roundtrip.
*/
window->maximized_horizontally = FALSE;
meta_window_tile (window);
}
static void
handle_toggle_tiled_right (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
meta_window_toggle_tile (window, META_TILE_ZONE_E);
}
static void
@ -3706,14 +3680,14 @@ init_builtin_key_bindings (MetaDisplay *display)
mutter_keybindings,
META_KEY_BINDING_PER_WINDOW,
META_KEYBINDING_ACTION_TOGGLE_TILED_LEFT,
handle_toggle_tiled, META_TILE_LEFT);
handle_toggle_tiled_left, 0);
add_builtin_keybinding (display,
"toggle-tiled-right",
mutter_keybindings,
META_KEY_BINDING_PER_WINDOW,
META_KEYBINDING_ACTION_TOGGLE_TILED_RIGHT,
handle_toggle_tiled, META_TILE_RIGHT);
handle_toggle_tiled_right, 0);
add_builtin_keybinding (display,
"toggle-above",

View File

@ -57,7 +57,13 @@ struct _MetaScreen
MetaRectangle rect; /* Size of screen; rect.x & rect.y are always 0 */
MetaUI *ui;
guint tile_preview_timeout_id;
struct {
gboolean exists;
guint timeout_id;
MetaWindow *window;
MetaRectangle area;
int monitor;
} tile_preview;
MetaWorkspace *active_workspace;
@ -132,9 +138,12 @@ void meta_screen_foreach_window (MetaScreen *scree
void meta_screen_update_cursor (MetaScreen *screen);
void meta_screen_update_tile_preview (MetaScreen *screen,
gboolean delay);
void meta_screen_hide_tile_preview (MetaScreen *screen);
void meta_screen_update_tile_preview (MetaScreen *screen,
MetaWindow *window,
MetaRectangle area,
int monitor,
gboolean delay);
void meta_screen_hide_tile_preview (MetaScreen *screen);
MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one);

View File

@ -718,8 +718,6 @@ meta_screen_new (MetaDisplay *display,
screen->ui = meta_ui_new (screen->display->xdisplay,
screen->xscreen);
screen->tile_preview_timeout_id = 0;
screen->stack = meta_stack_new (screen);
screen->stack_tracker = meta_stack_tracker_new (screen);
@ -807,8 +805,8 @@ meta_screen_free (MetaScreen *screen,
g_free (screen->monitor_infos);
if (screen->tile_preview_timeout_id)
g_source_remove (screen->tile_preview_timeout_id);
if (screen->tile_preview.timeout_id)
g_source_remove (screen->tile_preview.timeout_id);
g_free (screen->screen_name);
@ -1288,44 +1286,20 @@ static gboolean
meta_screen_update_tile_preview_timeout (gpointer data)
{
MetaScreen *screen = data;
MetaWindow *window = screen->display->grab_window;
gboolean needs_preview = FALSE;
screen->tile_preview_timeout_id = 0;
screen->tile_preview.timeout_id = 0;
if (window)
if (screen->tile_preview.exists)
{
switch (window->tile_mode)
{
case META_TILE_LEFT:
case META_TILE_RIGHT:
if (!META_WINDOW_TILED_SIDE_BY_SIDE (window))
needs_preview = TRUE;
break;
case META_TILE_MAXIMIZED:
if (!META_WINDOW_MAXIMIZED (window))
needs_preview = TRUE;
break;
default:
needs_preview = FALSE;
break;
}
}
if (needs_preview)
{
MetaRectangle tile_rect;
int monitor;
monitor = meta_window_get_current_tile_monitor_number (window);
meta_window_get_current_tile_area (window, &tile_rect);
meta_compositor_show_tile_preview (screen->display->compositor,
window, &tile_rect, monitor);
screen->tile_preview.window,
&screen->tile_preview.area,
screen->tile_preview.monitor);
}
else
meta_compositor_hide_tile_preview (screen->display->compositor);
{
meta_compositor_hide_tile_preview (screen->display->compositor);
}
return FALSE;
}
@ -1333,37 +1307,47 @@ meta_screen_update_tile_preview_timeout (gpointer data)
#define TILE_PREVIEW_TIMEOUT_MS 200
void
meta_screen_update_tile_preview (MetaScreen *screen,
gboolean delay)
meta_screen_update_tile_preview (MetaScreen *screen,
MetaWindow *window,
MetaRectangle area,
int monitor,
gboolean delay)
{
screen->tile_preview.exists = TRUE;
screen->tile_preview.window = window;
screen->tile_preview.area = area;
screen->tile_preview.monitor = monitor;
if (delay)
{
if (screen->tile_preview_timeout_id > 0)
if (screen->tile_preview.timeout_id > 0)
return;
screen->tile_preview_timeout_id =
screen->tile_preview.timeout_id =
g_timeout_add (TILE_PREVIEW_TIMEOUT_MS,
meta_screen_update_tile_preview_timeout,
screen);
g_source_set_name_by_id (screen->tile_preview_timeout_id,
g_source_set_name_by_id (screen->tile_preview.timeout_id,
"[mutter] meta_screen_update_tile_preview_timeout");
}
else
{
if (screen->tile_preview_timeout_id > 0)
g_source_remove (screen->tile_preview_timeout_id);
if (screen->tile_preview.timeout_id > 0)
g_source_remove (screen->tile_preview.timeout_id);
meta_screen_update_tile_preview_timeout ((gpointer)screen);
meta_screen_update_tile_preview_timeout ((gpointer) screen);
}
}
void
meta_screen_hide_tile_preview (MetaScreen *screen)
{
if (screen->tile_preview_timeout_id > 0)
g_source_remove (screen->tile_preview_timeout_id);
screen->tile_preview.exists = FALSE;
meta_compositor_hide_tile_preview (screen->display->compositor);
if (screen->tile_preview.timeout_id > 0)
g_source_remove (screen->tile_preview.timeout_id);
meta_screen_update_tile_preview_timeout ((gpointer) screen);
}
MetaWindow*

View File

@ -117,7 +117,6 @@ meta_stack_add (MetaStack *stack,
window->desc, window->stack_position);
stack_sync_to_xserver (stack);
meta_stack_update_window_tile_matches (stack, window->screen->active_workspace);
}
void
@ -153,7 +152,6 @@ meta_stack_remove (MetaStack *stack,
GUINT_TO_POINTER (window->frame->xwindow));
stack_sync_to_xserver (stack);
meta_stack_update_window_tile_matches (stack, window->screen->active_workspace);
}
void
@ -163,7 +161,6 @@ meta_stack_update_layer (MetaStack *stack,
stack->need_relayer = TRUE;
stack_sync_to_xserver (stack);
meta_stack_update_window_tile_matches (stack, window->screen->active_workspace);
}
void
@ -173,7 +170,6 @@ meta_stack_update_transient (MetaStack *stack,
stack->need_constrain = TRUE;
stack_sync_to_xserver (stack);
meta_stack_update_window_tile_matches (stack, window->screen->active_workspace);
}
/* raise/lower within a layer */
@ -202,7 +198,6 @@ meta_stack_raise (MetaStack *stack,
meta_window_set_stack_position_no_sync (window, max_stack_position);
stack_sync_to_xserver (stack);
meta_stack_update_window_tile_matches (stack, window->screen->active_workspace);
}
void
@ -230,7 +225,6 @@ meta_stack_lower (MetaStack *stack,
meta_window_set_stack_position_no_sync (window, min_stack_position);
stack_sync_to_xserver (stack);
meta_stack_update_window_tile_matches (stack, window->screen->active_workspace);
}
void
@ -246,27 +240,6 @@ meta_stack_thaw (MetaStack *stack)
stack->freeze_count -= 1;
stack_sync_to_xserver (stack);
meta_stack_update_window_tile_matches (stack, NULL);
}
void
meta_stack_update_window_tile_matches (MetaStack *stack,
MetaWorkspace *workspace)
{
GList *windows, *tmp;
if (stack->freeze_count > 0)
return;
windows = meta_stack_list_windows (stack, workspace);
tmp = windows;
while (tmp)
{
meta_window_compute_tile_match ((MetaWindow *) tmp->data);
tmp = tmp->next;
}
g_list_free (windows);
}
static gboolean
@ -1448,7 +1421,6 @@ meta_stack_set_positions (MetaStack *stack,
"Reset the stack positions of (nearly) all windows\n");
stack_sync_to_xserver (stack);
meta_stack_update_window_tile_matches (stack, NULL);
}
void
@ -1511,6 +1483,4 @@ meta_window_set_stack_position (MetaWindow *window,
{
meta_window_set_stack_position_no_sync (window, position);
stack_sync_to_xserver (window->screen->stack);
meta_stack_update_window_tile_matches (window->screen->stack,
window->screen->active_workspace);
}

View File

@ -413,6 +413,4 @@ GList* meta_stack_get_positions (MetaStack *stack);
void meta_stack_set_positions (MetaStack *stack,
GList *windows);
void meta_stack_update_window_tile_matches (MetaStack *stack,
MetaWorkspace *workspace);
#endif

View File

@ -88,6 +88,20 @@ typedef enum
META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED = 1 << 2,
} MetaMoveResizeResultFlags;
/* This contains all the "state" needed for a certain size configuration.
* We have three of these size configurations: normal, tiled, and
* maximized. The idea here is that if the user tiles a normal window,
* then maximizes it, we should, upon unmaximizing and untiling the window,
* return to a normal state. We need a way of storing this information
* while maximized, so we use this structure. */
struct _MetaWindowSizeState
{
guint maximized_horizontally : 1;
guint maximized_vertically : 1;
MetaRectangle rect;
};
typedef struct _MetaWindowSizeState MetaWindowSizeState;
struct _MetaWindow
{
GObject parent_instance;
@ -157,14 +171,6 @@ struct _MetaWindow
guint maximize_vertically_after_placement : 1;
guint minimize_after_placement : 1;
/* The current or requested tile mode. If maximized_vertically is true,
* this is the current mode. If not, it is the mode which will be
* requested after the window grab is released */
guint tile_mode : 2;
/* The last "full" maximized/unmaximized state. We need to keep track of
* that to toggle between normal/tiled or maximized/tiled states. */
guint saved_maximize : 1;
int tile_monitor_number;
int preferred_output_winsys_id;
/* Whether we're shaded */
@ -401,9 +407,6 @@ struct _MetaWindow
/* The current window geometry of the window. */
MetaRectangle rect;
/* The geometry to restore when we unmaximize. */
MetaRectangle saved_rect;
/* This is the geometry the window will have if no constraints have
* applied. We use this whenever we are moving implicitly (for example,
* if we move to avoid a panel, we can snap back to this position if
@ -441,11 +444,16 @@ struct _MetaWindow
/* Focused window that is (directly or indirectly) attached to this one */
MetaWindow *attached_focus_window;
/* The currently complementary tiled window, if any */
MetaWindow *tile_match;
/* Bypass compositor hints */
guint bypass_compositor;
/* This is where we store data while in another state. The information
* above in MetaWindow is always the current state of the window. */
struct {
MetaWindowSizeState normal, tiled, maximized;
} size_states;
MetaDirection constrained_edges;
};
struct _MetaWindowClass
@ -492,17 +500,8 @@ struct _MetaWindowClass
(w)->maximized_vertically)
#define META_WINDOW_MAXIMIZED_VERTICALLY(w) ((w)->maximized_vertically)
#define META_WINDOW_MAXIMIZED_HORIZONTALLY(w) ((w)->maximized_horizontally)
#define META_WINDOW_TILED_SIDE_BY_SIDE(w) ((w)->maximized_vertically && \
!(w)->maximized_horizontally && \
(w)->tile_mode != META_TILE_NONE)
#define META_WINDOW_TILED_LEFT(w) (META_WINDOW_TILED_SIDE_BY_SIDE(w) && \
(w)->tile_mode == META_TILE_LEFT)
#define META_WINDOW_TILED_RIGHT(w) (META_WINDOW_TILED_SIDE_BY_SIDE(w) && \
(w)->tile_mode == META_TILE_RIGHT)
#define META_WINDOW_TILED_MAXIMIZED(w)(META_WINDOW_MAXIMIZED(w) && \
(w)->tile_mode == META_TILE_MAXIMIZED)
#define META_WINDOW_ALLOWS_MOVE(w) ((w)->has_move_func && !(w)->fullscreen)
#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !META_WINDOW_TILED_SIDE_BY_SIDE(w) && !(w)->fullscreen && !(w)->shaded)
#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded)
#define META_WINDOW_ALLOWS_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && \
(((w)->size_hints.min_width < (w)->size_hints.max_width) || \
((w)->size_hints.min_height < (w)->size_hints.max_height)))
@ -522,7 +521,6 @@ void meta_window_unmanage (MetaWindow *window,
guint32 timestamp);
void meta_window_queue (MetaWindow *window,
guint queuebits);
void meta_window_tile (MetaWindow *window);
void meta_window_maximize_internal (MetaWindow *window,
MetaMaximizeFlags directions,
MetaRectangle *saved_rect);
@ -584,11 +582,6 @@ gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
GList* meta_window_get_workspaces (MetaWindow *window);
int meta_window_get_current_tile_monitor_number (MetaWindow *window);
void meta_window_get_current_tile_area (MetaWindow *window,
MetaRectangle *tile_area);
gboolean meta_window_same_application (MetaWindow *window,
MetaWindow *other_window);
@ -626,9 +619,6 @@ void meta_window_update_for_monitors_changed (MetaWindow *window);
void meta_window_on_all_workspaces_changed (MetaWindow *window);
gboolean meta_window_should_attach_to_parent (MetaWindow *window);
gboolean meta_window_can_tile_side_by_side (MetaWindow *window);
void meta_window_compute_tile_match (MetaWindow *window);
gboolean meta_window_updates_are_frozen (MetaWindow *window);
@ -695,4 +685,7 @@ gboolean meta_window_has_pointer (MetaWindow *window);
void meta_window_emit_size_changed (MetaWindow *window);
void meta_window_toggle_tile (MetaWindow *window,
MetaTileZone tile_zone);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -83,7 +83,11 @@ typedef enum
META_FRAME_IS_FLASHING = 1 << 14,
META_FRAME_ABOVE = 1 << 15,
META_FRAME_TILED_LEFT = 1 << 16,
META_FRAME_TILED_RIGHT = 1 << 17
META_FRAME_TILED_RIGHT = 1 << 17,
META_FRAME_CONSTRAINED_LEFT_EDGE = 1 << 18,
META_FRAME_CONSTRAINED_RIGHT_EDGE = 1 << 19,
META_FRAME_CONSTRAINED_TOP_EDGE = 1 << 20,
META_FRAME_CONSTRAINED_BOTTOM_EDGE = 1 << 21,
} MetaFrameFlags;
/**
@ -317,6 +321,26 @@ typedef enum
META_DIRECTION_VERTICAL = META_DIRECTION_UP | META_DIRECTION_DOWN,
} MetaDirection;
/* Tile zones are specified in terms of their constrained edges.
* So, "top left corner" is top and left, which should be obvious,
* but "left side of the screen" is top, bottom, and left
*/
typedef enum {
META_TILE_ZONE_MAXIMIZED_HORZ = META_DIRECTION_HORIZONTAL,
META_TILE_ZONE_MAXIMIZED_VERT = META_DIRECTION_VERTICAL,
META_TILE_ZONE_MAXIMIZED = META_TILE_ZONE_MAXIMIZED_HORZ | META_TILE_ZONE_MAXIMIZED_VERT,
META_TILE_ZONE_W = META_TILE_ZONE_MAXIMIZED_VERT | META_DIRECTION_LEFT,
META_TILE_ZONE_E = META_TILE_ZONE_MAXIMIZED_VERT | META_DIRECTION_RIGHT,
META_TILE_ZONE_N = META_TILE_ZONE_MAXIMIZED_HORZ | META_DIRECTION_TOP,
META_TILE_ZONE_S = META_TILE_ZONE_MAXIMIZED_HORZ | META_DIRECTION_BOTTOM,
META_TILE_ZONE_NW = META_DIRECTION_TOP | META_DIRECTION_LEFT,
META_TILE_ZONE_NE = META_DIRECTION_TOP | META_DIRECTION_RIGHT,
META_TILE_ZONE_SW = META_DIRECTION_BOTTOM | META_DIRECTION_LEFT,
META_TILE_ZONE_SE = META_DIRECTION_BOTTOM | META_DIRECTION_RIGHT,
} MetaTileZone;
/**
* MetaMotionDirection:
* @META_MOTION_UP: Upwards motion

View File

@ -214,8 +214,6 @@ MetaFrameType meta_window_get_frame_type (MetaWindow *window);
cairo_region_t *meta_window_get_frame_bounds (MetaWindow *window);
MetaWindow *meta_window_get_tile_match (MetaWindow *window);
void meta_window_make_fullscreen (MetaWindow *window);
void meta_window_unmake_fullscreen (MetaWindow *window);
void meta_window_make_above (MetaWindow *window);
@ -260,4 +258,8 @@ gboolean meta_window_is_client_decorated (MetaWindow *window);
gboolean meta_window_titlebar_is_onscreen (MetaWindow *window);
void meta_window_shove_titlebar_onscreen (MetaWindow *window);
void meta_window_tile (MetaWindow *window,
MetaTileZone tile_zone);
void meta_window_untile (MetaWindow *window);
#endif

View File

@ -100,22 +100,25 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
{
borders->invisible.left = MAX (borders->invisible.left,
draggable_borders - borders->visible.left);
borders->invisible.right = MAX (borders->invisible.right,
draggable_borders - borders->visible.right);
if (!(flags & META_FRAME_CONSTRAINED_LEFT_EDGE))
borders->invisible.left = MAX (borders->invisible.left,
draggable_borders - borders->visible.left);
if (!(flags & META_FRAME_CONSTRAINED_RIGHT_EDGE))
borders->invisible.right = MAX (borders->invisible.right,
draggable_borders - borders->visible.right);
}
if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
{
borders->invisible.bottom = MAX (borders->invisible.bottom,
draggable_borders - borders->visible.bottom);
/* borders.visible.top is the height of the *title bar*. We can't do the same
* algorithm here, titlebars are expectedly much bigger. Just subtract a couple
* pixels to get a proper feel. */
if (type != META_FRAME_TYPE_ATTACHED)
if (!(flags & META_FRAME_CONSTRAINED_TOP_EDGE) && type != META_FRAME_TYPE_ATTACHED)
borders->invisible.top = MAX (borders->invisible.top, draggable_borders - 2);
if (!(flags & META_FRAME_CONSTRAINED_BOTTOM_EDGE))
borders->invisible.bottom = MAX (borders->invisible.bottom,
draggable_borders - borders->visible.bottom);
}
borders->total.left = borders->invisible.left + borders->visible.left;

View File

@ -363,7 +363,9 @@ meta_window_wayland_main_monitor_changed (MetaWindow *window,
/* Window size. */
scale_rect_size (&window->rect, scale_factor);
scale_rect_size (&window->unconstrained_rect, scale_factor);
scale_rect_size (&window->saved_rect, scale_factor);
scale_rect_size (&window->size_states.normal.rect, scale_factor);
scale_rect_size (&window->size_states.tiled.rect, scale_factor);
scale_rect_size (&window->size_states.maximized.rect, scale_factor);
/* Window geometry offset (XXX: Need a better place, see
* meta_window_wayland_move_resize). */

View File

@ -965,10 +965,10 @@ save_state (void)
{
fprintf (outfile,
" <maximized saved_x=\"%d\" saved_y=\"%d\" saved_width=\"%d\" saved_height=\"%d\"/>\n",
window->saved_rect.x,
window->saved_rect.y,
window->saved_rect.width,
window->saved_rect.height);
window->size_states.normal.rect.x,
window->size_states.normal.rect.y,
window->size_states.normal.rect.width,
window->size_states.normal.rect.height);
}
/* Gravity */

View File

@ -413,10 +413,10 @@ meta_window_apply_session_info (MetaWindow *window,
info->saved_rect.height,
window->desc);
window->saved_rect.x = info->saved_rect.x;
window->saved_rect.y = info->saved_rect.y;
window->saved_rect.width = info->saved_rect.width;
window->saved_rect.height = info->saved_rect.height;
window->size_states.normal.rect.x = info->saved_rect.x;
window->size_states.normal.rect.y = info->saved_rect.y;
window->size_states.normal.rect.width = info->saved_rect.width;
window->size_states.normal.rect.height = info->saved_rect.height;
}
}
}