mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
Implement CTRL+ESC shortcut for poping up start menu
svn path=/trunk/; revision=5811
This commit is contained in:
@@ -26,7 +26,13 @@
|
||||
//
|
||||
|
||||
|
||||
#include "../utility/utility.h"
|
||||
#include "../utility/shellclasses.h"
|
||||
#include "../utility/shellbrowserimpl.h"
|
||||
#include "../utility/window.h"
|
||||
|
||||
#include "desktop.h"
|
||||
#include "../taskbar/desktopbar.h"
|
||||
|
||||
#include "../externals.h"
|
||||
#include "../explorer_intres.h"
|
||||
@@ -67,7 +73,6 @@ static void draw_desktop_background(HWND hwnd, HDC hdc)
|
||||
// This next part could be improved by working out how much
|
||||
// space the text actually needs...
|
||||
|
||||
#define DESKTOPBARBAR_HEIGHT 30
|
||||
rect.left = rect.right - 280;
|
||||
rect.top = rect.bottom - 56 - DESKTOPBARBAR_HEIGHT;
|
||||
rect.right = rect.left + 250;
|
||||
@@ -117,6 +122,20 @@ DesktopWindow::~DesktopWindow()
|
||||
}
|
||||
|
||||
|
||||
HWND DesktopWindow::Create()
|
||||
{
|
||||
IconWindowClass wcDesktop(_T("Progman"), IDI_REACTOS, CS_DBLCLKS);
|
||||
wcDesktop.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+1);
|
||||
|
||||
int width = GetSystemMetrics(SM_CXSCREEN);
|
||||
int height = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
return Window::Create(WINDOW_CREATOR(DesktopWindow),
|
||||
WS_EX_TOOLWINDOW, wcDesktop, _T("Program Manager"), WS_POPUP|WS_VISIBLE|WS_CLIPCHILDREN,
|
||||
0, 0, width, height, 0);
|
||||
}
|
||||
|
||||
|
||||
LRESULT DesktopWindow::Init(LPCREATESTRUCT pcs)
|
||||
{
|
||||
if (super::Init(pcs))
|
||||
@@ -189,6 +208,9 @@ LRESULT DesktopWindow::Init(LPCREATESTRUCT pcs)
|
||||
else if (SetShellWindow)
|
||||
SetShellWindow(_hwnd);
|
||||
|
||||
// create the explorer bar
|
||||
_desktopBar = DesktopBar::Create();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -221,23 +243,16 @@ LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
case WM_CLOSE:
|
||||
break; // Over-ride close. We need to close desktop some other way.
|
||||
|
||||
default:
|
||||
case WM_SYSCOMMAND:
|
||||
if (wparam == SC_TASKLIST) {
|
||||
if (_desktopBar)
|
||||
SendMessage(_desktopBar, nmsg, wparam, lparam);
|
||||
}
|
||||
goto def;
|
||||
|
||||
default: def:
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HWND create_desktop_window()
|
||||
{
|
||||
IconWindowClass wcDesktop(_T("Progman"), IDI_REACTOS, CS_DBLCLKS);
|
||||
wcDesktop.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+1);
|
||||
|
||||
int width = GetSystemMetrics(SM_CXSCREEN);
|
||||
int height = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
return Window::Create(WINDOW_CREATOR(DesktopWindow),
|
||||
WS_EX_TOOLWINDOW, wcDesktop, _T("Program Manager"), WS_POPUP|WS_VISIBLE|WS_CLIPCHILDREN,
|
||||
0, 0, width, height, 0);
|
||||
}
|
||||
|
||||
@@ -26,14 +26,6 @@
|
||||
//
|
||||
|
||||
|
||||
#include "../utility/utility.h"
|
||||
#include "../utility/shellclasses.h"
|
||||
#include "../utility/shellbrowserimpl.h"
|
||||
#include "../utility/window.h"
|
||||
|
||||
#include "../externals.h"
|
||||
|
||||
|
||||
struct BackgroundWindow : public SubclassedWindow
|
||||
{
|
||||
typedef SubclassedWindow super;
|
||||
@@ -52,6 +44,8 @@ struct DesktopWindow : public Window, public IShellBrowserImpl
|
||||
DesktopWindow(HWND hwnd);
|
||||
~DesktopWindow();
|
||||
|
||||
static HWND Create();
|
||||
|
||||
STDMETHOD(GetWindow)(HWND* lphwnd)
|
||||
{
|
||||
*lphwnd = _hwnd;
|
||||
@@ -80,4 +74,5 @@ protected:
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
IShellView* _pShellView;
|
||||
WindowHandle _desktopBar;
|
||||
};
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "utility/utility.h"
|
||||
|
||||
#include "explorer.h"
|
||||
#include "desktop/desktop.h"
|
||||
|
||||
#include "globals.h"
|
||||
#include "externals.h"
|
||||
|
||||
@@ -161,13 +163,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
|
||||
|
||||
if (startup_desktop)
|
||||
{
|
||||
hwndDesktop = create_desktop_window();
|
||||
|
||||
// Initialize the explorer bar
|
||||
HWND hwndExplorerBar = InitializeExplorerBar(hInstance);
|
||||
|
||||
// Load plugins
|
||||
// LoadAvailablePlugIns(hwndExplorerBar);
|
||||
hwndDesktop = DesktopWindow::Create();
|
||||
|
||||
#ifndef _DEBUG //MF: disabled for debugging
|
||||
{
|
||||
@@ -179,7 +175,5 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
|
||||
|
||||
int ret = explorer_main(hInstance, hwndDesktop, nShowCmd);
|
||||
|
||||
// ReleaseAvailablePlugIns();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -40,21 +40,9 @@ extern int explorer_main(HINSTANCE hinstance, HWND hwndDesktop, int cmdshow);
|
||||
// display explorer/file manager window
|
||||
extern void explorer_show_frame(HWND hwndDesktop, int cmdshow);
|
||||
|
||||
// create desktop window
|
||||
extern HWND create_desktop_window();
|
||||
|
||||
// test for already running desktop instance
|
||||
extern BOOL IsAnyDesktopRunning();
|
||||
|
||||
// start desktop bar
|
||||
extern HWND InitializeExplorerBar(HINSTANCE hInstance);
|
||||
|
||||
// load plugins
|
||||
extern int LoadAvailablePlugIns(HWND ExplWnd);
|
||||
|
||||
// shut down plugins
|
||||
extern int ReleaseAvailablePlugIns();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -40,26 +40,6 @@
|
||||
#include "quicklaunch.h"
|
||||
|
||||
|
||||
HWND InitializeExplorerBar(HINSTANCE hInstance)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
rect.left = -2; // hide left border
|
||||
#ifdef TASKBAR_AT_TOP
|
||||
rect.top = -2; // hide top border
|
||||
#else
|
||||
rect.top = GetSystemMetrics(SM_CYSCREEN) - DESKTOPBARBAR_HEIGHT;
|
||||
#endif
|
||||
rect.right = GetSystemMetrics(SM_CXSCREEN) + 2;
|
||||
rect.bottom = rect.top + DESKTOPBARBAR_HEIGHT + 2;
|
||||
|
||||
return Window::Create(WINDOW_CREATOR(DesktopBar), WS_EX_PALETTEWINDOW,
|
||||
BtnWindowClass(CLASSNAME_EXPLORERBAR), TITLE_EXPLORERBAR,
|
||||
WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE,
|
||||
rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, 0);
|
||||
}
|
||||
|
||||
|
||||
DesktopBar::DesktopBar(HWND hwnd)
|
||||
: super(hwnd),
|
||||
// initialize Common Controls library
|
||||
@@ -79,6 +59,26 @@ DesktopBar::~DesktopBar()
|
||||
}
|
||||
|
||||
|
||||
HWND DesktopBar::Create()
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
rect.left = -2; // hide left border
|
||||
#ifdef TASKBAR_AT_TOP
|
||||
rect.top = -2; // hide top border
|
||||
#else
|
||||
rect.top = GetSystemMetrics(SM_CYSCREEN) - DESKTOPBARBAR_HEIGHT;
|
||||
#endif
|
||||
rect.right = GetSystemMetrics(SM_CXSCREEN) + 2;
|
||||
rect.bottom = rect.top + DESKTOPBARBAR_HEIGHT + 2;
|
||||
|
||||
return Window::Create(WINDOW_CREATOR(DesktopBar), WS_EX_PALETTEWINDOW,
|
||||
BtnWindowClass(CLASSNAME_EXPLORERBAR), TITLE_EXPLORERBAR,
|
||||
WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE,
|
||||
rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, 0);
|
||||
}
|
||||
|
||||
|
||||
LRESULT DesktopBar::Init(LPCREATESTRUCT pcs)
|
||||
{
|
||||
if (super::Init(pcs))
|
||||
@@ -107,11 +107,8 @@ LRESULT DesktopBar::Init(LPCREATESTRUCT pcs)
|
||||
|
||||
void DesktopBar::RegisterHotkeys()
|
||||
{
|
||||
// register hotkey CTRL+ESC for opening Startmenu
|
||||
RegisterHotKey(_hwnd, 0, MOD_CONTROL, VK_ESCAPE);
|
||||
|
||||
// register hotkey WIN+E opening explorer
|
||||
RegisterHotKey(_hwnd, 1, MOD_WIN, 'E');
|
||||
RegisterHotKey(_hwnd, 0, MOD_WIN, 'E');
|
||||
|
||||
//TODO: register all common hotkeys
|
||||
}
|
||||
@@ -119,8 +116,7 @@ void DesktopBar::RegisterHotkeys()
|
||||
void DesktopBar::ProcessHotKey(int id_hotkey)
|
||||
{
|
||||
switch(id_hotkey) {
|
||||
case 0: ToggleStartmenu(); break;
|
||||
case 1: explorer_show_frame(_hwnd, SW_SHOWNORMAL); break;
|
||||
case 0: explorer_show_frame(_hwnd, SW_SHOWNORMAL); break;
|
||||
//TODO: implement all common hotkeys
|
||||
}
|
||||
}
|
||||
@@ -154,7 +150,8 @@ LRESULT DesktopBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
goto def;
|
||||
else
|
||||
return 0; // disable any other resizing
|
||||
}
|
||||
} else if (wparam == SC_TASKLIST)
|
||||
ToggleStartmenu();
|
||||
goto def;
|
||||
|
||||
case WM_SIZE: {
|
||||
|
||||
@@ -64,6 +64,8 @@ struct DesktopBar : public OwnerDrawParent<Window>
|
||||
DesktopBar(HWND hwnd);
|
||||
~DesktopBar();
|
||||
|
||||
static HWND Create();
|
||||
|
||||
protected:
|
||||
CommonControlInit _usingCmnCtrl;
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ LRESULT NotifyArea::ProcessTrayNotification(int notify_code, NOTIFYICONDATA* pni
|
||||
if (entry._idx == -1)
|
||||
entry._idx = ++_next_idx;
|
||||
|
||||
Refresh();
|
||||
Refresh(); //TODO: call only if really changes occurred
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ LRESULT Window::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
// close startup menu and other popup menus
|
||||
// This functionality is for tray notification icons missing in MS Windows.
|
||||
if (nmsg == WM_SETFOCUS)
|
||||
CancelModes((HWND)wparam);
|
||||
CancelModes((HWND)wparam); //@@ erronesly cancels desktop bar resize when switching from another process
|
||||
|
||||
return DefWindowProc(hwnd, nmsg, wparam, lparam);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user