On Fri, 25 Feb 2022 11:07:49 +0530
Prathu Baronia <[email protected]> wrote:

Dear Prathu,

> - Compare the result of the macro with 0 instead of treating as bool
> to remove the following warning.

I'm not sure if the patch is correct, but maybe it would be a better
thing to go all the way and turn INTERSECT into a proper function for
better readability.

int
intersect_area(int x, int y, int width, int height, XineramaScreenInfo *info)
{
        return ((MIN(x + width,  info.x_org + info.width)  - MAX(x, 
info.x_org)) *
                (MIN(y + height, info.y_org + info.height) - MAX(y, 
info.y_org)));
}

I find this much more readable than the macro and the extended naming
makes clear that INTERSECT returns an area and not just a boolean expression.
It would need to be put in an #ifdef XINERAMA.

With best regards

Laslo

Reply via email to