Re: libgnomeui geometry parsing problem



Malcolm Tredinnick <malcolm commsecure com au> writes:

> I just sent the message below to Miguel, but it occurs to me that you
> might be a more appropriate person to ask the questions of, especially
> for Gnome 2.0.

Hi,

well, the correct list for this is gnome-libs-devel gnome org 

------------------------------------------------------------------------

> It looks like the gnome_parse_geometry() function in
> gnome-libs/libgnomeui/gnome-geometry.c is broken (and it hasn't changed
> in the libgnomeui module for Gnome 2.0 either).
> 
> Basically, there is no way, using this function to tell the difference
> between a geometry string of "+1000+0" and "-24+0" for a screenwidth of
> 1024 pixels, for example.
> 
> The problem is that, according to the X manpage, the first one sets the
> lefthand edge to be 1000 pixels in from the left, whereas the latter
> sets the righthand edge to be 24 pixels in from the right. Since
> gnome_parse_geometry() only returns a TRUE/FALSE boolean, applications
> can't tell whether the xpos and ypos values that are filled in refer to
> the left or right edges.
> 
> There are two solutions to this, that I can see:
> 
> (1) Modify gnome_parse_geometry to return either FALSE (i.e. invalid
> geometry string), or the result of ORing together various flags, as is
> done by the XParseGeometry function.
> 
> (2) Just use XParseGeometry. Why isn't this being done at the moment?
> Other things in libgnomeui use X functions directly, so there's no
> seperation from the graphics system going on there.

Well, using XParseGeometry inside libgnomeui code is ok, but let's not start
using it directly in any applications. This makes porting these application
to other windowing systems (Mac OS X comes into my mind) much harder.

So there is a reason to keep the gnome_parse_geometry() function - however,
of course we should fix / improve it for GNOME 2.0.

I haven't looked at this yet, but I think gnome_parse_geometry() should use
XParseGeometry internally, but with an API which is not tied to the X server
so that we can also implement this function for other windowing systems.

Comments welcome ....

> In either case, I can prepare an appropriate patch. Changing the return
> value of gnome_parse_geometry() might be dangerous on the stable branch
> (but it might not be, if people just check for FALSE -- only things
> tests against TRUE will fail). But can we at least do something for
> Gnome 2?
> 
> I don't think we can reasonably hope that people will adjust their
> expectations of how a geometry argument works just for Gnome, when other
> X applications work differently (and are documented to do so).

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




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