stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] Event processing hook


From: Alessandro Piras
Subject: [STUMP] Event processing hook
Date: Wed, 28 Mar 2012 16:57:14 +0200

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

Attachment: 0001-Added-event-processing-hook.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]