summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMartin Wimpress <[email protected]>2015-06-10 18:21:45 +0100
committerMartin Wimpress <[email protected]>2015-06-10 18:21:45 +0100
commit7770b75d007a8c303aa7bd4bdae439cc3b00d269 (patch)
treed39ed524cb34f2292809a10b4656ae5df1cf7d9b /src/core
parent78416ca9529b236d39e0701e40314b2484090cf9 (diff)
parent060838853303871a9fbb1ddfe0228668318070e7 (diff)
downloadmarco-7770b75d007a8c303aa7bd4bdae439cc3b00d269.tar.bz2
marco-7770b75d007a8c303aa7bd4bdae439cc3b00d269.tar.xz
Merge pull request #160 from micove/add-tile-keybinds
Add tile keybinds (Fix #104, #127)
Diffstat (limited to 'src/core')
-rw-r--r--src/core/keybindings.c26
-rw-r--r--src/core/window.c18
2 files changed, 21 insertions, 23 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index d40c90d7..9e602a91 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -3050,7 +3050,6 @@ handle_toggle_above (MetaDisplay *display,
meta_window_make_above (window);
}
-/* TODO: actually use this keybinding, without messing up the existing keybinding schema */
static void
handle_toggle_tiled (MetaDisplay *display,
MetaScreen *screen,
@@ -3063,14 +3062,20 @@ handle_toggle_tiled (MetaDisplay *display,
if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
(META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
{
- window->tile_mode = META_TILE_NONE;
-
if (window->saved_maximize)
- meta_window_maximize (window, META_MAXIMIZE_VERTICAL |
- META_MAXIMIZE_HORIZONTAL);
- else
- meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL |
+ {
+ window->tile_mode = META_TILE_MAXIMIZED;
+ window->tile_monitor_number = meta_screen_get_xinerama_for_window (window->screen, window)->number;
+ meta_window_maximize (window, META_MAXIMIZE_VERTICAL |
META_MAXIMIZE_HORIZONTAL);
+ }
+ else
+ {
+ window->tile_mode = META_TILE_NONE;
+ window->tile_monitor_number = -1;
+ meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL |
+ META_MAXIMIZE_HORIZONTAL);
+ }
}
else if (meta_window_can_tile (window))
{
@@ -3082,6 +3087,13 @@ handle_toggle_tiled (MetaDisplay *display,
* we just set the flag and rely on meta_window_tile() syncing it to
* save an additional roundtrip.
*/
+
+ /* If we skip meta_window_unmaximize we have to manually reset the
+ * window->saved_maximize flag.
+ */
+ if (!META_WINDOW_MAXIMIZED (window))
+ window->saved_maximize = FALSE;
+
window->maximized_horizontally = FALSE;
meta_window_tile (window);
}
diff --git a/src/core/window.c b/src/core/window.c
index 254eb094..9b2ad926 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -2670,14 +2670,9 @@ meta_window_maximize (MetaWindow *window,
if (window->tile_mode != META_TILE_NONE)
{
saved_rect = &window->saved_rect;
- window->maximized_vertically = FALSE;
- }
-
- if (window->tile_mode != META_TILE_NONE)
- {
- saved_rect = &window->saved_rect;
window->maximized_vertically = FALSE;
+ window->tile_mode = META_TILE_NONE;
}
meta_window_maximize_internal (window,
@@ -2751,7 +2746,7 @@ meta_window_can_tile (MetaWindow *window)
MetaRectangle tile_area;
/*if (!META_WINDOW_ALLOWS_RESIZE (window))*/
- if (!META_WINDOW_ALLOWS_RESIZE (window))
+ if (!meta_window_can_tile_maximized (window) || window->shaded)
return FALSE;
monitor = meta_screen_get_current_xinerama (window->screen);
@@ -2780,15 +2775,6 @@ meta_window_unmaximize (MetaWindow *window,
/* At least one of the two directions ought to be set */
gboolean unmaximize_horizontally, unmaximize_vertically;
- /* Restore tiling if necessary */
- if (window->tile_mode == META_TILE_LEFT ||
- window->tile_mode == META_TILE_RIGHT)
- {
- window->maximized_horizontally = FALSE;
- meta_window_tile (window);
- return;
- }
-
unmaximize_horizontally = directions & META_MAXIMIZE_HORIZONTAL;
unmaximize_vertically = directions & META_MAXIMIZE_VERTICAL;
g_assert (unmaximize_horizontally || unmaximize_vertically);