Commit e4163061 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winex11: Use unixlib interface for X11 calls from systray.c.

parent 6290d059
......@@ -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 );
}
}
......
......@@ -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,
......
......@@ -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
*
......
......@@ -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;
......
......@@ -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,
......
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