diff --git a/wmdocklib/pywmgeneral.c b/wmdocklib/pywmgeneral.c index 457dd42..a3a04dd 100644 --- a/wmdocklib/pywmgeneral.c +++ b/wmdocklib/pywmgeneral.c @@ -182,12 +182,18 @@ pywmgeneral_copyXPMArea(PyObject *self, PyObject *args) { static PyObject * pywmgeneral_checkForEvents(PyObject *self, PyObject *args) { - /* If we find an event we handle, return a dicitionary containing some + /* If we find an event we handle, return a dictionary containing some * information about it. Return None if there are no events we handle. * Ignore events we don't handle. Also we provide a handler for when the * window is exposed, redraw it. */ XEvent event; + static char buffer[8]; + int bufsize = 8; + XComposeStatus dummy; + KeySym keysym; + int count; + if (!PyArg_ParseTuple(args, "")) return NULL; while (XPending(display)) { @@ -205,10 +211,14 @@ pywmgeneral_checkForEvents(PyObject *self, PyObject *args) { break; case KeyPress: - return Py_BuildValue("{s:s,s:i,s:i}", - "type", "keypress", - "state", event.xkey.state, - "keycode", event.xkey.keycode); + count = XLookupString((XKeyEvent*)&event, buffer, bufsize, &keysym, &dummy); + buffer[count] = '\0'; + + return Py_BuildValue("{s:s,s:i,s:i,s:s}", + "type", "keypress", + "state", event.xkey.state, + "keycode", event.xkey.keycode, + "button", buffer); case ButtonPress: case ButtonRelease: @@ -255,6 +265,11 @@ static PyMethodDef PyWmgeneralMethods[] = { {NULL, NULL, 0, NULL} }; +/* + * here comes the definition of the class Drawable + * + */ + typedef struct { PyObject_HEAD /* Type-specific fields go here. */ @@ -404,6 +419,11 @@ static PyTypeObject drawable_DrawableType = { Drawable_new, /* tp_new */ }; +/* + * end of class Dawable + * + */ + /*****************************************************************************/ /* Original C sources (With some modifications) */ /*****************************************************************************/ diff --git a/wmdocklib/wmoo.py b/wmdocklib/wmoo.py index a7dd26e..5972a4f 100644 --- a/wmdocklib/wmoo.py +++ b/wmdocklib/wmoo.py @@ -150,7 +150,7 @@ class Application: for evtype, key, area, callback in self._events: if evtype is not None and evtype != event['type']: continue if key is not None and key != event['button']: continue - if area is not None: + if area is not None and 'x' in event: if not area[0] <= event['x'] <= area[2]: continue if not area[1] <= event['y'] <= area[3]: continue