GNOME Bugzilla – Bug 630548
gnome-shell could auto-maximize windows when dragged to top edge of screen
Last modified: 2010-12-02 22:53:13 UTC
The new side-by-side tiling feature in gnome-shell is really neat. It works really well. One thing I've noticed, though, is I sort of intuitively expect the window to maximize when I drag it to the top edge of the screen. At some point I actually caught myself sitting there waiting for it to maximize and had to ask myself why it wasn't working. This subconscious expectation may have something to do with me crossing the old "shake loose a window and drag to a different monitor feature" with the new side-by-side tiling feature. Anyway, I think it's a useful feature to have so I'm proposing it here. The idea is that maximize is just a degenerate form of tiling. Instead of tiling two document windows and the panels together, it's tiling one window and the panels together.
Created attachment 171062 [details] [review] tiling: rename side-by-side tiling to edge tiling Currently, the new tiling feature, supports side-by-side, horizontal tiling when dragging windows to one of the vertical edges of a monitor. Other types of tiling (on other monitor edges) are potentially useful, though. This commit renames the preference from side_by_side_tiling to edge_tiling.
Created attachment 171063 [details] [review] tiling: add side_by_side suffix to tile code The meta_window_can_tile function and META_WINDOW_TILED macro are pretty side-by-side tiling specific, so rename them.
Created attachment 171064 [details] [review] tiling: use META_WINDOW_TILED_SIDE_BY_SIDE in state check The meta_window_handle_mouse_grab_op_event function ensures the tile_mode variable is in a consistent state after a drag op is finished. The way this is current done is: if (!window->maximized_vertically && window->tile_mode != META_TILE_NONE) window->tile_mode = META_TILE_NONE; While valid, it doesn't "read" as well as using the META_WINDOW_TILED_SIDE_BY_SIDE macro, since the macro is specifically about side-by-side tiling. This commit just changes things to use the macro and to not bother checking the tile mode (since if we just reset it anyway, then it doesn't matter if the value is right or wrong to begin with).
Created attachment 171065 [details] [review] tiling: Add new "maximized" tile In addition to the existing side-by-side tiling modes, this commit adds a new "maximize" tiling mode. It allows the user to maximize their windows (in other words, tile with the edge panels) by dragging their window to the top edge of the monitor.
Created attachment 171066 [details] [review] Rename side-by-side tiling key It's now called edge_tiling since it can do more than just side-by-side tiling.
Review of attachment 171063 [details] [review]: As mentioned on IRC, I'm a bit concerned about inconsistencies with side-by-side-tiling / top-edge-tiling / shaking-loose. But thinking about it a little, the old shaking-loose behavior is not very useful in the presence of top-edge-tiling - tiling requires a tiny bit more mouse movement and a button release, none of which should be a big deal. So I'd suggest trying to make shaking-loose and tiling mutually exclusive, e.g. only keep the old behavior if tiling is not enabled. I guess something like the following could work? ::: src/core/window.c @@ +7807,2 @@ /* Shake loose */ + window->shaken_loose = !META_WINDOW_TILED_SIDE_BY_SIDE (window); /* Shake loose, so that the window snaps back to maximized when dragged near the top; do not snap back if tiling is enabled, as top edge tiling can be used in that case */ window->shaken_loose = !meta_prefs_get_edge_tiling ();
Comment on attachment 171066 [details] [review] Rename side-by-side tiling key This patch isn't quite right. If we do end up landing the mutter changes, the gnome-shell module will need more changes than this.
Created attachment 171209 [details] [review] Use new key names when overriding metacity's defaults (In reply to comment #7) > This patch isn't quite right. If we do end up landing the mutter changes, the > gnome-shell module will need more changes than this. Correct - feel free to squash this patch.
Review of attachment 171062 [details] [review]: Looks good.
Review of attachment 171063 [details] [review]: Code looks good, though my suggestion from comment 6 still stands.
Review of attachment 171064 [details] [review]: Looks good.
Review of attachment 171065 [details] [review]: Looks good, except for one comment: ::: src/core/window.c @@ +7811,3 @@ + */ + if (x >= monitor->rect.x && + x < (monitor->rect.x + monitor->rect.width)) I think it is wrong to enforce maximized tiling on windows which are marked as non-resizable, or whose minimum size will cause maximization to fail - I'd suggest making the block optional with META_WINDOW_ALLOWS_RESIZE (window).
(In reply to comment #6) > Review of attachment 171063 [details] [review]: > > As mentioned on IRC, I'm a bit concerned about inconsistencies with > side-by-side-tiling / top-edge-tiling / shaking-loose. But thinking about it a > little, the old shaking-loose behavior is not very useful in the presence of > top-edge-tiling - tiling requires a tiny bit more mouse movement and a button > release, none of which should be a big deal. So I'd suggest trying to make > shaking-loose and tiling mutually exclusive, e.g. only keep the old behavior if > tiling is not enabled. > > I guess something like the following could work? > > ::: src/core/window.c > @@ +7807,2 @@ > /* Shake loose */ > + window->shaken_loose = !META_WINDOW_TILED_SIDE_BY_SIDE (window); > > /* Shake loose, so that the window snaps back to maximized > when dragged near the top; do not snap back if tiling > is enabled, as top edge tiling can be used in that case > */ > window->shaken_loose = !meta_prefs_get_edge_tiling (); Right makes sense. I'll add a commit after the commit that adds maximize edge tiling, which drops shake loose when edge tiling is enabled.
(In reply to comment #12) > Review of attachment 171065 [details] [review]: > > Looks good, except for one comment: > > ::: src/core/window.c > @@ +7811,3 @@ > + */ > + if (x >= monitor->rect.x && > + x < (monitor->rect.x + monitor->rect.width)) > > I think it is wrong to enforce maximized tiling on windows which are marked as > non-resizable, or whose minimum size will cause maximization to fail - I'd > suggest making the block optional with META_WINDOW_ALLOWS_RESIZE (window). Right, I guess to be consistent with the meta_window_can_tile_side_by_side usage we should have a meta_window_can_tile_maximized function that checks ALLOWS_RESIZE and also has_maximize_func
Created attachment 175742 [details] [review] tiling: Add new "maximized" tile In addition to the existing side-by-side tiling modes, this commit adds a new "maximize" tiling mode. It allows the user to maximize their windows (in other words, tile with the edge panels) by dragging their window to the top edge of the monitor.
Created attachment 175743 [details] [review] tiling: disable "shake loose" feature when edge tiling The old behavior of being able to shake loose a maiximized window overlaps with and is for the most part superceded by top edge tiling. This commit changes the code to only enable shake loose behavior when edge tiling is disabled.
Comment on attachment 175742 [details] [review] tiling: Add new "maximized" tile This is just the already reviewed commit with the change from comment 6 added, so i've pushed it.
(i meant comment 12 not comment 6 in the previous comment)
Comment on attachment 175743 [details] [review] tiling: disable "shake loose" feature when edge tiling This is florian's already discussed change to disable shaken loose behavior when edge tiling is enabled. I've pushed it.
Created attachment 175744 [details] [review] Rename side-by-side tiling key It's now called edge_tiling since it can do more than just side-by-side tiling.
Attachment 175744 [details] pushed as 0c89417 - Rename side-by-side tiling key This does the remaining discussed gnome-shell changes.