Skip to content

Commit

Permalink
Fixes to make the qt backend work again
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinmera committed Feb 11, 2019
1 parent f20d5f8 commit fcd04b8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
34 changes: 24 additions & 10 deletions backends/qt/context.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
(if (q+:is-valid glcontext)
(v:info :trial.context "~a successfully created context." context)
(error "Failed to create context."))
(acquire-context context)))
(make-current context)))

(defmethod shared-initialize :after ((context context)
slots
Expand Down Expand Up @@ -207,12 +207,26 @@

(defun launch-with-context (&optional (main 'main) &rest initargs)
#+linux (q+:qcoreapplication-set-attribute (q+:qt.aa_x11-init-threads))
(let ((context))
(with-main-window (main (apply #'make-instance main initargs)
:on-error #'standalone-error-handler
:show NIL
:finalize NIL)
(setf context (trial:context main))
(show context)
(start main))
(finalize context)))
(flet ((thunk ()
(ensure-qapplication :main-thread NIL)
(let* ((main (apply #'make-instance main initargs))
(context (trial:context main)))
(handler-bind ((error #'standalone-error-handler))
#+windows
(when (or (find :swank *features*)
(find :slynk *features*))
(qtools::fix-slime))
(q+:qcoreapplication-set-application-name (q+:window-title context))
(unwind-protect
(progn
(show context)
(start main)
(#_exec *qapplication*))
(finalize context))))))
#+darwin
(let ((out *standard-output*))
(tmt:with-body-in-main-thread (:blocking T)
(let ((*standard-output* out))
(qtools::with-traps-masked (thunk)))))
#-darwin
(qtools::with-traps-masked (thunk))))
2 changes: 1 addition & 1 deletion backends/qt/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(:nicknames #:org.shirakumo.fraf.trial.qt)
(:use #:cl+qt #:trial #:3d-vectors)
(:shadow #:context)
(:shadowing-import-from #:cl+qt #:finalize #:connect #:with-slots-bound #:with-all-slots-bound)
(:shadowing-import-from #:cl+qt #:finalize #:connect #:with-slots-bound #:with-all-slots-bound #:ensure-class)
(:shadowing-import-from #:trial #:load)
(:export
#:context))

0 comments on commit fcd04b8

Please sign in to comment.