From c4793a218fef29c98f4cd5ca6402260109e8c2cb Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 3 Dec 2015 05:36:42 -0700 Subject: [PATCH] Windows: avoid refresh on no-op canvas `show-scrollbars` --- gui-lib/mred/private/wx/win32/canvas.rkt | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/gui-lib/mred/private/wx/win32/canvas.rkt b/gui-lib/mred/private/wx/win32/canvas.rkt index 3ae6300f..7f5e6503 100644 --- a/gui-lib/mred/private/wx/win32/canvas.rkt +++ b/gui-lib/mred/private/wx/win32/canvas.rkt @@ -401,15 +401,19 @@ (define h-scroll-visible? hscroll?) (define v-scroll-visible? vscroll?) (define/public (show-scrollbars h? v?) - (when hscroll? - (atomically - (set! h-scroll-visible? (and h? #t)) - (ShowScrollBar canvas-hwnd SB_HORZ h?))) - (when vscroll? - (atomically - (set! v-scroll-visible? (and v? #t)) - (ShowScrollBar canvas-hwnd SB_VERT v?))) - (reset-dc)) + (unless (and (equal? h-scroll-visible? + (and h? hscroll? #t)) + (equal? v-scroll-visible? + (and v? vscroll? #t))) + (when hscroll? + (atomically + (set! h-scroll-visible? (and h? #t)) + (ShowScrollBar canvas-hwnd SB_HORZ h?))) + (when vscroll? + (atomically + (set! v-scroll-visible? (and v? #t)) + (ShowScrollBar canvas-hwnd SB_VERT v?))) + (reset-dc))) (define/override (do-set-scrollbars h-step v-step h-len v-len