mirror of
https://github.com/amiwm/amiwm.git
synced 2026-04-14 11:04:18 +00:00
Initial commit!
This commit is contained in:
21
libami/eventdispatcher.c
Normal file
21
libami/eventdispatcher.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "libami.h"
|
||||
|
||||
static int (*eventfunc[LASTEvent])(XEvent*);
|
||||
|
||||
static unsigned long eventmask=0;
|
||||
|
||||
static void eb_dispatch(XEvent *e, unsigned long mask)
|
||||
{
|
||||
if(e->type<0 || e->type>=LASTEvent || (!eventfunc[e->type]) ||
|
||||
(!eventfunc[e->type](e)))
|
||||
cx_send_event(mask, e);
|
||||
}
|
||||
|
||||
void cx_event_broker(int type, unsigned long mask, int (*callback)(XEvent*))
|
||||
{
|
||||
if(type>=0 && type<LASTEvent) {
|
||||
eventfunc[type]=callback;
|
||||
cx_broker(eventmask|=mask, eb_dispatch);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user