summaryrefslogtreecommitdiff
path: root/src/core/window.c
diff options
context:
space:
mode:
authorOmar Zeidan <[email protected]>2017-12-11 14:54:17 +0100
committerraveit65 <[email protected]>2017-12-20 20:42:12 +0100
commit6219f8e8bcaeefb9185a3c3f5f20de4e2fa8f18f (patch)
treee3652b4e35ca31478ef9f62f89765ff6d97e7b3a /src/core/window.c
parent01f68e8f9f1541393e6e069db08f834d4ef18691 (diff)
downloadmarco-6219f8e8bcaeefb9185a3c3f5f20de4e2fa8f18f.tar.bz2
marco-6219f8e8bcaeefb9185a3c3f5f20de4e2fa8f18f.tar.xz
Allow horizontal and vertical resizing when corner tiled
Diffstat (limited to 'src/core/window.c')
-rw-r--r--src/core/window.c159
1 files changed, 88 insertions, 71 deletions
diff --git a/src/core/window.c b/src/core/window.c
index 8a613dea..86bca3ec 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -2520,7 +2520,7 @@ static void
meta_window_save_rect (MetaWindow *window)
{
if (!(META_WINDOW_MAXIMIZED (window) || META_WINDOW_SIDE_TILED (window) ||
- META_WINDOW_QUARTER_TILED(window) || window->fullscreen))
+ META_WINDOW_CORNER_TILED(window) || window->fullscreen))
{
/* save size/pos as appropriate args for move_resize */
if (!window->maximized_horizontally)
@@ -2719,14 +2719,27 @@ meta_window_tile (MetaWindow *window)
if (window->tile_mode == META_TILE_NONE)
return;
- meta_window_maximize_internal (window, META_MAXIMIZE_VERTICAL, NULL);
-
+ if(window->tile_mode == META_TILE_LEFT || window->tile_mode == META_TILE_RIGHT)
+ meta_window_maximize_internal (window, META_MAXIMIZE_VERTICAL, NULL);
+ else
+ meta_window_save_rect(window);
+
+ window->tiled = TRUE;
/* move_resize with new tiling constraints
*/
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
}
+void
+meta_window_untile (MetaWindow *window)
+{
+ window->tiled = FALSE;
+
+ meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL | META_MAXIMIZE_HORIZONTAL);
+
+}
+
static gboolean
meta_window_can_tile_maximized (MetaWindow *window)
{
@@ -2779,77 +2792,73 @@ meta_window_unmaximize (MetaWindow *window,
/* Only do something if the window isn't already maximized in the
* given direction(s).
*/
- if ((unmaximize_horizontally && window->maximized_horizontally) ||
- (unmaximize_vertically && window->maximized_vertically))
- {
- MetaRectangle target_rect;
-
- meta_topic (META_DEBUG_WINDOW_OPS,
- "Unmaximizing %s%s\n",
- window->desc,
- unmaximize_horizontally && unmaximize_vertically ? "" :
- unmaximize_horizontally ? " horizontally" :
- unmaximize_vertically ? " vertically" : "BUGGGGG");
+ MetaRectangle target_rect;
- window->maximized_horizontally =
- window->maximized_horizontally && !unmaximize_horizontally;
- window->maximized_vertically =
- window->maximized_vertically && !unmaximize_vertically;
+ meta_topic (META_DEBUG_WINDOW_OPS,
+ "Unmaximizing %s%s\n",
+ window->desc,
+ unmaximize_horizontally && unmaximize_vertically ? "" :
+ unmaximize_horizontally ? " horizontally" :
+ unmaximize_vertically ? " vertically" : "BUGGGGG");
- /* Unmaximize to the saved_rect position in the direction(s)
- * being unmaximized.
- */
- meta_window_get_client_root_coords (window, &target_rect);
- if (unmaximize_horizontally)
- {
- target_rect.x = window->saved_rect.x;
- target_rect.width = window->saved_rect.width;
- }
- if (unmaximize_vertically)
- {
- target_rect.y = window->saved_rect.y;
- target_rect.height = window->saved_rect.height;
- }
+ window->maximized_horizontally =
+ window->maximized_horizontally && !unmaximize_horizontally;
+ window->maximized_vertically =
+ window->maximized_vertically && !unmaximize_vertically;
- /* Window's size hints may have changed while maximized, making
- * saved_rect invalid. #329152
- */
- ensure_size_hints_satisfied (&target_rect, &window->size_hints);
+ /* Unmaximize to the saved_rect position in the direction(s)
+ * being unmaximized.
+ */
+ meta_window_get_client_root_coords (window, &target_rect);
+ if (unmaximize_horizontally)
+ {
+ target_rect.x = window->saved_rect.x;
+ target_rect.width = window->saved_rect.width;
+ }
+ if (unmaximize_vertically)
+ {
+ target_rect.y = window->saved_rect.y;
+ target_rect.height = window->saved_rect.height;
+ }
- meta_window_move_resize (window,
- FALSE,
- target_rect.x,
- target_rect.y,
- target_rect.width,
- target_rect.height);
+ /* Window's size hints may have changed while maximized, making
+ * saved_rect invalid. #329152
+ */
+ ensure_size_hints_satisfied (&target_rect, &window->size_hints);
- /* Make sure user_rect is current.
- */
- force_save_user_window_placement (window);
+ meta_window_move_resize (window,
+ FALSE,
+ target_rect.x,
+ target_rect.y,
+ target_rect.width,
+ target_rect.height);
- /* When we unmaximize, if we're doing a mouse move also we could
- * get the window suddenly jumping to the upper left corner of
- * the workspace, since that's where it was when the grab op
- * started. So we need to update the grab state. We have to do
- * it after the actual operation, as the window may have been moved
- * by constraints.
- */
- if (meta_grab_op_is_moving (window->display->grab_op) &&
- window->display->grab_window == window)
- {
- window->display->grab_anchor_window_pos = window->user_rect;
- }
+ /* Make sure user_rect is current.
+ */
+ force_save_user_window_placement (window);
+
+ /* When we unmaximize, if we're doing a mouse move also we could
+ * get the window suddenly jumping to the upper left corner of
+ * the workspace, since that's where it was when the grab op
+ * started. So we need to update the grab state. We have to do
+ * it after the actual operation, as the window may have been moved
+ * by constraints.
+ */
+ if (meta_grab_op_is_moving (window->display->grab_op) &&
+ window->display->grab_window == window)
+ {
+ window->display->grab_anchor_window_pos = window->user_rect;
+ }
- if (window->display->grab_wireframe_active)
- {
- window->display->grab_wireframe_rect = target_rect;
- }
+ if (window->display->grab_wireframe_active)
+ {
+ window->display->grab_wireframe_rect = target_rect;
+ }
- recalc_window_features (window);
- set_net_wm_state (window);
+ recalc_window_features (window);
+ set_net_wm_state (window);
- meta_compositor_unmaximize_window (window->display->compositor, window);
- }
+ meta_compositor_unmaximize_window (window->display->compositor, window);
}
void
@@ -7019,7 +7028,7 @@ update_move (MetaWindow *window,
}
else if (meta_prefs_get_side_by_side_tiling () &&
!META_WINDOW_MAXIMIZED (window) &&
- !META_WINDOW_SIDE_TILED (window))
+ !META_WINDOW_TILED (window))
{
const MetaXineramaScreenInfo *monitor;
MetaRectangle work_area;
@@ -7064,7 +7073,7 @@ update_move (MetaWindow *window,
*/
if ((META_WINDOW_MAXIMIZED (window) && ABS (dy) >= shake_threshold) ||
- (META_WINDOW_SIDE_TILED (window) && (MAX (ABS (dx), ABS (dy)) >= shake_threshold)))
+ (META_WINDOW_TILED (window) && (MAX (ABS (dx), ABS (dy)) >= shake_threshold)))
{
double prop;
@@ -7074,6 +7083,7 @@ update_move (MetaWindow *window,
*/
window->shaken_loose = META_WINDOW_MAXIMIZED (window);
window->tile_mode = META_TILE_NONE;
+ window->tiled = FALSE;
/* move the unmaximized window to the cursor */
prop =
@@ -7175,10 +7185,17 @@ update_move (MetaWindow *window,
meta_window_get_client_root_coords (window, &old);
/* Don't allow movement in the maximized directions or while tiled */
- if (window->maximized_horizontally || META_WINDOW_SIDE_TILED (window))
- new_x = old.x;
- if (window->maximized_vertically)
- new_y = old.y;
+
+ if (window->maximized_horizontally || META_WINDOW_TILED (window))
+ {
+ new_x = old.x;
+ }
+
+ if (window->maximized_vertically || META_WINDOW_CORNER_TILED(window))
+ {
+ new_y = old.y;
+ }
+
/* Do any edge resistance/snapping */
meta_window_edge_resistance_for_move (window,