[EXPLORER]

- Remove no longer needed special casing for __MINGW32__. Patch by Ivan Rodionov.
CORE-7335 #resolve #comment Thanks! Committed in r60733.

svn path=/trunk/; revision=60733
This commit is contained in:
Thomas Faber 2013-10-22 19:51:25 +00:00
parent 053591f6b4
commit 8efecdcf15
11 changed files with 3 additions and 143 deletions

View file

@ -5,7 +5,6 @@ set_cpp(WITH_RTTI WITH_EXCEPTIONS WITH_STL)
add_definitions(
-DWIN32
-D__MINGW32__
-D__WINDRES__)
#add_pch(explorer precomp.h)

View file

@ -69,9 +69,7 @@ ExplorerGlobals::ExplorerGlobals()
#endif
_log = NULL;
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
_SHRestricted = 0;
#endif
_hwndDesktopBar = 0;
_hwndShellView = 0;
_hwndDesktop = 0;
@ -81,11 +79,7 @@ ExplorerGlobals::ExplorerGlobals()
void ExplorerGlobals::init(HINSTANCE hInstance)
{
_hInstance = hInstance;
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
_SHRestricted = (DWORD(STDAPICALLTYPE*)(RESTRICTIONS)) GetProcAddress(GetModuleHandle(TEXT("SHELL32")), "SHRestricted");
#endif
_icon_cache.init();
}
@ -999,38 +993,6 @@ int explorer_main(HINSTANCE hInstance, LPTSTR lpCmdLine, int cmdShow)
}
// MinGW does not provide a Unicode startup routine, so we have to implement an own.
#if defined(__MINGW32__) && defined(UNICODE)
#define _tWinMain wWinMain
int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int);
int main(int argc, char* argv[])
{
CONTEXT("main");
STARTUPINFO startupinfo;
int nShowCmd = SW_SHOWNORMAL;
GetStartupInfo(&startupinfo);
if (startupinfo.dwFlags & STARTF_USESHOWWINDOW)
nShowCmd = startupinfo.wShowWindow;
LPWSTR cmdline = GetCommandLineW();
while(*cmdline && !_istspace((unsigned)*cmdline))
++cmdline;
while(_istspace((unsigned)*cmdline))
++cmdline;
return wWinMain(GetModuleHandle(NULL), 0, cmdline, nShowCmd);
}
#endif // __MINGW && UNICODE
static bool SetShellReadyEvent(LPCTSTR evtName)
{
HANDLE hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, evtName);

View file

@ -279,9 +279,7 @@ extern struct ExplorerGlobals
FILE* _log;
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
DWORD(STDAPICALLTYPE* _SHRestricted)(RESTRICTIONS);
#endif
FileTypeManager _ftype_mgr;
IconCache _icon_cache;

View file

@ -39,11 +39,7 @@ const LPCTSTR C_DRIVE = C_DRIVE_STR;
ShellBrowser::ShellBrowser(HWND hwnd, HWND hwndFrame, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
BrowserCallback* cb, CtxMenuInterfaces& cm_ifs)
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
: super(IID_IShellFolderViewCB),
#else
:
#endif
_hwnd(hwnd),
_hwndFrame(hwndFrame),
_left_hwnd(left_hwnd),
@ -449,7 +445,6 @@ void ShellBrowser::UpdateFolderView(IShellFolder* folder)
fs.fFlags = FWF_NOCLIENTEDGE|FWF_BESTFITWINDOW;
}
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
SFV_CREATE sfv_create;
sfv_create.cbSize = sizeof(SFV_CREATE);
@ -458,9 +453,6 @@ void ShellBrowser::UpdateFolderView(IShellFolder* folder)
sfv_create.psfvcb = this;
HRESULT hr = SHCreateShellFolderView(&sfv_create, &_pShellView);
#else
HRESULT hr = folder->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView);
#endif
if (FAILED(hr)) {
_pShellView = NULL;
@ -480,9 +472,6 @@ void ShellBrowser::UpdateFolderView(IShellFolder* folder)
_pShellView->UIActivate(SVUIA_ACTIVATE_NOFOCUS);
}
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
/// shell view callback
HRESULT STDMETHODCALLTYPE ShellBrowser::MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@ -495,8 +484,6 @@ HRESULT STDMETHODCALLTYPE ShellBrowser::MessageSFVCB(UINT uMsg, WPARAM wParam, L
return E_NOTIMPL;
}
#endif
HRESULT ShellBrowser::OnDefaultCommand(LPIDA pida)
{

View file

@ -57,10 +57,8 @@ struct BrowserCallback
/// Implementation of IShellBrowserImpl interface in explorer child windows
struct ShellBrowser : public IShellBrowserImpl
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
, public IComSrvBase<IShellFolderViewCB, ShellBrowser>, public SimpleComObject
#endif
struct ShellBrowser : public IShellBrowserImpl,
public IComSrvBase<IShellFolderViewCB, ShellBrowser>, public SimpleComObject
{
ShellBrowser(HWND hwnd, HWND hwndFrame, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
BrowserCallback* cb, CtxMenuInterfaces& cm_ifs);
@ -168,12 +166,10 @@ protected:
void InitializeTree();
bool InitDragDrop();
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
typedef IComSrvBase<IShellFolderViewCB, ShellBrowser> super;
// IShellFolderViewCB
virtual HRESULT STDMETHODCALLTYPE MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam);
#endif
map<int, int> _image_map;

View file

@ -114,9 +114,7 @@ LRESULT DesktopBar::Init(LPCREATESTRUCT pcs)
// create task bar
_hwndTaskBar = TaskBar::Create(_hwnd);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOTRAYITEMSDISPLAY))
#endif
// create tray notification area
_hwndNotify = NotifyArea::Create(_hwnd);

