https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f45d80adc94be42cda84a…
commit f45d80adc94be42cda84ae5cc88c49049e249d33
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Apr 9 08:49:18 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Sun Apr 9 08:49:18 2023 +0900
[MSPAINT] Canvas: Don't draw new frame if HIT_NONE
CORE-18867
---
base/applications/mspaint/canvas.cpp | 6 ++++--
base/applications/mspaint/winproc.cpp | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp
index 4b69c9d25f7..3b260b8a5b3 100644
--- a/base/applications/mspaint/canvas.cpp
+++ b/base/applications/mspaint/canvas.cpp
@@ -155,7 +155,7 @@ VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT&
rcPaint)
}
// Draw new frame if any
- if (!::IsRectEmpty(&m_rcNew))
+ if (m_whereHit != HIT_NONE && !::IsRectEmpty(&m_rcNew))
DrawXorRect(hdcMem, &m_rcNew);
// Transfer the bits
@@ -668,8 +668,9 @@ LRESULT CCanvasWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOOL&
if (wParam == VK_ESCAPE && ::GetCapture() == m_hWnd)
{
// Cancel dragging
- m_whereHit = HIT_NONE;
::ReleaseCapture();
+ m_whereHit = HIT_NONE;
+ ::SetRectEmpty(&m_rcNew);
Invalidate(TRUE);
}
@@ -680,6 +681,7 @@ LRESULT CCanvasWindow::OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOO
{
// Cancel dragging
m_whereHit = HIT_NONE;
+ ::SetRectEmpty(&m_rcNew);
Invalidate(TRUE);
return 0;
}
diff --git a/base/applications/mspaint/winproc.cpp
b/base/applications/mspaint/winproc.cpp
index 09fc9e4b139..828bf0855ff 100644
--- a/base/applications/mspaint/winproc.cpp
+++ b/base/applications/mspaint/winproc.cpp
@@ -439,7 +439,7 @@ LRESULT CMainWindow::OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM
lParam, BO
EnableMenuItem(menu, IDM_EDITINVERTSELECTION, ENABLED_IF(trueSelection));
EnableMenuItem(menu, IDM_EDITCOPYTO, ENABLED_IF(trueSelection));
OpenClipboard();
- EnableMenuItem(menu, IDM_EDITPASTE, ENABLED_IF(GetClipboardData(CF_BITMAP) !=
NULL));
+ EnableMenuItem(menu, IDM_EDITPASTE,
ENABLED_IF(IsClipboardFormatAvailable(CF_BITMAP)));
CloseClipboard();
break;
case 2: /* View menu */
@@ -661,7 +661,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOOL& bH
break;
case IDM_EDITPASTE:
OpenClipboard();
- if (GetClipboardData(CF_BITMAP) != NULL)
+ if (IsClipboardFormatAvailable(CF_BITMAP))
{
InsertSelectionFromHBITMAP((HBITMAP) GetClipboardData(CF_BITMAP),
m_hWnd);
}