win32u: Introduce a new NtUserSystemTrayCall message call.
This commit is contained in:
parent
600206be39
commit
22bfdbeb48
9 changed files with 156 additions and 9 deletions
|
@ -50,6 +50,7 @@ SOURCES = \
|
||||||
spy.c \
|
spy.c \
|
||||||
syscall.c \
|
syscall.c \
|
||||||
sysparams.c \
|
sysparams.c \
|
||||||
|
systray.c \
|
||||||
vertical.c \
|
vertical.c \
|
||||||
vulkan.c \
|
vulkan.c \
|
||||||
window.c \
|
window.c \
|
||||||
|
|
|
@ -766,6 +766,15 @@ static BOOL nulldrv_ClipCursor( const RECT *clip, BOOL reset )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LRESULT nulldrv_NotifyIcon( HWND hwnd, UINT msg, NOTIFYICONDATAW *data )
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void nulldrv_CleanupIcons( HWND hwnd )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static void nulldrv_UpdateClipboard(void)
|
static void nulldrv_UpdateClipboard(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1157,6 +1166,16 @@ static BOOL loaderdrv_ClipCursor( const RECT *clip, BOOL reset )
|
||||||
return load_driver()->pClipCursor( clip, reset );
|
return load_driver()->pClipCursor( clip, reset );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LRESULT loaderdrv_NotifyIcon( HWND hwnd, UINT msg, NOTIFYICONDATAW *data )
|
||||||
|
{
|
||||||
|
return load_driver()->pNotifyIcon( hwnd, msg, data );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void loaderdrv_CleanupIcons( HWND hwnd )
|
||||||
|
{
|
||||||
|
load_driver()->pCleanupIcons( hwnd );
|
||||||
|
}
|
||||||
|
|
||||||
static LRESULT nulldrv_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
static LRESULT nulldrv_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1243,6 +1262,9 @@ static const struct user_driver_funcs lazy_load_driver =
|
||||||
loaderdrv_GetCursorPos,
|
loaderdrv_GetCursorPos,
|
||||||
loaderdrv_SetCursorPos,
|
loaderdrv_SetCursorPos,
|
||||||
loaderdrv_ClipCursor,
|
loaderdrv_ClipCursor,
|
||||||
|
/* systray functions */
|
||||||
|
loaderdrv_NotifyIcon,
|
||||||
|
loaderdrv_CleanupIcons,
|
||||||
/* clipboard functions */
|
/* clipboard functions */
|
||||||
nulldrv_ClipboardWindowProc,
|
nulldrv_ClipboardWindowProc,
|
||||||
loaderdrv_UpdateClipboard,
|
loaderdrv_UpdateClipboard,
|
||||||
|
@ -1327,6 +1349,8 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version
|
||||||
SET_USER_FUNC(GetCursorPos);
|
SET_USER_FUNC(GetCursorPos);
|
||||||
SET_USER_FUNC(SetCursorPos);
|
SET_USER_FUNC(SetCursorPos);
|
||||||
SET_USER_FUNC(ClipCursor);
|
SET_USER_FUNC(ClipCursor);
|
||||||
|
SET_USER_FUNC(NotifyIcon);
|
||||||
|
SET_USER_FUNC(CleanupIcons);
|
||||||
SET_USER_FUNC(ClipboardWindowProc);
|
SET_USER_FUNC(ClipboardWindowProc);
|
||||||
SET_USER_FUNC(UpdateClipboard);
|
SET_USER_FUNC(UpdateClipboard);
|
||||||
SET_USER_FUNC(ChangeDisplaySettings);
|
SET_USER_FUNC(ChangeDisplaySettings);
|
||||||
|
|
|
@ -4362,6 +4362,9 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa
|
||||||
case NtUserImeDriverCall:
|
case NtUserImeDriverCall:
|
||||||
return ime_driver_call( hwnd, msg, wparam, lparam, result_info );
|
return ime_driver_call( hwnd, msg, wparam, lparam, result_info );
|
||||||
|
|
||||||
|
case NtUserSystemTrayCall:
|
||||||
|
return system_tray_call( hwnd, msg, wparam, lparam, result_info );
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FIXME( "%p %x %lx %lx %p %x %x\n", hwnd, msg, (long)wparam, lparam, result_info, (int)type, ansi );
|
FIXME( "%p %x %lx %lx %p %x %x\n", hwnd, msg, (long)wparam, lparam, result_info, (int)type, ansi );
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#define __WINE_NTUSER_PRIVATE_H
|
#define __WINE_NTUSER_PRIVATE_H
|
||||||
|
|
||||||
#include "ntuser.h"
|
#include "ntuser.h"
|
||||||
|
#include "shellapi.h"
|
||||||
#include "wine/list.h"
|
#include "wine/list.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,6 +250,9 @@ extern void invalidate_dce( WND *win, const RECT *extra_rect );
|
||||||
/* message.c */
|
/* message.c */
|
||||||
extern BOOL set_keyboard_auto_repeat( BOOL enable );
|
extern BOOL set_keyboard_auto_repeat( BOOL enable );
|
||||||
|
|
||||||
|
/* systray.c */
|
||||||
|
extern LRESULT system_tray_call( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, void *data );
|
||||||
|
|
||||||
/* window.c */
|
/* window.c */
|
||||||
HANDLE alloc_user_handle( struct user_object *ptr, unsigned int type );
|
HANDLE alloc_user_handle( struct user_object *ptr, unsigned int type );
|
||||||
void *free_user_handle( HANDLE handle, unsigned int type );
|
void *free_user_handle( HANDLE handle, unsigned int type );
|
||||||
|
|
49
dlls/win32u/systray.c
Normal file
49
dlls/win32u/systray.c
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2023 Rémi Bernon for CodeWeavers
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#pragma makedep unix
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "ntstatus.h"
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
|
#include "win32u_private.h"
|
||||||
|
#include "ntuser_private.h"
|
||||||
|
#include "shellapi.h"
|
||||||
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(systray);
|
||||||
|
|
||||||
|
LRESULT system_tray_call( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, void *data )
|
||||||
|
{
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
|
case WINE_SYSTRAY_NOTIFY_ICON:
|
||||||
|
return user_driver->pNotifyIcon( hwnd, wparam, data );
|
||||||
|
case WINE_SYSTRAY_CLEANUP_ICONS:
|
||||||
|
user_driver->pCleanupIcons( hwnd );
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
FIXME( "Unknown NtUserSystemTrayCall msg %#x\n", msg );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
|
@ -25,6 +25,7 @@
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "ntuser.h"
|
#include "ntuser.h"
|
||||||
|
#include "shellapi.h"
|
||||||
#include "wow64win_private.h"
|
#include "wow64win_private.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
@ -3600,6 +3601,58 @@ NTSTATUS WINAPI wow64_NtUserMessageCall( UINT *args )
|
||||||
params.compstr = UlongToPtr( params32->compstr );
|
params.compstr = UlongToPtr( params32->compstr );
|
||||||
return NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, type, ansi );
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, type, ansi );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NtUserSystemTrayCall:
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
|
case WINE_SYSTRAY_NOTIFY_ICON:
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
DWORD cbSize;
|
||||||
|
ULONG hWnd;
|
||||||
|
UINT uID;
|
||||||
|
UINT uFlags;
|
||||||
|
UINT uCallbackMessage;
|
||||||
|
ULONG hIcon;
|
||||||
|
WCHAR szTip[128];
|
||||||
|
DWORD dwState;
|
||||||
|
DWORD dwStateMask;
|
||||||
|
WCHAR szInfo[256];
|
||||||
|
UINT uTimeout;
|
||||||
|
WCHAR szInfoTitle[64];
|
||||||
|
DWORD dwInfoFlags;
|
||||||
|
GUID guidItem;
|
||||||
|
ULONG hBalloonIcon;
|
||||||
|
} *params32 = result_info;
|
||||||
|
|
||||||
|
NOTIFYICONDATAW params = {.cbSize = sizeof(params)};
|
||||||
|
params.hWnd = UlongToHandle( params32->hWnd );
|
||||||
|
params.uID = params32->uID;
|
||||||
|
params.uFlags = params32->uFlags;
|
||||||
|
params.uCallbackMessage = params32->uCallbackMessage;
|
||||||
|
params.hIcon = UlongToHandle( params32->hIcon );
|
||||||
|
if (params.uFlags & NIF_TIP) wcscpy( params.szTip, params32->szTip );
|
||||||
|
params.dwState = params32->dwState;
|
||||||
|
params.dwStateMask = params32->dwStateMask;
|
||||||
|
|
||||||
|
if (params.uFlags & NIF_INFO)
|
||||||
|
{
|
||||||
|
wcscpy( params.szInfoTitle, params32->szInfoTitle );
|
||||||
|
wcscpy( params.szInfo, params32->szInfo );
|
||||||
|
params.uTimeout = params32->uTimeout;
|
||||||
|
params.dwInfoFlags = params32->dwInfoFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
params.guidItem = params32->guidItem;
|
||||||
|
params.hBalloonIcon = UlongToHandle( params32->hBalloonIcon );
|
||||||
|
|
||||||
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, type, ansi );
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NtUserMessageCall( hwnd, msg, wparam, lparam, result_info, type, ansi );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return message_call_32to64( hwnd, msg, wparam, lparam, result_info, type, ansi );
|
return message_call_32to64( hwnd, msg, wparam, lparam, result_info, type, ansi );
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <wingdi.h>
|
#include <wingdi.h>
|
||||||
#include <imm.h>
|
#include <imm.h>
|
||||||
#include <immdev.h>
|
#include <immdev.h>
|
||||||
|
#include <shellapi.h>
|
||||||
#include <winternl.h>
|
#include <winternl.h>
|
||||||
|
|
||||||
#ifndef W32KAPI
|
#ifndef W32KAPI
|
||||||
|
@ -314,6 +315,7 @@ enum
|
||||||
NtUserSpyEnter = 0x0303,
|
NtUserSpyEnter = 0x0303,
|
||||||
NtUserSpyExit = 0x0304,
|
NtUserSpyExit = 0x0304,
|
||||||
NtUserImeDriverCall = 0x0305,
|
NtUserImeDriverCall = 0x0305,
|
||||||
|
NtUserSystemTrayCall = 0x0306,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* NtUserThunkedMenuItemInfo codes */
|
/* NtUserThunkedMenuItemInfo codes */
|
||||||
|
@ -519,6 +521,13 @@ struct ime_driver_call_params
|
||||||
COMPOSITIONSTRING *compstr;
|
COMPOSITIONSTRING *compstr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* NtUserSystemTrayCall calls */
|
||||||
|
enum wine_systray_call
|
||||||
|
{
|
||||||
|
WINE_SYSTRAY_NOTIFY_ICON,
|
||||||
|
WINE_SYSTRAY_CLEANUP_ICONS,
|
||||||
|
};
|
||||||
|
|
||||||
#define WM_SYSTIMER 0x0118
|
#define WM_SYSTIMER 0x0118
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "winternl.h"
|
#include "winternl.h"
|
||||||
#include "ntuser.h"
|
#include "ntuser.h"
|
||||||
#include "immdev.h"
|
#include "immdev.h"
|
||||||
|
#include "shellapi.h"
|
||||||
#include "ddk/d3dkmthk.h"
|
#include "ddk/d3dkmthk.h"
|
||||||
#include "kbd.h"
|
#include "kbd.h"
|
||||||
#include "wine/list.h"
|
#include "wine/list.h"
|
||||||
|
@ -305,6 +306,9 @@ struct user_driver_funcs
|
||||||
BOOL (*pGetCursorPos)(LPPOINT);
|
BOOL (*pGetCursorPos)(LPPOINT);
|
||||||
BOOL (*pSetCursorPos)(INT,INT);
|
BOOL (*pSetCursorPos)(INT,INT);
|
||||||
BOOL (*pClipCursor)(const RECT*,BOOL);
|
BOOL (*pClipCursor)(const RECT*,BOOL);
|
||||||
|
/* notify icon functions */
|
||||||
|
LRESULT (*pNotifyIcon)(HWND,UINT,NOTIFYICONDATAW *);
|
||||||
|
void (*pCleanupIcons)(HWND);
|
||||||
/* clipboard functions */
|
/* clipboard functions */
|
||||||
LRESULT (*pClipboardWindowProc)(HWND,UINT,WPARAM,LPARAM);
|
LRESULT (*pClipboardWindowProc)(HWND,UINT,WPARAM,LPARAM);
|
||||||
void (*pUpdateClipboard)(void);
|
void (*pUpdateClipboard)(void);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <ntuser.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
|
@ -627,16 +628,14 @@ static BOOL delete_icon( struct icon *icon )
|
||||||
/* cleanup icons belonging to a window that has been destroyed */
|
/* cleanup icons belonging to a window that has been destroyed */
|
||||||
static void cleanup_systray_window( HWND hwnd )
|
static void cleanup_systray_window( HWND hwnd )
|
||||||
{
|
{
|
||||||
|
NOTIFYICONDATAW nid = {.cbSize = sizeof(nid), .hWnd = hwnd};
|
||||||
struct icon *icon, *next;
|
struct icon *icon, *next;
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE( icon, next, &icon_list, struct icon, entry )
|
LIST_FOR_EACH_ENTRY_SAFE( icon, next, &icon_list, struct icon, entry )
|
||||||
if (icon->owner == hwnd) delete_icon( icon );
|
if (icon->owner == hwnd) delete_icon( icon );
|
||||||
|
|
||||||
if (wine_notify_icon)
|
NtUserMessageCall( hwnd, WINE_SYSTRAY_CLEANUP_ICONS, 0, 0, NULL, NtUserSystemTrayCall, FALSE );
|
||||||
{
|
if (wine_notify_icon) wine_notify_icon( 0xdead, &nid );
|
||||||
NOTIFYICONDATAW nid = { sizeof(nid), hwnd };
|
|
||||||
wine_notify_icon( 0xdead, &nid );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update the taskbar buttons when something changed */
|
/* update the taskbar buttons when something changed */
|
||||||
|
@ -732,11 +731,11 @@ static BOOL handle_incoming(HWND hwndSource, COPYDATASTRUCT *cds)
|
||||||
/* try forwarding to the display driver first */
|
/* try forwarding to the display driver first */
|
||||||
if (cds->dwData == NIM_ADD || !(icon = get_icon( nid.hWnd, nid.uID )))
|
if (cds->dwData == NIM_ADD || !(icon = get_icon( nid.hWnd, nid.uID )))
|
||||||
{
|
{
|
||||||
|
if ((ret = NtUserMessageCall( hwndSource, WINE_SYSTRAY_NOTIFY_ICON, cds->dwData, 0,
|
||||||
|
&nid, NtUserSystemTrayCall, FALSE )) != -1)
|
||||||
|
goto done;
|
||||||
if (wine_notify_icon && ((ret = wine_notify_icon( cds->dwData, &nid )) != -1))
|
if (wine_notify_icon && ((ret = wine_notify_icon( cds->dwData, &nid )) != -1))
|
||||||
{
|
goto done;
|
||||||
if (nid.hIcon) DestroyIcon( nid.hIcon );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,6 +762,7 @@ static BOOL handle_incoming(HWND hwndSource, COPYDATASTRUCT *cds)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
if (nid.hIcon) DestroyIcon( nid.hIcon );
|
if (nid.hIcon) DestroyIcon( nid.hIcon );
|
||||||
sync_taskbar_buttons();
|
sync_taskbar_buttons();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Reference in a new issue