Commit 62c6646d authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

win32u: Introduce new SystrayDock driver entry points.

parent 550cac96
......@@ -775,6 +775,24 @@ static void nulldrv_CleanupIcons( HWND hwnd )
{
}
static void nulldrv_SystrayDockInit( HWND hwnd )
{
}
static BOOL nulldrv_SystrayDockInsert( HWND hwnd, UINT cx, UINT cy, void *icon )
{
return FALSE;
}
static void nulldrv_SystrayDockClear( HWND hwnd )
{
}
static BOOL nulldrv_SystrayDockRemove( HWND hwnd )
{
return FALSE;
}
static void nulldrv_UpdateClipboard(void)
{
}
......@@ -1176,6 +1194,26 @@ static void loaderdrv_CleanupIcons( HWND hwnd )
load_driver()->pCleanupIcons( hwnd );
}
static void loaderdrv_SystrayDockInit( HWND hwnd )
{
load_driver()->pSystrayDockInit( hwnd );
}
static BOOL loaderdrv_SystrayDockInsert( HWND hwnd, UINT cx, UINT cy, void *icon )
{
return load_driver()->pSystrayDockInsert( hwnd, cx, cy, icon );
}
static void loaderdrv_SystrayDockClear( HWND hwnd )
{
load_driver()->pSystrayDockClear( hwnd );
}
static BOOL loaderdrv_SystrayDockRemove( HWND hwnd )
{
return load_driver()->pSystrayDockRemove( hwnd );
}
static LRESULT nulldrv_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
return 0;
......@@ -1265,6 +1303,10 @@ static const struct user_driver_funcs lazy_load_driver =
/* systray functions */
loaderdrv_NotifyIcon,
loaderdrv_CleanupIcons,
loaderdrv_SystrayDockInit,
loaderdrv_SystrayDockInsert,
loaderdrv_SystrayDockClear,
loaderdrv_SystrayDockRemove,
/* clipboard functions */
nulldrv_ClipboardWindowProc,
loaderdrv_UpdateClipboard,
......@@ -1351,6 +1393,10 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version
SET_USER_FUNC(ClipCursor);
SET_USER_FUNC(NotifyIcon);
SET_USER_FUNC(CleanupIcons);
SET_USER_FUNC(SystrayDockInit);
SET_USER_FUNC(SystrayDockInsert);
SET_USER_FUNC(SystrayDockClear);
SET_USER_FUNC(SystrayDockRemove);
SET_USER_FUNC(ClipboardWindowProc);
SET_USER_FUNC(UpdateClipboard);
SET_USER_FUNC(ChangeDisplaySettings);
......
......@@ -40,6 +40,18 @@ LRESULT system_tray_call( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, voi
case WINE_SYSTRAY_CLEANUP_ICONS:
user_driver->pCleanupIcons( hwnd );
return 0;
case WINE_SYSTRAY_DOCK_INIT:
user_driver->pSystrayDockInit( hwnd );
return 0;
case WINE_SYSTRAY_DOCK_INSERT:
return user_driver->pSystrayDockInsert( hwnd, wparam, lparam, data );
case WINE_SYSTRAY_DOCK_CLEAR:
user_driver->pSystrayDockClear( hwnd );
return 0;
case WINE_SYSTRAY_DOCK_REMOVE:
return user_driver->pSystrayDockRemove( hwnd );
default:
FIXME( "Unknown NtUserSystemTrayCall msg %#x\n", msg );
break;
......
......@@ -526,6 +526,10 @@ enum wine_systray_call
{
WINE_SYSTRAY_NOTIFY_ICON,
WINE_SYSTRAY_CLEANUP_ICONS,
WINE_SYSTRAY_DOCK_INIT,
WINE_SYSTRAY_DOCK_INSERT,
WINE_SYSTRAY_DOCK_CLEAR,
WINE_SYSTRAY_DOCK_REMOVE,
};
#define WM_SYSTIMER 0x0118
......
......@@ -309,6 +309,10 @@ struct user_driver_funcs
/* notify icon functions */
LRESULT (*pNotifyIcon)(HWND,UINT,NOTIFYICONDATAW *);
void (*pCleanupIcons)(HWND);
void (*pSystrayDockInit)(HWND);
BOOL (*pSystrayDockInsert)(HWND,UINT,UINT,void *);
void (*pSystrayDockClear)(HWND);
BOOL (*pSystrayDockRemove)(HWND);
/* clipboard functions */
LRESULT (*pClipboardWindowProc)(HWND,UINT,WPARAM,LPARAM);
void (*pUpdateClipboard)(void);
......
......@@ -60,6 +60,7 @@ struct notify_data /* platform-independent format for NOTIFYICONDATA */
static int (CDECL *wine_notify_icon)(DWORD,NOTIFYICONDATAW *);
#define ICON_DISPLAY_HIDDEN -1
#define ICON_DISPLAY_DOCKED -2
/* an individual systray icon, unpacked from the NOTIFYICONDATA and always in unicode */
struct icon
......@@ -472,6 +473,8 @@ static void systray_add_icon( struct icon *icon )
if (icon->display != ICON_DISPLAY_HIDDEN) return; /* already added */
icon->display = nb_displayed++;
SetWindowLongW( icon->window, GWL_STYLE, GetWindowLongW( icon->window, GWL_STYLE ) | WS_CHILD );
SetParent( icon->window, tray_window );
pos = get_icon_pos( icon );
SetWindowPos( icon->window, 0, pos.x, pos.y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
......@@ -502,6 +505,8 @@ static void systray_remove_icon( struct icon *icon )
TRACE( "removed %u now %d icons\n", icon->id, nb_displayed );
icon->display = ICON_DISPLAY_HIDDEN;
SetParent( icon->window, GetDesktopWindow() );
SetWindowLongW( icon->window, GWL_STYLE, GetWindowLongW( icon->window, GWL_STYLE ) & ~WS_CHILD );
}
/* make an icon visible */
......@@ -511,6 +516,9 @@ static BOOL show_icon(struct icon *icon)
if (icon->display != ICON_DISPLAY_HIDDEN) return TRUE; /* already displayed */
if (!enable_taskbar && NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_INSERT, icon_cx,
icon_cy, icon, NtUserSystemTrayCall, FALSE ))
icon->display = ICON_DISPLAY_DOCKED;
systray_add_icon( icon );
update_tooltip_position( icon );
......@@ -525,6 +533,9 @@ static BOOL hide_icon(struct icon *icon)
if (icon->display == ICON_DISPLAY_HIDDEN) return TRUE; /* already hidden */
if (!enable_taskbar && NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_REMOVE, 0, 0,
NULL, NtUserSystemTrayCall, FALSE ))
icon->display = ICON_DISPLAY_HIDDEN;
ShowWindow( icon->window, SW_HIDE );
systray_remove_icon( icon );
......@@ -554,7 +565,12 @@ static BOOL modify_icon( struct icon *icon, NOTIFYICONDATAW *nid )
{
if (icon->image) DestroyIcon(icon->image);
icon->image = CopyIcon(nid->hIcon);
if (icon->display >= 0) InvalidateRect( icon->window, NULL, TRUE );
if (icon->display >= 0)
InvalidateRect( icon->window, NULL, TRUE );
else if (!enable_taskbar)
NtUserMessageCall( icon->window, WINE_SYSTRAY_DOCK_CLEAR, 0, 0,
NULL, NtUserSystemTrayCall, FALSE );
}
if (nid->uFlags & NIF_MESSAGE)
......@@ -604,8 +620,8 @@ static BOOL add_icon(NOTIFYICONDATAW *nid)
icon->owner = nid->hWnd;
icon->display = ICON_DISPLAY_HIDDEN;
CreateWindowW( tray_icon_class.lpszClassName, NULL, WS_CHILD,
0, 0, icon_cx, icon_cy, tray_window, NULL, NULL, icon );
CreateWindowExW( 0, tray_icon_class.lpszClassName, NULL, WS_CLIPSIBLINGS | WS_POPUP,
0, 0, icon_cx, icon_cy, 0, NULL, NULL, icon );
if (!icon->window) ERR( "Failed to create systray icon window\n" );
list_add_tail(&icon_list, &icon->entry);
......@@ -1027,6 +1043,7 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enab
SIZE size = get_window_size();
tray_window = CreateWindowExW( 0, shell_traywnd_class.lpszClassName, L"", WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT, size.cx, size.cy, 0, 0, 0, 0 );
NtUserMessageCall( tray_window, WINE_SYSTRAY_DOCK_INIT, 0, 0, NULL, NtUserSystemTrayCall, FALSE );
}
if (!tray_window)
......
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