After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 648700 - Key binding for half-screen tiling and restoring windows
Key binding for half-screen tiling and restoring windows
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
: 644995 650064 655031 660929 663897 665725 667443 (view as bug list)
Depends on: 635378
Blocks:
 
 
Reported: 2011-04-26 19:18 UTC by Diego
Modified: 2012-01-07 18:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
window: Queue a frame redraw after tiling (1.07 KB, patch)
2011-12-05 21:06 UTC, Florian Müllner
committed Details | Review
window: Keep track of the last full-maximization state (2.00 KB, patch)
2011-12-05 21:08 UTC, Florian Müllner
committed Details | Review
window: Make meta_window_can_tile_side_by_side() public (1.34 KB, patch)
2011-12-05 21:09 UTC, Florian Müllner
committed Details | Review
keybindings: Add toggle-tile-left/right bindings (6.84 KB, patch)
2011-12-05 21:10 UTC, Florian Müllner
none Details | Review
window: Relax restrictions for can_tile_maximized () (1.31 KB, patch)
2011-12-06 00:17 UTC, Florian Müllner
committed Details | Review
keybindings: Add toggle-tile-left/right bindings (6.54 KB, patch)
2011-12-06 00:18 UTC, Florian Müllner
committed Details | Review

Description Diego 2011-04-26 19:18:24 UTC
There should be a way to create a binding for tiling the window to either side of the screen and a binding to restore window to previous state.
Comment 1 Florian Müllner 2011-05-08 11:02:27 UTC
*** Bug 644995 has been marked as a duplicate of this bug. ***
Comment 2 Florian Müllner 2011-05-13 06:12:34 UTC
*** Bug 650064 has been marked as a duplicate of this bug. ***
Comment 3 Florian Müllner 2011-07-21 09:44:20 UTC
*** Bug 655031 has been marked as a duplicate of this bug. ***
Comment 4 ahatomastarday 2011-07-21 10:44:07 UTC
I've filed a bug that has turned out to be a duplicate of this one. So I'm adding here some (I believe relevant) information I wrote in that other bug, so it doesn't get lost.

