Patch for Bug 4964 (WM_SIZE message not sent at maximization)

Juris Smotrovs juris.smotrovs at sets.lv
Wed May 3 11:18:40 CDT 2006


Hi!

The problem is that Wine does not send WM_SIZE message
if the window has been maximized, but its (non-client area)
rectangle size in pixels has remained the same.
Wine looks only for rectangle size, but it should also send
WM_SIZE at state changes between "maximized", "minimized",
"restored", regardless of size changes (see WM_SIZE description
at e.g. MSDN).

The problem lies in correctly setting the
flags SWP_NOSIZE and SWP_NOCLIENTSIZE. A careful examination of these and
related tests showed that:
1) these flags should be set when the size in pixels of the corresponding
rectangles has changed (already implemented in Wine),
2) they should be set also when size in pixels has not changed, but window has
changed state between "maximized", "minimized" and "restored" (see description
of WM_SIZE; currently NOT implemented in Wine),
3) they should *not* be set when maximize, minimize or restore command is
issued on a window which is already, respectively, maximized, minimized or
restored.
Unfortunately, the information enabling to distinguish between 2) and 3) (i.e.
SW_... command	flags plus the current state of window) is available only in
X11DRV_ShowWindow(), but is already lost inside X11DRV_SetWindowPos() which is
actually responsible for setting the SWP_NOSIZE, SWP_NOCLIENTSIZE flags and is
called from X11DRV_ShowWindow().

Thus, for the current implementation of these functions, some way is needed to
pass the necessary data from X11DRV_ShowWindow() to X11DRV_SetWindowPos(). I
did not dare to change the interfaces, i.e. to add new flags to window
structures or parameters to these important functions. I suppose, it is rather
a prerogative of the people directly responsible for x11drv.

Therefore I offer this patch which uses an already existing flag WIN_NEED_SIZE
in a way not conflicting with its current usage, though, to achieve that, the
patch is a bit clumsy.

This patch solves the first Bug 4964 testcase problem, and
considerably improves behaviour of Wine on the second (dlls/user/tests/msg.c)
testcase (submitted earlier to this list), also making one existing todo
testcase to succeed:
msg.c:3230: Test succeeded inside todo block: ShowWindow(SW_HIDE):overlapped:
marked "todo_wine" but succeeds

If this patch is not accepted as it is, I hope, it enables you to solve this
issue without much effort -- knowing which interface changes one can afford
here (e.g. adding a new flag similar to WIN_NEED_SIZE which would make the
correction less clumsy).

Best regards,
Juris

Changelog:

Juris Smotrovs <juris.smotrovs at sets.lv>

WM_SIZE message is sent at maximization, minimization, restoration
of window, also when the rectangle size has not changed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch2.diff
Type: text/x-patch
Size: 3719 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060503/d08af5e0/patch2-0001.diff


More information about the wine-patches mailing list