From 7789fcd82784d1eca471da9fbd2651a667b635bb Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 26 Nov 2010 08:30:50 -0700 Subject: [PATCH] gtk & cocoa: frame iconize repairs In the "windowing.rktl" tests, for Gtk there are still race conditions between the program and the window manager. But for the first time ever, all platforms can pass the "windowing.rktl" test. original commit: 7da127227a3a493214b0878cd26bff6b51631115 --- collects/mred/private/wx/cocoa/frame.rkt | 4 +++- collects/mred/private/wx/gtk/frame.rkt | 2 ++ collects/tests/gracket/windowing.rktl | 24 ++++++++++++++++-------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/collects/mred/private/wx/cocoa/frame.rkt b/collects/mred/private/wx/cocoa/frame.rkt index 81972157..eb2053c7 100644 --- a/collects/mred/private/wx/cocoa/frame.rkt +++ b/collects/mred/private/wx/cocoa/frame.rkt @@ -520,7 +520,9 @@ (define/public (iconized?) (tell #:type _BOOL cocoa isMiniaturized)) (define/public (iconize on?) - (tellv cocoa miniaturize: cocoa)) + (if on? + (tellv cocoa miniaturize: cocoa) + (tellv cocoa deminiaturize: cocoa))) (define/public (set-title s) (tellv cocoa setTitle: #:type _NSString s)) diff --git a/collects/mred/private/wx/gtk/frame.rkt b/collects/mred/private/wx/gtk/frame.rkt index c1c43315..994ab5f2 100644 --- a/collects/mred/private/wx/gtk/frame.rkt +++ b/collects/mred/private/wx/gtk/frame.rkt @@ -180,6 +180,7 @@ (connect-delete gtk) (connect-configure gtk) (connect-focus gtk) + (connect-window-state gtk) (define saved-title (or label "")) (define is-modified? #f) @@ -311,6 +312,7 @@ (hash-set! all-frames this #t) (hash-remove! all-frames this)) (super direct-show on?) + (when on? (gtk_window_deiconify gtk)) (register-frame-shown this on?)) (define/public (destroy) diff --git a/collects/tests/gracket/windowing.rktl b/collects/tests/gracket/windowing.rktl index b90260e0..1f36d1d9 100644 --- a/collects/tests/gracket/windowing.rktl +++ b/collects/tests/gracket/windowing.rktl @@ -30,6 +30,17 @@ (thread (lambda () (sleep 0.01) (semaphore-post s))) (test s 'yield (yield s)))) +(define (iconize-pause) + (if (eq? 'unix (system-type)) + ;; iconization might take a while + ;; for the window manager to report back + (begin + (pause) + (when (regexp-match? #rx"darwin" (path->string (system-library-subpath))) + (sleep 0.75)) + (pause)) + (pause))) + (let ([s (make-semaphore 1)]) (test s 'yield-wrapped (yield s))) (let ([s (make-semaphore 1)]) @@ -256,21 +267,18 @@ (printf "Iconize\n") (stv f iconize #t) - (pause) - (pause) + (iconize-pause) (st #t f is-iconized?) (stv f iconize #f) - (pause) - (pause) + (iconize-pause) (st #f f is-iconized?) (stv f iconize #t) - (pause) - (pause) + (iconize-pause) (st #t f is-iconized?) (stv f show #t) - (pause) + (iconize-pause) (st #f f is-iconized?) - + (stv f maximize #t) (pause) (stv f maximize #f)