Commit 48e6bf3c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11: Use the new SystrayDock driver interface.

parent 229b4561
......@@ -47,7 +47,6 @@ static const kernel_callback kernel_callbacks[] =
x11drv_dnd_enter_event,
x11drv_dnd_position_event,
x11drv_dnd_post_drop,
x11drv_systray_change_owner,
};
C_ASSERT( NtUserDriverCallbackFirst + ARRAYSIZE(kernel_callbacks) == client_func_last );
......@@ -59,7 +58,6 @@ BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
struct init_params params =
{
foreign_window_proc,
&show_systray,
};
if (reason != DLL_PROCESS_ATTACH) return TRUE;
......
......@@ -603,12 +603,8 @@ static void handle_manager_message( HWND hwnd, XClientMessageEvent *event )
if (systray_atom && event->data.l[1] == systray_atom)
{
struct systray_change_owner_params params;
TRACE( "new owner %lx\n", event->data.l[2] );
params.event_handle = (UINT_PTR)event;
x11drv_client_func( client_func_systray_change_owner, &params, sizeof(params) );
NtUserPostMessage( systray_hwnd, WM_USER + 1, 0, 0 );
}
}
......
......@@ -404,6 +404,10 @@ static const struct user_driver_funcs x11drv_funcs =
.pGetCursorPos = X11DRV_GetCursorPos,
.pSetCursorPos = X11DRV_SetCursorPos,
.pClipCursor = X11DRV_ClipCursor,
.pSystrayDockInit = X11DRV_SystrayDockInit,
.pSystrayDockInsert = X11DRV_SystrayDockInsert,
.pSystrayDockClear = X11DRV_SystrayDockClear,
.pSystrayDockRemove = X11DRV_SystrayDockRemove,
.pChangeDisplaySettings = X11DRV_ChangeDisplaySettings,
.pGetCurrentDisplaySettings = X11DRV_GetCurrentDisplaySettings,
.pGetDisplayDepth = X11DRV_GetDisplayDepth,
......
......@@ -22,10 +22,6 @@
enum x11drv_funcs
{
unix_init,
unix_systray_clear,
unix_systray_dock,
unix_systray_hide,
unix_systray_init,
unix_tablet_attach_queue,
unix_tablet_get_packet,
unix_tablet_info,
......@@ -39,16 +35,6 @@ enum x11drv_funcs
struct init_params
{
WNDPROC foreign_window_proc;
BOOL *show_systray;
};
struct systray_dock_params
{
UINT64 event_handle;
void *icon;
int cx;
int cy;
BOOL *layered;
};
/* x11drv_tablet_info params */
......@@ -73,7 +59,6 @@ enum x11drv_client_funcs
client_func_dnd_enter_event,
client_func_dnd_position_event,
client_func_dnd_post_drop,
client_func_systray_change_owner,
client_func_last
};
......@@ -109,8 +94,3 @@ struct dnd_position_event_params
POINT point;
DWORD effect;
};
struct systray_change_owner_params
{
UINT64 event_handle;
};
......@@ -2189,12 +2189,16 @@ HWND create_foreign_window( Display *display, Window xwin )
}
NTSTATUS x11drv_systray_init( void *arg )
/***********************************************************************
* SystrayDockInit (X11DRV.@)
*/
void X11DRV_SystrayDockInit( HWND hwnd )
{
Display *display;
if (is_virtual_desktop()) return FALSE;
if (is_virtual_desktop()) return;
systray_hwnd = hwnd;
display = thread_init_display();
if (DefaultScreen( display ) == 0)
systray_atom = x11drv_atom(_NET_SYSTEM_TRAY_S0);
......@@ -2205,33 +2209,36 @@ NTSTATUS x11drv_systray_init( void *arg )
systray_atom = XInternAtom( display, systray_buffer, False );
}
XSelectInput( display, root_window, StructureNotifyMask );
return TRUE;
}
NTSTATUS x11drv_systray_clear( void *arg )
/***********************************************************************
* SystrayDockClear (X11DRV.@)
*/
void X11DRV_SystrayDockClear( HWND hwnd )
{
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 )
/***********************************************************************
* SystrayDockRemove (X11DRV.@)
*/
BOOL X11DRV_SystrayDockRemove( HWND hwnd )
{
HWND hwnd = *(HWND*)arg;
struct x11drv_win_data *data;
BOOL ret;
/* 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;
if ((ret = data->embedded)) data->mapped = FALSE;
release_win_data( data );
return ret;
}
return 0;
return FALSE;
}
......@@ -2270,46 +2277,23 @@ static void get_systray_visual_info( Display *display, Window systray_window, XV
}
NTSTATUS x11drv_systray_dock( void *arg )
/***********************************************************************
* SystrayDockInsert (X11DRV.@)
*/
BOOL X11DRV_SystrayDockInsert( HWND hwnd, UINT cx, UINT cy, void *icon )
{
struct systray_dock_params *params = arg;
Display *display = thread_init_display();
Window systray_window, window;
Display *display;
XEvent ev;
XSetWindowAttributes attr;
XVisualInfo visual;
struct x11drv_win_data *data;
UNICODE_STRING class_name;
BOOL layered;
HWND hwnd;
static const WCHAR icon_classname[] =
{'_','_','w','i','n','e','x','1','1','_','t','r','a','y','_','i','c','o','n',0};
if (params->event_handle)
{
XClientMessageEvent *event = (XClientMessageEvent *)(UINT_PTR)params->event_handle;
display = event->display;
systray_window = event->data.l[2];
}
else
{
display = thread_init_display();
if (!(systray_window = get_systray_selection_owner( display ))) return STATUS_UNSUCCESSFUL;
}
if (!(systray_window = get_systray_selection_owner( display ))) return FALSE;
get_systray_visual_info( display, systray_window, &visual );
*params->layered = layered = (visual.depth == 32);
RtlInitUnicodeString( &class_name, icon_classname );
hwnd = NtUserCreateWindowEx( layered ? WS_EX_LAYERED : 0, &class_name, &class_name, NULL,
WS_CLIPSIBLINGS | WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT,
params->cx, params->cy, NULL, 0, NULL, params->icon, 0,
NULL, 0, FALSE );
if (!(data = get_win_data( hwnd ))) return STATUS_UNSUCCESSFUL;
if (layered) set_window_visual( data, &visual, TRUE );
if (!(data = get_win_data( hwnd ))) return FALSE;
set_window_visual( data, &visual, TRUE );
make_window_embedded( data );
window = data->whole_window;
release_win_data( data );
......@@ -2330,19 +2314,7 @@ NTSTATUS x11drv_systray_dock( void *arg )
ev.xclient.data.l[4] = 0;
XSendEvent( display, systray_window, False, NoEventMask, &ev );
if (!layered)
{
attr.background_pixmap = ParentRelative;
attr.bit_gravity = ForgetGravity;
XChangeWindowAttributes( display, window, CWBackPixmap | CWBitGravity, &attr );
}
else
{
/* force repainig */
send_message( hwnd, WM_SIZE, SIZE_RESTORED, MAKELONG( params->cx, params->cy ));
}
return STATUS_SUCCESS;
return TRUE;
}
......
......@@ -3,6 +3,3 @@
@ cdecl GetCurrentPacket(ptr) X11DRV_GetCurrentPacket
@ cdecl LoadTabletInfo(long) X11DRV_LoadTabletInfo
@ cdecl WTInfoW(long long ptr) X11DRV_WTInfoW
# System tray
@ cdecl wine_notify_icon(long ptr)
......@@ -217,6 +217,10 @@ extern void X11DRV_SetCursor( HWND hwnd, HCURSOR handle );
extern BOOL X11DRV_SetCursorPos( INT x, INT y );
extern BOOL X11DRV_GetCursorPos( LPPOINT pos );
extern BOOL X11DRV_ClipCursor( const RECT *clip, BOOL reset );
extern void X11DRV_SystrayDockInit( HWND systray );
extern BOOL X11DRV_SystrayDockInsert( HWND owner, UINT cx, UINT cy, void *icon );
extern void X11DRV_SystrayDockClear( HWND hwnd );
extern BOOL X11DRV_SystrayDockRemove( HWND hwnd );
extern LONG X11DRV_ChangeDisplaySettings( LPDEVMODEW displays, LPCWSTR primary_name, HWND hwnd, DWORD flags, LPVOID lpvoid );
extern BOOL X11DRV_GetCurrentDisplaySettings( LPCWSTR name, BOOL is_primary, LPDEVMODEW devmode );
extern INT X11DRV_GetDisplayDepth( LPCWSTR name, BOOL is_primary );
......@@ -442,7 +446,6 @@ extern BOOL usexvidmode;
extern BOOL use_take_focus;
extern BOOL use_primary_selection;
extern BOOL use_system_cursors;
extern BOOL show_systray;
extern BOOL grab_fullscreen;
extern BOOL usexcomposite;
extern BOOL managed_mode;
......@@ -554,6 +557,7 @@ enum x11drv_atoms
extern Atom X11DRV_Atoms[NB_XATOMS - FIRST_XATOM];
extern Atom systray_atom;
extern HWND systray_hwnd;
#define x11drv_atom(name) (X11DRV_Atoms[XATOM_##name - FIRST_XATOM])
......@@ -835,10 +839,6 @@ static inline BOOL is_window_rect_mapped( const RECT *rect )
/* unixlib interface */
extern NTSTATUS x11drv_systray_clear( void *arg );
extern NTSTATUS x11drv_systray_dock( void *arg );
extern NTSTATUS x11drv_systray_hide( void *arg );
extern NTSTATUS x11drv_systray_init( void *arg );
extern NTSTATUS x11drv_tablet_attach_queue( void *arg );
extern NTSTATUS x11drv_tablet_get_packet( void *arg );
extern NTSTATUS x11drv_tablet_load_info( void *arg );
......
......@@ -30,7 +30,6 @@
extern NTSTATUS WINAPI x11drv_dnd_enter_event( void *params, ULONG size );
extern NTSTATUS WINAPI x11drv_dnd_position_event( void *params, ULONG size );
extern NTSTATUS WINAPI x11drv_dnd_post_drop( void *data, ULONG size );
extern NTSTATUS WINAPI x11drv_systray_change_owner( void *params, ULONG size );
extern NTSTATUS x11drv_dnd_drop_event( UINT arg );
extern NTSTATUS x11drv_dnd_leave_event( UINT arg );
......@@ -38,7 +37,6 @@ extern NTSTATUS x11drv_dnd_leave_event( UINT arg );
extern LRESULT WINAPI foreign_window_proc( HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam );
extern BOOL show_systray;
extern HMODULE x11drv_module;
#endif /* __WINE_X11DRV_DLL_H */
......@@ -65,6 +65,7 @@ XVisualInfo argb_visual = { 0 };
Colormap default_colormap = None;
XPixmapFormatValues **pixmap_formats;
Atom systray_atom = 0;
HWND systray_hwnd = 0;
unsigned int screen_bpp;
Window root_window;
BOOL usexvidmode = TRUE;
......@@ -73,7 +74,6 @@ BOOL usexcomposite = TRUE;
BOOL use_take_focus = TRUE;
BOOL use_primary_selection = FALSE;
BOOL use_system_cursors = TRUE;
BOOL show_systray = TRUE;
BOOL grab_fullscreen = FALSE;
BOOL managed_mode = TRUE;
BOOL decorated_mode = TRUE;
......@@ -494,9 +494,6 @@ static void setup_options(void)
if (!get_config_key( hkey, appkey, "UseSystemCursors", buffer, sizeof(buffer) ))
use_system_cursors = IS_OPTION_TRUE( buffer[0] );
if (!get_config_key( hkey, appkey, "ShowSystray", buffer, sizeof(buffer) ))
show_systray = IS_OPTION_TRUE( buffer[0] );
if (!get_config_key( hkey, appkey, "GrabFullscreen", buffer, sizeof(buffer) ))
grab_fullscreen = IS_OPTION_TRUE( buffer[0] );
......@@ -708,7 +705,6 @@ static NTSTATUS x11drv_init( void *arg )
init_user_driver();
X11DRV_DisplayDevices_Init(FALSE);
*params->show_systray = show_systray;
return STATUS_SUCCESS;
}
......@@ -1319,10 +1315,6 @@ NTSTATUS x11drv_client_call( enum client_callback func, UINT arg )
const unixlib_entry_t __wine_unix_call_funcs[] =
{
x11drv_init,
x11drv_systray_clear,
x11drv_systray_dock,
x11drv_systray_hide,
x11drv_systray_init,
x11drv_tablet_attach_queue,
x11drv_tablet_get_packet,
x11drv_tablet_info,
......@@ -1340,47 +1332,13 @@ static NTSTATUS x11drv_wow64_init( void *arg )
struct
{
ULONG foreign_window_proc;
ULONG show_systray;
} *params32 = arg;
struct init_params params;
params.foreign_window_proc = UlongToPtr( params32->foreign_window_proc );
params.show_systray = UlongToPtr( params32->show_systray );
return x11drv_init( &params );
}
static NTSTATUS x11drv_wow64_systray_clear( void *arg )
{
HWND hwnd = UlongToPtr( *(ULONG *)arg );
return x11drv_systray_clear( &hwnd );
}
static NTSTATUS x11drv_wow64_systray_dock( void *arg )
{
struct
{
UINT64 event_handle;
ULONG icon;
int cx;
int cy;
ULONG layered;
} *params32 = arg;
struct systray_dock_params params;
params.event_handle = params32->event_handle;
params.icon = UlongToPtr( params32->icon );
params.cx = params32->cx;
params.cy = params32->cy;
params.layered = UlongToPtr( params32->layered );
return x11drv_systray_dock( &params );
}
static NTSTATUS x11drv_wow64_systray_hide( void *arg )
{
HWND hwnd = UlongToPtr( *(ULONG *)arg );
return x11drv_systray_hide( &hwnd );
}
static NTSTATUS x11drv_wow64_tablet_get_packet( void *arg )
{
FIXME( "%p\n", arg );
......@@ -1406,10 +1364,6 @@ static NTSTATUS x11drv_wow64_tablet_info( void *arg )
const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
{
x11drv_wow64_init,
x11drv_wow64_systray_clear,
x11drv_wow64_systray_dock,
x11drv_wow64_systray_hide,
x11drv_systray_init,
x11drv_tablet_attach_queue,
x11drv_wow64_tablet_get_packet,
x11drv_wow64_tablet_info,
......
......@@ -1069,6 +1069,24 @@ static LRESULT WINAPI shell_traywnd_proc( HWND hwnd, UINT msg, WPARAM wparam, LP
case WM_MENUCOMMAND:
return menu_wndproc(hwnd, msg, wparam, lparam);
case WM_USER + 0:
update_systray_balloon_position();
return 0;
case WM_USER + 1:
{
struct icon *icon;
LIST_FOR_EACH_ENTRY( icon, &icon_list, struct icon, entry )
{
if (!icon->window) continue;
hide_icon( icon );
show_icon( icon );
}
return 0;
}
default:
return DefWindowProcW( hwnd, msg, wparam, lparam );
}
......
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