X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fdispatch.c;h=d6f91a2f6b66c42fa57e46467a7021a4b458fc0e;hb=5bf68f762b8fc87cf5583b645b948b4fe55f179f;hp=7b71369d226d6200f9699bd4624165e27cc15d84;hpb=4ed3fb89150d05e6fa134798315269c62de1bed9;p=chaz%2Fopenbox diff --git a/openbox/dispatch.c b/openbox/dispatch.c index 7b71369d..d6f91a2f 100644 --- a/openbox/dispatch.c +++ b/openbox/dispatch.c @@ -8,6 +8,7 @@ typedef struct { void *data; } Func; +/* an array of GSList*s of Func*s */ static GSList **funcs; void dispatch_startup() @@ -143,7 +144,7 @@ void dispatch_x(XEvent *xe, Client *c) } } -void dispatch_client(EventType e, Client *c) +void dispatch_client(EventType e, Client *c, int num0, int num1) { guint i; GSList *it; @@ -152,7 +153,9 @@ void dispatch_client(EventType e, Client *c) g_assert(c != NULL); obe.type = e; - obe.data.client = c; + obe.data.c.client = c; + obe.data.c.num[0] = num0; + obe.data.c.num[1] = num1; i = 0; while (e > 1) { @@ -166,13 +169,15 @@ void dispatch_client(EventType e, Client *c) } } -void dispatch_ob(EventType e) +void dispatch_ob(EventType e, int num0, int num1) { guint i; GSList *it; ObEvent obe; obe.type = e; + obe.data.o.num[0] = num0; + obe.data.o.num[1] = num1; i = 0; while (e > 1) { @@ -194,7 +199,7 @@ void dispatch_signal(int signal) ObEvent obe; obe.type = e; - obe.data.signal = signal; + obe.data.s.signal = signal; i = 0; while (e > 1) { @@ -207,3 +212,30 @@ void dispatch_signal(int signal) f->h(&obe, f->data); } } + +void dispatch_move(Client *c, int *x, int *y) +{ + guint i; + EventType e = Event_Client_Moving; + GSList *it; + ObEvent obe; + + obe.type = e; + obe.data.c.client = c; + obe.data.c.num[0] = *x; + obe.data.c.num[1] = *y; + + i = 0; + while (e > 1) { + e >>= 1; + ++i; + } + + for (it = funcs[i]; it != NULL; it = it->next) { + Func *f = it->data; + f->h(&obe, f->data); + } + + *x = obe.data.c.num[0]; + *y = obe.data.c.num[1]; +}