mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 04:03:56 +00:00
[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. svn path=/trunk/; revision=65557
This commit is contained in:
parent
d1c24a9a68
commit
8492b3df2a
3 changed files with 72 additions and 4 deletions
|
@ -35,6 +35,7 @@ class CDesktopBrowser :
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DWORD Tag;
|
DWORD Tag;
|
||||||
|
HACCEL m_hAccel;
|
||||||
private:
|
private:
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
HWND hWndShellView;
|
HWND hWndShellView;
|
||||||
|
@ -44,6 +45,9 @@ private:
|
||||||
CComPtr<IShellBrowser> DefaultShellBrowser;
|
CComPtr<IShellBrowser> DefaultShellBrowser;
|
||||||
LPITEMIDLIST pidlDesktopDirectory;
|
LPITEMIDLIST pidlDesktopDirectory;
|
||||||
LPITEMIDLIST pidlDesktop;
|
LPITEMIDLIST pidlDesktop;
|
||||||
|
|
||||||
|
LRESULT CDesktopBrowser::_NotifyTray(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDesktopBrowser();
|
CDesktopBrowser();
|
||||||
~CDesktopBrowser();
|
~CDesktopBrowser();
|
||||||
|
@ -51,8 +55,9 @@ public:
|
||||||
HWND FindDesktopListView ();
|
HWND FindDesktopListView ();
|
||||||
BOOL CreateDeskWnd();
|
BOOL CreateDeskWnd();
|
||||||
HWND DesktopGetWindowControl(IN UINT id);
|
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 LRESULT CALLBACK ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam);
|
||||||
static BOOL MessageLoop();
|
BOOL MessageLoop();
|
||||||
|
|
||||||
// *** IOleWindow methods ***
|
// *** IOleWindow methods ***
|
||||||
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
|
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
|
||||||
|
@ -252,7 +257,9 @@ HRESULT STDMETHODCALLTYPE CDesktopBrowser::EnableModelessSB(BOOL fEnable)
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CDesktopBrowser::TranslateAcceleratorSB(LPMSG lpmsg, WORD wID)
|
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)
|
HRESULT STDMETHODCALLTYPE CDesktopBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags)
|
||||||
|
@ -370,14 +377,52 @@ BOOL CDesktopBrowser::MessageLoop()
|
||||||
{
|
{
|
||||||
if (bRet != -1)
|
if (bRet != -1)
|
||||||
{
|
{
|
||||||
TranslateMessage(&Msg);
|
if (DesktopView->TranslateAcceleratorW(&Msg) != S_OK)
|
||||||
DispatchMessageW(&Msg);
|
{
|
||||||
|
TranslateMessage(&Msg);
|
||||||
|
DispatchMessage(&Msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
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)
|
LRESULT CALLBACK CDesktopBrowser::ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
|
||||||
{
|
{
|
||||||
CDesktopBrowser *pThis = NULL;
|
CDesktopBrowser *pThis = NULL;
|
||||||
|
@ -445,6 +490,9 @@ LRESULT CALLBACK CDesktopBrowser::ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg,
|
||||||
|
|
||||||
if (!pThis->CreateDeskWnd())
|
if (!pThis->CreateDeskWnd())
|
||||||
WARN("Could not create the desktop view control!\n");
|
WARN("Could not create the desktop view control!\n");
|
||||||
|
|
||||||
|
pThis->m_hAccel = LoadAcceleratorsW(shell32_hInstance, MAKEINTRESOURCEW(3));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,6 +524,8 @@ LRESULT CALLBACK CDesktopBrowser::ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg,
|
||||||
SHOnCWMCommandLine((HANDLE)lParam);
|
SHOnCWMCommandLine((HANDLE)lParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
return pThis->OnCommand(uMsg, wParam, lParam);
|
||||||
default:
|
default:
|
||||||
DefMsgHandler:
|
DefMsgHandler:
|
||||||
Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||||
|
|
|
@ -56,6 +56,17 @@ BEGIN
|
||||||
VK_F5, FCIDM_SHVIEW_REFRESH, VIRTKEY
|
VK_F5, FCIDM_SHVIEW_REFRESH, VIRTKEY
|
||||||
END
|
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
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This include a set of Shell32 icons,
|
* This include a set of Shell32 icons,
|
||||||
* bitmaps and avi files. Licence's can be
|
* bitmaps and avi files. Licence's can be
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
/* Accelerators */
|
/* Accelerators */
|
||||||
#define IDA_SHELLVIEW 1
|
#define IDA_SHELLVIEW 1
|
||||||
|
#define IDA_DESKBROWSER 3
|
||||||
|
|
||||||
/* Bitmaps */
|
/* Bitmaps */
|
||||||
#define IDB_REACTOS 131
|
#define IDB_REACTOS 131
|
||||||
|
@ -485,6 +486,12 @@
|
||||||
#define IDR_AVI_FILENUKE 163
|
#define IDR_AVI_FILENUKE 163
|
||||||
#define IDR_AVI_FILEDELETE 164
|
#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 */
|
/* Shell view commands */
|
||||||
#define FCIDM_SHVIEW_ARRANGE 0x7001
|
#define FCIDM_SHVIEW_ARRANGE 0x7001
|
||||||
#define FCIDM_SHVIEW_DELETE 0x7011
|
#define FCIDM_SHVIEW_DELETE 0x7011
|
||||||
|
|
Loading…
Reference in a new issue