Commit 5a458073 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Re-dock icons when the system tray owner has changed.

parent 68f497bd
......@@ -513,6 +513,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
*/
static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
......@@ -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 },
......
......@@ -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 )
......
......@@ -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 )
{
......
......@@ -119,6 +119,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
"CLIPBOARD",
"COMPOUND_TEXT",
"INCR",
"MANAGER",
"MULTIPLE",
"SELECTION_DATA",
"TARGETS",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment