import the lean explorer branch into the new repository Added: branches/lean-explorer/ Added: branches/lean-explorer/Make-rosshell-MinGW Added: branches/lean-explorer/Make-rosshell.mak Added: branches/lean-explorer/Makefile Added: branches/lean-explorer/Makefile-MinGW Added: branches/lean-explorer/Makefile-precomp Added: branches/lean-explorer/desktop/ Added: branches/lean-explorer/desktop/desktop.cpp Added: branches/lean-explorer/desktop/desktop.h Added: branches/lean-explorer/dialogs/ Added: branches/lean-explorer/dialogs/settings.cpp Added: branches/lean-explorer/dialogs/settings.h Added: branches/lean-explorer/explorer-jp.rc Added: branches/lean-explorer/explorer.cpp Added: branches/lean-explorer/explorer.dsp Added: branches/lean-explorer/explorer.dsw Added: branches/lean-explorer/explorer.h Added: branches/lean-explorer/explorer.rc Added: branches/lean-explorer/explorer_intres.h Added: branches/lean-explorer/explorer_intres.rc Added: branches/lean-explorer/externals.h Added: branches/lean-explorer/globals.h Added: branches/lean-explorer/make_explorer.dsp Added: branches/lean-explorer/make_rosshell.dsp Added: branches/lean-explorer/precomp.cpp Added: branches/lean-explorer/precomp.h Added: branches/lean-explorer/readme.txt Added: branches/lean-explorer/res/ Added: branches/lean-explorer/res/action.ico Added: branches/lean-explorer/res/appicon.ico Added: branches/lean-explorer/res/apps.ico Added: branches/lean-explorer/res/arrow.ico Added: branches/lean-explorer/res/arrow_dwn.ico Added: branches/lean-explorer/res/arrow_up.ico Added: branches/lean-explorer/res/arrowsel.ico Added: branches/lean-explorer/res/computer.ico Added: branches/lean-explorer/res/config.ico Added: branches/lean-explorer/res/documents.ico Added: branches/lean-explorer/res/explorer.ico Added: branches/lean-explorer/res/favorites.ico Added: branches/lean-explorer/res/floating.ico Added: branches/lean-explorer/res/folder.ico Added: branches/lean-explorer/res/info.ico Added: branches/lean-explorer/res/logoff.ico Added: branches/lean-explorer/res/logov.bmp Added: branches/lean-explorer/res/logov16.bmp Added: branches/lean-explorer/res/logov256.bmp Added: branches/lean-explorer/res/network.ico Added: branches/lean-explorer/res/printer.ico Added: branches/lean-explorer/res/reactos.ico Added: branches/lean-explorer/res/ros-big.ico Added: branches/lean-explorer/res/search-doc.ico Added: branches/lean-explorer/res/search.ico Added: branches/lean-explorer/res/startmenu.ico Added: branches/lean-explorer/res/toolbar.bmp Added: branches/lean-explorer/rosshell.dsp Added: branches/lean-explorer/rosshell.dsw Added: branches/lean-explorer/shell/ Added: branches/lean-explorer/shell/entries.cpp Added: branches/lean-explorer/shell/entries.h Added: branches/lean-explorer/shell/mainframe.cpp Added: branches/lean-explorer/shell/mainframe.h Added: branches/lean-explorer/shell/shellbrowser.cpp Added: branches/lean-explorer/shell/shellbrowser.h Added: branches/lean-explorer/shell/shellfs.cpp Added: branches/lean-explorer/shell/startup.c Added: branches/lean-explorer/taskbar/ Added: branches/lean-explorer/taskbar/desktopbar.cpp Added: branches/lean-explorer/taskbar/desktopbar.h Added: branches/lean-explorer/taskbar/quicklaunch.cpp Added: branches/lean-explorer/taskbar/quicklaunch.h Added: branches/lean-explorer/taskbar/startmenu.cpp Added: branches/lean-explorer/taskbar/startmenu.h Added: branches/lean-explorer/taskbar/taskbar.cpp Added: branches/lean-explorer/taskbar/taskbar.h Added: branches/lean-explorer/taskbar/traynotify.cpp Added: branches/lean-explorer/taskbar/traynotify.h Added: branches/lean-explorer/utility/ Added: branches/lean-explorer/utility/dragdropimpl.cpp Added: branches/lean-explorer/utility/dragdropimpl.h Added: branches/lean-explorer/utility/shellbrowserimpl.cpp Added: branches/lean-explorer/utility/shellbrowserimpl.h Added: branches/lean-explorer/utility/shellclasses.cpp Added: branches/lean-explorer/utility/shellclasses.h Added: branches/lean-explorer/utility/treedroptarget.h Added: branches/lean-explorer/utility/utility.cpp Added: branches/lean-explorer/utility/utility.h Added: branches/lean-explorer/utility/window.cpp Added: branches/lean-explorer/utility/window.h Property changes on: branches/lean-explorer ___________________________________________________________________ Name: svn:ignore + *.coff *.exe *.d *.o *.sym *.map bin Debug Release DRelease UDebug URelease _NO_COMUTIL doxy-doc *.ncb *.opt *.aps *.ncb *.plg *.suo buildno.h *.gch _____
Added: branches/lean-explorer/Make-rosshell-MinGW --- branches/lean-explorer/Make-rosshell-MinGW 2006-01-29 15:12:24 UTC (rev 32) +++ branches/lean-explorer/Make-rosshell-MinGW 2006-01-29 15:13:23 UTC (rev 33) @@ -0,0 +1,82 @@
+# +# ReactOS lean shell +# +# Make-rosshell.MinGW +# +# MinGW Makefile with precompiled header support +# + +CC = gcc +CXX = g++ +LINK = g++ + +CFLAGS = -DWIN32 -DROSSHELL -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -fexceptions -Wall -I. +RCFLAGS = -DWIN32 -DROSSHELL -D__WINDRES__ +LFLAGS = -Wl,--subsystem,windows + +ifdef DEBUG +CFLAGS += -D_DEBUG -g +RCFLAGS += -D_DEBUG +LFLAGS += -g +else +CFLAGS += -DNDEBUG -Os -D_NO_CONTEXT +RCFLAGS += -DNDEBUG +LFLAGS += -s +endif + +ifndef UNICODE +UNICODE = 1 +endif + +ifeq ($(UNICODE),1) +CFLAGS += -DUNICODE +# LFLAGS+= -Wl,--entry,_wWinMain@16 +endif + +CXXFLAGS = $(CFLAGS) + +EXEC_SUFFIX = .exe +RES_SUFFIX = .coff + +VPATH = shell utility taskbar desktop dialogs + +PROGRAM = rosshell + +TARGET = $(PROGRAM)$(EXEC_SUFFIX) + +OBJECTS = \ + startup.o \ + shellclasses.o \ + utility.o \ + window.o \ + dragdropimpl.o \ + shellbrowserimpl.o \ + explorer.o \ + entries.o \ + shellfs.o \ + desktop.o \ + desktopbar.o \ + taskbar.o \ + startmenu.o \ + traynotify.o \ + quicklaunch.o \ + settings.o + +LIBS = gdi32 comctl32 ole32 uuid + +all: precomp.h.gch $(TARGET) + +precomp.h.gch: *.h utility/*.h shell/*.h desktop/*.h + $(CXX) $(CFLAGS) precomp.h + +$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) + $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) + +$(PROGRAM)$(RES_SUFFIX): explorer_intres.rc res/*.bmp res/*.ico + windres $(RCFLAGS) -o $@ explorer_intres.rc + +clean: + rm -f $(TARGET) $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) precomp.h.gch \ + desktop/*.o dialogs/*.o shell/*.o taskbar/*.o utility/*.o + +ever: _____
Added: branches/lean-explorer/Make-rosshell.mak --- branches/lean-explorer/Make-rosshell.mak 2006-01-29 15:12:24 UTC (rev 32) +++ branches/lean-explorer/Make-rosshell.mak 2006-01-29 15:13:23 UTC (rev 33) @@ -0,0 +1,147 @@
+# +# ReactOS lean shell +# +# Makefile +# + +# Windows is default host environment +ifeq ($(HOST),) +HOST = mingw32-windows +endif + +ifeq ($(HOST),mingw32-linux) +CC = mingw32-gcc +CXX = mingw32-g++ +LINK = mingw32-g++ +RC = mingw32-windres +CD_PREFIX := ./ +PREFIX = mingw32- +EXE_POSTFIX := +EXE_PREFIX := ./ +endif + +ifeq ($(HOST),mingw32-windows) +CC = gcc +CXX = g++ +LINK = g++ +RC = windres +CD_PREFIX := +PREFIX = +EXE_PREFIX := +EXE_POSTFIX := .exe +endif + +PATH_TO_TOP = ../../.. +TOOLS_PATH = $(PATH_TO_TOP)/tools + +ifndef UNICODE +UNICODE = 1 +endif + +CFLAGS = -I./ -DWIN32 -D_ROS_ -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -fexceptions -Wall +RCFLAGS = -DWIN32 -D_ROS_ -D__WINDRES__ +LFLAGS = -Wl,--subsystem,windows + +ifdef DEBUG +CFLAGS += -D_DEBUG -g +RCFLAGS += -D_DEBUG +LFLAGS += -g +else +CFLAGS += -DNDEBUG -Os -D_NO_CONTEXT +RCFLAGS += -DNDEBUG +LFLAGS += -s +endif + +ifeq ($(UNICODE),1) +CFLAGS += -DUNICODE +# LFLAGS+= -Wl,--entry,_wWinMain@16 +RCFLAGS += -DUNICODE +endif + +CXXFLAGS = $(CFLAGS) + +EXEC_SUFFIX = .exe +RES_SUFFIX = .coff + +VPATH = shell utility taskbar desktop dialogs + +PROGRAM = rosshell + +TARGET = $(PROGRAM)$(EXEC_SUFFIX) + +OBJECTS = \ + startup.o \ + shellclasses.o \ + utility.o \ + window.o \ + dragdropimpl.o \ + shellbrowserimpl.o \ + explorer.o \ + entries.o \ + shellfs.o \ + desktop.o \ + desktopbar.o \ + taskbar.o \ + startmenu.o \ + traynotify.o \ + quicklaunch.o \ + settings.o + +LIBS = gdi32 comctl32 ole32 uuid + +.PHONY: all depends implib clean install dist bootcd depends + +all: $(TARGET) + +ever: + +$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) + $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) + +$(PROGRAM)$(RES_SUFFIX): explorer_intres.rc res/*.bmp res/*.ico + $(RC) $(RCFLAGS) -o $@ explorer_intres.rc + +clean: + $(TOOLS_PATH)/rdel $(TARGET) $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) \ + desktop/*.o dialogs/*.o shell/*.o taskbar/*.o utility/*.o + +# Use environment var ROS_INSTALL to override default install dir +ifneq ($(ROS_INSTALL),) +INSTALL_DIR = $(ROS_INSTALL) +else +ifeq ($(HOST),mingw32-windows) +INSTALL_DIR = C:/reactos +else +INSTALL_DIR = $(PATH_TO_TOP)/reactos +endif +endif + +implib: + +install: + -$(TOOLS_PATH)/rcopy $(TARGET) $(INSTALL_DIR)/$(TARGET) + +bootcd: + + +# dependency scanning + +DEP_FILTERED := $(filter-out $(DEP_EXCLUDE_FILTER), $(OBJECTS:.o=.d)) +DEP_FILES := $(join $(dir $(DEP_FILTERED)), $(addprefix ., $(notdir $(DEP_FILTERED)))) + +ifneq ($(MAKECMDGOALS),clean) +-include $(DEP_FILES) +endif + +ifeq ($(HOST),mingw32-windows) +DEPENDS_EXE := ......\tools\depends +else +DEPENDS_EXE := $(TOOLS_PATH)/depends +endif + +.%.d: %.c $(PATH_TO_TOP)/tools/depends$(EXE_POSTFIX) + $(CC) $(CFLAGS) -M $< | $(DEPENDS_EXE) $(@D) $@ + +.%.d: %.cpp $(PATH_TO_TOP)/tools/depends$(EXE_POSTFIX) + $(CC) $(CFLAGS) -M $< | $(DEPENDS_EXE) $(@D) $@ + _____
Added: branches/lean-explorer/Makefile --- branches/lean-explorer/Makefile 2006-01-29 15:12:24 UTC (rev 32) +++ branches/lean-explorer/Makefile 2006-01-29 15:13:23 UTC (rev 33) @@ -0,0 +1,149 @@
+# +# ReactOS lean shell +# +# Makefile +# + +# Windows is default host environment +ifeq ($(HOST),) +HOST = mingw32-windows +endif + +ifeq ($(HOST),mingw32-linux) +CC = mingw32-gcc +CXX = mingw32-g++ +LINK = mingw32-g++ +RC = mingw32-windres +CD_PREFIX := ./ +PREFIX = mingw32- +EXE_POSTFIX := +EXE_PREFIX := ./ +endif + +ifeq ($(HOST),mingw32-windows) +CC = gcc +CXX = g++ +LINK = g++ +RC = windres +CD_PREFIX := +PREFIX = +EXE_PREFIX := +EXE_POSTFIX := .exe +endif + +PATH_TO_TOP = ../../.. +TOOLS_PATH = $(PATH_TO_TOP)/tools + +ifndef UNICODE +UNICODE = 1 +endif + +CFLAGS = -I./ -DWIN32 -D_ROS_ -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -fexceptions -Wall +RCFLAGS = -DWIN32 -D_ROS_ -D__WINDRES__ +LFLAGS = -Wl,--subsystem,windows + +ifdef DEBUG +CFLAGS += -D_DEBUG -g +RCFLAGS += -D_DEBUG +LFLAGS += -g +else +CFLAGS += -DNDEBUG -Os -D_NO_CONTEXT +RCFLAGS += -DNDEBUG +LFLAGS += -s +endif + +ifeq ($(UNICODE),1) +CFLAGS += -DUNICODE +# LFLAGS+= -Wl,--entry,_wWinMain@16 +RCFLAGS += -DUNICODE +endif + +CXXFLAGS = $(CFLAGS) + +EXEC_SUFFIX = .exe +RES_SUFFIX = .coff + +VPATH = shell utility taskbar desktop dialogs + +PROGRAM = explorer + +TARGET = $(PROGRAM)$(EXEC_SUFFIX) + +OBJECTS = \ + startup.o \ + shellclasses.o \ + utility.o \ + window.o \ + dragdropimpl.o \ + shellbrowserimpl.o \ + explorer.o \ + entries.o \ + shellfs.o \ + mainframe.o \ + shellbrowser.o \ + desktop.o \ + desktopbar.o \ + taskbar.o \ + startmenu.o \ + traynotify.o \ + quicklaunch.o \ + settings.o + +LIBS = gdi32 comctl32 ole32 uuid + +.PHONY: all depends implib clean install dist bootcd depends + +all: $(TARGET) + +ever: + +$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) + $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) + +explorer$(RES_SUFFIX): explorer_intres.rc res/*.bmp res/*.ico + $(RC) $(RCFLAGS) -o $@ explorer_intres.rc + +clean: + $(TOOLS_PATH)/rdel $(TARGET) $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) \ + desktop/*.o dialogs/*.o shell/*.o taskbar/*.o utility/*.o + +# Use environment var ROS_INSTALL to override default install dir +ifneq ($(ROS_INSTALL),) +INSTALL_DIR = $(ROS_INSTALL) +else +ifeq ($(HOST),mingw32-windows) +INSTALL_DIR = C:/reactos +else +INSTALL_DIR = $(PATH_TO_TOP)/reactos +endif +endif + +implib: + +install: + -$(TOOLS_PATH)/rcopy $(TARGET) $(INSTALL_DIR)/$(TARGET) + +bootcd: + + +# dependency scanning + +DEP_FILTERED := $(filter-out $(DEP_EXCLUDE_FILTER), $(OBJECTS:.o=.d)) +DEP_FILES := $(join $(dir $(DEP_FILTERED)), $(addprefix ., $(notdir $(DEP_FILTERED)))) + +ifneq ($(MAKECMDGOALS),clean) +-include $(DEP_FILES) +endif + +ifeq ($(HOST),mingw32-windows) +DEPENDS_EXE := ......\tools\depends +else +DEPENDS_EXE := $(TOOLS_PATH)/depends +endif + +.%.d: %.c $(PATH_TO_TOP)/tools/depends$(EXE_POSTFIX) + $(CC) $(CFLAGS) -M $< | $(DEPENDS_EXE) $(@D) $@ + +.%.d: %.cpp $(PATH_TO_TOP)/tools/depends$(EXE_POSTFIX) + $(CC) $(CFLAGS) -M $< | $(DEPENDS_EXE) $(@D) $@ + Property changes on: branches/lean-explorer/Makefile ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____
Added: branches/lean-explorer/Makefile-MinGW --- branches/lean-explorer/Makefile-MinGW 2006-01-29 15:12:24 UTC (rev 32) +++ branches/lean-explorer/Makefile-MinGW 2006-01-29 15:13:23 UTC (rev 33) @@ -0,0 +1,80 @@
+# +# ReactOS lean explorer +# +# Makefile-MinGW +# + +CC = gcc +CXX = g++ +LINK = g++ + +CFLAGS = -DWIN32 -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -fexceptions -Wall -I. +RCFLAGS = -DWIN32 -D__WINDRES__ +LFLAGS = -Wl,--subsystem,windows + +ifdef DEBUG +CFLAGS += -D_DEBUG -g +RCFLAGS += -D_DEBUG +LFLAGS += -g +else +CFLAGS += -DNDEBUG -Os -D_NO_CONTEXT +RCFLAGS += -DNDEBUG +LFLAGS += -s +endif + +ifndef UNICODE +UNICODE = 1 +endif + +ifeq ($(UNICODE),1) +CFLAGS += -DUNICODE +# LFLAGS+= -Wl,--entry,_wWinMain@16 +RCFLAGS += -DUNICODE +endif + +CXXFLAGS = $(CFLAGS) + +EXEC_SUFFIX = .exe +RES_SUFFIX = .coff + +VPATH = shell utility taskbar desktop dialogs + +PROGRAM = explorer + +TARGET = $(PROGRAM)$(EXEC_SUFFIX) + +OBJECTS = \ + startup.o \ + shellclasses.o \ + utility.o \ + window.o \ + dragdropimpl.o \ + shellbrowserimpl.o \ + explorer.o \ + entries.o \ + shellfs.o \ + mainframe.o \ + shellbrowser.o \ + desktop.o \ + desktopbar.o \ + taskbar.o \ + startmenu.o \ + traynotify.o \ + quicklaunch.o \ + settings.o + +LIBS = gdi32 comctl32 ole32 uuid + +all: $(TARGET) + +$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) + $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) + +$(PROGRAM)$(RES_SUFFIX): $(PROGRAM)_intres.rc res/*.bmp res/*.ico + windres $(RCFLAGS) -o $@ $(PROGRAM)_intres.rc + +clean: + rm -f $(TARGET) $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) \ + desktop/*.o dialogs/*.o shell/*.o taskbar/*.o utility/*.o + +ever: Property changes on: branches/lean-explorer/Makefile-MinGW ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____
Added: branches/lean-explorer/Makefile-precomp --- branches/lean-explorer/Makefile-precomp 2006-01-29 15:12:24 UTC (rev 32) +++ branches/lean-explorer/Makefile-precomp 2006-01-29 15:13:23 UTC (rev 33) @@ -0,0 +1,84 @@
+# +# ReactOS lean explorer +# +# Makefile-precomp +# +# MinGW Makefile with precompiled header support +# + +CC = gcc +CXX = g++ +LINK = g++ + +CFLAGS = -DWIN32 -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -fexceptions -Wall -I. +RCFLAGS = -DWIN32 -D__WINDRES__ +LFLAGS = -Wl,--subsystem,windows + +ifdef DEBUG +CFLAGS += -D_DEBUG -g +RCFLAGS += -D_DEBUG +LFLAGS += -g +else +CFLAGS += -DNDEBUG -Os -D_NO_CONTEXT +RCFLAGS += -DNDEBUG +LFLAGS += -s +endif + +ifndef UNICODE +UNICODE = 1 +endif + +ifeq ($(UNICODE),1) +CFLAGS += -DUNICODE +# LFLAGS+= -Wl,--entry,_wWinMain@16 +endif + +CXXFLAGS = $(CFLAGS) + +EXEC_SUFFIX = .exe +RES_SUFFIX = .coff + +VPATH = shell utility taskbar desktop dialogs + +PROGRAM = explorer + +TARGET = $(PROGRAM)$(EXEC_SUFFIX) + +OBJECTS = \ + startup.o \ + shellclasses.o \ + utility.o \ + window.o \ + dragdropimpl.o \ + shellbrowserimpl.o \ + explorer.o \ + entries.o \ + shellfs.o \ + mainframe.o \ + shellbrowser.o \ + desktop.o \ + desktopbar.o \ + taskbar.o \ + startmenu.o \ + traynotify.o \ + quicklaunch.o \ + settings.o + +LIBS = gdi32 comctl32 ole32 uuid + +all: precomp.h.gch $(TARGET) + +precomp.h.gch: *.h utility/*.h shell/*.h desktop/*.h + $(CXX) $(CFLAGS) precomp.h + +$(TARGET): $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) + $(LINK) $(LFLAGS) -o $@ $^ $(addprefix -l,$(LIBS)) + +$(PROGRAM)$(RES_SUFFIX): explorer_intres.rc res/*.bmp res/*.ico + windres $(RCFLAGS) -o $@ explorer_intres.rc + +clean: + rm -f $(TARGET) $(OBJECTS) $(PROGRAM)$(RES_SUFFIX) precomp.h.gch \ + desktop/*.o dialogs/*.o shell/*.o taskbar/*.o utility/*.o + +ever: Property changes on: branches/lean-explorer/Makefile-precomp ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____
Added: branches/lean-explorer/desktop/desktop.cpp --- branches/lean-explorer/desktop/desktop.cpp 2006-01-29 15:12:24 UTC (rev 32) +++ branches/lean-explorer/desktop/desktop.cpp 2006-01-29 15:13:23 UTC (rev 33) @@ -0,0 +1,558 @@
+/* + * Copyright 2003, 2004, 2005 Martin Fuchs + * + * 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 + */ + + + // + // Explorer clone, lean version + // + // desktop.cpp + // + // Martin Fuchs, 09.08.2003 + // + + +#include "precomp.h" + +#include "../taskbar/desktopbar.h" +#include "../taskbar/taskbar.h" // for PM_GET_LAST_ACTIVE + +#include "../explorer_intres.h" + + +static BOOL (WINAPI*SetShellWindow)(HWND); +static BOOL (WINAPI*SetShellWindowEx)(HWND, HWND); + + +Desktops::Desktops() + : _current_desktop(0) +{ +} + +Desktops::~Desktops() +{ + // show all hidden windows + for(iterator it_dsk=begin(); it_dsk!=end(); ++it_dsk) + for(WindowSet::iterator it=it_dsk->_windows.begin(); it!=it_dsk->_windows.end(); ++it) + ShowWindowAsync(*it, SW_SHOW); +} + +void Desktops::init() +{ + resize(DESKTOP_COUNT); +} + +static BOOL CALLBACK SwitchDesktopEnumFct(HWND hwnd, LPARAM lparam) +{ + WindowSet& windows = *(WindowSet*)lparam; + + if (IsWindowVisible(hwnd)) + if (hwnd!=g_Globals._hwndDesktopBar && hwnd!=g_Globals._hwndDesktop) + windows.insert(hwnd); + + return TRUE; +} + +void Desktops::SwitchToDesktop(int idx) +{ + if (_current_desktop == idx) + return; + + Desktop& old_desktop = (*this)[_current_desktop]; + WindowSet& windows = old_desktop._windows; + Desktop& desktop = (*this)[idx]; + + windows.clear(); + + // collect window handles of all other desktops + WindowSet other_wnds; + for(const_iterator it1=begin(); it1!=end(); ++it1) + for(WindowSet::const_iterator it2=it1->_windows.begin(); it2!=it1->_windows.end(); ++it2) + other_wnds.insert(*it2); + + // save currently visible application windows + EnumWindows(SwitchDesktopEnumFct, (LPARAM)&windows); + + old_desktop._hwndForeground = (HWND)SendMessage(g_Globals._hwndDesktopBar, PM_GET_LAST_ACTIVE, 0, 0); + + // hide all windows of the previous desktop + for(WindowSet::iterator it=windows.begin(); it!=windows.end(); ++it) + ShowWindowAsync(*it, SW_HIDE); + + // show all windows of the new desktop + for(WindowSet::iterator it=desktop._windows.begin(); it!=desktop._windows.end(); ++it) + ShowWindowAsync(*it, SW_SHOW); + + if (desktop._hwndForeground) + SetForegroundWindow(desktop._hwndForeground); + + // remove the window handles of the other desktops from what we found on the previous desktop + for(WindowSet::const_iterator it=other_wnds.begin(); it!=other_wnds.end(); ++it) + windows.erase(*it); + + // We don't need to store the window handles of what's now visible the now current desktop. + desktop._windows.clear(); + + _current_desktop = idx; +} + + +static BOOL CALLBACK MinimizeDesktopEnumFct(HWND hwnd, LPARAM lparam) +{ + list<MinimizeStruct>& minimized = *(list<MinimizeStruct>*)lparam; + + if (IsWindowVisible(hwnd)) + if (hwnd!=g_Globals._hwndDesktopBar && hwnd!=g_Globals._hwndDesktop) + if (!IsIconic(hwnd)) { + minimized.push_back(MinimizeStruct(hwnd, GetWindowStyle(hwnd))); + ShowWindowAsync(hwnd, SW_MINIMIZE); + } + + return TRUE; +} + + /// minimize/restore all windows on the desktop +void Desktops::ToggleMinimize() +{ + list<MinimizeStruct>& minimized = (*this)[_current_desktop]._minimized; + + if (minimized.empty()) { + EnumWindows(MinimizeDesktopEnumFct, (LPARAM)&minimized); + } else { + for(list<MinimizeStruct>::const_iterator it=minimized.begin(); it!=minimized.end(); ++it) + ShowWindowAsync(it->first, it->second&WS_MAXIMIZE? SW_MAXIMIZE: SW_RESTORE); + + minimized.clear(); + } +} + + +BOOL IsAnyDesktopRunning() +{ + HINSTANCE hUser32 = GetModuleHandle(TEXT("user32")); + + SetShellWindow = (BOOL(WINAPI*)(HWND)) GetProcAddress(hUser32, "SetShellWindow"); + SetShellWindowEx = (BOOL(WINAPI*)(HWND,HWND)) GetProcAddress(hUser32, "SetShellWindowEx"); + + return GetShellWindow() != 0; +} + + +BackgroundWindow::BackgroundWindow(HWND hwnd) + : super(hwnd) +{ + // set background brush for the short moment of displaying the + // background color while moving foreground windows + SetClassLong(hwnd, GCL_HBRBACKGROUND, COLOR_BACKGROUND+1); + + _display_version = RegGetDWORDValue(HKEY_CURRENT_USER, TEXT("Control Panel\Desktop"), TEXT("PaintDesktopVersion"), 1); +} + +LRESULT BackgroundWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + switch(nmsg) { + case WM_ERASEBKGND: + DrawDesktopBkgnd((HDC)wparam); + return TRUE; + + case WM_MBUTTONDBLCLK: + explorer_show_frame(SW_SHOWNORMAL); + break; + + case PM_DISPLAY_VERSION: + if (lparam || wparam) { + DWORD or_mask = wparam; + DWORD reset_mask = LOWORD(lparam); + DWORD xor_mask = HIWORD(lparam); + _display_version = ((_display_version&~reset_mask) | or_mask) ^ xor_mask; + InvalidateRect(_hwnd, NULL, TRUE); + } + return _display_version; + + default: + return super::WndProc(nmsg, wparam, lparam); + } + + return 0; +} + +void BackgroundWindow::DrawDesktopBkgnd(HDC hdc) +{ + PaintDesktop(hdc); + +/* special solid background + HBRUSH bkgndBrush = CreateSolidBrush(RGB(0,32,160)); // dark blue + FillRect(hdc, &rect, bkgndBrush); + DeleteBrush(bkgndBrush); +*/ + if (_display_version) { + static const String s_bkgnd_txt = ResString(IDS_EXPLORER_VERSION_STR) + TEXT("\nby Martin Fuchs"); + + FmtString txt(s_bkgnd_txt, (LPCTSTR)ResString(IDS_VERSION_STR)); + ClientRect rect(_hwnd); + + rect.left = rect.right - 280; + rect.top = rect.bottom - 80 - DESKTOPBARBAR_HEIGHT; + rect.right = rect.left + 250; + rect.bottom = rect.top + 40; + + BkMode bkMode(hdc, TRANSPARENT); + + TextColor textColor(hdc, RGB(128,128,192)); + DrawText(hdc, txt, -1, &rect, DT_RIGHT); + + SetTextColor(hdc, RGB(255,255,255)); + --rect.right; + ++rect.top; + DrawText(hdc, txt, -1, &rect, DT_RIGHT); + } +} + + +DesktopWindow::DesktopWindow(HWND hwnd) + : super(hwnd) +{ + _pShellView = NULL; +} + +DesktopWindow::~DesktopWindow() +{ + if (_pShellView) + _pShellView->Release(); +} + + +HWND DesktopWindow::Create() +{ + static IconWindowClass wcDesktop(TEXT("Progman"), IDI_REACTOS, CS_DBLCLKS); + /* (disabled because of small ugly temporary artefacts when hiding start menu) + wcDesktop.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+1); */ + + int width = GetSystemMetrics(SM_CXSCREEN); + int height = GetSystemMetrics(SM_CYSCREEN); + + HWND hwndDesktop = Window::Create(WINDOW_CREATOR(DesktopWindow), + WS_EX_TOOLWINDOW, wcDesktop, TEXT("Program Manager"), WS_POPUP|WS_VISIBLE|WS_CLIPCHILDREN, + 0, 0, width, height, 0); + + // work around to display desktop bar in Wine + ShowWindow(GET_WINDOW(DesktopWindow, hwndDesktop)->_desktopBar, SW_SHOW); + + // work around for Windows NT, Win 98, ... + // Without this the desktop has mysteriously only a size of 800x600 pixels. + MoveWindow(hwndDesktop, 0, 0, width, height, TRUE); + + return hwndDesktop; +} + + +LRESULT DesktopWindow::Init(LPCREATESTRUCT pcs) +{ + if (super::Init(pcs)) + return 1; + + HRESULT hr = GetDesktopFolder()->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView); +/* also possible: + SFV_CREATE sfv_create; + + sfv_create.cbSize = sizeof(SFV_CREATE); + sfv_create.pshf = GetDesktopFolder(); + sfv_create.psvOuter = NULL; + sfv_create.psfvcb = NULL; + + HRESULT hr = SHCreateShellFolderView(&sfv_create, &_pShellView); +*/ + HWND hWndView = 0; + + if (SUCCEEDED(hr)) { + FOLDERSETTINGS fs; + + fs.ViewMode = FVM_ICON; + fs.fFlags = FWF_DESKTOP|FWF_NOCLIENTEDGE|FWF_NOSCROLL|FWF_BESTFITWINDOW|FWF_SNAPTOGR ID; //|FWF_AUTOARRANGE; + + ClientRect rect(_hwnd); + + hr = _pShellView->CreateViewWindow(NULL, &fs, this, &rect, &hWndView); + + ///@todo use IShellBrowser::GetViewStateStream() to restore previous view state -> see SHOpenRegStream() + + if (SUCCEEDED(hr)) { + g_Globals._hwndShellView = hWndView; + + // subclass shellview window + new DesktopShellView(hWndView, _pShellView); + + _pShellView->UIActivate(SVUIA_ACTIVATE_FOCUS); + + /* + IShellView2* pShellView2; + + hr = _pShellView->QueryInterface(IID_IShellView2, (void**)&pShellView2); + + SV2CVW2_PARAMS params; + params.cbSize = sizeof(SV2CVW2_PARAMS); + params.psvPrev = _pShellView; + params.pfs = &fs; + params.psbOwner = this; + params.prcView = ▭ + params.pvid = params.pvid;//@@ + + hr = pShellView2->CreateViewWindow2(¶ms); + params.pvid; + */ + + /* + IFolderView* pFolderView; + + hr = _pShellView->QueryInterface(IID_IFolderView, (void**)&pFolderView); + + if (SUCCEEDED(hr)) { + hr = pFolderView->GetAutoArrange(); + hr = pFolderView->SetCurrentViewMode(FVM_DETAILS); + } + */ + } + } + + if (hWndView && SetShellWindowEx) + SetShellWindowEx(_hwnd, hWndView); + else if (SetShellWindow) + SetShellWindow(_hwnd); + + // create the explorer bar + _desktopBar = DesktopBar::Create(); + g_Globals._hwndDesktopBar = _desktopBar; + + return 0; +} + + +LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) +{ + switch(nmsg) { + case WM_LBUTTONDBLCLK: + case WM_RBUTTONDBLCLK: + case WM_MBUTTONDBLCLK: + explorer_show_frame(SW_SHOWNORMAL); + break; + + case WM_GETISHELLBROWSER: + return (LRESULT)static_cast<IShellBrowser*>(this); + + case WM_DESTROY: + + ///@todo use IShellBrowser::GetViewStateStream() and _pShellView->SaveViewState() to store view state + + if (SetShellWindow) + SetShellWindow(0); + break; + + case WM_CLOSE: + ShowExitWindowsDialog(_hwnd); + break; + + case WM_SYSCOMMAND: + if (wparam == SC_TASKLIST) { + if (_desktopBar) + SendMessage(_desktopBar, nmsg, wparam, lparam); + } + goto def; + + default: def: + return super::WndProc(nmsg, wparam, lparam); + } + + return 0; +} + + +HRESULT DesktopWindow::OnDefaultCommand(LPIDA pida) +{ +#ifndef ROSSHELL // in shell-only-mode fall through and let shell32 handle the command [truncated at 1000 lines; 18435 more skipped]