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 309956 - active window shoud change when scrolling on the window-list
active window shoud change when scrolling on the window-list
Status: RESOLVED FIXED
Product: libwnck
Classification: Core
Component: tasklist
git master
Other Linux
: Normal enhancement
: ---
Assigned To: libwnck maintainers
libwnck maintainers
Depends on: 310381
Blocks:
 
 
Reported: 2005-07-10 14:04 UTC by Xavier Claessens
Modified: 2005-12-04 10:03 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
the patch i'm speaking about (2.03 KB, patch)
2005-07-11 13:41 UTC, Xavier Claessens
none Details | Review
same patch with b-m-p bugfix (2.23 KB, patch)
2005-07-12 18:11 UTC, Xavier Claessens
none Details | Review
syntax cleaning (2.30 KB, patch)
2005-07-12 21:50 UTC, Xavier Claessens
none Details | Review
better patch (1.60 KB, patch)
2005-07-14 15:12 UTC, Xavier Claessens
none Details | Review
b-m-p bug doesn't matter now (2.17 KB, patch)
2005-07-16 14:54 UTC, Xavier Claessens
none Details | Review
same patch but against CVS (1.72 KB, patch)
2005-07-17 12:18 UTC, Xavier Claessens
needs-work Details | Review
follow the on-screen order and takes care of groups (2.92 KB, patch)
2005-07-22 16:20 UTC, Xavier Claessens
none Details | Review
maybe better ? (2.85 KB, patch)
2005-07-25 14:04 UTC, Xavier Claessens
none Details | Review
works scroll right/left change colomn, up/down change row (3.85 KB, patch)
2005-08-18 19:11 UTC, Xavier Claessens
none Details | Review
gnome-panel/applets/wncklet patch (5.43 KB, patch)
2005-10-23 00:08 UTC, Nigel Tao
none Details | Review
yet another patch (2.81 KB, patch)
2005-10-28 23:58 UTC, Xavier Claessens
none Details | Review
getting better and better (4.96 KB, patch)
2005-11-20 15:46 UTC, Xavier Claessens
none Details | Review
revised by vuntz (5.45 KB, patch)
2005-11-20 17:35 UTC, Xavier Claessens
none Details | Review
better comments (5.28 KB, patch)
2005-11-20 17:48 UTC, Xavier Claessens
committed Details | Review

Description Xavier Claessens 2005-07-10 14:04:02 UTC
hi !

since gnome-2.10 scrolling on the workspace applet change the virtual desktop.
It's great and the same thing would be also great in tasklist applet.

i'm trying to patch it myself, but i can't find where it is in applets/wncklet.
So if someone can help me I will be happy to code this "simple" patch :-)
Comment 1 Sebastien Bacher 2005-07-10 14:13:55 UTC
have you tried with libwnck/tasklist.c?
Comment 2 Xavier Claessens 2005-07-11 13:41:02 UTC
Created attachment 48951 [details] [review]
the patch i'm speaking about
Comment 3 Xavier Claessens 2005-07-11 13:44:52 UTC
that's my first patch ever, so please read it and give me feedback :-)

the patch is tested only with the test-tasklist script because it's difficult
for me to test it with de gnome-applet without breaking my distrib.

i've build it against libwnck-2.10.0, if cvs version needed please tell me.
Comment 4 Xavier Claessens 2005-07-11 13:53:49 UTC
line 25 of the patch:

