x11drv: Allow WM to manage more windows.

Vitaliy Margolen wine-patch at kievinfo.com
Fri Jan 13 13:15:52 CST 2006


For this I'm checking for menus that should not be managed ATM. We probably
need to use _NET_WM_WINDOW_TYPE_MENU instead. Unfortunately we have some other
problems with this - whole menu disappears when I'm going to the second
level menu.

Also WM_CAPTION doesn't necessarily means window title. For example lots of
tool-tips are STATIC class windows with that flag set.

This patch has been tested on several programs (Steam, Delphi5, ACDSee) in
several window managers (KDE, Gnome, Xfce4, iceWM). So far the only problem is
windows that being created as managed, and then changed style after creation to
qualify as unmanaged (Steam's tool-tips). This is completely different problem
however.

ChangeLog:
x11drv: Allow WM to manage more windows.

 dlls/x11drv/window.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)
-------------- next part --------------
0d932577acfaf7885593aee13a2ed344499f0c2f
diff --git a/dlls/x11drv/window.c b/dlls/x11drv/window.c
index 8eca46e..a795603 100644
--- a/dlls/x11drv/window.c
+++ b/dlls/x11drv/window.c
@@ -67,6 +67,8 @@ static const char visual_id_prop[]    = 
 inline static BOOL is_window_managed( HWND hwnd )
 {
     DWORD style, ex_style;
+    char class_name[7];
+    static const char menu_class[] = "#32768";
 
     if (!managed_mode) return FALSE;
     /* tray window is always managed */
@@ -75,14 +77,6 @@ inline static BOOL is_window_managed( HW
     /* child windows are not managed */
     style = GetWindowLongW( hwnd, GWL_STYLE );
     if (style & WS_CHILD) return FALSE;
-    /* windows with caption are managed */
-    if ((style & WS_CAPTION) == WS_CAPTION) return TRUE;
-    /* tool windows are not managed  */
-    if (ex_style & WS_EX_TOOLWINDOW) return FALSE;
-    /* windows with thick frame are managed */
-    if (style & WS_THICKFRAME) return TRUE;
-    /* application windows are managed */
-    if (ex_style & WS_EX_APPWINDOW) return TRUE;
     /* full-screen popup windows are managed */
     if (style & WS_POPUP)
     {
@@ -91,8 +85,15 @@ inline static BOOL is_window_managed( HW
         if ((rect.right - rect.left) == screen_width && (rect.bottom - rect.top) == screen_height)
             return TRUE;
     }
-    /* default: not managed */
-    return FALSE;
+    /* popups without sysmenu are not managed */
+    if (style & WS_POPUP && !(style & WS_SYSMENU)) return FALSE;
+    /* menu windows are not managed */
+    if (GetClassNameA(hwnd, class_name, sizeof(class_name)) &&
+        !memcmp(class_name, menu_class, sizeof(menu_class)))
+        return FALSE;
+
+    /* default: managed */
+    return TRUE;
 }
 
 


More information about the wine-patches mailing list