Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Julien Danjou <julien <at> danjou.info>
Subject: Re: [PATCH] Error out when creating a simplewindow with invalid geometries
Newsgroups: gmane.comp.window-managers.awesome.devel
Date: Tuesday 17th March 2009 16:13:06 UTC (over 8 years ago)
At 1237305418 time_t, Uli Schlachter wrote:
> +    if (MIN(geometry.width, geometry.height) <= 2 * border_width)

You should store the MIN() value since you use it later. :-)

> +    {
> +        /* The border_width is so big that there would be no space left
in the
> +         * window. This now adjusts border_width so that there is at
least 1px
> +         * space inside the window, except when we were already called
with a
> +         * width/height of 0, in which case this will likely lead to a X
> +         * protocol error.
> +         */
> +        border_width = MIN(geometry.width, geometry.height) / 2;
> +        if (border_width > 0)
> +            border_width--;
> +        fprintf(stderr, "error: Attempted to create a window with too
large
> border_width / too small size\n");

I don't like that, and you should use warn().

I'd sugget to rather change the behaviour of the geometry: 
-     sw->geometries.internal.width = geometry.width - 2*border_width; 
-     sw->geometries.internal.height = geometry.height - 2*border_width; 
+     sw->geometries.internal.width = geometry.width;
+     sw->geometries.internal.height = geometry.height;

Which should avoid any error and probably clarify things. 
What do you think guys?

Cheers,
-- 
Julien Danjou
// ᐰ <[email protected]>   http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
// My root password is
 
CD: 3ms