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 610892 - [Overview] Switch workspace when dragging the desktop
[Overview] Switch workspace when dragging the desktop
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-02-24 01:04 UTC by Florian Müllner
Modified: 2010-03-18 22:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[Overview] Switch workspace when dragging the desktop (6.20 KB, patch)
2010-02-24 01:04 UTC, Florian Müllner
reviewed Details | Review
[Overview] Switch workspace when dragging the desktop (6.35 KB, patch)
2010-02-24 20:27 UTC, Florian Müllner
reviewed Details | Review
[Overview] Switch workspace when dragging the desktop (6.36 KB, patch)
2010-03-02 17:11 UTC, Florian Müllner
none Details | Review
[Overview] Switch workspace when dragging the desktop (5.71 KB, patch)
2010-03-02 18:45 UTC, Florian Müllner
none Details | Review
[Overview] Switch workspace when dragging the desktop (5.86 KB, patch)
2010-03-16 18:03 UTC, Florian Müllner
reviewed Details | Review
[Overview] Switch workspace when dragging the desktop (6.45 KB, patch)
2010-03-18 00:26 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2010-02-24 01:04:39 UTC
Some days ago there was some IRC discussion about allowing to switch workspaces with drag and swipe of the desktop - IMHO that's an interestng alternative to using the scrollbar, and a nice complement to bug 607821.
Comment 1 Florian Müllner 2010-02-24 01:04:44 UTC
Created attachment 154554 [details] [review]
[Overview] Switch workspace when dragging the desktop

Depending on screen size and pointer position, the scroll bar used
to switch the active workspace in linear view may not be a convenient
target, so allow dragging the desktop as an alternative.
Comment 2 drago01 2010-02-24 13:38:15 UTC
(In reply to comment #0)
> Some days ago there was some IRC discussion about allowing to switch workspaces
> with drag and swipe of the desktop - IMHO that's an interestng alternative to
> using the scrollbar, and a nice complement to bug 607821.

(In reply to comment #1)
> Created an attachment (id=154554) [details] [review]
> [Overview] Switch workspace when dragging the desktop
> 
> Depending on screen size and pointer position, the scroll bar used
> to switch the active workspace in linear view may not be a convenient
> target, so allow dragging the desktop as an alternative.

This works better than expected (didn't like the idea because it seemed odd to me), but after actually trying it I like it ;)

Switching this way feels way more natural than using the scrollbar or clicking on the indicators. (Feels like a big iPhone ;) )

This needs an ui-review though but Jon wasn't against this idea (he was in favor of at least trying it).
Comment 3 William Jon McCann 2010-02-24 15:59:26 UTC
This complements some of the work in bug 607821.  I think it is an interesting thing to try.
Comment 4 drago01 2010-02-24 19:48:18 UTC
Review of attachment 154554 [details] [review]:

Looks good overall and as I said before works fine for me.

Just some minor (style) comments.

Jon can we read your comment as "yes we want to get it in" ?

::: js/ui/workspacesView.js
@@ +691,3 @@
+        switch (event.type()) {
+
+        case Clutter.EventType.BUTTON_RELEASE:

Missing indention ... should be like

switch (foo) {
   case bar:
       ....

@@ +732,3 @@
+            return true;
+
+        case Clutter.EventType.MOTION:

Same here

@@ +738,3 @@
+
+            this._scroll.adjustment.value += (dx / primary.width);
+            this._dragDirection = - dx;

Remove the space it looks odd (i.e just write -dx)
Comment 5 Florian Müllner 2010-02-24 20:10:10 UTC
(In reply to comment #4)
> ::: js/ui/workspacesView.js
> @@ +691,3 @@
> +        switch (event.type()) {
> +
> +        case Clutter.EventType.BUTTON_RELEASE:
> 
> Missing indention ... should be like

Dammit! I always indent the case line, but as there's quite a diversity of styles here I grepped for it to match the overall style - of course I had to pick the _only_ one which does not indent (calendar.js).

So yeah, I'll be more than happy to fix that ...
Comment 6 Florian Müllner 2010-02-24 20:27:06 UTC
Created attachment 154621 [details] [review]
[Overview] Switch workspace when dragging the desktop

Fix style according to review.
Comment 7 drago01 2010-02-24 21:27:09 UTC
Review of attachment 154621 [details] [review]:

Looks good I'd say get an ack from Jon and commit (unless someone else finds flaws in the code ;) )
Comment 8 Colin Walters 2010-03-02 15:27:55 UTC
Review of attachment 154621 [details] [review]:

Looks pretty good to me.
Comment 9 Florian Müllner 2010-03-02 17:11:16 UTC
Created attachment 155053 [details] [review]
[Overview] Switch workspace when dragging the desktop

Correct the bounds check of the workspace index in _onCapturedEvent() to
apply to the new index rather than the currently active one - this fixes
the issue that the workspace was snapped back when the handle was dragged
far enough to trigger a workspace switch before releasing the pointer.
Comment 10 Florian Müllner 2010-03-02 18:45:16 UTC
Created attachment 155058 [details] [review]
[Overview] Switch workspace when dragging the desktop

Played around with Jon on IRC - it seems better to just remove the complicated rules for cancelling a switch: just do it according to the drag direction and be done :)
Comment 11 Colin Walters 2010-03-11 20:02:41 UTC
I'd like to wait on this patch until we land bug 607821
Comment 12 Florian Müllner 2010-03-16 18:03:01 UTC
Created attachment 156292 [details] [review]
[Overview] Switch workspace when dragging the desktop

Rebased patch.
Comment 13 Colin Walters 2010-03-17 22:42:41 UTC
Review of attachment 156292 [details] [review]:

Works very well!  Two minor comments.

::: js/ui/workspacesView.js
@@ +596,3 @@
+    // @draggable: whether workspace @index should be draggable
+    // @index: workspace index
+    // _setWorkspaceDraggable:

I think I'd prefer this to be:

if (draggable)
  this._workspaces[index].actor.reactive = true;

Which has the property that it won't break if we later make the workspace actor always reactive (think a slight hover effect or something).

@@ +645,3 @@
+
+                [stageX, stageY] = event.get_coords();
+

This is fairly minor, but I think it's worth doing a bit of checking here to see if we've dragged more than say 20% of the way; if we haven't, just snap back.
Comment 14 Florian Müllner 2010-03-18 00:26:36 UTC
Created attachment 156416 [details] [review]
[Overview] Switch workspace when dragging the desktop

> This is fairly minor, but I think it's worth doing a bit of checking here to
> see if we've dragged more than say 20% of the way; if we haven't, just snap
> back.

Not sure if I like it - it's no longer possible to just grab the desktop and throw it in the desired direction; but then, it might be better to implement that in another patch with a proper animation ...
The exact threshold is up to debate of course (patch goes with the proposed 20%).
Comment 15 Florian Müllner 2010-03-18 22:41:20 UTC
Attachment 156416 [details] pushed as 47644ca - [Overview] Switch workspace when dragging the desktop