diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 5b04b0bb8..1b92df1dc 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -161,7 +161,22 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa { // Note: lParam is -1 to prevent endless loops of calls ::SendMessage(_dockingManager.getHSelf(), WM_NCACTIVATE, wParam, -1); - return ::DefWindowProc(hwnd, message, wParam, lParam); + result = ::DefWindowProc(hwnd, message, wParam, lParam); + if (NppDarkMode::isDarkMenuEnabled() && NppDarkMode::isEnabled()) + { + NppDarkMode::drawUAHMenuNCBottomLine(hwnd); + } + return result; + } + + case WM_NCPAINT: + { + result = ::DefWindowProc(hwnd, message, wParam, lParam); + if (NppDarkMode::isDarkMenuEnabled() && NppDarkMode::isEnabled()) + { + NppDarkMode::drawUAHMenuNCBottomLine(hwnd); + } + return result; } case WM_ERASEBKGND: diff --git a/PowerEditor/src/NppDarkMode.cpp b/PowerEditor/src/NppDarkMode.cpp index b47e7c886..f220fdbef 100644 --- a/PowerEditor/src/NppDarkMode.cpp +++ b/PowerEditor/src/NppDarkMode.cpp @@ -353,6 +353,34 @@ namespace NppDarkMode } } + void drawUAHMenuNCBottomLine(HWND hWnd) + { + MENUBARINFO mbi = { sizeof(mbi) }; + if (!GetMenuBarInfo(hWnd, OBJID_MENU, 0, &mbi)) + { + return; + } + + RECT rcClient = { 0 }; + GetClientRect(hWnd, &rcClient); + MapWindowPoints(hWnd, nullptr, (POINT*)&rcClient, 2); + + RECT rcWindow = { 0 }; + GetWindowRect(hWnd, &rcWindow); + + OffsetRect(&rcClient, -rcWindow.left, -rcWindow.top); + + // the rcBar is offset by the window rect + RECT rcAnnoyingLine = rcClient; + rcAnnoyingLine.bottom = rcAnnoyingLine.top; + rcAnnoyingLine.top--; + + + HDC hdc = GetWindowDC(hWnd); + FillRect(hdc, &rcAnnoyingLine, NppDarkMode::getDarkerBackgroundBrush()); + ReleaseDC(hWnd, hdc); + } + // from DarkMode.h void initExperimentalDarkMode(bool fixDarkScrollbar, bool dark) diff --git a/PowerEditor/src/NppDarkMode.h b/PowerEditor/src/NppDarkMode.h index 1faacfd80..7a63d675e 100644 --- a/PowerEditor/src/NppDarkMode.h +++ b/PowerEditor/src/NppDarkMode.h @@ -55,6 +55,7 @@ namespace NppDarkMode // processes messages related to UAH / custom menubar drawing. // return true if handled, false to continue with normal processing in your wndproc bool runUAHWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* lr); + void drawUAHMenuNCBottomLine(HWND hWnd); // from DarkMode.h void initExperimentalDarkMode(bool fixDarkScrollbar, bool dark);