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 661256 - windows doesn't remember their positions when moved by keyboard shortcuts
windows doesn't remember their positions when moved by keyboard shortcuts
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
3.2.x
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2011-10-08 10:12 UTC by Mariusz Libera
Modified: 2012-03-13 16:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A fix for this bug (6.47 KB, patch)
2012-01-22 11:28 UTC, Mariusz Libera
needs-work Details | Review
Fix move-to-corner keybindings (2.14 KB, patch)
2012-03-12 19:43 UTC, Owen Taylor
committed Details | Review

Description Mariusz Libera 2011-10-08 10:12:22 UTC
When I use a keyboard shortcuts set in gconf to move a window 
(move_to_{e,n,s,w}), it moves as expected but when I then use shortcut 
to drag it to another workspace (shift+ctrl+alt+up/down) it is back in 
it's previous position. Similar thing happens when I use toggle_shaded 
shortcut - window is back at it's previous position.
Comment 1 Mariusz Libera 2012-01-20 21:16:00 UTC
Ok, so handle_move_to_corner_backend (responsible for move_to_{e,n,s,w} actions) 
calls meta_window_move_resize with user_op set to FALSE. This causes 
meta_window_move_resize_internal to call save_user_window_placement.
So I changed handle_move_to_corner_backend to set user_op to TRUE, 
as handle_move_to_center is doing (which is behaving correctly), 
and that fixed the problem of remembering window position after move_to_{e,n,s,w}. 

But now windows that I move using these shortcuts are no longer positioned correctly.
I mean they are few pixels off screen and doesn't respect top bar. Why is this broken?
Comment 2 Mariusz Libera 2012-01-21 00:59:20 UTC
It seems constrain_to_single_monitor as well as constrain_fully_onscreen 
exits early because is_user_action == true.
In result do_screen_and_monitor_relative_constraints, which probably would fix window placement, is not executed.

Any chance of fixing this?
Comment 3 Mariusz Libera 2012-01-22 11:28:45 UTC
Created attachment 205806 [details] [review]
A fix for this bug

This makes windows save their placement after move_to_side_* actions
by passing additional flag to meta_window_move_resize_internal telling 
it to call save_user_window_placement.
Now it works as expected.
Comment 4 Owen Taylor 2012-03-12 19:43:17 UTC
Review of attachment 205806 [details] [review]:

Good job tracking down this problem.

In general, functions with boolean parameters should be looked at with suspicion, since it makes callers hard to read - the function of a TRUE or FALSE is not obvious to someone reading the code. Functions with multiple booleans are basically always wrong, so I don't want to add an extra boolean to meta_window_move_resize()

An alternative would be make meta_window_move_resize() take flags like meta_window_move_resize_internal() - this is a better way to do a function with options. Still, I'm a little reluctant to make that change:

 * I don't want to make meta_window_move_resize() different from other members of the family - meta_window_move(), meta_window_resize(), etc, which currently take the user_op boolean, so we'd need to change all of them.
 * But these other functions are public and used in gnome-shell extensions, etc, so changing them would be a bit of a compatibility headache.

So, I'm more inclined to look around for another solution. I think the basic problem you were seeing wasn't that the constraint was needed, but rather that the logic in handle_move_to_corner_backend() isn't quite right with the addition of invisible borders. Will attach my attempt at a fix. Testing appreciated!
Comment 5 Owen Taylor 2012-03-12 19:43:29 UTC
Created attachment 209533 [details] [review]
Fix move-to-corner keybindings

The move-to-corner keybindings weren't treated as user actions, which
resulted in them not affecting the saved position - they weren't
always being treated as sticky. Marking them as a user action revealed
bugs in the positioning logic that were hidden by the constraint
code applied to automated moves. Fix those as well. Bug tracked
down by Mariusz Libera.
Comment 6 Florian Müllner 2012-03-12 20:13:44 UTC
Review of attachment 209533 [details] [review]:

LGTM (and works in testing)
Comment 7 Mariusz Libera 2012-03-13 02:21:08 UTC
Thanks for looking into it. I tried that patch with mutter 3.2.2
but results weren't good - http://www.youtube.com/watch?v=i3yUdnJFBds
Is version from git required for it to work properly?
Comment 8 Florian Müllner 2012-03-13 02:37:32 UTC
(In reply to comment #7)
> I tried that patch with mutter 3.2.2 but results weren't 
> good - http://www.youtube.com/watch?v=i3yUdnJFBds

Looks like bug 659643.
Comment 9 Owen Taylor 2012-03-13 16:20:20 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > I tried that patch with mutter 3.2.2 but results weren't 
> > good - http://www.youtube.com/watch?v=i3yUdnJFBds
> 
> Looks like bug 659643.

Yeah, at least the fix for that is going to be needed to make this patch work.
Comment 10 Owen Taylor 2012-03-13 16:20:38 UTC
Attachment 209533 [details] pushed as 047b9de - Fix move-to-corner keybindings