Alexandre Julliard : winex11: Cleanup system tray icons when their owner is destroyed instead of polling.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Mar 27 08:55:17 CDT 2015
Module: wine
Branch: master
Commit: 86748a8480d846c500c42e3e6f03e628111d4da6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=86748a8480d846c500c42e3e6f03e628111d4da6
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Mar 27 17:14:16 2015 +0900
winex11: Cleanup system tray icons when their owner is destroyed instead of polling.
---
dlls/winex11.drv/systray.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c
index a694610..c7e7013 100644
--- a/dlls/winex11.drv/systray.c
+++ b/dlls/winex11.drv/systray.c
@@ -85,11 +85,9 @@ Atom systray_atom = 0;
#define MIN_DISPLAYED 8
#define ICON_BORDER 2
-#define VALID_WIN_TIMER 1
-#define BALLOON_CREATE_TIMER 2
-#define BALLOON_SHOW_TIMER 3
+#define BALLOON_CREATE_TIMER 1
+#define BALLOON_SHOW_TIMER 2
-#define VALID_WIN_TIMEOUT 2000
#define BALLOON_CREATE_TIMEOUT 2000
#define BALLOON_SHOW_MIN_TIMEOUT 10000
#define BALLOON_SHOW_MAX_TIMEOUT 30000
@@ -453,10 +451,6 @@ static LRESULT WINAPI tray_icon_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
switch (msg)
{
- case WM_CREATE:
- SetTimer( hwnd, VALID_WIN_TIMER, VALID_WIN_TIMEOUT, NULL );
- break;
-
case WM_SIZE:
if (icon->window && icon->layered) repaint_tray_icon( icon );
break;
@@ -507,9 +501,6 @@ static LRESULT WINAPI tray_icon_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
case WM_TIMER:
switch (wparam)
{
- case VALID_WIN_TIMER:
- if (!IsWindow( icon->owner )) delete_icon( icon );
- break;
case BALLOON_CREATE_TIMER:
balloon_create_timer( icon );
break;
@@ -811,6 +802,15 @@ static BOOL delete_icon( struct tray_icon *icon )
return TRUE;
}
+/* cleanup all icons for a given window */
+static void cleanup_icons( HWND owner )
+{
+ struct tray_icon *this, *next;
+
+ LIST_FOR_EACH_ENTRY_SAFE( this, next, &icon_list, struct tray_icon, entry )
+ if (this->owner == owner) delete_icon( this );
+}
+
/***********************************************************************
* wine_notify_icon (X11DRV.@)
@@ -834,6 +834,9 @@ 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 0xdead: /* Wine extension: owner window has died */
+ cleanup_icons( data->hWnd );
+ break;
default:
FIXME( "unhandled tray message: %u\n", msg );
break;
More information about the wine-cvs
mailing list