-      /* courent window found:
+      /* current window found:

sorry :)
Comment 5 Xavier Claessens 2005-07-11 14:39:31 UTC
i'm testing the patch in action with the window-list applet...
seems to work very well, but i've a strange bug when passing over
beep-media-player :

when b-m-p is the only window in this desktop, scrolling minimize the window...
and when there is others windows it scrolls well over others but when comming on
b-m-p it can't go to another (it stays on b-m-p)... can't understand why...

any suggestion ?

Comment 6 Xavier Claessens 2005-07-12 10:09:06 UTC
ok ! after some testing I think the bug isn't my fault. When you have a
beep-media-player in the tasklist and just click on it in the panel b-m-p 's
window is selected but her button on tasklist is pushed and active_task in the
tasklist doesn't point to it...

I think that's an old bug never found in tasklist but I can't find what is going
wrong.
Comment 7 Xavier Claessens 2005-07-12 18:11:36 UTC
Created attachment 49043 [details] [review]
same patch with b-m-p bugfix

I hope this patch fix b-m-p bug.

The problem was b-m-p (also xmms I think) has multiple windows (player,
playlist,...) but only one (the player) is registred as a task. So when b-m-p
receive the focus the callback « wnck_tasklist_active_window_changed » is
luched for each window composing b-m-p but only one has a corresponding task,
for others « wnck_tasklist_change_active_task » is lunched with a NULL
pointer and then _WnckTasklistPrivate::active_task become NULL witch is not
what we want !

I realy don't know if I fixed it the right way so please give me feedback :-)
Comment 8 Xavier Claessens 2005-07-12 21:50:09 UTC
Created attachment 49068 [details] [review]
syntax cleaning
Comment 9 Xavier Claessens 2005-07-14 15:12:46 UTC
Created attachment 49170 [details] [review]
better patch

 - use GList fonctions like «g_list_find» is better than recode it :-) So now
the code is far cleaner.

 - remove workaround for b-m-p bug, i'll open another bug for it since it has
nothing to do with scroll.
Comment 10 Xavier Claessens 2005-07-14 15:50:59 UTC
b-m-p 's bug is now on #310381
Comment 11 Xavier Claessens 2005-07-16 14:54:33 UTC
Created attachment 49286 [details] [review]
b-m-p bug doesn't matter now

now the b-m-p bug doesn't matter. I added «previously_active_task» witch is
the previous non-NULL task actived.

It works very well for me.
Comment 12 Xavier Claessens 2005-07-17 10:29:16 UTC
since bug #310381 seems to be fixed (by me) the last attached patch become
obsolete and the good one is "better patch".
Comment 13 Xavier Claessens 2005-07-17 12:18:30 UTC
Created attachment 49316 [details] [review]
same patch but against CVS
Comment 14 Elijah Newren 2005-07-17 15:18:52 UTC
I don't think this is usable without bug 310381 being fixed first (if the user
has any transients not shown in the tasklist, continuing to scroll restarts at
one of the ends of the tasklist).  Note that it will be important to handle
group modal windows as well in that bug or this patch will introduce a usability
problem for that case.  So I'll mark this bug as depending on 310381.

I haven't tested this with grouped windows, but I have a feeling that users with
that setting wouldn't like this behavior at all.  But then again, punishing
users who use stupid settings (*grumble*) may not be such a bad idea after
all...  ;-)

The patch in 130308 that introduced scrolling in the workspace switcher does not
wrap when you hit the end of the list.  If this patch is to be accepted, it
shouldn't do so either.

The patch kind of sucks in mouse focus because it *always* starts at one of the
ends of the list (because any window is deactivated by moving the mouse to the
taskbar).  There's a related case in sloppy and click focus modes where if a
modal dialog is popped up but doesn't get focus and is modal to the window that
last had focus then all windows are defocused.  I believe in these cases, the
patch should start the scrolling from the most recently active task.  There's a
wnck_window_is_most_recently_activated() function that may help with this.

I'm still not sure with libwnck or wnck-applet should be patched; Mark patched
the latter in bug 130308 and so it seems to me that perhaps that's the
appropriate place for a patch like this but I don't know as I'm not a panel
maintainer.  I'd like Mark or Vincent to comment on this aspect.

Of course, there's the whole question of whether we want this behavior.  It does
add a consistency with the workspace switcher (though some, like Havoc, didn't
like the idea there either), but there's also some differences: (1) the user has
to be over the window list meaning that the mouse will be over one of the tasks
which will therefore be highlighted--but while scrolling through the windows
other tasks become highlighted.  So we kind of have this dual highlighting thing
going on that seems weird to me.  (2) Users have much more difficulty
associating an order with windows than they do with workspaces (We have a number
of bugs about this), and (3) scrolling through grouped tasks (as mentioned
above) doesn't seem to make sense.
Comment 15 Xavier Claessens 2005-07-17 16:14:56 UTC
answers for each paragraphs:

1) yes

2) it works but it's not usefull because it doesn't scroll in the same order
than what we see in the panel... i'll see if it's possible to take care of the
group order.

3) my patch doesn't warp neither ;-)

4) that is easy to solve with wnck_screen_get_previously_active_window() I
think... i'll take a look at that

5) Vincent said me that he doesn't know if it's possible to do that thing in
gnome-pannel...

6) Since it's possible for workspace I always try it with tasks, it's intuitive
for me, but maybe not for anyone else ? (1) there is 2 different highlight:
simply color change when mouse is over the button and when the task is active
the button is pushed down. I'm using this patch since i've wrote it and never I
got confused... (2) it's simply easyer to switch to next task by scrolling. but
ok, it's not THE KILLER FEACTURE.
Comment 16 Elijah Newren 2005-07-17 16:34:34 UTC
3) Oh, right--I just had one of those windows that triggers bug 310381 near each
edge of my tasklist so I probably confused the wraparound thing.  :)

5) Ah, ok.

6) Well, I won't block it.  Just thought I'd mention it because any patch for a
feature like this needs to be approved by at least one other maintainer and if
we've covered the bases on issues it makes their job easier.  I agree that (1)
and (2) are minor issues and I'm not sure what I think about (3) but you're
looking into it anyway.
Comment 17 Xavier Claessens 2005-07-22 16:20:36 UTC
Created attachment 49577 [details] [review]
follow the on-screen order and takes care of groups

Ok so here I create «tasklist::windows_sorted» list, witch is the same as
«tasklist::windows» but with respect of the on-panel order (groups before and
then ungrouped tasks). Then when scrolling it is very simple, just get the next
or prev element in the list.

is it ok ?
Comment 18 Xavier Claessens 2005-07-25 14:04:04 UTC
Created attachment 49716 [details] [review]
maybe better ?

Don't build a second list of windows, but replace tasklist::windows by the
sorted one.
Comment 19 Vincent Untz 2005-08-15 15:47:40 UTC
Comment on attachment 49716 [details] [review]
maybe better ?

Just some random comments. Don't take this as a full review :-)

>+      /* Build sorted windows list */
>+      if (g_list_length(task->windows) > 1)
>+        windows_sorted = g_list_concat(windows_sorted,
>+                                       g_list_copy(task->windows));
>+      else
>+        windows_sorted = g_list_append(windows_sorted, task);
>+

