Module: wine Branch: master Commit: cbdf1294e6474ae5254a2fe9cb900b08a89b8b1b URL: http://source.winehq.org/git/wine.git/?a=commit;h=cbdf1294e6474ae5254a2fe9cb...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jan 23 21:40:45 2008 +0100
winex11: Export a function to dock a window into the system tray, and get rid of the WS_EX_TRAYWINDOW style.
---
dlls/winex11.drv/window.c | 18 +++++++----------- dlls/winex11.drv/winex11.drv.spec | 3 +++ include/winuser.h | 3 --- programs/explorer/systray.c | 8 +++++++- 4 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 1715b0c..da6efab 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -79,9 +79,6 @@ BOOL is_window_managed( HWND hwnd, UINT swp_flags, const RECT *window_rect ) { DWORD style, ex_style;
- /* tray window is always managed */ - ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE ); - if (ex_style & WS_EX_TRAYWINDOW) return TRUE; /* child windows are not managed */ style = GetWindowLongW( hwnd, GWL_STYLE ); if ((style & (WS_CHILD|WS_POPUP)) == WS_CHILD) return FALSE; @@ -91,6 +88,7 @@ BOOL is_window_managed( HWND hwnd, UINT swp_flags, const RECT *window_rect ) /* windows with caption are managed */ if ((style & WS_CAPTION) == WS_CAPTION) return TRUE; /* tool windows are not managed */ + ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE ); if (ex_style & WS_EX_TOOLWINDOW) return FALSE; /* windows with thick frame are managed */ if (style & WS_THICKFRAME) return TRUE; @@ -642,15 +640,19 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data, HICO }
/*********************************************************************** - * systray_dock_window + * wine_make_systray_window (X11DRV.@) * * Docks the given X window with the NETWM system tray. */ -static void systray_dock_window( Display *display, struct x11drv_win_data *data ) +void X11DRV_make_systray_window( HWND hwnd ) { static Atom systray_atom; + Display *display = thread_display(); + struct x11drv_win_data *data; Window systray_window;
+ if (!(data = X11DRV_get_win_data( hwnd ))) return; + wine_tsx11_lock(); if (!systray_atom) { @@ -1449,12 +1451,6 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) newPos.right, newPos.bottom, swFlag ); }
- /* Dock system tray windows. */ - /* Dock after the window is created so we don't have problems calling - * SetWindowPos. */ - if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_TRAYWINDOW) - systray_dock_window( display, data ); - return TRUE;
failed: diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 87db841..7fbdfff 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -128,6 +128,9 @@ # Desktop @ cdecl wine_create_desktop(long long) X11DRV_create_desktop
+# System tray +@ cdecl wine_make_systray_window(long) X11DRV_make_systray_window + # XIM @ cdecl ForceXIMReset(long) X11DRV_ForceXIMReset
diff --git a/include/winuser.h b/include/winuser.h index 3a6a42c..aec4a83 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -3217,9 +3217,6 @@ typedef struct tagMINIMIZEDMETRICS { #define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE|WS_EX_CLIENTEDGE) #define WS_EX_PALETTEWINDOW (WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_TOPMOST)
-/* WINE internal... */ -#define WS_EX_TRAYWINDOW 0x80000000L - #endif /* NOWINSTYLES */
/* Window scrolling */ diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index a5535ff..06347d4 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -220,6 +220,7 @@ static void modify_icon(NOTIFYICONDATAW *nid, BOOL modify_tooltip)
static void add_icon(NOTIFYICONDATAW *nid) { + HMODULE x11drv = GetModuleHandleA( "winex11.drv" ); RECT rect; struct icon *icon; static const WCHAR adaptor_windowname[] = /* Wine System Tray Adaptor */ {'W','i','n','e',' ','S','y','s','t','e','m',' ','T','r','a','y',' ','A','d','a','p','t','o','r',0}; @@ -250,13 +251,18 @@ static void add_icon(NOTIFYICONDATAW *nid) AdjustWindowRect(&rect, WS_CLIPSIBLINGS | WS_CAPTION, FALSE);
/* create the adaptor window */ - icon->window = CreateWindowEx(WS_EX_TRAYWINDOW, adaptor_classname, + icon->window = CreateWindowEx(0, adaptor_classname, adaptor_windowname, WS_CLIPSIBLINGS | WS_CAPTION, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, NULL, icon); + if (x11drv) + { + void (*make_systray_window)(HWND) = (void *)GetProcAddress( x11drv, "wine_make_systray_window" ); + if (make_systray_window) make_systray_window( icon->window ); + }
if (!hide_systray) ShowWindow(icon->window, SW_SHOWNA);