Event processing hook

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Event processing hook

Alessandro Piras
Hi everybody,
I'm starting hacking on stumpwm. I wrote a systray in common lisp that
runs in the same image as stumpwm. I only tested it on sbcl, and it's
not completely ready yet - it's still buggy, some errors occur when
resuming the system after hibernating.

I needed to process the tray events, and I thought processing them
separately from the other stumpwm events would have been better, so I
added a hook that runs just before stumpwm processes it's own event.
The patch is attached here, let me know what you think! It would be
great if it could get pushed to the main git repo :-)
As an example, here is the code that I wrote to process the events for my tray:

    (let ((event-handler (lambda ()
                           (loop while (ignore-errors
                                         (xlib:process-event stumpwm::*display* :timeout 0 :handler hnd))))))
      (setf (tray-event-processing-fn tray) event-handler)
      (stumpwm::add-hook stumpwm:*event-processing-hook*
                         event-handler))))

The 0 timeout is needed so that when there are no more tray-relative
events to process, hnd will return nil but process-events will still
terminate, allowing stumpwm to process the other events.

About the errors I'm getting after resuming, I would like to do
something about them, but I don't know where to start.
I've seen there is a *top-level-error-hook*, but I've seen no
arguments are passed to it. How am I supposed to check the error, to
see if it's a tray related error that I need to handle or some other
error that I should not?

Cheers,
Alessandro

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel

0001-Added-event-processing-hook.patch (4K) Download Attachment