X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fdispatch.c;h=08690a3715c9e74e8ed1842400f2572f3eab4817;hb=83508a2ad227464b84e9cd84f7172ac69bf85230;hp=6ee211fd37d660e02ff3c7be3cdb9343f437165e;hpb=bfea000a7407e51b5659590415e410a47f6f046b;p=chaz%2Fopenbox diff --git a/openbox/dispatch.c b/openbox/dispatch.c index 6ee211fd..08690a37 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() @@ -21,10 +22,7 @@ void dispatch_startup() j >>= 1; ++i; } - funcs = g_new(GSList*, i); - - for (i = 0, j = 1; j < EVENT_RANGE; ++i, j <<= 1) - funcs[i] = NULL; + funcs = g_new0(GSList*, i); } void dispatch_shutdown() @@ -211,3 +209,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]; +}