(resend)systray: keep systray hidden when requested by moving itoff screen

Dmitry Timoshkov dmitry at codeweavers.com
Tue Aug 26 21:52:49 CDT 2008


"Aric Stewart" <aric at codeweavers.com> wrote:

> diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c
> index 8b82d9a..4a7e57e 100644
> --- a/programs/explorer/systray.c
> +++ b/programs/explorer/systray.c
> @@ -437,6 +437,19 @@ static LRESULT WINAPI tray_wndproc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
>     case WM_COPYDATA:
>         return handle_incoming((HWND)wparam, (COPYDATASTRUCT *)lparam);
> 
> +    case WM_DISPLAYCHANGE:
> +        if (hide_systray)
> +        {
> +            int offscreen;
> +            SIZE size;
> +            size = get_window_size();
> +            offscreen = GetSystemMetrics(SM_XVIRTUALSCREEN);
> +            offscreen += GetSystemMetrics(SM_CXVIRTUALSCREEN);
> +            offscreen += 20;
> +            MoveWindow(tray_window, offscreen, -500, size.cx, size.cy, TRUE);
> +        }
> +        break;
> +
>     case WM_TIMER:
>         cleanup_destroyed_windows();
>         break;
> @@ -568,5 +581,15 @@ void initialize_systray(void)
>         WINE_ERR("Could not create tray window\n");
>         return;
>     }
> +
> +    if (hide_systray)
> +    {
> +        int offscreen;
> +        offscreen = GetSystemMetrics(SM_XVIRTUALSCREEN);
> +        offscreen += GetSystemMetrics(SM_CXVIRTUALSCREEN);
> +        offscreen += 20;
> +        MoveWindow(tray_window, offscreen, -500, size.cx, size.cy, TRUE);
> +    }
> +    
>     SetTimer( tray_window, 1, 2000, NULL );
> }

Why not add a function do_hide_systray() and call it unconditionally
from both places?

do_hide_systray()
{
if (!hide_systray) return;
[hide systray]
}

That would help keeping the code coherent if somebody changes one of places
later.

-- 
Dmitry.



More information about the wine-devel mailing list