[Lazarus] window classes according to WM

Andrew Haines AndrewD207 at aol.com
Tue Sep 13 04:23:56 CEST 2011


On 09/12/11 21:59, David Emerson wrote:
> Hi all,
> 
> What is the property that determines the window class, as seen by the WM / xorg?
> 
> I'm asking for the purpose of grouping: I'd like to be able to have distinct 
> groups of windows that the WM will group independently of one another.
> 
> As an example, looking at the easter/holydays example, if I use KDE3's edit 
> window-specific settings dialog I can detect window properties. It shows me
> 
> Class: Holyday (holyday Holyday)
> 
> and some other stuff. My assumption is that the class is used by the WM to 
> determine which windows are grouped together.
> 
> The real reason I'm asking is that in fpgui, the class is undefined and I'd like 
> to find out how it's done in lazarus, where it IS defined.
> 
> Cheers,
> David.
> 
>
Lazarus uses other toolkits in linux (gtk, qt) which set these hints
already. So no special steps are done with lazarus to set the windows
class. The toolkit does it for us.

You can set the class on a window using the Xlib function XAllocClassHint

Here's the manual page for this function
http://www.xfree86.org/current/XAllocClassHint.3.html

see especially
http://www.xfree86.org/current/XAllocClassHint.3.html#toc5

The first param is the program name and the second is the class name you
want.

Lastly here's a c example of it's use
http://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkwindow-x11.c#n834


You have to set the class just after the XWindow is created and before
it is shown.

Regards,

Andrew

PS I found all this searching google for: x11 window class grouping




More information about the Lazarus mailing list