xcb impl for generic events
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 21 Sep 2011 06:17:22 +0000 (06:17 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 21 Sep 2011 06:17:22 +0000 (06:17 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@63508 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_x/xcb/ecore_xcb_events.c

index 3510f0b..42b932e 100644 (file)
@@ -2037,6 +2037,15 @@ _ecore_xcb_event_handle_generic_event(xcb_generic_event_t *event)
    Ecore_X_Event_Generic *e;
 
    ev = (xcb_ge_event_t *)event;
+
+   /* pad0 *IS* extension - bug in xcb */
+   if (ev->pad0 == _ecore_xcb_event_input)
+     {
+        _ecore_xcb_event_handle_input_event(event);
+// FIXME: should we generate generic events as WELL as input events?        
+//        return;
+     }
+
    if (!(e = calloc(1, sizeof(Ecore_X_Event_Generic))))
      return;
 
@@ -2049,14 +2058,17 @@ _ecore_xcb_event_handle_generic_event(xcb_generic_event_t *event)
     * XCB people have been notified of this issue */
    e->extension = ev->pad0;
    /* e->data = ev->pad1; */
+   if (ev->length > 0)
+     {
+        int len = ev->length * sizeof(int);
+        e->data = malloc(len);
+        if (e->data) memcpy(e->data, &(event[1]), len);
+     }
 
    e->evtype = ev->event_type;
 
-   if (e->extension == _ecore_xcb_event_input)
-     _ecore_xcb_event_handle_input_event(event);
-
    ecore_event_add(ECORE_X_EVENT_GENERIC, e, 
-                   _ecore_xcb_event_generic_event_free, event);
+                   _ecore_xcb_event_generic_event_free, e->data);
 }
 
 static void