From d5a6da4ea8964c5000dd38e0f2912e28ebda7493 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 10 Oct 2011 22:12:39 +0000 Subject: [PATCH] [EXPLORER] Implement support for hotkeys for run, show desktop and logoff currently it also causes the startmenu to open, like with win-E, but this is a different bug See issue #1512 for more details. svn path=/trunk/; revision=54076 --- .../shell/explorer/taskbar/desktopbar.cpp | 22 ++++++++++++++++--- .../base/shell/explorer/taskbar/desktopbar.h | 5 +++++ .../base/shell/explorer/taskbar/startmenu.cpp | 12 ++++++---- .../base/shell/explorer/taskbar/startmenu.h | 1 + 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/reactos/base/shell/explorer/taskbar/desktopbar.cpp b/reactos/base/shell/explorer/taskbar/desktopbar.cpp index 51c846cfa83..ae2e74bee2a 100644 --- a/reactos/base/shell/explorer/taskbar/desktopbar.cpp +++ b/reactos/base/shell/explorer/taskbar/desktopbar.cpp @@ -245,7 +245,10 @@ LRESULT StartButton::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) void DesktopBar::RegisterHotkeys() { // register hotkey WIN+E opening explorer - RegisterHotKey(_hwnd, 0, MOD_WIN, 'E'); + RegisterHotKey(_hwnd, IDHK_EXPLORER, MOD_WIN, 'E'); + RegisterHotKey(_hwnd, IDHK_RUN, MOD_WIN, 'R'); + RegisterHotKey(_hwnd, IDHK_DESKTOP, MOD_WIN, 'D'); + RegisterHotKey(_hwnd, IDHK_LOGOFF, MOD_WIN, 'L'); ///@todo register all common hotkeys } @@ -253,8 +256,21 @@ void DesktopBar::RegisterHotkeys() void DesktopBar::ProcessHotKey(int id_hotkey) { switch(id_hotkey) { - case 0: explorer_show_frame(SW_SHOWNORMAL); - break; + case IDHK_EXPLORER: + explorer_show_frame(SW_SHOWNORMAL); + break; + + case IDHK_RUN: + _startMenuRoot->Command(IDC_LAUNCH, 0); + break; + + case IDHK_LOGOFF: + _startMenuRoot->Command(IDC_LOGOFF, 0); + break; + + case IDHK_DESKTOP: + g_Globals._desktops.ToggleMinimize(); + break; ///@todo implement all common hotkeys } diff --git a/reactos/base/shell/explorer/taskbar/desktopbar.h b/reactos/base/shell/explorer/taskbar/desktopbar.h index 599aaad7a22..7c802e1c456 100644 --- a/reactos/base/shell/explorer/taskbar/desktopbar.h +++ b/reactos/base/shell/explorer/taskbar/desktopbar.h @@ -63,6 +63,11 @@ #define IDC_FIRST_MENU 0x3000 +// hotkeys +#define IDHK_EXPLORER 0 +#define IDHK_RUN 1 +#define IDHK_DESKTOP 2 +#define IDHK_LOGOFF 3 /// desktop bar window, also known as "system tray" struct DesktopBar : public diff --git a/reactos/base/shell/explorer/taskbar/startmenu.cpp b/reactos/base/shell/explorer/taskbar/startmenu.cpp index 371f2cfb099..d5c752707b2 100644 --- a/reactos/base/shell/explorer/taskbar/startmenu.cpp +++ b/reactos/base/shell/explorer/taskbar/startmenu.cpp @@ -1692,6 +1692,10 @@ void StartMenuRoot::TrackStartmenu() } } +int StartMenuRoot::Command(int id, int code) +{ + return super::Command(id, code); +} LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs) { @@ -2111,10 +2115,10 @@ void StartMenuHandler::ShowSearchComputer() MessageBox(0, TEXT("SHFindComputer() not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK); } -struct RunDialogThread : public Thread -{ - int Run(); -}; +struct RunDialogThread : public Thread +{ + int Run(); +}; int RunDialogThread::Run() { diff --git a/reactos/base/shell/explorer/taskbar/startmenu.h b/reactos/base/shell/explorer/taskbar/startmenu.h index 742a3b02bfe..1336699d181 100644 --- a/reactos/base/shell/explorer/taskbar/startmenu.h +++ b/reactos/base/shell/explorer/taskbar/startmenu.h @@ -369,6 +369,7 @@ struct StartMenuRoot : public StartMenuHandler static HWND Create(HWND hwndDesktopBar, int icon_size); void TrackStartmenu(); + int Command(int id, int code); HWND _hwndStartButton;