X-Git-Url: https://git.distorted.org.uk/~mdw/clg/blobdiff_plain/15421c362657b5e0d72a0de1421dda312abeca57..14ac49ee8d7beed7f1355e6982889acbd82a8548:/gtk/gtk.lisp diff --git a/gtk/gtk.lisp b/gtk/gtk.lisp index a9d333e..88c82b5 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.64 2006/06/30 10:57:21 espen Exp $ +;; $Id: gtk.lisp,v 1.69 2007/01/14 23:22:16 espen Exp $ (in-package "GTK") @@ -65,6 +65,11 @@ (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,20 +87,27 @@ #+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) + #?(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) (gdk:threads-set-lock-functions) (unless (gtk-init) @@ -424,11 +436,11 @@ (container-add bin child) child) -(defmethod compute-signal-function ((bin bin) signal function object) +(defmethod compute-signal-function ((bin bin) signal function object args) (declare (ignore signal)) (if (eq object :child) - #'(lambda (&rest args) - (apply function (bin-child bin) (rest args))) + #'(lambda (&rest emission-args) + (apply function (bin-child bin) (nconc (rest emission-args) args))) (call-next-method))) @@ -658,8 +670,8 @@ (ensure-signal-id 'response dialog) (call-next-method))) -(defmethod compute-signal-function ((dialog dialog) signal function object) - (declare (ignore function object)) +(defmethod compute-signal-function ((dialog dialog) signal function object args) + (declare (ignore function object args)) (let ((callback (call-next-method)) (id (dialog-response-id dialog signal))) (if id @@ -1056,6 +1068,8 @@ (defmethod activate-radio-widget ((button radio-button)) (signal-emit button 'clicked)) +(defgeneric add-activate-callback (action function &key object after)) + (defmethod add-activate-callback ((button radio-button) function &key object after) (%add-activate-callback button 'clicked function object after)) @@ -1470,10 +1484,14 @@ (defbinding %window-set-default-icon () nil (icons (glist gdk:pixbuf))) +(defgeneric (setf window-default-icon) (icon)) + (defmethod (setf window-default-icon) ((icon gdk:pixbuf)) (%window-set-default-icon icon) icon) +(defgeneric (setf window-group) (group window)) + (defmethod (setf window-group) ((group window-group) (window window)) (window-group-add-window group window) group) @@ -2394,3 +2412,17 @@ (defmethod allocate-foreign ((plug plug) &key id) (%plug-new (or id 0))) + + +;;;; New stuff in Gtk+ 2.10 + +;;; Link button + +#?(pkg-exists-p "gtk+-2.0" :atleast-version "2.10.0") +(progn + (define-callback-marshal %link-button-uri-callback nil (link-button (link string))) + + (defbinding link-button-set-uri-hook (function) pointer + (%link-button-uri-callback callback) + ((register-callback-function function) unsigned-int) + (user-data-destroy-callback callback)))