BurntSushi / xgbutil

A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.)
Do What The F*ck You Want To Public License
194 stars 46 forks source link

[Patch] Add a simple hook system to allow interception of events. #13

Closed AmandaCameron closed 11 years ago

AmandaCameron commented 11 years ago

This is a simple patch that adds hooks to the xevent main loop, allowing handling of messages that don't conform to the package's routing mechanics

Hooks return true to allow the message to be processed as normal, false to abort processing of the event, presumably to implement it all in the hook's callback.

http://amanda.darkdna.net/p/1acba

BurntSushi commented 11 years ago

Thanks. Nice work!

AmandaCameron commented 11 years ago

Not so nice, there's a problem -- because of the defer to do the unlocking, it'll leak memory, as well as never unlock the thing, so once the XEvent loop stats, no hooks can be registered. -- Sorry!