Re: [dwm] applyrules

From: Filippo Erik Negroni <>
Date: Fri, 29 Aug 2008 10:54:53 +0100

2008/8/29 Anselm R Garbe <>

> > ch is also initialised to {0}, which, I believe, is reduntant if
> > XGetClassHint is successful.
> Well, I think we should keep this and also the checks for res_class
> and res_name, since it is not mandatory to set both or any of these
> WM_CLASS properties. If seen some apps during the last 6 years of X
> work, which are broken in this way.
Isn't WM_CLASS a string property? In particular, composed of two null
terminated strings?
When setting WM_CLASS using XSetClassHint, passing two NULL pointers will
result in some default strings to be used by the implementation.
I would suspect that, if an implementation fails to return an empty WM_CLASS
property as two null terminated strings (even if empty), then I would wrap
that check in an assert.
But I understand in practice that it is possible for WM_CLASS to be returned
as a structure of two NULL pointers and a WM should be able to cope with it.

> The global static variable dc is initialised to {0}, which is redundant,
> > being a static.
> Is this defined somewhere?

Variables of static storage duration have value 0 by default.

Infact, the reason why you can use ={0} to initialise structure variables
appropriately is that the standard says that when using ={0}, the first
member of the structure will be initialised to 0, and all the other members
will be initialised as if they had been initialised in a static context.

[] If there are fewer initializers in a brace-enclosed list than
there are elements or members of an aggregate, or fewer characters in a
string literal used to initialize an array of known size than there are
elements in the array, the remainder of the aggregate shall be initialized
implicitly the same as objects that have static storage duration.

Received on Fri Aug 29 2008 - 09:54:53 UTC

This archive was generated by hypermail 2.2.0 : Fri Aug 29 2008 - 10:00:04 UTC