From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winex11.drv/systray.c | 33 ++++++------------------ dlls/winex11.drv/unixlib.h | 3 +++ dlls/winex11.drv/window.c | 46 ++++++++++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 3 +++ dlls/winex11.drv/x11drv_main.c | 3 +++ 5 files changed, 62 insertions(+), 26 deletions(-)
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c index 45ad0617246..bb2e5d563dd 100644 --- a/dlls/winex11.drv/systray.c +++ b/dlls/winex11.drv/systray.c @@ -587,10 +587,13 @@ static BOOL init_systray(void) { static BOOL init_done; WNDCLASSEXW class; - Display *display;
- if (is_virtual_desktop()) return FALSE; if (init_done) return TRUE; + if (!X11DRV_CALL( systray_init, NULL )) + { + init_done = TRUE; + return FALSE; + }
icon_cx = GetSystemMetrics( SM_CXSMICON ) + 2 * ICON_BORDER; icon_cy = GetSystemMetrics( SM_CYSMICON ) + 2 * ICON_BORDER; @@ -620,17 +623,6 @@ static BOOL init_systray(void) return FALSE; }
- display = thread_init_display(); - if (DefaultScreen( display ) == 0) - systray_atom = x11drv_atom(_NET_SYSTEM_TRAY_S0); - else - { - char systray_buffer[29]; /* strlen(_NET_SYSTEM_TRAY_S4294967295)+1 */ - sprintf( systray_buffer, "_NET_SYSTEM_TRAY_S%u", DefaultScreen( display ) ); - systray_atom = XInternAtom( display, systray_buffer, False ); - } - XSelectInput( display, root_window, StructureNotifyMask ); - init_done = TRUE; return TRUE; } @@ -700,18 +692,11 @@ void change_systray_owner( Display *display, Window systray_window ) /* hide a tray icon */ static BOOL hide_icon( struct tray_icon *icon ) { - struct x11drv_win_data *data; - TRACE( "id=0x%x, hwnd=%p\n", icon->id, icon->owner );
if (!icon->window) return TRUE; /* already hidden */
- /* make sure we don't try to unmap it, it confuses some systray docks */ - if ((data = get_win_data( icon->window ))) - { - if (data->embedded) data->mapped = FALSE; - release_win_data( data ); - } + X11DRV_CALL( systray_hide, &icon->window ); DestroyWindow(icon->window); DestroyWindow(icon->tooltip); icon->window = 0; @@ -759,11 +744,7 @@ static BOOL modify_icon( struct tray_icon *icon, NOTIFYICONDATAW *nid ) { if (icon->display != -1) InvalidateRect( icon->window, NULL, TRUE ); else if (icon->layered) repaint_tray_icon( icon ); - else - { - Window win = X11DRV_get_whole_window( icon->window ); - if (win) XClearArea( gdi_display, win, 0, 0, 0, 0, True ); - } + else X11DRV_CALL( systray_clear, &icon->window ); } }
diff --git a/dlls/winex11.drv/unixlib.h b/dlls/winex11.drv/unixlib.h index fe3b430dc87..ce89f7d4d39 100644 --- a/dlls/winex11.drv/unixlib.h +++ b/dlls/winex11.drv/unixlib.h @@ -24,6 +24,9 @@ enum x11drv_funcs unix_clipboard_message, unix_create_desktop, unix_init, + unix_systray_clear, + unix_systray_hide, + unix_systray_init, unix_tablet_attach_queue, unix_tablet_get_packet, unix_tablet_info, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 7ccec4ee4ec..4ae1d3f11a3 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2092,6 +2092,52 @@ HWND create_foreign_window( Display *display, Window xwin ) }
+NTSTATUS x11drv_systray_init( void *arg ) +{ + Display *display; + + if (is_virtual_desktop()) return FALSE; + + display = thread_init_display(); + if (DefaultScreen( display ) == 0) + systray_atom = x11drv_atom(_NET_SYSTEM_TRAY_S0); + else + { + char systray_buffer[29]; /* strlen(_NET_SYSTEM_TRAY_S4294967295)+1 */ + sprintf( systray_buffer, "_NET_SYSTEM_TRAY_S%u", DefaultScreen( display ) ); + systray_atom = XInternAtom( display, systray_buffer, False ); + } + XSelectInput( display, root_window, StructureNotifyMask ); + + return TRUE; +} + + +NTSTATUS x11drv_systray_clear( void *arg ) +{ + HWND hwnd = *(HWND*)arg; + Window win = X11DRV_get_whole_window( hwnd ); + if (win) XClearArea( gdi_display, win, 0, 0, 0, 0, True ); + return 0; +} + + +NTSTATUS x11drv_systray_hide( void *arg ) +{ + HWND hwnd = *(HWND*)arg; + struct x11drv_win_data *data; + + /* make sure we don't try to unmap it, it confuses some systray docks */ + if ((data = get_win_data( hwnd ))) + { + if (data->embedded) data->mapped = FALSE; + release_win_data( data ); + } + + return 0; +} + + /*********************************************************************** * X11DRV_get_whole_window * diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 3986733782a..ec72d8a550e 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -827,6 +827,9 @@ static inline BOOL is_window_rect_mapped( const RECT *rect )
extern NTSTATUS x11drv_clipboard_message( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_create_desktop( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_systray_clear( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_systray_hide( void *arg ) DECLSPEC_HIDDEN; +extern NTSTATUS x11drv_systray_init( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_tablet_attach_queue( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_tablet_get_packet( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS x11drv_tablet_load_info( void *arg ) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 749fe2f761b..2d65f2a03d6 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -977,6 +977,9 @@ const unixlib_entry_t __wine_unix_call_funcs[] = x11drv_clipboard_message, x11drv_create_desktop, x11drv_init, + x11drv_systray_clear, + x11drv_systray_hide, + x11drv_systray_init, x11drv_tablet_attach_queue, x11drv_tablet_get_packet, x11drv_tablet_info,