Author: gadamopoulos
Date: Thu Dec 4 17:30:44 2014
New Revision: 65557
URL:
http://svn.reactos.org/svn/reactos?rev=65557&view=rev
Log:
[SHELL32]
- Implement handling accelerators for CDesktopBrowser. The only noticeable difference is
that pressing alt+f4 in the desktop doesn't close it.
See issue #8864 for more details.
Modified:
trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp
trunk/reactos/dll/win32/shell32/shell32.rc
trunk/reactos/dll/win32/shell32/shresdef.h
Modified: trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDesktop…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CDesktopBrowser.cpp [iso-8859-1] Thu Dec 4 17:30:44
2014
@@ -35,6 +35,7 @@
{
public:
DWORD Tag;
+ HACCEL m_hAccel;
private:
HWND hWnd;
HWND hWndShellView;
@@ -44,6 +45,9 @@
CComPtr<IShellBrowser> DefaultShellBrowser;
LPITEMIDLIST pidlDesktopDirectory;
LPITEMIDLIST pidlDesktop;
+
+ LRESULT CDesktopBrowser::_NotifyTray(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
public:
CDesktopBrowser();
~CDesktopBrowser();
@@ -51,8 +55,9 @@
HWND FindDesktopListView ();
BOOL CreateDeskWnd();
HWND DesktopGetWindowControl(IN UINT id);
+ LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM
wParam, IN LPARAM lParam);
- static BOOL MessageLoop();
+ BOOL MessageLoop();
// *** IOleWindow methods ***
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
@@ -252,7 +257,9 @@
HRESULT STDMETHODCALLTYPE CDesktopBrowser::TranslateAcceleratorSB(LPMSG lpmsg, WORD wID)
{
- return S_FALSE;
+ if (!::TranslateAcceleratorW(hWnd, m_hAccel, lpmsg))
+ return S_FALSE;
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CDesktopBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags)
@@ -370,12 +377,50 @@
{
if (bRet != -1)
{
- TranslateMessage(&Msg);
- DispatchMessageW(&Msg);
+ if (DesktopView->TranslateAcceleratorW(&Msg) != S_OK)
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
}
}
return TRUE;
+}
+
+#define TWM_DOEXITWINDOWS (WM_USER + 342)
+#define TWM_CYCLEFOCUS (WM_USER + 348)
+
+LRESULT CDesktopBrowser::_NotifyTray(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ HWND hwndTray;
+ HRESULT hres;
+
+ hres = this->ShellDesk->GetTrayWindow(&hwndTray);
+
+ if (SUCCEEDED(hres))
+ PostMessageW(hwndTray, uMsg, wParam, lParam);
+
+ return 0;
+}
+
+LRESULT CDesktopBrowser::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (LOWORD(wParam))
+ {
+ case FCIDM_DESKBROWSER_CLOSE:
+ return _NotifyTray(TWM_DOEXITWINDOWS, 0, 0);
+ case FCIDM_DESKBROWSER_FOCUS:
+ if (GetKeyState(VK_SHIFT))
+ return _NotifyTray(TWM_CYCLEFOCUS, 1, 0xFFFFFFFF);
+ else
+ return _NotifyTray(TWM_CYCLEFOCUS, 1, 1);
+ case FCIDM_DESKBROWSER_SEARCH:
+ SHFindFiles(NULL, NULL);
+ break;
+ case FCIDM_DESKBROWSER_REFRESH:
+ break;
+ }
}
LRESULT CALLBACK CDesktopBrowser::ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM
wParam, IN LPARAM lParam)
@@ -445,6 +490,9 @@
if (!pThis->CreateDeskWnd())
WARN("Could not create the desktop view control!\n");
+
+ pThis->m_hAccel = LoadAcceleratorsW(shell32_hInstance,
MAKEINTRESOURCEW(3));
+
break;
}
@@ -476,6 +524,8 @@
SHOnCWMCommandLine((HANDLE)lParam);
break;
+ case WM_COMMAND:
+ return pThis->OnCommand(uMsg, wParam, lParam);
default:
DefMsgHandler:
Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam);
Modified: trunk/reactos/dll/win32/shell32/shell32.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32.…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shell32.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shell32.rc [iso-8859-1] Thu Dec 4 17:30:44 2014
@@ -54,6 +54,17 @@
shv_accel ACCELERATORS
BEGIN
VK_F5, FCIDM_SHVIEW_REFRESH, VIRTKEY
+END
+
+IDA_DESKBROWSER ACCELERATORS
+BEGIN
+ //"s", 34172, ALT
+ VK_F4, FCIDM_DESKBROWSER_CLOSE, VIRTKEY, ALT
+ VK_F6, FCIDM_DESKBROWSER_FOCUS, VIRTKEY
+ VK_TAB, FCIDM_DESKBROWSER_FOCUS, VIRTKEY
+ VK_TAB, FCIDM_DESKBROWSER_FOCUS, VIRTKEY, SHIFT
+ VK_F3, FCIDM_DESKBROWSER_SEARCH, VIRTKEY
+ VK_F5, FCIDM_DESKBROWSER_REFRESH, VIRTKEY
END
/*
Modified: trunk/reactos/dll/win32/shell32/shresdef.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shresdef…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shresdef.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shresdef.h [iso-8859-1] Thu Dec 4 17:30:44 2014
@@ -22,6 +22,7 @@
/* Accelerators */
#define IDA_SHELLVIEW 1
+#define IDA_DESKBROWSER 3
/* Bitmaps */
#define IDB_REACTOS 131
@@ -485,6 +486,12 @@
#define IDR_AVI_FILENUKE 163
#define IDR_AVI_FILEDELETE 164
+/* Desktop Browser commands */
+#define FCIDM_DESKBROWSER_CLOSE 0xA004
+#define FCIDM_DESKBROWSER_FOCUS 0xA030
+#define FCIDM_DESKBROWSER_SEARCH 0xA085
+#define FCIDM_DESKBROWSER_REFRESH 0xA220
+
/* Shell view commands */
#define FCIDM_SHVIEW_ARRANGE 0x7001
#define FCIDM_SHVIEW_DELETE 0x7011