Decorationless managed windows again

Ove Kaaven ovehk at ping.uio.no
Sun Jan 20 15:16:22 CST 2002


The logic in this patch is now somewhat revised according to Alexandre's
comments. I did not make this configurable, though, thinking that if the
user's WM really is too old to support them, then he probably wouldn't
mind getting more top-level windows managed anyway...

Log:
Ove Kaaven <ovek at transgaming.com>
In managed mode, always manage overlapped windows and popup windows that
are children of the desktop, irrespective of their decorations. Use MWM
hints to remove the window manager decorations from such windows if
necessary (like XMMS does).

Index: wine/dlls/x11drv/mwm.h
diff -u /dev/null wine/dlls/x11drv/mwm.h:1.2
--- /dev/null	Sun Jan 20 12:37:42 2002
+++ wine/dlls/x11drv/mwm.h	Fri Nov 23 13:28:23 2001
@@ -0,0 +1,65 @@
+/*
+ * Motif Window Manager definitions
+ *
+ * Copyright 2001 Ove Kåven, TransGaming Technologies Inc.
+ * (these definitions were found in GTK+ 1.2, gdk/MwmUtil.h)
+ */
+#ifndef __WINE_MWM_H
+#define __WINE_MWM_H
+
+typedef struct {
+  unsigned long flags;
+  unsigned long functions;
+  unsigned long decorations;
+  long input_mode;
+  unsigned long status;
+} MotifWmHints, MwmHints;
+
+#define MWM_HINTS_FUNCTIONS   1
+#define MWM_HINTS_DECORATIONS 2
+#define MWM_HINTS_INPUT_MODE  4
+#define MWM_HINTS_STATUS      8
+
+#define MWM_FUNC_ALL          0x01
+#define MWM_FUNC_RESIZE       0x02
+#define MWM_FUNC_MOVE         0x04
+#define MWM_FUNC_MINIMIZE     0x08
+#define MWM_FUNC_MAXIMIZE     0x10
+#define MWM_FUNC_CLOSE        0x20
+
+#define MWM_DECOR_ALL         0x01
+#define MWM_DECOR_BORDER      0x02
+#define MWM_DECOR_RESIZEH     0x04
+#define MWM_DECOR_TITLE       0x08
+#define MWM_DECOR_MENU        0x10
+#define MWM_DECOR_MINIMIZE    0x20
+#define MWM_DECOR_MAXIMIZE    0x40
+
+#define MWM_INPUT_MODELESS                  0
+#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
+#define MWM_INPUT_SYSTEM_MODAL              2
+#define MWM_INPUT_FULL_APPLICATION_MODAL    3
+#define MWM_INPUT_APPLICATION_MODAL         1
+
+#define MWM_TEAROFF_WINDOW 1
+
+typedef struct {
+  long flags;
+  Window wm_window;
+} MotifWmInfo, MwmInfo;
+
+#define MWM_INFO_STARTUP_STANDARD 1
+#define MWM_INFO_STARTUP_CUSTOM   2
+
+#define _XA_MOTIF_WM_HINTS    "_MOTIF_WM_HINTS"
+#define _XA_MOTIF_WM_MESSAGES "_MOTIF_WM_MESSAGES"
+#define _XA_MOTIF_WM_OFFSET   "_MOTIF_WM_OFFSET"
+#define _XA_MOTIF_WM_MENU     "_MOTIF_WM_MENU"
+#define _XA_MOTIF_WM_INFO     "_MOTIF_WM_INFO"
+
+#define _XA_MWM_HINTS    _XA_MOTIF_WM_HINTS
+#define _XA_MWM_MESSAGES _XA_MOTIF_WM_MESSAGES
+#define _XA_MWM_MENU     _XA_MOTIF_WM_MENU
+#define _XA_MWM_INFO     _XA_MOTIF_WM_INFO
+
+#endif /* __WINE_MWM_H */
Index: wine/dlls/x11drv/window.c
diff -u wine/dlls/x11drv/window.c:1.1.1.7 wine/dlls/x11drv/window.c:1.9
--- wine/dlls/x11drv/window.c:1.1.1.7	Wed Jan 16 11:03:34 2002
+++ wine/dlls/x11drv/window.c	Sun Jan 20 12:10:17 2002
@@ -26,6 +26,7 @@
 #include "dce.h"
 #include "options.h"
 #include "hook.h"
+#include "mwm.h"
 
 DEFAULT_DEBUG_CHANNEL(x11drv);
 
@@ -44,6 +44,7 @@
 Atom dndProtocol = None;
 Atom dndSelection = None;
 Atom wmChangeState = None;
