]> Dogcows Code - chaz/openbox/blobdiff - openbox/dispatch.c
add misc.h with some standard enumerations with proper prefixing and capitalizations.
[chaz/openbox] / openbox / dispatch.c
index 6ee211fd37d660e02ff3c7be3cdb9343f437165e..87f41dcc69c76767578647da6a80decaa7d188be 100644 (file)
@@ -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()
@@ -155,6 +153,7 @@ void dispatch_client(EventType e, Client *c, int num0, int num1)
     obe.data.c.client = c;
     obe.data.c.num[0] = num0;
     obe.data.c.num[1] = num1;
+    obe.data.c.num[2] = 0;
 
     i = 0;
     while (e > 1) {
@@ -211,3 +210,58 @@ void dispatch_signal(int signal)
         f->h(&obe, f->data);
     }
 }
+
+void dispatch_move(Client *c, int *x, int *y)
+{
+    guint i;
+    GSList *it;
+    EventType e = Event_Client_Moving;
+    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];
+}
+
+void dispatch_resize(Client *c, int *w, int *h, ObCorner corner)
+{
+    guint i;
+    GSList *it;
+    EventType e = Event_Client_Resizing;
+    ObEvent obe;
+
+    obe.type = e;
+    obe.data.c.client = c;
+    obe.data.c.num[0] = *w;
+    obe.data.c.num[1] = *h;
+    obe.data.c.num[2] = corner;
+
+    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);
+    }
+
+    *w = obe.data.c.num[0];
+    *h = obe.data.c.num[1];
+}
This page took 0.022936 seconds and 4 git commands to generate.