Module: wine Branch: master Commit: 9f774ada6c4f5b1bd3ac56bd47f342758028e97a URL: http://source.winehq.org/git/wine.git/?a=commit;h=9f774ada6c4f5b1bd3ac56bd47...
Author: Roman Pisl rpisl@seznam.cz Date: Mon Oct 10 16:35:39 2016 +0200
winex11: Implement NIM_SETVERSION.
Signed-off-by: Roman Pisl rpisl@seznam.cz Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winex11.drv/systray.c | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c index c7e7013..794f2c6 100644 --- a/dlls/winex11.drv/systray.c +++ b/dlls/winex11.drv/systray.c @@ -65,6 +65,7 @@ struct tray_icon UINT info_flags; /* flags for info balloon */ UINT info_timeout; /* timeout for info balloon */ HICON info_icon; /* info balloon icon */ + UINT version; /* notify icon api version */ };
static struct list icon_list = LIST_INIT( icon_list ); @@ -484,15 +485,37 @@ static LRESULT WINAPI tray_icon_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR case WM_LBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_MBUTTONDBLCLK: - /* notify the owner hwnd of the message */ - TRACE("relaying 0x%x\n", msg); - ret = PostMessageW(icon->owner, icon->callback_message, icon->id, msg); - if (!ret && (GetLastError() == ERROR_INVALID_WINDOW_HANDLE)) { - WARN( "application window was destroyed, removing icon %u\n", icon->id ); - delete_icon( icon ); + WPARAM wpar; + BOOL oldver; + + oldver = icon->version <= NOTIFY_VERSION; + if (oldver) { + /* 0 up to NOTIFYICON_VERSION (=3) */ + wpar = icon->id; + } else { + /* NOTIFYICON_VERSION_4 */ + RECT rect; + WORD x, y; + + GetWindowRect( icon->window, &rect ); + x = rect.left + LOWORD(lparam); + y = rect.top + HIWORD(lparam); + wpar = MAKEWPARAM(x, y); + } + + /* notify the owner hwnd of the message */ + TRACE("relaying 0x%x\n", msg); + ret = PostMessageW(icon->owner, icon->callback_message, wpar, + oldver ? msg : MAKELPARAM(msg, icon->id)); + + if (!ret && (GetLastError() == ERROR_INVALID_WINDOW_HANDLE)) + { + WARN( "application window was destroyed, removing icon %u\n", icon->id ); + delete_icon( icon ); + } + return 0; } - return 0;
case WM_WINDOWPOSCHANGED: update_systray_balloon_position(); @@ -834,6 +857,13 @@ int CDECL wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data ) case NIM_MODIFY: if ((icon = get_icon( data->hWnd, data->uID ))) ret = modify_icon( icon, data ); break; + case NIM_SETVERSION: + if ((icon = get_icon( data->hWnd, data->uID ))) + { + icon->version = data->u.uVersion; + ret = TRUE; + } + break; case 0xdead: /* Wine extension: owner window has died */ cleanup_icons( data->hWnd ); break;