-(system:add-fd-handler (gdk:event-poll-fd) :input #'main-iterate-all)
-(setq lisp::*periodic-polling-function* #'main-iterate-all)
-(setq lisp::*max-event-to-sec* 0)
-(setq lisp::*max-event-to-usec* 1000)
-
-
-
-;;;; Metaclass used for subclasses of object
-
-(eval-when (:compile-toplevel :load-toplevel :execute)
- (defclass object-class (gobject-class))
-
- (defclass direct-object-slot-definition (direct-virtual-slot-definition))
-
- (defclass effective-object-slot-definition
- (effective-virtual-slot-definition)))
-
-
-(defmethod initialize-instance :after ((slotd direct-object-slot-definition)
- &rest initargs &key)
- (declare (ignore initargs))
- (unless (slot-boundp slotd 'location)
- (with-slots (pcl::name location pcl::class) slotd
- (setf
- location
- (format nil "~A::~A"
- (alien-type-name (class-name pcl::class))
- (name-to-string pcl::name))))))
-
-
-(defmethod direct-slot-definition-class ((class object-class) initargs)
- (case (getf initargs :allocation)
- (:arg (find-class 'direct-object-slot-definition))
- (t (call-next-method))))
-
-
-(defmethod effective-slot-definition-class ((class object-class) initargs)
- (case (getf initargs :allocation)
- (:arg (find-class 'effective-object-slot-definition))
- (t (call-next-method))))
-
-
-(defmethod compute-virtual-slot-location
- ((class object-class) (slotd effective-object-slot-definition)
- direct-slotds)
- (with-slots (type) slotd
- (let ((location (slot-definition-location (first direct-slotds)))
- (type-number (find-type-number type))
- (reader (get-reader-function type))
- (writer (get-writer-function type))
- (destroy (get-destroy-function type)))
- (list
- #'(lambda (object)
- (with-gc-disabled
- (let ((arg (arg-new type-number)))
- (setf (arg-name arg) location)
- (object-get-arg object arg)
- (prog1
- (funcall reader arg +arg-value-offset+)
- (arg-free arg t t)))))
- #'(lambda (value object)
- (with-gc-disabled
- (let ((arg (arg-new type-number)))
- (setf (arg-name arg) location)
- (funcall writer value arg +arg-value-offset+)
- (object-set-arg object arg)
- (funcall destroy arg +arg-value-offset+)
- (arg-free arg nil)
- value)))))))
-
-
-(defmethod validate-superclass ((class object-class)
- (super pcl::standard-class))
- (subtypep (class-name super) 'object))
-
-
-;;;; Metaclasses used for widgets and containers
-
-(eval-when (:compile-toplevel :load-toplevel :execute)
- (defclass widget-class (object-class))
-
- (defclass container-class (widget-class)
- (child-class)))
-
-
-(defvar *child-to-container-class-mappings* (make-hash-table))
-
-(defmethod shared-initialize ((class container-class) names
- &rest initargs &key name child-class)
- (declare (ignore initargs))
- (call-next-method)
- (with-slots ((child-class-slot child-class)) class
- (setf
- child-class-slot
- (or
- (first child-class)
- (intern (format nil "~A-CHILD" (or name (class-name class)))))
- (gethash child-class-slot *child-to-container-class-mappings*)
- class)))
-
-
-(defmethod validate-superclass ((class widget-class)
- (super pcl::standard-class))
- (subtypep (class-name super) 'widget))
-
-(defmethod validate-superclass ((class container-class)
- (super pcl::standard-class))
- (subtypep (class-name super) 'container))