]> Dogcows Code - chaz/openbox/blobdiff - openbox/dispatch.c
dont lower below lower layers
[chaz/openbox] / openbox / dispatch.c
index 7b71369d226d6200f9699bd4624165e27cc15d84..08690a3715c9e74e8ed1842400f2572f3eab4817 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()
@@ -143,7 +141,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 +150,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 +166,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 +196,31 @@ void dispatch_signal(int signal)
     ObEvent obe;
 
     obe.type = e;
-    obe.data.signal = signal;
+    obe.data.s.signal = signal;
+
+    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);
+    }
+}
+
+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) {
@@ -206,4 +232,7 @@ void dispatch_signal(int signal)
         Func *f = it->data;
         f->h(&obe, f->data);
     }
+
+    *x = obe.data.c.num[0];
+    *y = obe.data.c.num[1];
 }
This page took 0.02227 seconds and 4 git commands to generate.