diff --git a/dlls/x11drv/mwm.h b/dlls/x11drv/mwm.h new file mode 100644 index 00000000000..c5b85ef78a8 --- /dev/null +++ b/dlls/x11drv/mwm.h @@ -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 */ diff --git a/dlls/x11drv/window.c b/dlls/x11drv/window.c index 18cfbb786f3..b9b64d2a24d 100644 --- a/dlls/x11drv/window.c +++ b/dlls/x11drv/window.c @@ -26,6 +26,7 @@ #include "dce.h" #include "options.h" #include "hook.h" +#include "mwm.h" DEFAULT_DEBUG_CHANNEL(x11drv); @@ -44,6 +45,7 @@ Atom wmTakeFocus = None; 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 */ @@ -366,11 +368,36 @@ static void set_wm_hints( Display *display, WND *win ) { 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(); @@ -600,7 +627,8 @@ static void create_desktop( Display *display, WND *wndPtr, CREATESTRUCTA *cs ) 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();