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 645325 - window rearrangement causes wrong window to be selected
window rearrangement causes wrong window to be selected
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-03-20 19:24 UTC by wepmaschda
Modified: 2012-01-15 17:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
delay rearrangement when cursor hovers a window (670 bytes, patch)
2012-01-01 17:01 UTC, Vít Stanislav
none Details | Review
patch (1.27 KB, patch)
2012-01-08 10:05 UTC, Vít Stanislav
needs-work Details | Review
patch (1.13 KB, patch)
2012-01-12 09:23 UTC, Vít Stanislav
needs-work Details | Review
patch (1.21 KB, patch)
2012-01-12 14:15 UTC, Vít Stanislav
accepted-commit_now Details | Review
patch (1.21 KB, patch)
2012-01-14 10:40 UTC, Vít Stanislav
committed Details | Review

Description wepmaschda 2011-03-20 19:24:50 UTC
In overview when closing a window and afterwards dragging a window it can happen that you pick a wrong window or no window if windows' positions is updated while initiating the drag. 

Window arrangement update should start when leaving the windows area.

Similar behaviour is implemented in google chrome when closing tabs.
Comment 1 Allan Day 2011-11-18 13:02:14 UTC
Removing the delay before window rearrangement occurs might fix this.

Renaming for clarity.
Comment 2 wepmaschda 2011-11-18 13:16:02 UTC
Removing the delay before window rearrangement will make closing multiple windows harder.

(Closing three windows should be possible by localizing the three windows and clicking the three close buttons in a row without an interrupting rearrangement.)
Comment 3 Allan Day 2011-11-18 15:54:53 UTC
(In reply to comment #2)
> Removing the delay before window rearrangement will make closing multiple
> windows harder. ...

True.

(In reply to comment #0)
...
> Window arrangement update should start when leaving the windows area.
...

A better solution might be to not rearrange the windows if the pointer is hovering over one of them.
Comment 4 Vít Stanislav 2012-01-01 17:01:18 UTC
Created attachment 204422 [details] [review]
delay rearrangement when cursor hovers a window

My patch aims to solve this as Allan proposed. 
BTW, I've found another little bug while testing my patch. When there's a delayed rearrangement (after I've closed a window), then I drag a window (nothing delays rearrangement anymore, so other windows are rearranged), then if I drop the window in the same workspace (cause I've changed my mind), the window goes to it's previous position, but it should go to its position after rearrangement. I doubt if we should be concerned about it, since it's really rare to happen, but if "Every Detail Matters" :).
Comment 5 Allan Day 2012-01-05 10:28:16 UTC
(In reply to comment #4)
> Created an attachment (id=204422) [details] [review]
> delay rearrangement when cursor hovers a window
> 
> My patch aims to solve this as Allan proposed.  ...

Keep 'em coming Vít! Can we have a patch and not a diff please?
Comment 6 Vít Stanislav 2012-01-08 10:05:30 UTC
Created attachment 204829 [details] [review]
patch

patch described earlier.
Comment 7 Allan Day 2012-01-09 10:04:57 UTC
(In reply to comment #6)
> Created an attachment (id=204829) [details] [review]
> patch
> 
> patch described earlier.

Seems to have the desired effect.
Comment 8 drago01 2012-01-09 17:44:59 UTC
Review of attachment 204829 [details] [review]:

Just use global.stage.get_actor_at_pos() instead to find the actor under the pointer.
Comment 9 Vít Stanislav 2012-01-12 09:23:53 UTC
Created attachment 205068 [details] [review]
patch

(In reply to comment #8)
> Review of attachment 204829 [details] [review]:
> 
> Just use global.stage.get_actor_at_pos() instead to find the actor under the
> pointer.

Do you mean something like this?.
Comment 10 drago01 2012-01-12 09:44:17 UTC
Review of attachment 205068 [details] [review]:

Better but not there yet ;)

::: js/ui/workspace.js
@@ +1180,3 @@
 
+        for (let i = 0; i < this._windows.length; i++) {
+            if (this._windows[i].actor == global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y))

Store the result of the pick in a variable and use that in the loop. Don't pick in a loop.
Comment 11 Vít Stanislav 2012-01-12 14:15:13 UTC
Created attachment 205102 [details] [review]
patch

(In reply to comment #10)
> Review of attachment 205068 [details] [review]:
> 
> Better but not there yet ;)
> 
> ::: js/ui/workspace.js
> @@ +1180,3 @@
> 
> +        for (let i = 0; i < this._windows.length; i++) {
> +            if (this._windows[i].actor ==
> global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y))
> 
> Store the result of the pick in a variable and use that in the loop. Don't pick
> in a loop.

I really have a lot to learn still. Thanks for patience.
Comment 12 drago01 2012-01-14 10:18:22 UTC
Review of attachment 205102 [details] [review]:

Code looks good.

Fine to commit with this change to the commit message:

"With this patch is window rearrangement delayed when cursor is in a window." -> "Fix that by delaying window rearrangement when cursor is over a window."
Comment 13 Vít Stanislav 2012-01-14 10:40:16 UTC
Created attachment 205259 [details] [review]
patch

(In reply to comment #12)
> Review of attachment 205102 [details] [review]:
> 
> Code looks good.
> 
> Fine to commit with this change to the commit message:
> 
> "With this patch is window rearrangement delayed when cursor is in a window."
> -> "Fix that by delaying window rearrangement when cursor is over a window."

I'm not entirely sure if I'm expected to upload the patch with altered message, but here it is.
Comment 14 drago01 2012-01-15 15:23:47 UTC
(In reply to comment #13)
> Created an attachment (id=205259) [details] [review]
> patch
> 
> (In reply to comment #12)
> > Review of attachment 205102 [details] [review] [details]:
> > 
> > Code looks good.
> > 
> > Fine to commit with this change to the commit message:
> > 
> > "With this patch is window rearrangement delayed when cursor is in a window."
> > -> "Fix that by delaying window rearrangement when cursor is over a window."
> 
> I'm not entirely sure if I'm expected to upload the patch with altered message,
> but here it is.

Pushed it for you http://git.gnome.org/browse/gnome-shell/commit/?id=b88b743

Thanks for the patch!
Comment 15 Allan Day 2012-01-15 17:04:52 UTC
Yeah, thanks Vít! It's great to have this fixed.