summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2017-08-30 15:13:58 -0400
committerVictor Kareh <[email protected]>2017-08-30 15:13:58 -0400
commitf396a2bebc9c365527c5c6e4d4d489879e8bbea4 (patch)
tree01a48bc49de888a02e3a08a4d83455176b95e9ab
parentc577f51e1e1258f8a6c55764a8b86d3421c466e7 (diff)
downloadmarco-f396a2bebc9c365527c5c6e4d4d489879e8bbea4.tar.bz2
marco-f396a2bebc9c365527c5c6e4d4d489879e8bbea4.tar.xz
Store a window flag when user resizes from tiled
Use that flag to retain the correct window size when performing other operations. Reset when re-tiling.
-rw-r--r--src/core/constraints.c8
-rw-r--r--src/core/keybindings.c1
-rw-r--r--src/core/window-private.h1
-rw-r--r--src/core/window.c6
4 files changed, 15 insertions, 1 deletions
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 783449d3..99b0aefa 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -929,7 +929,13 @@ constrain_tiling (MetaWindow *window,
break;
}
- /* Maintain current tile size for all other user-initiated alternatives */
+ /* Mark window as being resized from a tiled state */
+ window->tile_resized = TRUE;
+ }
+
+ if (window->tile_resized)
+ {
+ /* Maintain current tile size for user-resized windows */
target_size.x = info->orig.x;
target_size.width = info->orig.width;
}
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index f4eb01b1..fd17b49d 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -3109,6 +3109,7 @@ handle_toggle_tiled (MetaDisplay *display,
else if (meta_window_can_tile (window))
{
window->tile_mode = mode;
+ window->tile_resized = FALSE;
window->tile_monitor_number = meta_screen_get_xinerama_for_window (window->screen, window)->number;
/* Maximization constraints beat tiling constraints, so if the window
* is maximized, tiling won't have any effect unless we unmaximize it
diff --git a/src/core/window-private.h b/src/core/window-private.h
index e449b172..e775a59e 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -146,6 +146,7 @@ struct _MetaWindow
* 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;
+ guint tile_resized : 1;
/* The last "full" maximized/unmaximized state. We need to keep track of
* that to toggle between normal/tiled or maximized/tiled states. */
diff --git a/src/core/window.c b/src/core/window.c
index 1bb3bb76..546600dd 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -476,6 +476,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->require_titlebar_visible = TRUE;
window->on_all_workspaces = FALSE;
window->tile_mode = META_TILE_NONE;
+ window->tile_resized = FALSE;
window->tile_monitor_number = -1;
window->shaded = FALSE;
window->initially_iconic = FALSE;
@@ -7032,6 +7033,7 @@ update_move (MetaWindow *window,
/* Check if the cursor is in a position which triggers tiling
* and set tile_mode accordingly.
*/
+ MetaTileMode tile_mode = window->tile_mode;
if (meta_window_can_tile (window) &&
x >= monitor->rect.x && x < (work_area.x + shake_threshold))
window->tile_mode = META_TILE_LEFT;
@@ -7047,6 +7049,10 @@ update_move (MetaWindow *window,
if (window->tile_mode != META_TILE_NONE)
window->tile_monitor_number = monitor->number;
+
+ /* Reset resized flag when changing tile mode */
+ if (tile_mode != window->tile_mode)
+ window->tile_resized = FALSE;
}
/* shake loose (unmaximize) maximized or tiled window if dragged beyond