You need to add some spaces here, e.g.:
if (g_list_length (task->windows) > 1)

>+static gboolean
>+wnck_tasklist_scroll_cb (WnckTasklist *tasklist,
>+                         GdkEventScroll *event,
>+                         gpointer user_data)
>+{
>+  GList *window;
>+
>+  window = g_list_find(tasklist->priv->windows,
>+                       tasklist->priv->active_task);
>+    
>+  switch (event->direction)
>+    {
>+      case GDK_SCROLL_UP:
>+      case GDK_SCROLL_RIGHT:
>+        if (!window)
>+          window = g_list_last(tasklist->priv->windows);
>+        else
>+          window = window->prev;
>+      break;
>+      
>+      case GDK_SCROLL_DOWN:
>+      case GDK_SCROLL_LEFT:
>+        if (!window)
>+          window = tasklist->priv->windows;
>+        else
>+          window = window->next;
>+      break;
>+    }

Does it do the right thing if I have a tasklist with 4 lines and 3 columns? I'd
expect the left scroll to go left and the up scroll to go up :-)
Comment 20 Xavier Claessens 2005-08-18 14:30:29 UTC
How can I know howmany columns there are ? I think it's impossible (or very
difficult).
Comment 21 Xavier Claessens 2005-08-18 19:11:05 UTC
Created attachment 50944 [details] [review]
works scroll right/left change colomn, up/down change row

ok, this patch do its job.

add tasklist::n_rows. Scroll right/left switch the colomn.
Comment 22 Nigel Tao 2005-10-23 00:07:03 UTC
I wanted this feature, and somewhat foolishly cooked up my own patch BEFORE
searching bugzilla.

For the record, I've attached my patch, which is for gnome-panel
(applets/wncklet) rather than libwnck (since the existing
scroll-changes-workspace behavior is in gnome-panel rather than libwnck,
although libwnck is probably more appropriate).  This does mean that it uses the
libwnck public API rather than its internals.

Also, it patches the window selector menu AS WELL AS the window list.  I've got
the menu in one of Fitt's corners which makes it easy to switch active windows
using only the mouse.

Now that we are past 2.12's feature freeze - what would it take to get accepted?
Comment 23 Nigel Tao 2005-10-23 00:08:59 UTC
Created attachment 53780 [details] [review]
gnome-panel/applets/wncklet patch
Comment 24 Xavier Claessens 2005-10-28 23:58:48 UTC
Created attachment 54024 [details] [review]
yet another patch

I think your patch doesn't take care of grouped tasks and doesn't seperate
up/left, down/right.

My last patch was buggy with right/left if there is grouped windows. After
testings I think every goes fine with this attached patch.
Comment 25 Xavier Claessens 2005-11-20 15:46:06 UTC
Created attachment 54974 [details] [review]
getting better and better

Damn previous patch wasn't yet perfect. This last patch fixes a segfault
(startup tasks shouldn't be in windows list) and a bug when scrolling too fast.


Any comments ?
Comment 26 Xavier Claessens 2005-11-20 17:35:09 UTC
Created attachment 54978 [details] [review]
revised by vuntz

Same thing but with modifications recommended by vuntz.
Comment 27 Xavier Claessens 2005-11-20 17:48:13 UTC
Created attachment 54979 [details] [review]
better comments
Comment 28 Vincent Untz 2005-11-20 20:31:29 UTC
Patch looks okay to me, but I'd love to see a small comment from Elijah, Havoc
or Mark :-)
Comment 29 Elijah Newren 2005-11-25 22:24:23 UTC
Heh, so, after writing a test program it turns out that since Metacity sucks and
doesn't support group modal windows that libwnck's similar sucking doesn't
happen to hurt this bug.  Bug 310381 is already being left open for the
libwnck's lack-of-group-modal-support (and it needs to be fixed when Metacity
and gtk+ are fixed anyway), so that drops that objection I had to the patch.

So, since Vincent is okay with it, go ahead and commit.
Comment 30 Vincent Untz 2005-12-04 10:03:05 UTC
2005-12-04  Vincent Untz  <vuntz@gnome.org>

        Add scrolling support to the tasklist. Patch by Xavier Claessens
        <x_claessens@skynet.be>. Fix bug #309956.

        * libwnck/tasklist.c: (wnck_tasklist_size_allocate): recreate the list
        of windows here, but have it sorted
        (wnck_tasklist_scroll_cb): new
        (wnck_tasklist_new): connect to scroll-event
        (wnck_task_compare): add a comment here about the fact that the
        windows sort used for scrolling depends on the position of the
        sequences in the sort