Setting some windows relations.

Vincent Povirk madewokherd at
Thu Nov 19 13:42:50 CST 2015

> The first is the setting of the owner window for the modal dialogs. In Windows it is common practice
> to set it through SetWindowLong with GWL_HWNDPARENT and it works - the owner window stay always under the .
> In WINE, setting the owner this way does not work. The owner window can be raised above the modal dialog.
> On the other hand, setting the hWndParent in CreateWindowEx works as intended.

>From inspecting the code (and not doing any actual debugging), I think
the issue here is that user32 doesn't notify the X11 driver when the
window owner changes. You might be able to force the X11 driver to
refresh this information by setting an icon on the window.

> The second problem is with the windows that have to change from WS_POPUP to WS_OVERLAPPED and back by the
> same SetWindowLong.
> When I create a window as WS_OVERLAPPED and then change the style to WS_POPUP, the window looks like WS_POPUP,
> but does not behave as such. For example in Linux it has override_redirect=0, steals the focus from the main window, etc.
> When the window is created initially with WS_POPUP, nothing of this happens.
> Again in Windows, changing the style by SetWindowLong works as intended.

We have a mechanism for changing an override_redirect window to
non-override_redirect, but I don't see anything for the other
direction. You might be able to work around this by setting the
window's parent (using SetParent) to something other than the desktop,
then setting the parent back to the desktop (which should mean
destroying the X11 window and recreating it).

I'd suggest using a virtual desktop for testing, but I know at the
moment this has z-order problems as well. While user32 has an internal
notion of z-order that should be consistent with real windows, that's
not 1:1 with what's in virtual desktops or X11. (In the Mac driver, it
is 1:1, but I know that's not any help. I don't know any good reason
we couldn't change this in virtual desktops at least.)

More information about the wine-devel mailing list