Commit 5e7a8f4d authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

explorer: Don't activate the systray icon when showing it.

Fixes a regression introduced by 62c6646d, because SetParent will unconditionally activate the window, causing newly added icons to deactivate the foreground window. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent 26498d93
...@@ -543,6 +543,15 @@ static LRESULT WINAPI tray_icon_wndproc( HWND hwnd, UINT msg, WPARAM wparam, LPA ...@@ -543,6 +543,15 @@ static LRESULT WINAPI tray_icon_wndproc( HWND hwnd, UINT msg, WPARAM wparam, LPA
break; break;
} }
case WM_WINDOWPOSCHANGING:
if (icon->display == ICON_DISPLAY_HIDDEN)
{
/* Changing the icon's parent via SetParent would activate it, stealing the focus. */
WINDOWPOS *wp = (WINDOWPOS*)lparam;
wp->flags |= SWP_NOACTIVATE;
}
break;
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGED:
update_systray_balloon_position(); update_systray_balloon_position();
break; break;
...@@ -566,9 +575,9 @@ static void systray_add_icon( struct icon *icon ) ...@@ -566,9 +575,9 @@ static void systray_add_icon( struct icon *icon )
if (icon->display != ICON_DISPLAY_HIDDEN) return; /* already added */ 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 ); SetWindowLongW( icon->window, GWL_STYLE, GetWindowLongW( icon->window, GWL_STYLE ) | WS_CHILD );
SetParent( icon->window, tray_window ); SetParent( icon->window, tray_window );
icon->display = nb_displayed++;
pos = get_icon_pos( icon ); pos = get_icon_pos( icon );
SetWindowPos( icon->window, 0, pos.x, pos.y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW ); SetWindowPos( icon->window, 0, pos.x, pos.y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
......
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