mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:54:13 +00:00
explorer: Cleanup system tray icons when their owner is destroyed instead of polling.
This commit is contained in:
parent
7c538cddeb
commit
aceec41e93
3 changed files with 21 additions and 15 deletions
|
@ -529,6 +529,10 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR
|
||||||
SystemParametersInfoW( SPI_SETDESKWALLPAPER, 0, NULL, FALSE );
|
SystemParametersInfoW( SPI_SETDESKWALLPAPER, 0, NULL, FALSE );
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case WM_PARENTNOTIFY:
|
||||||
|
if (LOWORD(wp) == WM_DESTROY) cleanup_systray_window( (HWND)lp );
|
||||||
|
return 0;
|
||||||
|
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
if (!using_root)
|
if (!using_root)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,10 +21,11 @@
|
||||||
#ifndef __WINE_EXPLORER_PRIVATE_H
|
#ifndef __WINE_EXPLORER_PRIVATE_H
|
||||||
#define __WINE_EXPLORER_PRIVATE_H
|
#define __WINE_EXPLORER_PRIVATE_H
|
||||||
|
|
||||||
extern void manage_desktop( WCHAR *arg );
|
extern void manage_desktop( WCHAR *arg ) DECLSPEC_HIDDEN;
|
||||||
extern void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL enable_shell );
|
extern void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL enable_shell ) DECLSPEC_HIDDEN;
|
||||||
extern void initialize_appbar(void);
|
extern void initialize_appbar(void) DECLSPEC_HIDDEN;
|
||||||
extern void do_startmenu( HWND owner );
|
extern void cleanup_systray_window( HWND hwnd ) DECLSPEC_HIDDEN;
|
||||||
extern LRESULT menu_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
extern void do_startmenu( HWND owner ) DECLSPEC_HIDDEN;
|
||||||
|
extern LRESULT menu_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
#endif /* __WINE_EXPLORER_PRIVATE_H */
|
#endif /* __WINE_EXPLORER_PRIVATE_H */
|
||||||
|
|
|
@ -97,11 +97,9 @@ static HWND start_button;
|
||||||
#define MIN_DISPLAYED 8
|
#define MIN_DISPLAYED 8
|
||||||
#define ICON_BORDER 2
|
#define ICON_BORDER 2
|
||||||
|
|
||||||
#define VALID_WIN_TIMER 1
|
#define BALLOON_CREATE_TIMER 1
|
||||||
#define BALLOON_CREATE_TIMER 2
|
#define BALLOON_SHOW_TIMER 2
|
||||||
#define BALLOON_SHOW_TIMER 3
|
|
||||||
|
|
||||||
#define VALID_WIN_TIMEOUT 2000
|
|
||||||
#define BALLOON_CREATE_TIMEOUT 2000
|
#define BALLOON_CREATE_TIMEOUT 2000
|
||||||
#define BALLOON_SHOW_MIN_TIMEOUT 10000
|
#define BALLOON_SHOW_MIN_TIMEOUT 10000
|
||||||
#define BALLOON_SHOW_MAX_TIMEOUT 30000
|
#define BALLOON_SHOW_MAX_TIMEOUT 30000
|
||||||
|
@ -430,7 +428,6 @@ static BOOL add_icon(NOTIFYICONDATAW *nid)
|
||||||
icon->owner = nid->hWnd;
|
icon->owner = nid->hWnd;
|
||||||
icon->display = -1;
|
icon->display = -1;
|
||||||
|
|
||||||
if (list_empty( &icon_list )) SetTimer( tray_window, VALID_WIN_TIMER, VALID_WIN_TIMEOUT, NULL );
|
|
||||||
list_add_tail(&icon_list, &icon->entry);
|
list_add_tail(&icon_list, &icon->entry);
|
||||||
|
|
||||||
return modify_icon( icon, nid );
|
return modify_icon( icon, nid );
|
||||||
|
@ -443,17 +440,22 @@ static BOOL delete_icon(struct icon *icon)
|
||||||
list_remove(&icon->entry);
|
list_remove(&icon->entry);
|
||||||
DestroyIcon(icon->image);
|
DestroyIcon(icon->image);
|
||||||
HeapFree(GetProcessHeap(), 0, icon);
|
HeapFree(GetProcessHeap(), 0, icon);
|
||||||
if (list_empty( &icon_list )) KillTimer( tray_window, VALID_WIN_TIMER );
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup icons belonging to windows that have been destroyed */
|
/* cleanup icons belonging to a window that has been destroyed */
|
||||||
static void cleanup_destroyed_windows(void)
|
void cleanup_systray_window( 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 (!IsWindow( icon->owner )) delete_icon( icon );
|
if (icon->owner == hwnd) delete_icon( icon );
|
||||||
|
|
||||||
|
if (wine_notify_icon)
|
||||||
|
{
|
||||||
|
NOTIFYICONDATAW nid = { sizeof(nid), hwnd };
|
||||||
|
wine_notify_icon( 0xdead, &nid );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL handle_incoming(HWND hwndSource, COPYDATASTRUCT *cds)
|
static BOOL handle_incoming(HWND hwndSource, COPYDATASTRUCT *cds)
|
||||||
|
@ -561,7 +563,6 @@ static LRESULT WINAPI tray_wndproc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
switch (wparam)
|
switch (wparam)
|
||||||
{
|
{
|
||||||
case VALID_WIN_TIMER: cleanup_destroyed_windows(); break;
|
|
||||||
case BALLOON_CREATE_TIMER: balloon_create_timer(); break;
|
case BALLOON_CREATE_TIMER: balloon_create_timer(); break;
|
||||||
case BALLOON_SHOW_TIMER: balloon_timer(); break;
|
case BALLOON_SHOW_TIMER: balloon_timer(); break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue