Revert "another attempt to fix the 64-bit Lion hidden-window problem"

This reverts commit f6e5468dbb85c2ed48178ac43fb25084430413ef.

Merge to 5.2

original commit: 9fd11ac92cec38a0497ae155f472ab82cca97a2b
This commit is contained in:
Matthew Flatt 2011-10-10 15:38:42 -06:00
parent 85af4802de
commit 8da2243aeb
3 changed files with 15 additions and 52 deletions

View File

@ -91,16 +91,14 @@
(let ([front (get-front)] (let ([front (get-front)]
[parent (and (version-10.6-or-later?) [parent (and (version-10.6-or-later?)
parent)]) parent)])
(call-in-run-loop (when parent
(lambda () (tellv ns beginSheetModalForWindow: (send parent get-cocoa-window)
(when parent completionHandler: #f))
(tellv ns beginSheetModalForWindow: (send parent get-cocoa-window) (begin0
completionHandler: #f)) (tell #:type _NSInteger ns runModal)
(begin0 (when parent (tell app endSheet: ns))
(tell #:type _NSInteger ns runModal) (when front (tellv (send front get-cocoa-window)
(when parent (tell app endSheet: ns)) makeKeyAndOrderFront: #f)))))])
(when front (tellv (send front get-cocoa-window)
makeKeyAndOrderFront: #f)))))))])
(begin0 (begin0
(if (zero? result) (if (zero? result)
#f #f

View File

@ -16,8 +16,7 @@
"bitmap.rkt" "bitmap.rkt"
"cg.rkt" "cg.rkt"
"utils.rkt" "utils.rkt"
"types.rkt" "types.rkt")
"queue.rkt")
(provide (provide
(protect-out printer-dc% (protect-out printer-dc%
@ -106,10 +105,8 @@
(if (atomically (if (atomically
(let ([front (get-front)]) (let ([front (get-front)])
(begin0 (begin0
(call-in-run-loop (= (tell #:type _NSInteger (tell NSPageLayout pageLayout) runModalWithPrintInfo: print-info)
(lambda () NSOkButton)
(= (tell #:type _NSInteger (tell NSPageLayout pageLayout) runModalWithPrintInfo: print-info)
NSOkButton)))
(when front (when front
(tellv (send front get-cocoa-window) makeKeyAndOrderFront: #f))))) (tellv (send front get-cocoa-window) makeKeyAndOrderFront: #f)))))
(begin (begin

View File

@ -21,7 +21,6 @@
set-menu-bar-hooks! set-menu-bar-hooks!
set-fixup-window-locations! set-fixup-window-locations!
post-dummy-event post-dummy-event
call-in-run-loop
try-to-sync-refresh try-to-sync-refresh
sync-cocoa-events) sync-cocoa-events)
@ -31,8 +30,7 @@
queue-event queue-event
yield) yield)
(import-class NSApplication NSAutoreleasePool NSColor NSProcessInfo NSArray (import-class NSApplication NSAutoreleasePool NSColor NSProcessInfo NSArray)
NSRunLoop)
(import-protocol NSApplicationDelegate) (import-protocol NSApplicationDelegate)
;; Extreme hackery to hide original arguments from ;; Extreme hackery to hide original arguments from
@ -80,11 +78,7 @@
(queue-file-event (string->path filename))] (queue-file-event (string->path filename))]
[-a _void (applicationDidFinishLaunching: [_id notification]) [-a _void (applicationDidFinishLaunching: [_id notification])
(unless got-file? (unless got-file?
(queue-start-empty-event)) (queue-start-empty-event))]
(tellv app stop: self)]
[-a _void (callbackAndStopLoop)
(run-loop-callback)
(tellv app stop: self)]
[-a _BOOL (applicationShouldHandleReopen: [_id app] hasVisibleWindows: [_BOOL has-visible?]) [-a _BOOL (applicationShouldHandleReopen: [_id app] hasVisibleWindows: [_BOOL has-visible?])
;; If we have any visible windows, return #t to do the default thing. ;; If we have any visible windows, return #t to do the default thing.
;; Otherwise return #f, because we don't want any invisible windows resurrected. ;; Otherwise return #f, because we don't want any invisible windows resurrected.
@ -138,34 +132,7 @@
(unless (zero? v) (unless (zero? v)
(log-error (format "error from CGDisplayRegisterReconfigurationCallback: ~a" v)))) (log-error (format "error from CGDisplayRegisterReconfigurationCallback: ~a" v))))
;; To make sure that `finishLaunching' is called, call `run' (tellv app finishLaunching)
;; and have `applicationDidFinishLaunching' quit the run loop.
;; This seems to work better than calling `finishLaunching'
;; directly undet 64-bt Lion, where calling just `finishLaunching'
;; somehow doesn't get the start-up AppleEvents.
(tellv app run)
;; Use `call-in-run-loop' to run something that needs to be
;; within `run', such as a modal-dialog run loop. It starts
;; a `run' with a high-priority callback to run `thunk', and
;; the run loop is stopped immediately after `thunk' returns.
(define (call-in-run-loop thunk)
(define result #f)
(set! run-loop-callback
(lambda ()
(set! run-loop-callback void)
(set! result (thunk))))
(tellv (tell NSRunLoop currentRunLoop)
performSelector: #:type _SEL (selector callbackAndStopLoop)
target: app-delegate
argument: #f
order: #:type _NSUInteger 0
modes: (tell NSArray
arrayWithObjects: #:type (_vector i _id) (vector NSDefaultRunLoopMode)
count: #:type _NSUInteger 1))
(tellv app run)
result)
(define run-loop-callback void)
;; ------------------------------------------------------------ ;; ------------------------------------------------------------
;; Create an event to post when MzScheme has been sleeping but is ;; Create an event to post when MzScheme has been sleeping but is
@ -254,6 +221,7 @@
(define kCFSocketReadCallBack 1) (define kCFSocketReadCallBack 1)
(import-class NSRunLoop)
(let* ([rl (tell #:type _CFRunLoopRef (tell NSRunLoop currentRunLoop) getCFRunLoop)] (let* ([rl (tell #:type _CFRunLoopRef (tell NSRunLoop currentRunLoop) getCFRunLoop)]
[cfs (CFSocketCreateWithNative (CFAllocatorGetDefault) ready_sock kCFSocketReadCallBack [cfs (CFSocketCreateWithNative (CFAllocatorGetDefault) ready_sock kCFSocketReadCallBack
socket_callback sock-context)] socket_callback sock-context)]