View file

@ -1560,9 +1560,7 @@ StartMenuRoot::StartMenuRoot(HWND hwnd, const StartMenuRootCreateInfo& info)
: super(hwnd, info._icon_size),
_hwndStartButton(0)
{
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCOMMONGROUPS))
#endif
try {
// insert directory "All Users\Start Menu"
ShellDirectory cmn_startmenu(GetDesktopFolder(), SpecialFolderPath(CSIDL_COMMON_STARTMENU, _hwnd), _hwnd);
@ -1706,34 +1704,12 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
AddSeparator();
#ifdef __MINGW32__
HKEY hkey, hkeyAdv;
DWORD value, len;
if (RegOpenKey(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"), &hkey))
hkey = 0;
if (RegOpenKey(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"), &hkeyAdv))
hkeyAdv = 0;
#define IS_VALUE_ZERO(hk, name) \
(!hk || (len=sizeof(value),RegQueryValueEx(hk, name, NULL, NULL, (LPBYTE)&value, &len) || !value))
#define IS_VALUE_NOT_ZERO(hk, name) \
(!hk || (len=sizeof(value),RegQueryValueEx(hk, name, NULL, NULL, (LPBYTE)&value, &len) || value>0))
#endif
// insert hard coded start entries
AddButton(ResString(IDS_PROGRAMS), ICID_APPS, true, IDC_PROGRAMS);
AddButton(ResString(IDS_DOCUMENTS), ICID_DOCUMENTS, true, IDC_DOCUMENTS);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NORECENTDOCSMENU))
#else
if (IS_VALUE_ZERO(hkey, _T("NoRecentDocsMenu")))
#endif
AddButton(ResString(IDS_RECENT), ICID_RECENT, true, IDC_RECENT);
AddButton(ResString(IDS_FAVORITES), ICID_FAVORITES, true, IDC_FAVORITES);
@ -1742,42 +1718,26 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
AddButton(ResString(IDS_BROWSE), ICID_FOLDER, true, IDC_BROWSE);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOFIND))
#else
if (IS_VALUE_ZERO(hkey, _T("NoFind")))
#endif
AddButton(ResString(IDS_SEARCH), ICID_SEARCH, true, IDC_SEARCH);
AddButton(ResString(IDS_START_HELP), ICID_INFO, false, IDC_START_HELP);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NORUN))
#else
if (IS_VALUE_ZERO(hkey, _T("NoRun")))
#endif
AddButton(ResString(IDS_LAUNCH), ICID_ACTION, false, IDC_LAUNCH);
AddSeparator();
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || SHRestricted(REST_STARTMENULOGOFF) != 1)
#else
if (IS_VALUE_NOT_ZERO(hkeyAdv, _T("StartMenuLogoff")))
#endif
AddButton(ResString(IDS_LOGOFF), ICID_LOGOFF, false, IDC_LOGOFF);
#ifdef __REACTOS__
AddButton(ResString(IDS_RESTART), ICID_RESTART, false, IDC_RESTART);
#endif
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCLOSE))
#else
if (IS_VALUE_ZERO(hkey, _T("NoClose")))
#endif
AddButton(ResString(IDS_SHUTDOWN), ICID_SHUTDOWN, false, IDC_SHUTDOWN);
#ifndef __REACTOS__
@ -1785,10 +1745,6 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs)
#endif
#ifdef __MINGW32__
RegCloseKey(hkeyAdv);
RegCloseKey(hkey);
#endif
#ifdef _LIGHT_STARTMENU
@ -2205,18 +2161,14 @@ void SettingsMenu::AddEntries()
AddButton(ResString(IDS_ADMIN), ICID_ADMIN, true, IDC_ADMIN);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
#endif
AddButton(ResString(IDS_SETTINGS_MENU), ICID_CONFIG, true, IDC_SETTINGS_MENU);
AddButton(ResString(IDS_SETTINGS_MENU), ICID_CONFIG, true, IDC_SETTINGS_MENU);
AddButton(ResString(IDS_DESKTOPBAR_SETTINGS), ICID_DESKSETTING, false, ID_DESKTOPBAR_SETTINGS);
AddButton(ResString(IDS_PRINTERS), ICID_PRINTER, false, IDC_PRINTERS);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NOCONTROLPANEL))
#endif
AddButton(ResString(IDS_CONTROL_PANEL), ICID_CONTROLPAN, false, IDC_CONTROL_PANEL);
}
@ -2224,9 +2176,7 @@ void BrowseMenu::AddEntries()
{
super::AddEntries();
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NONETHOOD)) // or REST_NOENTIRENETWORK ?
#endif
#if defined(ROSSHELL) || defined(__REACTOS__) // __REACTOS__ to be removed when printer/network will be implemented
AddButton(ResString(IDS_NETWORK), ICID_NETWORK, false, IDC_NETWORK);
#else
@ -2242,9 +2192,7 @@ void SearchMenu::AddEntries()
AddButton(ResString(IDS_SEARCH_FILES), ICID_SEARCH_DOC, false, IDC_SEARCH_FILES);
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_HASFINDCOMPUTERS))
#endif
AddButton(ResString(IDS_SEARCH_COMPUTER),ICID_COMPUTER, false, IDC_SEARCH_COMPUTER);
AddButton(ResString(IDS_SEARCH_PRG), ICID_APPS, false, IDC_SEARCH_PROGRAM);

