Changeset 5730
- Timestamp:
- Jan 18, 2007, 3:12:58 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/examples/cocoa-window.lisp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/examples/cocoa-window.lisp
r5565 r5730 99 99 (let* ((e (send (@class ns-event) 100 100 :other-event-with-type #$NSApplicationDefined 101 :location (ns-make-point 0.0e0 0.0e0)101 :location (ns-make-point +cgfloat-zero+ +cgfloat-zero+) 102 102 :modifier-flags 0 103 103 :timestamp 0.0d0 … … 138 138 (funcall (appkit-interrupt-function (send e 'data1))) 139 139 (send-super :send-event e))) 140 141 ;;; This is a reverse-engineered version of most of -[NSApplication terminate],142 ;;; split off this way because we don't necessarily want to just do143 ;; (#_exit 0) when we've shut down the Cocoa UI.144 #+apple-objc145 (define-objc-method ((:void shutdown)146 lisp-application)147 (unless (eql (pref self :<NSA>pplication._app<F>lags._app<D>ying) #$YES)148 (if (eql #$NO (external-call "__runningOnAppKitThread" :<BOOL>))149 (send self150 :perform-selector-on-main-thread (@selector "shutdown")151 :with-object (%null-ptr)152 :wait-until-done nil)153 (progn154 (setf (pref self :<NSA>pplication._app<F>lags._app<D>ying) #$YES)155 (send (send (@class ns-notification-center) 'default-center)156 :post-notification-name #@"NSApplicationWillTerminateNotification"157 :object self)158 ;; Remove self as the observer of all notifications (the159 ;; precise set of notifications for which it's registered160 ;; may vary from release to release161 (send (send (@class ns-notification-center) 'default-center)162 :remove-observer self163 :name (%null-ptr)164 :object (%null-ptr))165 (objc-message-send (@class ns-menu) "_saveTornOffMenus" :void)166 (send (send (@class ns-user-defaults) 'standard-user-defaults)167 'synchronize)168 (objc-message-send (@class ns-pasteboard)169 "_provideAllPromisedData" :void)170 (objc-message-send (send (@class ns-help-manager) 'shared-help-manager)171 "_cleanupHelpForQuit" :void)172 ;; See what happens when you muck around in Things You Shouldn't173 ;; Know About ?174 (let* ((addr (or (foreign-symbol-address175 "__NSKeyboardUIHotKeysUnregister")176 (foreign-symbol-address177 "__NSKeyboardUIHotKeysCleanup"))))178 (if addr (ff-call addr :void)))179 (send (the ns-application self) :stop (%null-ptr))))))180 140 181 141 … … 270 230 (attributes ())) 271 231 272 (setq size (float size 0.0f0))232 (setq size (float size +cgfloat-zero+)) 273 233 (with-cstrs ((name name)) 274 234 (with-autorelease-pool 275 (rletz ((matrix (:array : float 6)))276 (setf ( %get-single-float matrix0) size277 (%get-single-float matrix 12) size)235 (rletz ((matrix (:array :<CGF>loat 6))) 236 (setf (paref matrix (:* :<CGF>loat) 0) size 237 (paref matrix (:* :<CGF>loat) 3) size) 278 238 (let* ((fontname (send (@class ns-string) :string-with-c-string name)) 279 239 (font (send (@class ns-font) … … 305 265 (defun create-paragraph-style (font line-break-mode) 306 266 (let* ((p (make-objc-instance 'ns-mutable-paragraph-style)) 307 (charwidth (send (send font 'screen-font) 308 :width-of-string #@" "))) 267 (charwidth (slet ((advance 268 (send font 'maximum-advancement))) 269 (fround (pref advance :<NSS>ize.width))))) 309 270 (send p 310 271 :set-line-break-mode … … 392 353 (auto-display t) 393 354 (activate t)) 394 (rlet ((frame :<NSR>ect :origin.x (float x) :origin.y (float y) :size.width (float width) :size.height (float height))) 355 (rlet ((frame :<NSR>ect 356 :origin.x (float x +cgfloat-zero+) 357 :origin.y (float y +cgfloat-zero+) 358 :size.width (float width +cgfloat-zero+) 359 :size.height (float height +cgfloat-zero+))) 395 360 (let* ((stylemask 396 361 (logior #$NSTitledWindowMask
Note:
See TracChangeset
for help on using the changeset viewer.