If this gets implemented, I think we should use the same keyboard shortcuts Windows 7 uses for this (not just because they're used in Windows, but because I think they make sense). These shortcuts are the following:

Windows key + Up  = Maximize window
Windows key + Down = Minimize window (maybe this one wouldn't make much sense
in GNOME 3, since minimize buttons are gone)
Windows key + Left = Move window to the left and resize it so it fits half the
screen
Windows key + Right = Move window to the right and resize it so it fits half
the screen
Comment 5 Christopher De Cairos 2011-07-24 06:01:20 UTC
Hello, I'm new to Gnome development and would really like to see this get implemented.  Perhaps I can dive into this as I REALLY want this feature :D.  I need only be pointed in the right direction.
Comment 6 Jasper St. Pierre (not reading bugmail) 2011-07-24 06:19:31 UTC
stefano posted a patch on IRC, but it was shot down because of the keybinding work going on:

#gnome-shell, July 22nd, 2011:
[16:26:52] <stefano> hi.. I have a patch for bug #648700 at http://pastebin.com/KxHCcPzg
[16:26:54] <bebot> Bug http://bugzilla.gnome.org/show_bug.cgi?id=648700 normal, Normal, ---, mutter-maint, UNCONFIRMED, Key binding for half-screen tiling and restoring windows
[16:27:48] <owen> stefano: I don't want to do any keybinding stuff until we get stuff over to gsettings (fmuellner was working on that some)
[16:29:10] <stefano> ah ok.. that's why the bug remained open
[16:31:19] <mclasen> could use fancy bugzilla features and make the one bug block the other...
Comment 7 Christopher De Cairos 2011-07-26 17:33:44 UTC
Any idea when that gsettings stuff is going to land?
Comment 8 Pelle K 2011-09-01 22:26:23 UTC
The "restoring windows" part is just as important as the actual tiling, IMHO. I guess the tiling part is quickly taken care of by binding keyboard shortcuts to the already existing methods in mutter for that, but a method to restore the window to it's *exact* and former position doesn't exist yet AFAIK...

Preferably, you re-use the Meta+L/R for restoring the former window position, like in Windows 7 or KDE 4. If you don't know what i'm talking about, then it works like this; you press Meta+R to tile a window to the right, and while it's in the tiled position, you press Meta+L to restore it. If you continue pressing Meta+L you're gonna tile it to the left, and to restore that window, you then press Meta+R. It's very natural once you try it out.

BTW, maybe i'm just not used to bugzilla (or the gnome way of doing things), but shouldn't this bug be flagged as NEW or ASSIGNED by now?
Comment 9 Florian Müllner 2011-10-04 20:52:02 UTC
*** Bug 660929 has been marked as a duplicate of this bug. ***
Comment 10 Diego 2011-10-10 16:35:25 UTC
Hi, I was wondering if there's been any new development on this?  It seems like issues with keybindings have been mostly worked out as the windows key can now be assigned to bindings.

Hope this gets implemented soon.
Comment 11 Jasper St. Pierre (not reading bugmail) 2011-10-10 19:13:58 UTC
(In reply to comment #10)
> Hi, I was wondering if there's been any new development on this?  It seems like
> issues with keybindings have been mostly worked out as the windows key can now
> be assigned to bindings.

That is unrelated. We are waiting on Florian to finish his metacity gsettings changes. Speaking of that, Florian, can you at least publish/land your changes as is, without a rework of the keybinding stuff?
Comment 12 Rui Matos 2011-11-12 01:48:51 UTC
*** Bug 663897 has been marked as a duplicate of this bug. ***
Comment 13 Florian Müllner 2011-12-05 21:06:22 UTC
Created attachment 202870 [details] [review]
window: Queue a frame redraw after tiling

Usually tiling involves a size change and the frame is redrawn
automatically, however this is not the case when switching directly
between left- and right-tiled.
Ensure that a redraw happens in that case as well.
Comment 14 Florian Müllner 2011-12-05 21:08:48 UTC
Created attachment 202871 [details] [review]
window: Keep track of the last full-maximization state

In order to be able to toggle between tiled and normal/maximized
states, we need to keep track of the last full maximization state.
Comment 15 Florian Müllner 2011-12-05 21:09:28 UTC
Created attachment 202872 [details] [review]
window: Make meta_window_can_tile_side_by_side() public

In order to support keybindings for window tiling, we need to
determine whether a window is tilable or not, so make this public.
Comment 16 Florian Müllner 2011-12-05 21:10:13 UTC
Created attachment 202873 [details] [review]
keybindings: Add toggle-tile-left/right bindings

Having keybindings for side-by-side tiling has been requested for
a long time, so add this support now.
Comment 17 Jasper St. Pierre (not reading bugmail) 2011-12-05 22:52:14 UTC
Review of attachment 202870 [details] [review]:

Yep.
Comment 18 Jasper St. Pierre (not reading bugmail) 2011-12-05 22:57:18 UTC
Review of attachment 202873 [details] [review]:

::: src/core/keybindings.c
@@ +3264,3 @@
+      /* Cheat meta_window_can_tile_side_by_side() */
+      window->maximized_horizontally = 0;
+      window->tile_mode = META_TILE_NONE;

I don't understand this. How are you cheating meta_window_can_tile_side_by_side()?
Comment 19 Jasper St. Pierre (not reading bugmail) 2011-12-05 22:57:31 UTC
Review of attachment 202872 [details] [review]:

Sure.
Comment 20 Jasper St. Pierre (not reading bugmail) 2011-12-05 22:58:06 UTC
Review of attachment 202871 [details] [review]:

Yep.
Comment 21 Florian Müllner 2011-12-05 23:11:20 UTC
(In reply to comment #18)
> I don't understand this. How are you cheating
> meta_window_can_tile_side_by_side()?

The current tiling code requires that a window is "dragged free" first before tiling it in a different position. While this behavior makes sense for the dragging functionality, it feels overly restrictive for the keybindings, e.g. I think we want to allow to change from left-tiled to right-tiled (or maximized) without untiling first.

(An alternative approach to the "cheating" would be to implement the restrictions in move_resize_internal instead of can_tile_side_by_side())
Comment 22 Jasper St. Pierre (not reading bugmail) 2011-12-05 23:18:18 UTC
(In reply to comment #21)
> (In reply to comment #18)
> > I don't understand this. How are you cheating
> > meta_window_can_tile_side_by_side()?
> 
> The current tiling code requires that a window is "dragged free" first before
> tiling it in a different position. While this behavior makes sense for the
> dragging functionality, it feels overly restrictive for the keybindings, e.g. I
> think we want to allow to change from left-tiled to right-tiled (or maximized)
> without untiling first.

I completely agree. Can we relax these restrictions instead of cheating the system?

> (An alternative approach to the "cheating" would be to implement the
> restrictions in move_resize_internal instead of can_tile_side_by_side())
Comment 23 Florian Müllner 2011-12-06 00:17:25 UTC
Created attachment 202886 [details] [review]
window: Relax restrictions for can_tile_maximized ()

The current code requires windows to be resizable to be considered
for tiling, which excludes all maximized/tiled windows. While this
restriction concurs with the desired behavior for edge-tiling, it
feels overly restrictive for keybindings.
As the edge-tiling code in update_move() already ensures the above
restriction, it seems save to remove it from the can_tile_maximized()
function, assuming that windows that are not meant to be tiled or
maximized won't provide a maximize function.

(In reply to comment #22)
> Can we relax these restrictions instead of cheating the system?

I think so. At least a quick test with different kind of windows did not turn up any behavior changes.
Comment 24 Florian Müllner 2011-12-06 00:18:22 UTC
Created attachment 202887 [details] [review]
keybindings: Add toggle-tile-left/right bindings

Updated patch, now with 70% less cheating!
Comment 25 Jasper St. Pierre (not reading bugmail) 2011-12-06 00:25:43 UTC
Review of attachment 202886 [details] [review]:

This makes sense to me.
Comment 26 Jasper St. Pierre (not reading bugmail) 2011-12-06 00:26:12 UTC
Review of attachment 202887 [details] [review]:

::: src/core/keybindings.c
@@ +3262,3 @@
+      window->tile_monitor_number = window->monitor->number;
+      window->tile_mode = mode;
+      window->maximized_horizontally = 0;

Why this?
Comment 27 Florian Müllner 2011-12-06 00:41:43 UTC
(In reply to comment #26)
> +      window->maximized_horizontally = 0;
> 
> Why this?

meta_window_tile () resizes the window to half the screen width and maximizes it vertically. However, if the window is currently fully maximized, the resize operation does not have any effect (as meta_window_maximize_internal does not unset directions not requested, and maximization flags beat normal size hints).
Comment 28 Matthias Clasen 2011-12-07 13:03:41 UTC
*** Bug 665725 has been marked as a duplicate of this bug. ***
Comment 29 Florian Müllner 2011-12-13 13:50:04 UTC
Attachment 202870 [details] pushed as 4ca5527 - window: Queue a frame redraw after tiling
Attachment 202871 [details] pushed as bed9cb1 - window: Keep track of the last full-maximization state
Attachment 202872 [details] pushed as baeb9fb - window: Make meta_window_can_tile_side_by_side() public
Attachment 202886 [details] pushed as c3d76ae - window: Relax restrictions for can_tile_maximized ()
Attachment 202887 [details] pushed as 34f6ffd - keybindings: Add toggle-tile-left/right bindings (with an additional comment as requested on IRC)
Comment 30 Rui Matos 2012-01-07 18:00:24 UTC
*** Bug 667443 has been marked as a duplicate of this bug. ***