Commit f689e3fc authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

shell32: Move systray handling to the explorer process.

parent 0199b441
......@@ -1158,7 +1158,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
InitCommonControlsEx(NULL);
SIC_Initialize();
SYSTRAY_Init();
InitChangeNotifications();
break;
......
......@@ -126,9 +126,6 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
(((kst)&(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_COPY :\
DROPEFFECT_MOVE))
/* Systray */
BOOL SYSTRAY_Init(void);
HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
......
......@@ -4,10 +4,11 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = explorer.exe
APPMODE = -mwindows
IMPORTS = user32 kernel32
IMPORTS = user32 gdi32 advapi32 kernel32
C_SRCS = \
explorer.c
explorer.c \
systray.c
@MAKE_PROG_RULES@
......
/*
* explorer.exe
*
* Copyright 2004 CodeWeavers, Mike Hearn
* Copyright 2005,2006 CodeWeavers, Aric Stewart
*
* This library is free software; you can redistribute it and/or
......@@ -21,8 +22,17 @@
#include <windows.h>
#include <ctype.h>
#include <wine/debug.h>
#include <systray.h>
WINE_DEFAULT_DEBUG_CHANNEL(explorer);
unsigned int shell_refs = 0;
typedef struct parametersTAG {
BOOL explorer_mode;
BOOL systray_mode;
WCHAR root[MAX_PATH];
WCHAR selection[MAX_PATH];
} parameters_struct;
......@@ -128,6 +138,11 @@ static void ParseCommandLine(LPSTR commandline,parameters_struct *parameters)
CopyPathRoot(parameters->root,
parameters->selection);
}
else if (strncmp(p,"systray",7)==0)
{
parameters->systray_mode = TRUE;
p+=7;
}
p2 = p;
p = strchr(p,'/');
}
......@@ -138,6 +153,44 @@ static void ParseCommandLine(LPSTR commandline,parameters_struct *parameters)
}
}
static void do_systray_loop(void)
{
initialize_systray();
while (TRUE)
{
const int timeout = 5;
MSG message;
DWORD res;
res = MsgWaitForMultipleObjectsEx(0, NULL, shell_refs ? INFINITE : timeout * 1000,
QS_ALLINPUT, MWMO_WAITALL);
if (res == WAIT_TIMEOUT) break;
res = PeekMessage(&message, 0, 0, 0, PM_REMOVE);
if (!res) continue;
if (message.message == WM_QUIT)
{
WINE_FIXME("Somebody sent the shell a WM_QUIT message, should we reboot?");
/* Sending the tray window a WM_QUIT message is actually a
* tip given by some programming websites as a way of
* forcing a reboot! let's delay implementing this hack
* until we find a program that really needs it. for now
* just bail out.
*/
break;
}
TranslateMessage(&message);
DispatchMessage(&message);
}
shutdown_systray();
}
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE previnstance,
LPSTR cmdline,
......@@ -157,8 +210,13 @@ int WINAPI WinMain(HINSTANCE hinstance,
ParseCommandLine(cmdline,&parameters);
len = lstrlenW(winefile) +1;
if (parameters.selection[0])
if (parameters.systray_mode)
{
do_systray_loop();
return 0;
}
else if (parameters.selection[0])
{
len += lstrlenW(parameters.selection) + 2;
winefile_commandline = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
......@@ -191,7 +249,7 @@ int WINAPI WinMain(HINSTANCE hinstance,
parameters.root, &si, &info);
HeapFree(GetProcessHeap(),0,winefile_commandline);
if (!rc)
return 0;
......
/*
* Copyright (C) 2004 Mike Hearn, for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
void initialize_systray(void);
void shutdown_systray(void);
/* when this drops to zero, a few seconds later the shell will shut down */
extern unsigned int shell_refs;
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