diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-04-26 17:07:39 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-04-27 16:31:52 +0930 |
commit | c142891001e53b3c9d1d4a0cfcb0ff555c2f0070 (patch) | |
tree | 788b0ac42f52fbab4c896c71a6c928a4b1785c9f | |
parent | 94284e40f5fc9bf30cc2cc5915f6adb22de7bffe (diff) |
Deprecate XGetExtensionVersion(), replace with XQueryInputVersion().
We need XI to be able to do some sort of versioning support.
-rw-r--r-- | include/X11/extensions/XInput.h | 9 | ||||
-rw-r--r-- | man/XGetExtensionVersion.man | 19 | ||||
-rw-r--r-- | src/XExtInt.c | 5 | ||||
-rw-r--r-- | src/XGetVers.c | 31 | ||||
-rw-r--r-- | src/XIint.h | 2 |
5 files changed, 59 insertions, 7 deletions
diff --git a/include/X11/extensions/XInput.h b/include/X11/extensions/XInput.h index 72e729d..e30762b 100644 --- a/include/X11/extensions/XInput.h +++ b/include/X11/extensions/XInput.h @@ -1218,11 +1218,18 @@ extern void XFreeDeviceState( XDeviceState* /* list */ ); -extern XExtensionVersion *XGetExtensionVersion( +/* Replaced by XQueryInputVersion */ +extern _X_DEPRECATED XExtensionVersion *XGetExtensionVersion( Display* /* display */, _Xconst char* /* name */ ); +extern XExtensionVersion *XQueryInputVersion( + Display* /* display */, + int /* major */, + int /* minor */ +); + extern XDeviceInfo *XListInputDevices( Display* /* display */, int* /* ndevices */ diff --git a/man/XGetExtensionVersion.man b/man/XGetExtensionVersion.man index 93c4621..098d18f 100644 --- a/man/XGetExtensionVersion.man +++ b/man/XGetExtensionVersion.man @@ -15,9 +15,11 @@ .ds xL Programming With Xlib .TH XGetExtensionVersion __LIB_MAN_SUFFIX__ __xorgversion__ "X FUNCTIONS" .SH NAME -XGetExtensionVersion \- query the version of the input extension. +XQueryInputVersion, XGetExtensionVersion \- query the version of the input extension. .SH SYNTAX .HP +XExtensionVersion *XQueryInputVersion\^(\^Display *\fIdisplay\fP\^, int \fImajor\fP\^, int \fIminor\fP\^); +.HP XExtensionVersion *XGetExtensionVersion\^(\^Display *\fIdisplay\fP\^, char *\fIname\fP\^); .SH ARGUMENTS @@ -28,7 +30,22 @@ Specifies the connection to the X server. .I name Specifies the extension to be queried. The input extension name is defined in the header file \fIXI.h\fP. +.TP 12 +.I major +Specifies the major version as supported by the client. +.TP 12 +.I minor +Specifies the minor version as supported by the client. .SH DESCRIPTION +The \fIXQueryInputVersion\fP request queries the version of the input +extension and returns an \fIXExtensionVersion\fP structure. This structure +contains a major_version and minor_version number which can be compared +with constants defined in \fIXI.h\fP. The client must specify the highest +version numbers it can supports. +.LP +The \fIXGetExtensionVersion\fP request is deprecated and should not be used. +Clients issuing a \fIXgetExtensionVersion\fP request will not be able to use +MPX features. The \fIXGetExtensionVersion\fP request queries the version of the input extension, and returns an \fIXExtensionVersion\fP structure. This structure contains a major_version and minor_version number which can be compared diff --git a/src/XExtInt.c b/src/XExtInt.c index 8d5ec3d..2809f74 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -221,7 +221,10 @@ _XiCheckExtInit(dpy, version_index, info) return (-1); } ((XInputData *) info->data)->vers = - _XiGetExtensionVersion(dpy, "XInputExtension", info); + _XiGetExtensionVersion(dpy, "XInputExtension", + versions[version_index].major_version, + versions[version_index].minor_version, + info); } if (versions[version_index].major_version > Dont_Check) { diff --git a/src/XGetVers.c b/src/XGetVers.c index d3c765a..863e290 100644 --- a/src/XGetVers.c +++ b/src/XGetVers.c @@ -60,14 +60,36 @@ SOFTWARE. #include <X11/extensions/extutil.h> #include "XIint.h" -XExtensionVersion * +/* DEPRECATED + * + * Pre-MPX versions will use this call. Major/minor is undefined in the + * request. + */ +_X_DEPRECATED XExtensionVersion * XGetExtensionVersion(register Display * dpy, _Xconst char *name) { XExtensionVersion *ext; XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); - ext = _XiGetExtensionVersion(dpy, name, info); + ext = _XiGetExtensionVersion(dpy, name, 0, 0, info); + if (ext != (XExtensionVersion *) NoSuchExtension) { + UnlockDisplay(dpy); + SyncHandle(); + } + return (ext); +} + +/* Query X Input extension version. To be used post-MPX. + */ +XExtensionVersion * +XQueryInputVersion(Display *dpy, int major, int minor) +{ + XExtensionVersion *ext; + XExtDisplayInfo *info = XInput_find_display(dpy); + + LockDisplay(dpy); + ext = _XiGetExtensionVersion(dpy, NULL, major, minor, info); if (ext != (XExtensionVersion *) NoSuchExtension) { UnlockDisplay(dpy); SyncHandle(); @@ -76,7 +98,8 @@ XGetExtensionVersion(register Display * dpy, _Xconst char *name) } XExtensionVersion * -_XiGetExtensionVersion(register Display * dpy, _Xconst char *name, XExtDisplayInfo *info) +_XiGetExtensionVersion(register Display * dpy, _Xconst char *name, + int major, int minor, XExtDisplayInfo *info) { xGetExtensionVersionReq *req; xGetExtensionVersionReply rep; @@ -90,6 +113,8 @@ _XiGetExtensionVersion(register Display * dpy, _Xconst char *name, XExtDisplayIn req->ReqType = X_GetExtensionVersion; req->nbytes = name ? strlen(name) : 0; req->length += (unsigned)(req->nbytes + 3) >> 2; + req->majorVersion = major; + req->minorVersion = minor; _XSend(dpy, name, (long)req->nbytes); if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) { diff --git a/src/XIint.h b/src/XIint.h index f35619c..c5c3460 100644 --- a/src/XIint.h +++ b/src/XIint.h @@ -12,6 +12,6 @@ extern XExtDisplayInfo *XInput_find_display(Display *); extern int _XiCheckExtInit(Display *, int, XExtDisplayInfo *); -extern XExtensionVersion *_XiGetExtensionVersion(Display *, _Xconst char *, XExtDisplayInfo *); +extern XExtensionVersion *_XiGetExtensionVersion(Display *, _Xconst char *, int, int, XExtDisplayInfo *); #endif |