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 674104 - Show the workspace switcher when moving a window
Show the workspace switcher when moving a window
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: 2012-04-14 13:37 UTC by Giovanni Campagna
Modified: 2012-06-27 18:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make meta_workspace_get_neighbor() public (2.56 KB, patch)
2012-04-14 13:39 UTC, Giovanni Campagna
committed Details | Review
Make it possible to reimplement move-to-workspace keybindings from plugins (4.39 KB, patch)
2012-04-14 13:39 UTC, Giovanni Campagna
committed Details | Review
WorkspaceSwitcher: simplify code for handling keybindings (6.98 KB, patch)
2012-04-14 13:39 UTC, Giovanni Campagna
committed Details | Review
WindowManager: handle move-to-workspace keybindings (3.82 KB, patch)
2012-04-14 13:39 UTC, Giovanni Campagna
needs-work Details | Review
WindowManager: handle move-to-workspace keybindings (4.03 KB, patch)
2012-06-27 17:38 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2012-04-14 13:37:42 UTC
Currently, when moving a window to a different workspace with <Ctrl><Alt><Shift>Arrow, the actual moving is animated but we don't show the workspace switcher.
This can be confusing, because if the original window is fullscreen, you have no idea where you come from and where you ended up. Compare this to Unity/Compiz, they instead show the switcher for all keyboard initiated movements.

Patches coming (many of them, because some minor mutter changes are needed)
Comment 1 Giovanni Campagna 2012-04-14 13:39:02 UTC
Created attachment 212045 [details] [review]
Make meta_workspace_get_neighbor() public

There is no need for this function to be private, and it can
greatly simplify gnome-shell code handling workspace switch.
Comment 2 Giovanni Campagna 2012-04-14 13:39:12 UTC
Created attachment 212046 [details] [review]
Make it possible to reimplement move-to-workspace keybindings from plugins

Export the necessary functions so that a plugin that wishes to do
so can reimplement those keybindings without loss of functionality.
Comment 3 Giovanni Campagna 2012-04-14 13:39:30 UTC
Created attachment 212047 [details] [review]
WorkspaceSwitcher: simplify code for handling keybindings

Most of code implementing workspace switches was repeated with
minor differences on each direction. Instead, consolidate it
and use the new meta_workspace_get_neighbor.
Comment 4 Giovanni Campagna 2012-04-14 13:39:41 UTC
Created attachment 212048 [details] [review]
WindowManager: handle move-to-workspace keybindings

Install a custom handler for move-to-workspace-* keybindings that
shows the workspace switcher, which gives the user a sense of
direction when navigating with the keyboard.
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-04-14 16:10:06 UTC
Review of attachment 212046 [details] [review]:

Uh, we can already move windows to certain workspaces from the Shell. That should be all that's needed here, right? I agree that change_workspace is a lot easier, but I don't understand the stuff about mouse_mode.
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-04-14 16:10:39 UTC
Hah, this is quite similar to bug #660839. Of course, the patches in there were never updated for the new keybindings work, but I think they're still worth a look.
Comment 7 Jasper St. Pierre (not reading bugmail) 2012-04-14 16:10:58 UTC
Review of attachment 212045 [details] [review]:

Sure.
Comment 8 Jasper St. Pierre (not reading bugmail) 2012-04-14 16:13:29 UTC
Review of attachment 212047 [details] [review]:

Wow, much better.
Comment 9 Jasper St. Pierre (not reading bugmail) 2012-04-14 16:16:52 UTC
Review of attachment 212048 [details] [review]:

So, what I did before was something like:

    let [action, to, workspace, direction] = binding.split('-');
    const MOTION_DIRECTIONS = {'up': Meta.MotionDirection.UP,
                              'down': Meta.MotionDirection.DOWN};
    let motionDirection = MOTION_DIRECTIONS[direction];

    if (action === 'switch')
        this._switchWorkspace(display, window, motionDirection);
    else if (action === 'move')
        this._moveWorkspace(display, window, motionDirection);

