diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 89d3a93d527..662b068c71c 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -512,6 +512,17 @@ static void set_focus( Display *display, HWND hwnd, Time time ) } +/********************************************************************** + * handle_manager_message + */ +static void handle_manager_message( HWND hwnd, XClientMessageEvent *event ) +{ + if (hwnd != GetDesktopWindow()) return; + if (systray_atom && event->data.l[1] == systray_atom) + change_systray_owner( event->display, event->data.l[2] ); +} + + /********************************************************************** * handle_wm_protocols */ @@ -1428,6 +1439,7 @@ struct client_message_handler static const struct client_message_handler client_messages[] = { + { XATOM_MANAGER, handle_manager_message }, { XATOM_WM_PROTOCOLS, handle_wm_protocols }, { XATOM__XEMBED, handle_xembed_protocol }, { XATOM_DndProtocol, handle_dnd_protocol }, diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c index 9d153963609..fbbe8c2530e 100644 --- a/dlls/winex11.drv/systray.c +++ b/dlls/winex11.drv/systray.c @@ -73,7 +73,7 @@ static BOOL delete_icon( struct tray_icon *icon ); #define SYSTEM_TRAY_BEGIN_MESSAGE 1 #define SYSTEM_TRAY_CANCEL_MESSAGE 2 -static Atom systray_atom; +Atom systray_atom = 0; #define MIN_DISPLAYED 8 #define ICON_BORDER 2 @@ -427,6 +427,19 @@ static void dock_systray_icon( Display *display, struct tray_icon *icon, Window wine_tsx11_unlock(); } +/* dock systray windows again with the new owner */ +void change_systray_owner( Display *display, Window systray_window ) +{ + struct tray_icon *icon; + + ERR( "new owner %lx\n", systray_window ); + LIST_FOR_EACH_ENTRY( icon, &icon_list, struct tray_icon, entry ) + { + if (icon->display == -1) continue; + hide_icon( icon ); + dock_systray_icon( display, icon, systray_window ); + } +} /* hide a tray icon */ static BOOL hide_icon( struct tray_icon *icon ) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 4308823771c..d6fdbf09036 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -619,6 +619,7 @@ enum x11drv_atoms XATOM_CLIPBOARD = FIRST_XATOM, XATOM_COMPOUND_TEXT, XATOM_INCR, + XATOM_MANAGER, XATOM_MULTIPLE, XATOM_SELECTION_DATA, XATOM_TARGETS, @@ -691,6 +692,7 @@ enum x11drv_atoms }; extern Atom X11DRV_Atoms[NB_XATOMS - FIRST_XATOM]; +extern Atom systray_atom; #define x11drv_atom(name) (X11DRV_Atoms[XATOM_##name - FIRST_XATOM]) @@ -780,6 +782,7 @@ extern void wait_for_withdrawn_state( Display *display, struct x11drv_win_data * extern void update_user_time( Time time ); extern void update_net_wm_states( Display *display, struct x11drv_win_data *data ); extern void make_window_embedded( Display *display, struct x11drv_win_data *data ); +extern void change_systray_owner( Display *display, Window systray_window ); static inline void mirror_rect( const RECT *window_rect, RECT *rect ) { diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index fe4a88cfa35..0d1a7da92ab 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -119,6 +119,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "CLIPBOARD", "COMPOUND_TEXT", "INCR", + "MANAGER", "MULTIPLE", "SELECTION_DATA", "TARGETS",