Skip to content

Commit c3d2ef2

Browse files
authored
keybindings.c: Make sure we can tile before we attempt to (#624)
Not doing so leaves us in a weird state. The window gets squared corners and other tiled styling but doesn't actually tile. ref: linuxmint/mint21-beta#83
1 parent 78c1ce2 commit c3d2ef2

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/core/keybindings.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3464,6 +3464,30 @@ get_new_tile_mode (MetaTileMode direction,
34643464
return ret;
34653465
}
34663466

3467+
static gboolean
3468+
can_tile (MetaWindow *window,
3469+
MetaTileMode mode)
3470+
{
3471+
switch (mode) {
3472+
case META_TILE_LEFT:
3473+
case META_TILE_RIGHT:
3474+
return meta_window_can_tile_left_right (window);
3475+
case META_TILE_TOP:
3476+
case META_TILE_BOTTOM:
3477+
return meta_window_can_tile_top_bottom (window);
3478+
case META_TILE_ULC:
3479+
case META_TILE_LLC:
3480+
case META_TILE_URC:
3481+
case META_TILE_LRC:
3482+
return meta_window_can_tile_corner (window);
3483+
case META_TILE_MAXIMIZED:
3484+
case META_TILE_NONE:
3485+
return TRUE;
3486+
default:
3487+
return FALSE;
3488+
}
3489+
}
3490+
34673491
static void
34683492
handle_tile_action (MetaDisplay *display,
34693493
MetaWindow *window,
@@ -3483,7 +3507,7 @@ handle_tile_action (MetaDisplay *display,
34833507
{
34843508
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
34853509
}
3486-
else
3510+
else if (can_tile (window, new_mode))
34873511
{
34883512
window->tile_monitor_number = window->monitor->number;
34893513
/* Maximization constraints beat tiling constraints, so if the window

0 commit comments

Comments
 (0)