can't set window class name using gtk_window_set_wmclass



 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





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