Bug#276734: GDK icon window trouble
Loïc Minier
Loïc Minier ,
276734@bugs.debian.org
Sat, 16 Oct 2004 02:39:04 +0200
--llIrKcgUOe3dCx0c
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Lo=EFc Minier <lool@dooz.org> - Sat, Oct 16, 2004:
> Attached is my modified file
Here it is, sorry.
--=20
Lo=EFc Minier <lool@dooz.org>
--llIrKcgUOe3dCx0c
Content-Type: text/x-csrc; charset=us-ascii
Content-Disposition: attachment; filename="gdk.c"
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <X11/Xutil.h>
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);
}
--llIrKcgUOe3dCx0c--