x11drv: Fix the special case where windows have WS_CHILD and WS_POPUP.

Peter Dons Tychsen donpedro at tdcadsl.dk
Tue Jul 24 21:19:10 CDT 2007

Hello Wine team!

Weeeee this one took me many hours to lock down....

This patch fixes an oddity which happens when some application choose to
create windows which have the WS_CHILD and WS_POPUP style set. It is not
allowed according to MS, but some apps do it anyway. The POPUP should
overrule the CHILD style, makeing it a Window manager window.

This clears the way for the "Company of Heroes" patch installers to
work, making it possible to play this game with Wine. Now it just needs
some D3D fixes :-)

>From 1d731e4d961d28029f160aed8da9aa16e4c04a32 Mon Sep 17 00:00:00 2001
From: Peter Dons Tychsen <donpedro at tdcadsl.dk>
Date: Wed, 25 Jul 2007 04:09:50 +0200
Subject: [PATCH] This patch fixes the special case where windows have
WS_CHILD and WS_POPUP. According to MSDN this is not valid, but some
apps do it anyway. This patch makes sure these windows are treated as
top-level windows which the window manager should handle. This fixes the
"Company of Heroes" installer which does this.

 dlls/winex11.drv/window.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index be5d114..5cc35fa 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -76,7 +76,7 @@ static inline BOOL is_window_managed( HWND hwnd )
     if (ex_style & WS_EX_TRAYWINDOW) return TRUE;
     /* child windows are not managed */
     style = GetWindowLongW( hwnd, GWL_STYLE );
-    if (style & WS_CHILD) return FALSE;
+    if ((style & WS_CHILD) && !(style & WS_POPUP)) return FALSE;
     /* windows with caption are managed */
     if ((style & WS_CAPTION) == WS_CAPTION) return TRUE;
     /* tool windows are not managed  */

More information about the wine-patches mailing list