From b80ef376308cb3329074a8df2c490bb4accaeb4b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 10 Dec 2010 19:57:05 -0700 Subject: [PATCH] win32: avoid continued failure when painting fails original commit: a5c4863848279b205411aa8ce2400ff02afc3a32 --- collects/mred/private/wx/win32/canvas.rkt | 35 ++++++++++++----------- collects/mred/private/wx/win32/window.rkt | 2 -- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/collects/mred/private/wx/win32/canvas.rkt b/collects/mred/private/wx/win32/canvas.rkt index cfaf727a..92e3c78b 100644 --- a/collects/mred/private/wx/win32/canvas.rkt +++ b/collects/mred/private/wx/win32/canvas.rkt @@ -155,23 +155,24 @@ [(= msg WM_PAINT) (let* ([ps (malloc 128)] [hdc (BeginPaint w ps)]) - (if for-gl? - (queue-paint) - (if (positive? paint-suspended) - (set! suspended-refresh? #t) - (let* ([hbrush (if no-autoclear? - #f - (if transparent? - background-hbrush - (CreateSolidBrush bg-colorref)))]) - (when hbrush - (let ([r (GetClientRect canvas-hwnd)]) - (FillRect hdc r hbrush)) - (unless transparent? - (DeleteObject hbrush))) - (unless (do-canvas-backing-flush hdc) - (queue-paint))))) - (EndPaint hdc ps)) + (when hdc + (if for-gl? + (queue-paint) + (if (positive? paint-suspended) + (set! suspended-refresh? #t) + (let* ([hbrush (if no-autoclear? + #f + (if transparent? + background-hbrush + (CreateSolidBrush bg-colorref)))]) + (when hbrush + (let ([r (GetClientRect canvas-hwnd)]) + (FillRect hdc r hbrush)) + (unless transparent? + (DeleteObject hbrush))) + (unless (do-canvas-backing-flush hdc) + (queue-paint))))) + (EndPaint hdc ps))) 0] [(= msg WM_NCPAINT) (if control-border-theme diff --git a/collects/mred/private/wx/win32/window.rkt b/collects/mred/private/wx/win32/window.rkt index 71e6ac5d..8f5086bc 100644 --- a/collects/mred/private/wx/win32/window.rkt +++ b/collects/mred/private/wx/win32/window.rkt @@ -56,8 +56,6 @@ -> (unless r (failed 'ClientToScreen)))) (define-gdi32 CreateFontIndirectW (_wfun _LOGFONT-pointer -> _HFONT)) -(define-user32 FillRect (_wfun _HDC _RECT-pointer _HBRUSH -> (r : _int) - -> (when (zero? r) (failed 'FillRect)))) (define-shell32 DragAcceptFiles (_wfun _HWND _BOOL -> _void))