Fix dock panels visual glitch

The visual glitch is caused by 'Find in Search Results'.

Fix #13402, fix #13459
pull/13461/head
ozone10 2 years ago committed by Don Ho
parent e28db05754
commit 37a18bf3b8

@ -280,6 +280,20 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
switch (Message)
{
case WM_ERASEBKGND:
{
if (!NppDarkMode::isEnabled())
{
break;
}
RECT rc{};
::GetClientRect(hwnd, &rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE;
}
case WM_LBUTTONDOWN:
{
_isMouseDown = TRUE;
@ -296,11 +310,11 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
if (!hookMouse)
{
DWORD dwError = ::GetLastError();
TCHAR str[128];
TCHAR str[128]{};
::wsprintf(str, TEXT("GetLastError() returned %lu"), dwError);
::MessageBox(NULL, str, TEXT("SetWindowsHookEx(MOUSE) failed on runProcCaption"), MB_OK | MB_ICONERROR);
}
::RedrawWindow(hwnd, NULL, NULL, TRUE);
::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
}
focusClient();
@ -366,7 +380,7 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
if (_isMouseOver != isMouseOver)
{
::SetFocus(NULL);
::RedrawWindow(hwnd, NULL, NULL, TRUE);
::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
}
}
}
@ -428,7 +442,7 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
}
case WM_SETTEXT:
{
::RedrawWindow(hwnd, NULL, NULL, TRUE);
::RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
return TRUE;
}
default:
@ -681,6 +695,10 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
break;
}
RECT rc{};
::GetClientRect(hwnd, &rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE;
}
@ -697,7 +715,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
break;
}
PAINTSTRUCT ps;
PAINTSTRUCT ps{};
HDC hdc = ::BeginPaint(hwnd, &ps);
::FillRect(hdc, &ps.rcPaint, NppDarkMode::getDarkerBackgroundBrush());
@ -1119,7 +1137,7 @@ intptr_t CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
int tabDpiDynamicalMinWidth = NppParameters::getInstance()._dpiManager.scaleX(24);
::SendMessage(_hContTab, TCM_SETMINTABWIDTH, 0, tabDpiDynamicalMinWidth);
break;
return TRUE;
}
case WM_NCCALCSIZE:
case WM_SIZE:
@ -1133,12 +1151,18 @@ intptr_t CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
{
break;
}
RECT rc = {};
RECT rc{};
getClientRect(rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE;
}
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
case WM_DRAWITEM :
{
// draw tab or caption

@ -119,10 +119,10 @@ public:
void setTabStyle(const BOOL & bDrawOgLine) {
_bDrawOgLine = bDrawOgLine;
RedrawWindow(_hContTab, NULL, NULL, 0);
::RedrawWindow(_hContTab, nullptr, nullptr, RDW_INVALIDATE);
};
virtual void destroy() {
void destroy() override{
for (int iTb = static_cast<int>(_vTbData.size()); iTb > 0; iTb--)
{
delete _vTbData[iTb-1];
@ -144,7 +144,7 @@ protected :
return (((DockingCont *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)))->runProcTab(hwnd, Message, wParam, lParam));
};
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
// drawing functions
void drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct);

@ -96,7 +96,7 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
if (!_isRegistered)
{
WNDCLASS clz;
WNDCLASS clz{};
clz.style = 0;
clz.lpfnWndProc = staticWinProc;
@ -216,6 +216,20 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
{
switch (message)
{
case WM_ERASEBKGND:
{
if (!NppDarkMode::isEnabled())
{
break;
}
RECT rc{};
::GetClientRect(hwnd, &rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE;
}
case WM_NCACTIVATE:
{
// activate/deactivate titlebar of toolbars
@ -660,8 +674,17 @@ void DockingManager::createDockableDlg(tTbData data, int iCont, bool isVisible)
}
// attach toolbar
if (_vContainer.size() > (size_t)iCont && _vContainer[iCont] != NULL)
if (_vContainer.size() > static_cast<size_t>(iCont) && _vContainer[iCont] != nullptr)
{
_vContainer[iCont]->createToolbar(data);
for (const auto& cont : _vContainer)
{
if (cont->isVisible() && cont != _vContainer[iCont])
{
::RedrawWindow(cont->getHSelf(), nullptr, nullptr, RDW_INVALIDATE);
}
}
}
// notify client app
if (iCont < DOCKCONT_MAX)
@ -706,7 +729,7 @@ void DockingManager::showDockableDlg(TCHAR* pszName, BOOL view)
LRESULT DockingManager::SendNotify(HWND hWnd, UINT message)
{
NMHDR nmhdr;
NMHDR nmhdr{};
nmhdr.code = message;
nmhdr.hwndFrom = _hParent;
nmhdr.idFrom = ::GetDlgCtrlID(_hParent);

@ -19,7 +19,6 @@
#include "DockingSplitter.h"
#include "Notepad_plus_msgs.h"
#include "Parameters.h"
#include "NppDarkMode.h"
BOOL DockingSplitter::_isVertReg = FALSE;
BOOL DockingSplitter::_isHoriReg = FALSE;
@ -30,7 +29,7 @@ void DockingSplitter::init(HINSTANCE hInst, HWND hWnd, HWND hMessage, UINT flags
_hMessage = hMessage;
_flags = flags;
WNDCLASS wc;
WNDCLASS wc{};
DWORD hwndExStyle = (DWORD)GetWindowLongPtr(hWnd, GWL_EXSTYLE);
_isRTL = hwndExStyle & WS_EX_LAYOUTRTL;
@ -56,7 +55,7 @@ void DockingSplitter::init(HINSTANCE hInst, HWND hWnd, HWND hMessage, UINT flags
wc.cbWndExtra = 0;
wc.hInstance = _hInst;
wc.hIcon = NULL;
wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
wc.hbrBackground = ::GetSysColorBrush(COLOR_3DFACE);
wc.lpszMenuName = NULL;
if (!::RegisterClass(&wc))
@ -129,7 +128,7 @@ LRESULT DockingSplitter::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
if (_isLeftButtonDown == TRUE)
{
POINT pt;
POINT pt{};
::GetCursorPos(&pt);
@ -152,9 +151,10 @@ LRESULT DockingSplitter::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
break;
}
RECT rc = {};
getClientRect(rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getBackgroundBrush());
RECT rc{};
::GetClientRect(hwnd, &rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return TRUE;
}
default :

Loading…
Cancel
Save