Why X protocol/server forbid zero width/height?
Dmitry Yu. Bolkhovityanov
D.Yu.Bolkhovityanov at inp.nsk.su
Wed Nov 23 04:28:44 PST 2005
On Wed, 23 Nov 2005, Russell Shaw wrote:
> Jim Gettys wrote:
>> I have no clue; I certainly don't remember any reason for this in the
>> dusty attic of my brain. - Jim
>> b
>>
>> On Wed, 2005-11-23 at 11:35 +0600, Dmitry Yu. Bolkhovityanov wrote:
>>
>>> Hi!
>>>
>>> As specs say, and as practice confirms, attempt to set XWindow's
>>> width and/or height to 0 results in BadValue error.
>>>
>>> BUT: why such a design decision was made (19 years ago?)?
>>>
>>> Zero width and/or height seem to be a natural concept (so that
>>> windows can exist and be "invisible" when they have no content -- this is
>>> particularly useful for container windows). And forbidding zero size
>>> creates a "hole" in "size space", so that all widgets have to avoid zero
>>> size, including unnatural code like "if (width==0) width=1".
>>>
>>> Googling through Usenet gave no answer to this question.
>>>
>>> P.S. Of course, now this can't be changed -- but the reasons of that
>>> decision are of interest for better understanding of X ideology.
>
> It should be able to be changed if you do your own extension. I'm going
> to fix lots of things for my own uses.
Well, in this case -- no. The check is hardcoded in
xc/programs/Xserver/dix/window.c::ConfigureWindow(), lines 2236-2240:
if (!w || !h)
{
client->errorValue = 0;
return BadValue;
}
What I'm curious about is -- why? Why is that check at all there?
_________________________________________
Dmitry Yu. Bolkhovityanov
The Budker Institute of Nuclear Physics
Novosibirsk, Russia
More information about the xorg
mailing list