From eaf246231046482db0f88ba5c1b79b568d1396aa Mon Sep 17 00:00:00 2001 From: Rafal Harabien Date: Thu, 13 Oct 2011 15:50:24 +0000 Subject: [PATCH] [EXPLORER] - If Start Menu is open, WIN key hides it svn path=/trunk/; revision=54113 --- reactos/base/shell/explorer/taskbar/desktopbar.cpp | 11 +++++++---- reactos/base/shell/explorer/taskbar/desktopbar.h | 2 +- reactos/base/shell/explorer/taskbar/startmenu.cpp | 5 +++++ reactos/base/shell/explorer/taskbar/startmenu.h | 4 +++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/reactos/base/shell/explorer/taskbar/desktopbar.cpp b/reactos/base/shell/explorer/taskbar/desktopbar.cpp index ae2e74bee2a..ed0879f1407 100644 --- a/reactos/base/shell/explorer/taskbar/desktopbar.cpp +++ b/reactos/base/shell/explorer/taskbar/desktopbar.cpp @@ -306,7 +306,7 @@ LRESULT DesktopBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) else return 0; // disable any other resizing } else if (wparam == SC_TASKLIST) - ShowStartMenu(); + ShowOrHideStartMenu(); goto def; case WM_SIZE: @@ -430,7 +430,7 @@ int DesktopBar::Command(int id, int code) { switch(id) { case IDC_START: - ShowStartMenu(); + ShowOrHideStartMenu(); break; case ID_ABOUT_EXPLORER: @@ -484,7 +484,7 @@ int DesktopBar::Command(int id, int code) } -void DesktopBar::ShowStartMenu() +void DesktopBar::ShowOrHideStartMenu() { if (_startMenuRoot) { @@ -492,7 +492,10 @@ void DesktopBar::ShowStartMenu() if (!Button_GetState(_hwndStartButton)) Button_SetState(_hwndStartButton, TRUE); - _startMenuRoot->TrackStartmenu(); + if (_startMenuRoot->IsStartMenuVisible()) + _startMenuRoot->CloseStartMenu(); + else + _startMenuRoot->TrackStartmenu(); // StartMenu was closed, release button state Button_SetState(_hwndStartButton, false); diff --git a/reactos/base/shell/explorer/taskbar/desktopbar.h b/reactos/base/shell/explorer/taskbar/desktopbar.h index 7c802e1c456..8fe52c7f14d 100644 --- a/reactos/base/shell/explorer/taskbar/desktopbar.h +++ b/reactos/base/shell/explorer/taskbar/desktopbar.h @@ -103,7 +103,7 @@ protected: void ControlResize(WPARAM wparam, LPARAM lparam); void RegisterHotkeys(); void ProcessHotKey(int id_hotkey); - void ShowStartMenu(); + void ShowOrHideStartMenu(); LRESULT ProcessCopyData(COPYDATASTRUCT* pcd); WindowHandle _hwndTaskBar; diff --git a/reactos/base/shell/explorer/taskbar/startmenu.cpp b/reactos/base/shell/explorer/taskbar/startmenu.cpp index d5c752707b2..2418c3e2659 100644 --- a/reactos/base/shell/explorer/taskbar/startmenu.cpp +++ b/reactos/base/shell/explorer/taskbar/startmenu.cpp @@ -1872,6 +1872,11 @@ void StartMenuRoot::CloseStartMenu(int id) ShowWindow(_hwnd, SW_HIDE); } +bool StartMenuRoot::IsStartMenuVisible() const +{ + return IsWindowVisible(_hwnd); +} + void StartMenuRoot::ProcessKey(int vk) { switch(vk) { diff --git a/reactos/base/shell/explorer/taskbar/startmenu.h b/reactos/base/shell/explorer/taskbar/startmenu.h index 1336699d181..eb5c5ef60ce 100644 --- a/reactos/base/shell/explorer/taskbar/startmenu.h +++ b/reactos/base/shell/explorer/taskbar/startmenu.h @@ -369,6 +369,8 @@ struct StartMenuRoot : public StartMenuHandler static HWND Create(HWND hwndDesktopBar, int icon_size); void TrackStartmenu(); + void CloseStartMenu(int id=0); + bool IsStartMenuVisible() const; int Command(int id, int code); HWND _hwndStartButton; @@ -383,7 +385,7 @@ protected: virtual void ProcessKey(int vk); void Paint(PaintCanvas& canvas); - void CloseStartMenu(int id=0); + void ReadLogoSize(); UINT GetLogoResId();