Bug#252203: GDK icon window trouble
Brad Jorsch
Brad Jorsch <anomie@users.sourceforge.net>, 252203@bugs.debian.org
Tue, 1 Jun 2004 22:11:29 -0400
Package: libgtk2.0-0
Version: 2.4.1-4
I've noticed that a recent update seems to have broken the
gdk_window_set_icon() function, at least as far as using the
icon_window parameter. Specifically, it doesn't seem to get around to
setting the IconWindowHint on the leader window. If i set this one hint
manually, it works as expected.
I'm not sure which version introducted this bug, but i suspect the one
that introduced the function update_wm_hints in gdk/x11/gdkwindow-x11.c.
If that's true, please forward this upstream.
The following code segment used to work and now doesn't.
static GdkWindow *get_gdk_leader(GdkWindow *win){
GdkAtom atom, type;
gint len;
guchar *data;
GdkWindow *leader=NULL;
atom=gdk_atom_intern("WM_CLIENT_LEADER", TRUE);
type=gdk_atom_intern("WINDOW", TRUE);
if(atom==GDK_NONE || type==GDK_NONE) return NULL;
if(!gdk_property_get(win, atom, type, 0, 4, FALSE, NULL, NULL, &len, &data)) return NULL;
if(len==4) leader=gdk_window_foreign_new(*(GdkNativeWindow *)data);
g_free(data);
return leader;
}
static GtkWidget *dockwin, *iconwin;
void openDockWindow(...)
GdkWindow *leader;
XWMHints hints;
if((dockwin=gtk_window_new(GTK_WINDOW_TOPLEVEL))==NULL) die("Couldn't create window");
if((iconwin=gtk_window_new(GTK_WINDOW_TOPLEVEL))==NULL) die("Couldn't create window");
gtk_widget_set_size_request(dockwin, 64, 64);
gtk_widget_set_size_request(iconwin, 64, 64);
gtk_widget_set_app_paintable(dockwin, TRUE);
gtk_widget_set_app_paintable(iconwin, TRUE);
// ... more setup here ...
gtk_widget_realize(dockwin);
gtk_widget_realize(iconwin);
// ... more setup here ...
if((leader=get_gdk_leader(dockwin->window))==NULL) die("Couldn't obtain Gdk leader window");
gdk_window_reparent(iconwin->window, leader, 0, 0);
gdk_window_set_icon(leader, iconwin->window, NULL, NULL);
// Add the following 3 lines to make it work now:
// hints.icon_window = GDK_WINDOW_XWINDOW(iconwin->window);
// hints.flags = IconWindowHint;
// XSetWMHints(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(leader), &hints);
gdk_window_unref(leader);
// ... more setup here ...
gtk_widget_show(iconwin);
gtk_widget_show(dockwin);
gdk_window_withdraw(dockwin->window);
}