+Atom mwmHints = None;
 Atom kwmDockWindow = None;
 Atom _kde_net_wm_system_tray_window_for = None; /* KDE 2 Final */
 
@@ -66,9 +68,10 @@
     if (win->dwStyle & WS_CHILD) return FALSE;
     /* tool windows are not managed */
     if (win->dwExStyle & WS_EX_TOOLWINDOW) return FALSE;
-    /* windows with caption or thick frame are managed */
-    if ((win->dwStyle & WS_CAPTION) == WS_CAPTION) return TRUE;
-    if (win->dwStyle & WS_THICKFRAME) return TRUE;
+    /* overlapped windows are managed */
+    if (!(win->dwStyle & WS_POPUP)) return TRUE;
+    /* popup windows on the desktop are managed */
+    if (win->parent == GetDesktopWindow()) return TRUE;
     /* default: not managed */
     return FALSE;
 }
@@ -366,13 +369,38 @@
     {
         int val = 1;
         if (kwmDockWindow != None)
-            TSXChangeProperty( display, data->whole_window, kwmDockWindow, kwmDockWindow,
-                               32, PropModeReplace, (char*)&val, 1 );
+            XChangeProperty( display, data->whole_window, kwmDockWindow, kwmDockWindow,
+                             32, PropModeReplace, (char*)&val, 1 );
         if (_kde_net_wm_system_tray_window_for != None)
-            TSXChangeProperty( display, data->whole_window, _kde_net_wm_system_tray_window_for,
-                               XA_WINDOW, 32, PropModeReplace, (char*)&data->whole_window, 1 );
+            XChangeProperty( display, data->whole_window, _kde_net_wm_system_tray_window_for,
+                             XA_WINDOW, 32, PropModeReplace, (char*)&data->whole_window, 1 );
     }
 
+    if (mwmHints != None)
+    {
+        MwmHints mwm_hints;
+        mwm_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
+        mwm_hints.functions = 0;
+        if ((win->dwStyle & WS_CAPTION) == WS_CAPTION) mwm_hints.functions |= MWM_FUNC_MOVE;
+        if (win->dwStyle & WS_THICKFRAME) mwm_hints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE;
+        if (win->dwStyle & WS_MINIMIZE)   mwm_hints.functions |= MWM_FUNC_MINIMIZE;
+        if (win->dwStyle & WS_MAXIMIZE)   mwm_hints.functions |= MWM_FUNC_MAXIMIZE;
+        if (win->dwStyle & WS_SYSMENU)    mwm_hints.functions |= MWM_FUNC_CLOSE;
+        mwm_hints.decorations = 0;
+        if ((win->dwStyle & WS_CAPTION) == WS_CAPTION) mwm_hints.decorations |= MWM_DECOR_TITLE;
+        if (win->dwExStyle & WS_EX_DLGMODALFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER;
+        else if (win->dwStyle & WS_THICKFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER | MWM_DECOR_RESIZEH;
+        else if ((win->dwStyle & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME) mwm_hints.decorations |= MWM_DECOR_BORDER;
+        else if (win->dwStyle & WS_BORDER) mwm_hints.decorations |= MWM_DECOR_BORDER;
+        else if (!(win->dwStyle & (WS_CHILD|WS_POPUP))) mwm_hints.decorations |= MWM_DECOR_BORDER;
+        if (win->dwStyle & WS_SYSMENU)  mwm_hints.decorations |= MWM_DECOR_MENU;
+        if (win->dwStyle & WS_MINIMIZE) mwm_hints.decorations |= MWM_DECOR_MINIMIZE;
+        if (win->dwStyle & WS_MAXIMIZE) mwm_hints.decorations |= MWM_DECOR_MAXIMIZE;
+
+        XChangeProperty( display, data->whole_window, mwmHints, mwmHints, 32,
+                         PropModeReplace, (char*)&mwm_hints, sizeof(mwm_hints)/sizeof(long) );
+    }
+
     wine_tsx11_unlock();
 
     /* wm hints */
@@ -600,7 +628,8 @@
     wmTakeFocus = 0;  /* not yet */
     dndProtocol = XInternAtom( display, "DndProtocol" , False );
     dndSelection = XInternAtom( display, "DndSelection" , False );
-    wmChangeState = XInternAtom (display, "WM_CHANGE_STATE", False);
+    wmChangeState = XInternAtom( display, "WM_CHANGE_STATE", False );
+    mwmHints = XInternAtom( display, _XA_MWM_HINTS, False );
     kwmDockWindow = XInternAtom( display, "KWM_DOCKWINDOW", False );
     _kde_net_wm_system_tray_window_for = XInternAtom( display, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False );
     wine_tsx11_unlock();





More information about the wine-patches mailing list