Fix right click on caption bar unhidding main menu

Fix #16652, close #16682
This commit is contained in:
Don Ho 2025-06-13 19:19:33 +02:00
parent e85c354135
commit 7cc002680a

View File

@ -2969,7 +2969,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
((toTray == sta_close || toTray == sta_minimize_close) && wParam == SC_CLOSE) ((toTray == sta_close || toTray == sta_minimize_close) && wParam == SC_CLOSE)
) )
{ {
if (nullptr == _pTrayIco) if (!_pTrayIco)
{ {
HICON icon = nullptr; HICON icon = nullptr;
Notepad_plus_Window::loadTrayIcon(_pPublicInterface->getHinst(), &icon); Notepad_plus_Window::loadTrayIcon(_pPublicInterface->getHinst(), &icon);
@ -2983,11 +2983,11 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE; return TRUE;
} }
if (wParam == SC_KEYMENU && lParam == VK_SPACE) if ((wParam & 0xFFF0) == SC_KEYMENU && lParam == VK_SPACE) // typing Alt-Space to have the system menu of application icon in the title bar
{ {
_sysMenuEntering = true; _sysMenuEntering = true;
} }
else if (wParam == 0xF093) //it should be SC_MOUSEMENU. A bug? else if ((wParam & 0xFFF0) == SC_MOUSEMENU) // clicking the application icon in the title bar to have the system menu
{ {
_sysMenuEntering = true; _sysMenuEntering = true;
} }
@ -2995,6 +2995,15 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return ::DefWindowProc(hwnd, message, wParam, lParam); return ::DefWindowProc(hwnd, message, wParam, lParam);
} }
case WM_NCRBUTTONDOWN: // right click on the title bar to have system menu (in the form of contextual menu beside of mouse cursor)
{
if (wParam == HTCAPTION)
{
_sysMenuEntering = true;
}
return ::DefWindowProc(hwnd, message, wParam, lParam);
}
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
{ {
::SendMessage(hwnd, WM_COMMAND, IDM_FILE_NEW, 0); ::SendMessage(hwnd, WM_COMMAND, IDM_FILE_NEW, 0);