View file

@ -133,7 +133,6 @@ LRESULT TaskBar::Init(LPCREATESTRUCT pcs)
//SetWindowFont(_htoolbar, GetStockFont(ANSI_VAR_FONT), FALSE);
//SendMessage(_htoolbar, TB_SETPADDING, 0, MAKELPARAM(8,8));
#ifndef __MINGW32__ // TBMETRICS missing in MinGW (as of 20.09.2005)
// set metrics for the Taskbar toolbar to enable button spacing
TBMETRICS metrics;
@ -145,7 +144,6 @@ LRESULT TaskBar::Init(LPCREATESTRUCT pcs)
metrics.cyButtonSpacing = 3;
SendMessage(_htoolbar, TB_SETMETRICS, 0, (LPARAM)&metrics);
#endif
_next_id = IDC_FIRST_APP;
@ -264,11 +262,9 @@ int TaskBar::Notify(int id, NMHDR* pnmh)
ActivateApp(it, false, false); // don't restore minimized windows on right button click
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
static DynamicFct<DWORD(STDAPICALLTYPE*)(RESTRICTIONS)> pSHRestricted(TEXT("SHELL32"), "SHRestricted");
if (pSHRestricted && !(*pSHRestricted)(REST_NOTRAYCONTEXTMENU))
#endif
ShowAppSystemMenu(it);
}
break;}

View file

