From a68a1cd7cb990ba276fbc36a7591044d78b3d3c1 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 15 May 2007 16:54:01 +0930 Subject: [PATCH 1/5] Add XGenericEvent definition and handling for long events. --- include/X11/Xlib.h | 16 ++++++++++++++++ src/xcb_io.c | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/X11/Xlib.h b/include/X11/Xlib.h index a26789b1..73cfacda 100644 --- a/include/X11/Xlib.h +++ b/include/X11/Xlib.h @@ -971,6 +971,22 @@ typedef struct { Window window; /* window on which event was requested in event mask */ } XAnyEvent; + +/*************************************************************** + * + * GenericEvent. This event is the standard event for all newer extensions. + */ + +typedef struct + { + int type; /* of event. Always GenericEvent */ + unsigned long serial; /* # of last request processed */ + Bool send_event; /* true if from SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* major opcode of extension that caused the event */ + int evtype; /* actual event type. */ + } XGenericEvent; + /* * this union is defined so Xlib can always use the same sized * event structure internally, to avoid memory fragmentation. diff --git a/src/xcb_io.c b/src/xcb_io.c index d40ac102..c84f4bb4 100644 --- a/src/xcb_io.c +++ b/src/xcb_io.c @@ -85,7 +85,17 @@ static void handle_event(Display *dpy, xcb_generic_event_t *e) if(e->response_type == X_Error) _XError(dpy, (xError *) e); else + { + /* GenericEvents may be > 32 bytes. In this case, the event struct + * is trailed by the additional bytes. the xcb_generic_event_t + * struct uses 4 bytes for internal numbering, so we need to + * shift the trailing data to be after the first 32 bytes. + */ + if (e->response_type == GenericEvent && ((xcb_ge_event_t*)e)->length) { + memmove(&e->full_sequence, &e[1], ((xcb_ge_event_t*)e)->length * 4); + } _XEnq(dpy, (xEvent *) e); + } free(e); } From c34f76f475bc632490122e67b5a82575d69d5569 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 12 May 2008 21:46:24 +0930 Subject: [PATCH 2/5] Pull down extra bytes when reading a GenericEvent (non-xcb). I refuse to take any responsibily for this code. It works, I guess. But - all the flushing is done somewhere before that, so we might need to flush here. Under some circumstances anyway. Don't ask me, I'm an optical illusion. Build with xcb as transport layer highly recommended. --- src/XlibInt.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/XlibInt.c b/src/XlibInt.c index f90f8511..4f4229a1 100644 --- a/src/XlibInt.c +++ b/src/XlibInt.c @@ -1066,7 +1066,17 @@ void _XReadEvents( if (rep->generic.type == X_Error) _XError (dpy, (xError *) rep); else /* must be an event packet */ - _XEnq (dpy, (xEvent *)rep); + { + if (rep->generic.type == GenericEvent) + { + int evlen; + evlen = (rep->generic.length << 2); + if (_XRead(dpy, &read_buf[len], evlen) == -2) + goto got_event; /* XXX: aargh! */ + } + + _XEnq (dpy, (xEvent *)rep); + } INCITERPTR(rep,xReply); len -= SIZEOF(xReply); } From a7f85567a3e850fba0c44571453d2852ab1a09be Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 13 May 2008 10:28:39 -0400 Subject: [PATCH 3/5] Bug #15884: Remove useless sleep()'s from the connection code. For network transports, there's enough delay in the network layer already without adding more. For local transports, just hurry up and fail if the server isn't there. --- modules/im/ximcp/imTrans.c | 3 --- src/ConnDis.c | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/im/ximcp/imTrans.c b/modules/im/ximcp/imTrans.c index a239219b..cb17ca06 100644 --- a/modules/im/ximcp/imTrans.c +++ b/modules/im/ximcp/imTrans.c @@ -77,10 +77,7 @@ _XimTransConnect( spec->trans_conn = NULL; if (connect_stat == TRANS_TRY_CONNECT_AGAIN) - { - sleep(1); continue; - } else break; } diff --git a/src/ConnDis.c b/src/ConnDis.c index f919d51d..e61e0f05 100644 --- a/src/ConnDis.c +++ b/src/ConnDis.c @@ -42,6 +42,7 @@ in this Software without prior written authorization from The Open Group. #include #include #include +#include #if !defined(WIN32) #ifndef Lynx @@ -389,10 +390,7 @@ _X11TransConnectDisplay ( trans_conn = NULL; if (connect_stat == TRANS_TRY_CONNECT_AGAIN) - { - sleep(1); continue; - } else break; } @@ -409,7 +407,6 @@ _X11TransConnectDisplay ( { _X11TransClose(trans_conn); trans_conn = NULL; - sleep(1); if (saddr) { free ((char *) saddr); From 631d32d13247d1cf52c0833d438c5b38b01b17a4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 28 May 2008 17:31:59 +0930 Subject: [PATCH 4/5] Require xproto 7.0.13 and libxcb 1.1.90 (for GenericEvents) --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3719f02a..a5a41b83 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,7 @@ AC_CACHE_CHECK([whether to use XCB], [ac_cv_use_xcb], [ac_cv_use_xcb=yes]) AM_CONDITIONAL(XCB, test x$ac_cv_use_xcb != xno) # Checks for pkg-config packages -PKG_CHECK_MODULES(XPROTO, [xproto >= 7.0.6]) +PKG_CHECK_MODULES(XPROTO, [xproto >= 7.0.13]) AC_SUBST(XPROTO_CFLAGS) case "$ac_cv_use_xcb" in @@ -43,7 +43,7 @@ no) AC_DEFINE(USE_XCB, 0, [Use XCB for low-level protocol implementation]) ;; *) - X11_REQUIRES="xcb-xlib >= 0.9.92" + X11_REQUIRES="xcb-xlib >= 1.1.90" X11_EXTRA_DEPS="xcb-xlib" xdmauth="no" # XCB handles all auth AC_DEFINE(USE_XCB, 1, [Use XCB for low-level protocol implementation]) From 721b574d36f1884c3f1bf7bd933646e2ed6680b5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 29 May 2008 10:57:21 +0930 Subject: [PATCH 5/5] Bump to 1.1.99.1 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a5a41b83..a5947e2d 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ(2.57) AC_INIT([libX11], - 1.1.4, + 1.1.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libX11) AC_CONFIG_SRCDIR([Makefile.am])