Hi all,

yesterday I tinkered a bit with various parts of Wine at home in the evening,
and I found one strange thing (or at least I don't understand it):

in DIALOG_CreateIndirect():

        if ( !(template.style & WS_CHILD) )
        {
            INT16 dX, dY;

            if( !(template.style & DS_ABSALIGN) )
                ClientToScreen( owner, (POINT *)&rect );

            /* try to fit it into the desktop */

            if( (dX = rect.left + rect.right + GetSystemMetrics(SM_CXDLGFRAME)
                 - GetSystemMetrics(SM_CXSCREEN)) > 0 ) rect.left -= dX;
            if( (dY = rect.top + rect.bottom + GetSystemMetrics(SM_CYDLGFRAME)
                 - GetSystemMetrics(SM_CYSCREEN)) > 0 ) rect.top -= dY;
            if( rect.left < 0 ) rect.left = 0;
            if( rect.top < 0 ) rect.top = 0;
        }

Why do we use ClientToScreen() here ?
Isn't it supposed to shift a rectangle (the window coordinates as a whole),
NOT a point structure (only "starting" points of window) here ?

I get values equivalent to
trace:dialog:DIALOG_CreateIndirect -3, 336, -22, 235
trace:dialog:DIALOG_CreateIndirect 226, 336, 166, 235
before replacing ClientToScreen
with MapWindowPoints(owner, 0, (POINT *)&rect, 2 ); and
trace:dialog:DIALOG_CreateIndirect -3, 336, -22, 235
trace:dialog:DIALOG_CreateIndirect 226, 565, 166, 423
after it.

And after we do that conversion we fiddle with all four of
rect.left,right,top,bottom, so we should really use MapWindowPoints(), right ?

Anybody care to enlighten me ?

Andreas Mohr

Reply via email to