Skip to content

Commit ca511fd

Browse files
committed
#40 fix: current active view cannot be painted (and 100% cpu)
Application is blocked in a loop. When we process WM_PAINT, we must call BeginPaint and EndPaint even though the view is inactive otherwise we create a loop!
1 parent f452e7c commit ca511fd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Console/ConsoleView.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,14 @@ LRESULT ConsoleView::OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lPa
243243

244244
LRESULT ConsoleView::OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
245245
{
246-
if (!m_bActive) return 0;
247-
246+
// /!\ The WM_PAINT message is sent to your window's WinProc() whenever the window's client area needs repainting.
247+
// We must call BeginPaint and EndPaint even though the view is inactive
248+
// otherwise we create a loop!
248249
CPaintDC dc(m_hWnd);
250+
if (!m_bActive) return 0;
249251

250252
if (m_bNeedFullRepaint)
251253
{
252-
//TRACE(L"ConsoleView::OnPaint\n");
253254
// we need to update offscreen buffers here for first paint and relative backgrounds
254255
RepaintText(m_dcText);
255256
UpdateOffscreen(dc.m_ps.rcPaint);

0 commit comments

Comments
 (0)