libX11: Changes to 'master'
Peter Hutterer
whot at kemper.freedesktop.org
Sat Jul 11 23:14:30 PDT 2009
configure.ac | 2
include/X11/Xlib.h | 23 +++++
include/X11/Xlibint.h | 72 ++++++++++++++++
man/Makefile.am | 9 ++
man/XGetEventData.man | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/ChkIfEv.c | 1
src/ChkMaskEv.c | 4
src/ChkTypEv.c | 4
src/ChkTypWEv.c | 4
src/ChkWinEv.c | 4
src/FreeEventData.c | 42 +++++++++
src/GetEventData.c | 42 +++++++++
src/IfEvent.c | 1
src/InitExt.c | 43 +++++++++
src/Makefile.am | 2
src/MaskEvent.c | 4
src/NextEvent.c | 4
src/OpenDis.c | 11 ++
src/PeekEvent.c | 5 +
src/PeekIfEv.c | 5 +
src/PutBEvent.c | 18 +++-
src/WinEvent.c | 4
src/XlibInt.c | 184 ++++++++++++++++++++++++++++++++++++++++-
src/utlist.h | 116 ++++++++++++++++++++++++++
24 files changed, 823 insertions(+), 4 deletions(-)
New commits:
commit 554f755e5545f63d3c8f299297927238da155773
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Fri Jun 26 11:27:43 2009 +1000
Add generic event cookie handling to libX11.
Generic events require more bytes than Xlib provides in the standard XEvent.
Memory allocated by the extension and stored as pointers inside the event is
prone to leak by simple 'while (1) { XNextEvent(...); }' loops.
This patch adds cookie handling for generic events. Extensions may register
a cookie handler in addition to the normal event vectors. If an extension
has registered a cookie handler, _all_ generic events for this extensions
must be handled through cookies. Otherwise, the default event handler is
used.
The cookie handler must return an XGenericEventCookie with a pointer to the
data.The rest of the event (type, serialNumber, etc.) are to be filled as
normal. When a client retrieves such a cookie event, the data is stored in
an internal queue (the 'cookiejar'). This data is freed on the next call to
XNextEvent().
New extension interfaces:
XESetWireToEventCookie(display, extension_number, cookie_handler)
Where cookie_handler must set cookie->data. The data pointer is of arbitray
size and type but must be a single memory block. This memory block
represents the actual extension's event.
New client interfaces:
XGetEventData(display, *cookie);
XFreeEventData(display, *cookie);
If the client needs the actual event data, it must call XGetEventData() with
the cookie. This returns the data pointer (and removes it from the cookie
jar) and the client is then responsible for freeing the event with
XFreeEventData(). It is safe to call either function with a non-cookie
event. Events unclaimed or not handled by the XGetEventData() are cleaned up
automatically.
Example client code:
XEvent event;
XGenericEventCookie *cookie = &ev;
XNextEvent(display, &event);
if (XGetEventData(display, cookie)) {
XIEvent *xievent = cookie->data;
...
} else if (cookie->type == GenericEvent) {
/* handle generic event */
} else {
/* handle extension/core event */
}
XFreeEventData(display, cookie);
Cookies are not multi-threading safe. Clients that use XGetEventData() must
lock between XNextEvent and XGetEventData to avoid other threads freeing
cookies.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
commit d7675cb8fa7155e7aff1459636a117a97aa1bf28
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Mon Jul 6 13:17:35 2009 +1000
Bump to 1.2.99.1
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
More information about the xorg-commit
mailing list