[patch] Re: xftaskbar4 doesn't listen to removal of _NET_WM_STATE_SKIP_TASKBAR?

Brian J. Tarricone bjt23 at cornell.edu
Thu Oct 28 09:47:24 CEST 2004


Olivier Fourdan wrote:

>So it's a problem with the netk-pager (ie wnck pager since it's the same
>code base) - You should check that code, it's probably missing a refresh
>of the widget somewhere when the property is changed.
>  
>
ok, this is bizarre.  here's what's supposed to happen, from my reading 
of the code and adding some printf()s:

1) i call gtk_window_set_skip_taskbar_hint(window, TRUE);
2) NetkWindow notices a property change
3) NetkWindow updates its internal info, sees it's a _NET_WM_STATE 
change, and emits the 'state-changed' signal.
4) NetkTasklist receives the 'state-changed' signal, and checks to see 
which _NET_WM_STATE atom has changed
5) NetkTasklist updates its display based on what has changed

now, on the first call (as in #1), this all works properly.  on the 
second call (passing FALSE instead), we don't get past #3.  NetkWindow 
emits the signal, but NetkTasklist never gets it at all.  if i further 
toggle the button and change the state, NetkTasklist still doesn't get 
the signal, despite the fact that my print statements in netk-window.c 
say that it's definitely emitting them.

ok, i think i see why.  after the first run through, when we set 
_NET_WM_STATE_SKIP_TASKBAR, NetkTasklist calls 
netk_tasklist_update_lists() to update its internal list of 
NetkWindows.  first it ditches the entire list it already has, and then 
it rebuilds it using netk_screen_get_windows().  however, after getting 
this list, it filters it, NOT including any windows that fail 
netk_tasklist_include_window(), which, of course, our window fails this 
function, because its SKIP_TASKBAR hint is set.  and so, NetkTasklist 
stops looking at this window at all, and will never, ever, ever see any 
state changes for this window again (well, ok, it will if you change 
workspaces after unsetting the SKIP_TASKBAR hint).

ok, so after messing with this for a while, and making it crash a lot, i 
have a solution, albeit not the best one.  the NetkTask structures (and 
the GList that holds them) are very much tied to the button widget 
itself, and trying to add a NetkTask structure to the list while 
destroying or otherwise hiding the button doesn't work (either the 
taskbar crashes if the button isn't there, or the button placement is 
all messed up if you try to hide them).  the logic for laying out the 
buttons in the tasklist is quite complex, and i don't think it's worth 
modifying that for such a trivial broken feature.

with that in mind, i added another GList to the NetkTasklist struct, 
that keeps track of hidden_windows.  these aren't shown or added to the 
tasklist at all, and are simply there for the signal connections.  
attached is a patch; let me know what you think.

    -brian

>Cheers,
>Olivier.
>
>On Wed, 2004-10-27 at 22:01 -0700, Brian J. Tarricone wrote:
>  
>
>>hmm, i'm writing that systray icon for xfmedia that jasper suggested, 
>>and i noticed that if i use gtk_window_set_skip_taskbar_hint(), passing 
>>it TRUE, the window disappears from the taskbar, as it should.  but if i 
>>later call it again and pass it FALSE, the taskbar doesn't show a button 
>>for the window again.  i've checked with xprop, and the property is 
>>indeed being removed.
>>
>>i've attached a quick testcase that illustrates the problem.  any 
>>ideas?  am i doing something wrong?
>>
>>    -brian
>>plain text document attachment (tststh.c)
>>/* compile with:
>> * gcc -o tststh tststh.c `pkg-config gtk+-2.0 --cflags --libs`
>> */
>>
>>#include <gtk/gtk.h>
>>
>>static void
>>btn_toggle_cb(GtkToggleButton *tb, GtkWindow *win)
>>{
>>	gtk_window_set_skip_taskbar_hint(win, gtk_toggle_button_get_active(tb));
>>}
>>
>>int
>>main(int argc, char **argv)
>>{
>>	GtkWidget *win, *btn;
>>
>>	gtk_init(&argc, &argv);
>>
>>	win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>>	gtk_window_set_default_size(GTK_WINDOW(win), 50, 50);
>>	gtk_container_set_border_width(GTK_CONTAINER(win), 12);
>>	g_signal_connect(G_OBJECT(win), "delete-event",
>>			G_CALLBACK(gtk_main_quit), NULL);
>>
>>	btn = gtk_toggle_button_new_with_label("Toggle hint");
>>	gtk_widget_show(btn);
>>	gtk_container_add(GTK_CONTAINER(win), btn);
>>	g_signal_connect(G_OBJECT(btn), "toggled",
>>			G_CALLBACK(btn_toggle_cb), win);
>>
>>	gtk_widget_show(win);
>>
>>	gtk_main();
>>
>>	return 0;
>>}
>>_______________________________________________
>>Xfce4-dev mailing list
>>Xfce4-dev at xfce.org
>>http://lunar-linux.org/mailman/listinfo/xfce4-dev
>>    
>>
>
>_______________________________________________
>Xfce4-dev mailing list
>Xfce4-dev at xfce.org
>http://lunar-linux.org/mailman/listinfo/xfce4-dev
>  
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-tasklist-skip-taskbar-hint.diff
Type: text/x-patch
Size: 3720 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20041028/cd7c1d04/attachment.bin>


More information about the Xfce4-dev mailing list