summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-02-16 10:27:57 -0500
committerKristian Høgsberg <krh@bitplanet.net>2010-02-16 10:38:50 -0500
commit215d0dae6151e83ca4dc1a65c96d56b0835d27e7 (patch)
treeed553d9fd313f63bb58d54158e0b809ea6f8b0ab
parentf845e4ff1bf4e7e2f804024157494a12eedec174 (diff)
glx: Only register wire handlers for the events the server supports
-rw-r--r--src/glx/dri2.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index a7a8cb50aa..963c587e7a 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -81,7 +81,7 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
dri2Info,
dri2ExtensionName,
&dri2ExtensionHooks,
- DRI2NumberEvents, NULL)
+ 0, NULL)
static Bool
DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
@@ -182,6 +182,7 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor)
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2QueryVersionReply rep;
xDRI2QueryVersionReq *req;
+ int i, nevents;
XextCheckExtension(dpy, info, dri2ExtensionName, False);
@@ -201,6 +202,24 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor)
UnlockDisplay(dpy);
SyncHandle();
+ switch (rep.minorVersion) {
+ case 1:
+ nevents = 0;
+ break;
+ case 2:
+ nevents = 1;
+ break;
+ case 3:
+ default:
+ nevents = 2;
+ break;
+ }
+
+ for (i = 0; i < nevents; i++) {
+ XESetWireToEvent (dpy, info->codes->first_event + i, DRI2WireToEvent);
+ XESetEventToWire (dpy, info->codes->first_event + i, DRI2EventToWire);
+ }
+
return True;
}