winex11: Export a function to dock a window into the system tray, and get rid of the WS_EX_TRAYWINDOW style.
This commit is contained in:
parent
d147e02087
commit
cbdf1294e6
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue