X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/8ab0db90ff4867ccaa730c9c089d9cc2a10e92bf..995eb841c0c43cb35740619c5ae9c0bde939b18b:/gtk/gtk.lisp diff --git a/gtk/gtk.lisp b/gtk/gtk.lisp index 4eb3604..2730538 100644 --- a/gtk/gtk.lisp +++ b/gtk/gtk.lisp @@ -20,7 +20,7 @@ ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: gtk.lisp,v 1.62 2006-04-26 12:33:52 espen Exp $ +;; $Id: gtk.lisp,v 1.66 2006-09-14 11:52:40 espen Exp $ (in-package "GTK") @@ -45,7 +45,7 @@ (defun gtk-version () (format nil "Gtk+ v~A.~A.~A" major minor micro)))) (defun clg-version () - "clg 0.93pre") + "clg 0.93") ;;;; Initalization @@ -65,6 +65,11 @@ (defun clg-init (&optional display) (error "When running clg in Slime the communication style :spawn can not be used. See the README file and for more information.")) (unless (gdk:display-get-default) + #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0") + (progn + #+sbcl(sb-int:set-floating-point-modes :traps nil) + #+cmu(ext:set-floating-point-modes :traps nil)) + (gdk:gdk-init) (unless (gtk-init) (error "Initialization of GTK+ failed.")) @@ -82,34 +87,27 @@ (defun clg-init (&optional display) #+clisp ;; When running in Slime we need to hook into the Swank server ;; to handle events asynchronously - (if (find-symbol "WAIT-UNTIL-READABLE" "SWANK") - (setf (symbol-function 'swank::wait-until-readable) - #'(lambda (stream) - (loop - (case (socket:socket-status (cons stream :input) 0 *event-poll-interval*) - (:input (return t)) - (:eof (read-char stream)) - (otherwise (main-iterate-all)))))) + (if (find-package "SWANK") + (let ((read-from-emacs (symbol-function (find-symbol "READ-FROM-EMACS" "SWANK"))) + (stream (funcall (find-symbol "CONNECTION.SOCKET-IO" "SWANK") (symbol-value (find-symbol "*EMACS-CONNECTION*" "SWANK"))))) + (setf (symbol-function (find-symbol "READ-FROM-EMACS" "SWANK")) + #'(lambda () + (loop + (case (socket:socket-status (cons stream :input) 0 *event-poll-interval*) + (:input (return (funcall read-from-emacs))) + (:eof (read-char stream)) + (otherwise (main-iterate-all))))))) #-readline(warn "Not running in Slime and Readline support is missing, so the Gtk main loop has to be invoked explicit."))))) #+sbcl (defun clg-init-with-threading (&optional display) "Initializes the system and starts the event handling" (unless (gdk:display-get-default) - (gdk:gdk-init) - (gdk:threads-set-lock-functions) - (unless (gtk-init) - (error "Initialization of GTK+ failed.")) - (sb-thread:make-thread - #'(lambda () - (gdk:display-open display) - (gdk:with-global-lock (main))) - :name "gtk event loop"))) + #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0") + (progn + #+sbcl(sb-int:set-floating-point-modes :traps nil) + #+cmu(ext:set-floating-point-modes :traps nil)) -#+sbcl -(defun clg-init-with-threading (&optional display) - "Initializes the system and starts the event handling" - (unless (gdk:display-get-default) (gdk:gdk-init) (gdk:threads-set-lock-functions) (unless (gtk-init)