Author: dquintana Date: Wed May 21 11:38:29 2014 New Revision: 63397
URL: http://svn.reactos.org/svn/reactos?rev=63397&view=rev Log: [BROWSEUI] * Improve the message loop to allow processing of accelerators.
[SHELL32] * Return the accelerator to the shell browser if the view doesn't handle it.
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp branches/shell-experiments/dll/win32/shell32/shlview.cpp
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Wed May 21 11:38:29 2014 @@ -2528,7 +2528,7 @@
HRESULT STDMETHODCALLTYPE CShellBrowser::v_MayTranslateAccelerator(MSG *pmsg) { - return E_NOTIMPL; + return fCurrentShellView->TranslateAcceleratorW(pmsg); }
HRESULT STDMETHODCALLTYPE CShellBrowser::_GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor) @@ -3272,56 +3272,59 @@ return 0; }
-//static LRESULT CALLBACK ExplorerWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -//{ -// return DefWindowProc(hwnd, uMsg, wParam, lParam); -//} - -static void ExplorerMessageLoop() -{ +static HRESULT ExplorerMessageLoop(IEThreadParamBlock * parameters) +{ + CComPtr<IShellBrowser> shellBrowser; + CComObject<CShellBrowser> *theCabinet; + HRESULT hResult; MSG Msg; BOOL Ret;
- while (1) - { - Ret = (GetMessage(&Msg, NULL, 0, 0) != 0); - - if (Ret != -1) + OleInitialize(NULL); + + ATLTRY(theCabinet = new CComObject<CShellBrowser>); + if (theCabinet == NULL) + { + hResult = E_OUTOFMEMORY; + goto uninitialize; + } + + hResult = theCabinet->QueryInterface(IID_PPV_ARG(IShellBrowser, &shellBrowser)); + if (FAILED(hResult)) + { + delete theCabinet; + goto uninitialize; + } + + hResult = theCabinet->Initialize(parameters->directoryPIDL, 0, 0, 0); + if (FAILED(hResult)) + goto uninitialize; + + while (Ret = GetMessage(&Msg, NULL, 0, 0)) + { + if (Ret == -1) { - if (!Ret) - break; - + // Error: continue or exit? + break; + } + + if (theCabinet->v_MayTranslateAccelerator(&Msg) != S_OK) + { TranslateMessage(&Msg); DispatchMessage(&Msg); - - if (Msg.message == WM_QUIT) - break; } - } + + if (Msg.message == WM_QUIT) + break; + } + +uninitialize: + OleUninitialize(); + return hResult; }
DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter) { - CComPtr<IShellBrowser> shellBrowser; - CComObject<CShellBrowser> *theCabinet; - IEThreadParamBlock *parameters; - HRESULT hResult; - - parameters = (IEThreadParamBlock *)lpThreadParameter; - OleInitialize(NULL); - ATLTRY (theCabinet = new CComObject<CShellBrowser>); - if (theCabinet == NULL) - return E_OUTOFMEMORY; - hResult = theCabinet->QueryInterface(IID_PPV_ARG(IShellBrowser, &shellBrowser)); - if (FAILED(hResult)) - { - delete theCabinet; - return hResult; - } - hResult = theCabinet->Initialize(parameters->directoryPIDL, 0, 0, 0); - if (FAILED(hResult)) - return hResult; - ExplorerMessageLoop(); - OleUninitialize(); - return 0; -} + IEThreadParamBlock * parameters = (IEThreadParamBlock *) lpThreadParameter; + return ExplorerMessageLoop(parameters); +}
Modified: branches/shell-experiments/dll/win32/shell32/shlview.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/shel... ============================================================================== --- branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] Wed May 21 11:38:29 2014 @@ -1925,6 +1925,8 @@
/* FIXME: should call TranslateAcceleratorSB */
+ return m_pShellBrowser->TranslateAcceleratorSB(lpmsg, 0); + TRACE("-- key=0x04%lx\n", lpmsg->wParam) ; }