diff --git a/collects/mred/private/wx/cocoa/frame.rkt b/collects/mred/private/wx/cocoa/frame.rkt index 4370a2ec..5536d187 100644 --- a/collects/mred/private/wx/cocoa/frame.rkt +++ b/collects/mred/private/wx/cocoa/frame.rkt @@ -12,6 +12,7 @@ "cursor.rkt" "../../syntax.rkt" "../common/queue.rkt" + "../common/freeze.rkt" "../../lock.rkt") (provide frame% @@ -55,9 +56,17 @@ #f] [-a _void (windowDidResize: [_id notification]) (when wxb - (queue-window*-event wxb (lambda (wx) - (send wx on-size 0 0) - (send wx clean-up))))] + (let ([wx (->wx wxb)]) + (when wx + (queue-window-event wx (lambda () + (send wx on-size 0 0) + (send wx clean-up))) + ;; Live resize: + (constrained-reply (send wx get-eventspace) + (lambda () + (pre-event-sync #t) + (let loop () (when (yield) (loop)))) + (void)))))] [-a _void (windowDidMove: [_id notification]) (when wxb (queue-window*-event wxb (lambda (wx) @@ -248,6 +257,8 @@ (for/or ([i (in-range (tell #:type _NSUInteger wins count))]) (let ([win (tell wins objectAtIndex: #:type _NSUInteger i)]) (and (tell #:type _BOOL win isVisible) + (or (not root-fake-frame) + (not (ptr-equal? win (send root-fake-frame get-cocoa)))) win)))))))]) (cond [next (tellv next makeKeyWindow)] diff --git a/collects/mred/private/wx/cocoa/queue.rkt b/collects/mred/private/wx/cocoa/queue.rkt index 1dcc21fc..9e96c79b 100644 --- a/collects/mred/private/wx/cocoa/queue.rkt +++ b/collects/mred/private/wx/cocoa/queue.rkt @@ -47,7 +47,10 @@ (not (eq? (application-pref-handler) nothing-application-pref-handler)) (super-tell #:type _BOOL validateMenuItem: menuItem))] [-a _BOOL (application: [_id theApplication] openFile: [_NSString filename]) - (queue-file-event (string->path filename))]) + (queue-file-event (string->path filename))] + [-a _void (applicationDidChangeScreenParameters: notification) + ;; Need to reset blit windows, since OS may move them incorrectly + (void)]) (tellv app finishLaunching) @@ -55,16 +58,6 @@ (tellv app setDelegate: app-delegate) (tellv app activateIgnoringOtherApps: #:type _BOOL #t) -#| -(import-class NSNotificationCenter) -(define-cocoa NSMenuDidBeginTrackingNotification _id) -(tellv (tell NSNotificationCenter defaultCenter) - addObserver: app-delegate - selector: #:type _SEL (selector trackingMenuNow:) - name: NSMenuDidBeginTrackingNotification - object: #f) -|# - ;; ------------------------------------------------------------ ;; Create an event to post when MzScheme has been sleeping but is ;; ready to wake up diff --git a/collects/mred/private/wx/cocoa/tab-panel.rkt b/collects/mred/private/wx/cocoa/tab-panel.rkt index dec99d7c..d5f8a397 100644 --- a/collects/mred/private/wx/cocoa/tab-panel.rkt +++ b/collects/mred/private/wx/cocoa/tab-panel.rkt @@ -8,6 +8,7 @@ "utils.rkt" "window.rkt" "panel.rkt" + "queue.rkt" "../common/event.rkt" "../common/procs.rkt" (for-syntax racket/base)) diff --git a/collects/mred/private/wx/cocoa/window.rkt b/collects/mred/private/wx/cocoa/window.rkt index 1ff12848..b937b47b 100644 --- a/collects/mred/private/wx/cocoa/window.rkt +++ b/collects/mred/private/wx/cocoa/window.rkt @@ -512,6 +512,7 @@ (define/public (set-size x y w h) (let ([x (if (= x -11111) (get-x) x)] [y (if (= y -11111) (get-y) y)]) + (tellv cocoa setNeedsDisplay: #:type _BOOL #t) (tellv cocoa setFrame: #:type _NSRect (make-NSRect (make-NSPoint x (flip y h)) (make-NSSize w h))))) (define/public (move x y) diff --git a/collects/mred/private/wx/common/clipboard.rkt b/collects/mred/private/wx/common/clipboard.rkt index caee9e65..af22c334 100644 --- a/collects/mred/private/wx/common/clipboard.rkt +++ b/collects/mred/private/wx/common/clipboard.rkt @@ -27,6 +27,14 @@ (void)) (super-new)) +(define string-clipboard-client% + (class clipboard-client% + (init-field the-bytes) + (super-new) + (define/override (get-types) (list "TEXT")) + (define/override (get-data s) + (and (equal? s "TEXT") the-bytes)))) + (defclass clipboard% object% (init x-selection?) @@ -44,12 +52,15 @@ (send driver get-data type)) (def/public (get-clipboard-string [exact-integer? timestamp]) (send driver get-text-data)) - (def/public-unimplemented set-clipboard-string) - (def/public (set-clipboard-client [clipboard-client% c] [exact-integer? timestamp]) (send c set-client-eventspace (current-eventspace)) (send driver set-client c (send c get-types))) + (def/public (set-clipboard-string [string? str] + [exact-integer? timestamp]) + (set-clipboard-client (make-object string-clipboard-client% + (string->bytes/utf-8 str)) + timestamp)) (super-new))