Re: can't set window class name using gtk_window_set_wmclass



On Fri, 29 Dec 2000, Vlad Harchev wrote:

 Hmm, I'm sorry for my ignorance, I was completely wrong. Let me correct
myself.

* xlsclients lists clients, not windows, so gtk_window_set_wmclass has nothing
	to do with setting client's name and class name.
* Options --class and --name are only available for gnome programs (BTW, I see
	no reason not add support for these commandline options to GTK,
	though I didn't look at the code yet).

 I'm sorry for this.

 Happy New Year to all lists' subscribers.

>  Hi, 
> 
>  I can't set a window class name and window class class using
> gtk_window_set_wmclass (I check them using xlsclients -l).
> 
>  Here is the code:
> ----------------------
> #include <gtk/gtk.h>
> 
> int main(gint argc, gchar** argv)
> {
>    GtkWidget* w;
>    gtk_init(&argc,&argv);
>    w=gtk_window_new(GTK_WINDOW_TOPLEVEL);
>    gtk_window_set_wmclass(GTK_WINDOW(w),"a","A");
>    gtk_widget_show_all(w);
>    gtk_main();
>    return 0;
> }
> ---------------------
>  Compile it to the file named different from 'a' or 'A', say 'wmtest' run and
> 'xlsclient -l' in another xterm - you'll get something like
> 
> Window 0x400001:
>   Machine:  hostname
>   Command:  ./wmtest
>   Instance/Class:  wmtest/Wmtest
> 
>  While the expected output is:
> Window 0x400001:
>   Machine:  hostname
>   Command:  ./wmtest
>   Instance/Class:  a/A
> 
>  Interestingly, just copying code for setting class hints from gdkwindow.c
> doesn't help too, here is the code:
> -----------------------
> #include <gtk/gtk.h>
> #include <gdk/gdkx.h>
> #include <X11/Xlib.h>
> #include <X11/Xutil.h>
> 
> 
> int main(gint argc, gchar** argv)
> {
>    GtkWidget* w;
>    gtk_init(&argc,&argv);
>    w=gtk_window_new(GTK_WINDOW_TOPLEVEL);
>    gtk_window_set_wmclass(GTK_WINDOW(w),"a","A");
>    gtk_widget_show_all(w);
>     {
>         XClassHint* hint;
>         hint = XAllocClassHint();
>         hint->res_name = "a";
>         hint->res_class = "A";
>         XSetClassHint(GDK_DISPLAY(),GDK_WINDOW_XWINDOW(w->window),hint);
>         XFree(hint);
>     }
>    gtk_main();
>    return 0;
> }
> ----------------------
>  Produces the same output of 'xlsclients -l' (i.e. - not expected).
> 
>  Also, using --class and --name command line args that any gtk program
> understands gives no results (classname/name don't change in the output of
> 'xlsclients -l').
> 
>  I've tried these programs without window manager at all - doesn't help at
> all.
> 
>  Does any X guru out there knows what's happening or at least how to
> [reliably] set window class name using XLib?
> 
>  Thanks.
> 
>  Best regards,
>   -Vlad
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 

 Best regards,
  -Vlad





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]