Initial commit!

This commit is contained in:
reddsik
2017-03-26 13:00:19 +02:00
commit c85716f60e
90 changed files with 28790 additions and 0 deletions

21
libami/eventdispatcher.c Normal file
View 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);
}
}