I think that would be cleaner than something like this.
Comment 10 Giovanni Campagna 2012-04-14 16:25:59 UTC
(In reply to comment #5)
> Review of attachment 212046 [details] [review]:
> 
> Uh, we can already move windows to certain workspaces from the Shell. That
> should be all that's needed here, right? I agree that change_workspace is a lot
> easier, but I don't understand the stuff about mouse_mode.

I'm not sure either, I just wanted to make sure that gnome-shell code did exactly the same as metacity original code, to avoid weird regressions.
Anyway, as I understand it, mutter can sometimes decide to ignore enter/leave events in sloppy/mouse focus modes (for popups?), but then it needs to reset that, once the user has made its choice with the keyboard.
Comment 11 Giovanni Campagna 2012-06-25 17:26:05 UTC
So, what was the outcome of this bug / what needs to change before merging?

(No hurry, just cleaning up the queue)
Comment 12 Jasper St. Pierre (not reading bugmail) 2012-06-25 17:34:10 UTC
I don't quite understand the mouse mode stuff, so I'd like to have Owen take a look at it.

Otherwise, I think rebasing the patches in my bug that I linked above is fine. You can commit the ACN patches.
Comment 13 Giovanni Campagna 2012-06-25 21:11:43 UTC
Comment on attachment 212045 [details] [review]
Make meta_workspace_get_neighbor() public

Attachment 212045 [details] pushed as e31f55e - Make meta_workspace_get_neighbor() public
Comment 14 Giovanni Campagna 2012-06-27 17:03:37 UTC
(In reply to comment #12)
> I don't quite understand the mouse mode stuff, so I'd like to have Owen take a
> look at it.
> 
> Otherwise, I think rebasing the patches in my bug that I linked above is fine.
> You can commit the ACN patches.

It seems that patch #1 there is above some unreferenced work to handle move-to-worskspace-* keybindings, so I'm rebasing it on top of patch #4 here.
Comment 15 Jasper St. Pierre (not reading bugmail) 2012-06-27 17:14:44 UTC
Review of attachment 212048 [details] [review]:

::: js/ui/windowManager.js
@@ +595,3 @@
+    _handleMoveWindow: function(display, screen, window, binding) {
+        if (screen.n_workspaces == 1)
+            return;

This won't ever happen.

@@ +598,3 @@
+
+        if (this._workspaceSwitcherPopup == null)
+            this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();

Why are we doing this here?

@@ +601,3 @@
+
+        if (binding.get_name() == 'move-to-workspace-up')
+            this.actionMoveWindow(window, Meta.MotionDirection.UP);

Again, I'd like to see a bit more genericism:

    let [action, to, workspace, direction] = binding.get_name().split('-');
    direction = Meta.MotionDirection[direction.toUpperCase()];
    if (action == 'move')
         // ...
    else if (action == 'switch')
         // ...

@@ +616,3 @@
+        if (activeWorkspace != toActivate) {
+            /* This won't have any effect for "always sticky" windows
+               (like desktop windows or docks) */

We use // style comments in the shell.
Comment 16 Giovanni Campagna 2012-06-27 17:17:13 UTC
(In reply to comment #15)
> Review of attachment 212048 [details] [review]:
> 
> ::: js/ui/windowManager.js
> @@ +595,3 @@
> +    _handleMoveWindow: function(display, screen, window, binding) {
> +        if (screen.n_workspaces == 1)
> +            return;
> 
> This won't ever happen.

Unless you enable static workspaces.
Comment 17 Giovanni Campagna 2012-06-27 17:19:29 UTC
(In reply to comment #15)
> Review of attachment 212048 [details] [review]:
> 
> @@ +598,3 @@
> +
> +        if (this._workspaceSwitcherPopup == null)
> +            this._workspaceSwitcherPopup = new
> WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
> 
> Why are we doing this here?

Uhm... I just copied what the keybindings for switch-workspace do (and showing the switcher is the whole point of this bug)
Comment 18 Jasper St. Pierre (not reading bugmail) 2012-06-27 17:21:54 UTC
(In reply to comment #17)
> Uhm... I just copied what the keybindings for switch-workspace do (and showing
> the switcher is the whole point of this bug)

Just curious why it was there instead of in _actionMoveWorkspace, is all.

(In reply to comment #16)
> Unless you enable static workspaces.

get_neighbor should return the same workspace anyway, so I don't think it matters.
Comment 19 Jasper St. Pierre (not reading bugmail) 2012-06-27 17:23:04 UTC
Review of attachment 212048 [details] [review]:

Although maybe the genericism is a bit too much and too early. Hm...
Comment 20 Giovanni Campagna 2012-06-27 17:38:05 UTC
Created attachment 217433 [details] [review]
WindowManager: handle move-to-workspace keybindings

Install a custom handler for move-to-workspace-* keybindings that
shows the workspace switcher, which gives the user a sense of
direction when navigating with the keyboard.
Comment 21 Jasper St. Pierre (not reading bugmail) 2012-06-27 17:44:14 UTC
Review of attachment 217433 [details] [review]:

Yep. This works for me.
Comment 22 Giovanni Campagna 2012-06-27 17:49:16 UTC
(In reply to comment #21)
> Review of attachment 217433 [details] [review]:
> 
> Yep. This works for me.

Wait... what about the mouse_mode stuff?
Comment 23 Jasper St. Pierre (not reading bugmail) 2012-06-27 18:02:33 UTC
See how-to-get-focus-right.txt and bug #167545 . I don't know why it happens only with a flip in the regular keybinding handler, rather than all the time.
Comment 24 Giovanni Campagna 2012-06-27 18:06:35 UTC
(In reply to comment #23)
> See how-to-get-focus-right.txt and bug #167545 . I don't know why it happens
> only with a flip in the regular keybinding handler, rather than all the time.

Ok, I read this as "mouse_mode must be cleared when handling the keybinding".
Comment 25 Giovanni Campagna 2012-06-27 18:07:14 UTC
Comment on attachment 212046 [details] [review]
Make it possible to reimplement move-to-workspace keybindings from plugins

Attachment 212046 [details] pushed as f65b7c5 - Make it possible to reimplement move-to-workspace keybindings from plugins
Comment 26 Giovanni Campagna 2012-06-27 18:08:46 UTC
Attachment 212047 [details] pushed as de72065 - WorkspaceSwitcher: simplify code for handling keybindings
Attachment 217433 [details] pushed as 04dbf15 - WindowManager: handle move-to-workspace keybindings