Browse code
chore: cleanup demo-app
Ed Langley authored on 21/10/2019 04:07:52
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -170,12 +170,23 @@ |
170 | 170 |
:pointer p]))) |
171 | 171 |
|
172 | 172 |
;#+null |
173 |
-(defun old-code () |
|
173 |
+(defun main () |
|
174 | 174 |
#+sbcl |
175 | 175 |
(sb-int:set-floating-point-modes :traps '()) |
176 | 176 |
|
177 |
+ (load "~/quicklisp/setup.lisp") |
|
178 |
+ (funcall (intern "QUICKLOAD" |
|
179 |
+ (find-package :QL)) |
|
180 |
+ :swank) |
|
181 |
+ |
|
182 |
+ #+nil |
|
183 |
+ (funcall (intern "CREATE-SERVER" |
|
184 |
+ (find-package :swank)) |
|
185 |
+ :port 5060 |
|
186 |
+ :dont-close t) |
|
187 |
+ |
|
177 | 188 |
(trivial-main-thread:with-body-in-main-thread (:blocking t) |
178 |
- [#@NSAutoReleasePool @(new)] |
|
189 |
+ [#@NSAutoreleasePool @(new)] |
|
179 | 190 |
[#@NSApplication @(sharedApplication)] |
180 | 191 |
#+nil |
181 | 192 |
[objc-runtime::ns-app @(setActivationPolicy:) :int 0] |
... | ... |
@@ -203,19 +214,25 @@ |
203 | 214 |
(defclass application-shim () |
204 | 215 |
((%main-view :initarg :main-view :accessor main-view))) |
205 | 216 |
|
206 |
-(defparameter *application-shim* (make-instance 'application-shim)) |
|
207 |
- |
|
208 |
- ;#+nil |
|
209 |
-(defun main () |
|
217 |
+(defvar *application-shim* |
|
218 |
+ (make-instance 'application-shim)) |
|
219 |
+;;#+nil |
|
220 |
+(defun old-main () |
|
210 | 221 |
(load "~/quicklisp/setup.lisp") |
211 |
- (funcall (intern "QUICKLOAD" (find-package :QL)) :swank) |
|
212 |
- (funcall (intern "CREATE-SERVER" (find-package :swank)) :port 5060 :dont-close t) |
|
213 |
- |
|
214 |
- (trivial-main-thread:with-body-in-main-thread (:blocking t) |
|
222 |
+ (funcall (intern "QUICKLOAD" |
|
223 |
+ (find-package :QL)) |
|
224 |
+ :swank) |
|
225 |
+ #+nil |
|
226 |
+ (funcall (intern "CREATE-SERVER" |
|
227 |
+ (find-package :swank)) |
|
228 |
+ :port 5060 |
|
229 |
+ :dont-close t) |
|
230 |
+ |
|
231 |
+ (trivial-main-thread:with-body-in-main-thread (:blocking nil) |
|
215 | 232 |
#+sbcl |
216 | 233 |
(sb-int:set-floating-point-modes :traps '()) |
217 | 234 |
|
218 |
- [#@NSAutoReleasePool @(new)] |
|
235 |
+ [#@NSAutoreleasePool @(new)] |
|
219 | 236 |
[#@NSApplication @(sharedApplication)] |
220 | 237 |
|
221 | 238 |
(format t "~&app: ~s~%" objc-runtime::ns-app) |
... | ... |
@@ -229,19 +246,20 @@ |
229 | 246 |
(quit-name @"Quit") |
230 | 247 |
(key @"q") |
231 | 248 |
(quit-menu-item |
232 |
- [[[#@NSMenuItem @(alloc)] |
|
233 |
- @(initWithTitle:action:keyEquivalent:) :pointer quit-name :pointer @(terminate?) :string key] |
|
234 |
- @(autorelease)])) |
|
249 |
+ [[[#@NSMenuItem @(alloc)] |
|
250 |
+ @(initWithTitle:action:keyEquivalent:) :pointer quit-name :pointer @(terminate?) :string key] |
|
251 |
+ @(autorelease)])) |
|
235 | 252 |
[menubar @(addItem:) :pointer app-menu-item] |
236 | 253 |
[app-menu @(addItem:) :pointer quit-menu-item] |
237 | 254 |
[app-menu-item @(setSubmenu:) :pointer app-menu] |
238 | 255 |
[objc-runtime::ns-app @(setMainMenu:) :pointer menubar] ) |
239 | 256 |
|
240 | 257 |
(setf (main-view *application-shim*) |
241 |
- [#@NSStackView @(stackViewWithViews:) :pointer [[#@NSArray @(alloc)] @(init)]]) |
|
258 |
+ [#@NSStackView @(stackViewWithViews:) |
|
259 |
+ :pointer [[#@NSArray @(alloc)] @(init)]]) |
|
242 | 260 |
(with-point (p (20 20)) |
243 | 261 |
(let* ((foreign-rect (make-rect 10 10 120 120)) |
244 |
- (the-window (init-window [#@NSWindow @(alloc)] foreign-rect 1 2 nil))) |
|
262 |
+ (the-window (init-window [#@NSWindow @(alloc)] foreign-rect 15 2 nil))) |
|
245 | 263 |
|
246 | 264 |
[(value-for-key the-window "contentView") @(addSubview:) :pointer (main-view *application-shim*)] |
247 | 265 |
[the-window @(cascadeTopLeftFromPoint:) :pointer p] |