@ -133,7 +133,6 @@ bool NotifyInfo::modify(NOTIFYICONDATA* pnid)
changes = true; ///@todo compare icon
}
#ifdef NIF_STATE // as of 21.08.2003 missing in MinGW headers
if (pnid->uFlags & NIF_STATE) {
DWORD new_state = (_dwState&~pnid->dwStateMask) | (pnid->dwState&pnid->dwStateMask);
@ -142,7 +141,6 @@ bool NotifyInfo::modify(NOTIFYICONDATA* pnid)
changes = true;
}
}
#endif
// store tool tip text
if (pnid->uFlags & NIF_TIP) {
@ -252,9 +250,7 @@ void NotifyArea::read_config()
// read notification icon settings from XML configuration
XMLPos cfg_pos = g_Globals.get_cfg();
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_HIDECLOCK))
#endif
{
if (cfg_pos.go_down("desktopbar")) {
clock_visible = XMLBoolRef(XMLPos(cfg_pos,"options"), "show-clock", !get_hide_clock_from_registry());
@ -609,12 +605,10 @@ LRESULT NotifyArea::ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pni
*/
bool changes = entry.modify(pnid);
#if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers
if (DetermineHideState(entry) && entry._mode==NIM_HIDE) {
entry._dwState |= NIS_HIDDEN;
changes = true;
}
#endif
if (changes)
UpdateIcons(); ///@todo call only if really changes occurred
@ -635,7 +629,6 @@ LRESULT NotifyArea::ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pni
}
break;}
#if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers
case NIM_SETFOCUS:
SetForegroundWindow(_hwnd);
return TRUE;
@ -648,7 +641,6 @@ LRESULT NotifyArea::ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pni
return TRUE;
} else
return FALSE;
#endif
}
return FALSE;
@ -662,9 +654,7 @@ void NotifyArea::UpdateIcons()
for(NotifyIconMap::const_iterator it=_icon_map.begin(); it!=_icon_map.end(); ++it) {
const NotifyInfo& entry = it->second;
#ifdef NIF_STATE // as of 21.08.2003 missing in MinGW headers
if (_show_hidden || !(entry._dwState & NIS_HIDDEN))
#endif
_sorted_icons.insert(entry);
}
@ -830,8 +820,6 @@ void NotifyIconConfig::create_name()
}
#if NOTIFYICON_VERSION>=3 // as of 21.08.2003 missing in MinGW headers
bool NotifyIconConfig::match(const NotifyIconConfig& props) const
{
if (!_tipText.empty() && !props._tipText.empty())
@ -873,7 +861,6 @@ bool NotifyArea::DetermineHideState(NotifyInfo& entry)
return false;
}
#endif
String string_from_mode(NOTIFYICONMODE mode)

View file

@ -483,20 +483,15 @@ SpecialFolderFSPath::SpecialFolderFSPath(int folder, HWND hwnd)
void CtxMenuInterfaces::reset()
{
_pctxmenu2 = NULL;
#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005)
_pctxmenu3 = NULL;
#endif
}
bool CtxMenuInterfaces::HandleMenuMsg(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005)
if (_pctxmenu3) {
if (SUCCEEDED(_pctxmenu3->HandleMenuMsg(nmsg, wparam, lparam)))
return true;
}
#endif
if (_pctxmenu2)
if (SUCCEEDED(_pctxmenu2->HandleMenuMsg(nmsg, wparam, lparam)))
@ -512,11 +507,9 @@ IContextMenu* CtxMenuInterfaces::query_interfaces(IContextMenu* pcm1)
reset();
// Get the higher version context menu interfaces.
#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005)
if (pcm1->QueryInterface(IID_IContextMenu3, (void**)&pcm) == NOERROR)
_pctxmenu3 = (LPCONTEXTMENU3)pcm;
else
#endif
if (pcm1->QueryInterface(IID_IContextMenu2, (void**)&pcm) == NOERROR)
_pctxmenu2 = (LPCONTEXTMENU2)pcm;

View file

@ -1114,9 +1114,7 @@ struct CtxMenuInterfaces
IContextMenu2* _pctxmenu2;
#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005)
IContextMenu3* _pctxmenu3;
#endif
};
template<typename BASE> struct ExtContextMenuHandlerT
@ -1151,7 +1149,6 @@ template<typename BASE> struct ExtContextMenuHandlerT
break;
#ifndef __MINGW32__ // IContextMenu3 missing in MinGW (as of 6.2.2005)
case WM_MENUCHAR: // only supported by IContextMenu3
if (_cm_ifs._pctxmenu3) {
LRESULT lResult = 0;
@ -1162,7 +1159,6 @@ template<typename BASE> struct ExtContextMenuHandlerT
}
return 0;
#endif
}
return super::WndProc(nmsg, wparam, lparam);