explorer: Added desktop option.

The /desktop option causes explorer to create and manage the desktop
window.
This commit is contained in:
Alexandre Julliard 2006-03-07 11:41:52 +01:00
parent bb84eaa98f
commit a93b6a5945
4 changed files with 115 additions and 2 deletions

View File

@ -7,6 +7,7 @@ APPMODE = -mwindows
IMPORTS = user32 gdi32 advapi32 kernel32 IMPORTS = user32 gdi32 advapi32 kernel32
C_SRCS = \ C_SRCS = \
desktop.c \
explorer.c \ explorer.c \
systray.c systray.c

View File

@ -0,0 +1,74 @@
/*
* Explorer desktop support
*
* Copyright 2006 Alexandre Julliard
*
* 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
*/
#include <windows.h>
#include <wine/debug.h>
#include "explorer_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(explorer);
#define DESKTOP_CLASS_ATOM MAKEINTATOMW(32769)
static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPARAM lp )
{
WINE_TRACE( "got msg %x wp %x lp %lx\n", message, wp, lp );
switch(message)
{
case WM_SYSCOMMAND:
if ((wp & 0xfff0) == SC_CLOSE) ExitWindows( 0, 0 );
break;
case WM_SETCURSOR:
return (LRESULT)SetCursor( LoadCursorA( 0, (LPSTR)IDC_ARROW ) );
case WM_NCHITTEST:
return HTCLIENT;
case WM_ERASEBKGND:
PaintDesktop( (HDC)wp );
return TRUE;
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint( hwnd, &ps );
if (ps.fErase) PaintDesktop( ps.hdc );
EndPaint( hwnd, &ps );
}
return 0;
}
return 0;
}
void manage_desktop(void)
{
MSG msg;
HWND hwnd = CreateWindowExW( 0, DESKTOP_CLASS_ATOM, NULL,
WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
0, 0, 0, NULL );
if (hwnd != GetDesktopWindow()) return; /* some other process beat us to it */
SetWindowLongPtrW( hwnd, GWLP_WNDPROC, (LONG_PTR)desktop_wnd_proc );
WINE_TRACE( "explorer starting on hwnd %p\n", hwnd );
while (GetMessageW( &msg, 0, 0, 0 )) DispatchMessageW( &msg );
WINE_TRACE( "explorer exiting for hwnd %p\n", hwnd );
}

View File

@ -23,7 +23,7 @@
#include <ctype.h> #include <ctype.h>
#include <wine/debug.h> #include <wine/debug.h>
#include "explorer_private.h"
#include <systray.h> #include <systray.h>
WINE_DEFAULT_DEBUG_CHANNEL(explorer); WINE_DEFAULT_DEBUG_CHANNEL(explorer);
@ -33,6 +33,7 @@ unsigned int shell_refs = 0;
typedef struct parametersTAG { typedef struct parametersTAG {
BOOL explorer_mode; BOOL explorer_mode;
BOOL systray_mode; BOOL systray_mode;
BOOL desktop_mode;
WCHAR root[MAX_PATH]; WCHAR root[MAX_PATH];
WCHAR selection[MAX_PATH]; WCHAR selection[MAX_PATH];
} parameters_struct; } parameters_struct;
@ -143,6 +144,11 @@ static void ParseCommandLine(LPSTR commandline,parameters_struct *parameters)
parameters->systray_mode = TRUE; parameters->systray_mode = TRUE;
p+=7; p+=7;
} }
else if (strncmp(p,"desktop",7)==0)
{
parameters->desktop_mode = TRUE;
p+=7;
}
p2 = p; p2 = p;
p = strchr(p,'/'); p = strchr(p,'/');
} }
@ -216,7 +222,13 @@ int WINAPI WinMain(HINSTANCE hinstance,
do_systray_loop(); do_systray_loop();
return 0; return 0;
} }
else if (parameters.selection[0]) if (parameters.desktop_mode)
{
manage_desktop();
return 0;
}
if (parameters.selection[0])
{ {
len += lstrlenW(parameters.selection) + 2; len += lstrlenW(parameters.selection) + 2;
winefile_commandline = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); winefile_commandline = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));

View File

@ -0,0 +1,26 @@
/*
* Explorer private definitions
*
* Copyright 2006 Alexandre Julliard
*
* 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
*/
#ifndef __WINE_EXPLORER_PRIVATE_H
#define __WINE_EXPLORER_PRIVATE_H
extern void manage_desktop(void);
#endif /* __WINE_EXPLORER_PRIVATE_H */