On Thu, 04 Apr 2013, Iain Patterson escribió:

> Quoth Daniel Déchelotte,
> 
> >How does it compare to
> >int wScreenKeepInside(WScreen * scr, int *x, int *y, int width, int height)
> >found in screen.c?
> 
>   The new function calls:
> 
> >>>> +        WMRect rect = wGetRectForHead(scr,
> >>>> wGetHeadForPointerLocation(scr));
> 
>   That will find an area the size of the head containing the mouse
> pointer.
> 
>   wScreenKeepInside() calls:
> 
>       head = wGetHeadForRect(scr, rect);
>       rect = wGetRectForHead(scr, head);
> 
>   That will find an area the size of the head containing the largest
> portion of the x/y/width/height arguments.
> 
>   In a multi-head setup the two areas may not be the same.  Think
> pointer at the right edge of the leftmost head.

I will print this mail and put in my wall. Is a very good.

We should include this documentation in the code, to understand what is 
happening in some places. We should include other functions, or rename these, 
to have a better position management.

I added Christophe to this mail, because IMO this is the problem with their 
screens. The menu uses wGetRectForHead(), but Docks uses a different function.

Finally:

kix@kentin:~/src/wmaker/git/wmaker-crm/src$ grep wGetHeadForPointerLocation *.c 
| wc
     23     113    1691
kix@kentin:~/src/wmaker/git/wmaker-crm/src$ grep wGetHeadForPoint *.c | wc
     28     144    2030
kix@kentin:~/src/wmaker/git/wmaker-crm/src$ grep wGetHeadForWindow *.c | wc
     27     124    1704
kix@kentin:~/src/wmaker/git/wmaker-crm/src$ grep wGetHeadForRect *.c | wc
      7      36     403
kix@kentin:~/src/wmaker/git/wmaker-crm/src$ grep wGetRectForHead *.c | wc
     41     225    2582
kix@kentin:~/src/wmaker/git/wmaker-crm/src$

All these functions are used in code to place the icons, menus,... in the 
screen or similar. I think is better  have an small functions like 
"get_screen_position (&x, &y, ...)" and use these functions in all places. This 
will avoid problems, like now, about why the menu position is right, and the 
icon is wrong,... To get something painted in the screen we need:

1. Start position (x,y)
2. Size (width, lenght)

And then, it returns the final (x, y) position. This function can be used for 
windows, for icons, for menus,... because is not oriented to an object.

kix


-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to