next up previous contents
Next: A SERVE-EVENT Example Up: Using SERVE-EVENT with the Previous: 7.4.1 Without Object Sets

7.4.2 With Object Sets

This section discusses the use of object sets and system:serve-event to handle CLX events. This is necessary when a single X application has distinct windows that want to handle the same events in different ways. Basically, you need some way of asking for a given window which way you want to handle some event because this event is handled differently depending on the window. Object sets provide this feature.

For each CLX event-key symbol-name ıXXX (for example, key-press), there is a function serve-ıXXX of two arguments, an object set and a function. The serve-ıXXX function establishes the function as the handler for the :XXX event in the object set. Recall from section 7.1, system:add-xwindow-object associates some Lisp object with a CLX window in an object set. When system:serve-event notices activity on a window, it calls the function given to ext:enable-clx-event-handling. If this function is ext:object-set-event-handler, it calls the function given to serve-ıXXX, passing the object given to system:add-xwindow-object and the event's slots as well as a couple other arguments described below.

To use object sets in this way:

[Function]
ext: object-set-event-handler display

This function is a suitable argument to ext:enable-clx-event-handling. The actual event handlers defined for particular events within a given object set must take an argument for every slot in the appropriate event. In addition to the event slots, ext:object-set-event-handler passes the following arguments:

Describing any ext:serve-event-key-name function, where event-key-name is an event-key symbol-name (for example, ext:serve-key-press), indicates exactly what all the arguments are in their correct order.

When creating an object set for use with ext:object-set-event-handler, specify ext:default-clx-event-handler as the default handler for events in that object set. If no default handler is specified, and the system invokes the default default handler, it will cause an error since this function takes arguments suitable for handling port messages.


next up previous contents
Next: A SERVE-EVENT Example Up: Using SERVE-EVENT with the Previous: 7.4.1 Without Object Sets

Raymond Toy
Mon Jul 14 09:11:27 EDT 1997