Ignore:
Timestamp:
Apr 27, 2009, 12:01:18 AM (11 years ago)
Author:
gb
Message:

Try to ensure that window/view creation and initialization happens on the
main thread.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/examples/webkit.lisp

    r6232 r11968  
    2626                 
    2727
    28 (defun browser-window (urlspec)
     28(defun %browser-window (urlspec)
     29  (gui::assume-cocoa-thread)
    2930  ;; Content rect for window, bounds rect for view.
    3031  (ns:with-ns-rect (r 100.0 100.0 800.0 600.0)
     
    6364            ;; view-locking errors.  Maybe that's just
    6465            ;; an artifact of some other problem.
    65             (#/performSelectorOnMainThread:withObject:waitUntilDone:
    66              webframe (@selector #/loadRequest:) request t)
     66            (#/loadRequest: webframe request)
    6767            ;; Make the window visible & activate it
    6868            ;; The view knows how to draw itself and respond
     
    7070            (#/makeKeyAndOrderFront: w +null-ptr+))
    7171          v)))))
     72
     73(defun browser-window (urlspec)
     74  (let* ((ip ccl::*initial-process*))
     75    (if (eq ccl::*current-process* ip)
     76      (%browser-window urlspec)
     77      (let* ((s (make-semaphore))
     78             (v nil))
     79        (process-interrupt ip (lambda ()
     80                                (setq v (%browser-window urlspec))
     81                                (signal-semaphore s)))
     82        (wait-on-semaphore s)
     83        v))))
     84
    7285       
    7386;;; (browser-window "http://openmcl.clozure.com")
Note: See TracChangeset for help on using the changeset viewer.