input: define server-supported protocol versions in one single file.

include/protocol-versions.h specifies each extension version as supported by
the server and sent back on the wire to the client.

This fixes up several issues with the server potentially reporting a higher
version of the protocol if recompiled against a newer version of the
protocol.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Rémi Cardona <remi@gentoo.org>
Acked-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
Peter Hutterer 2009-09-18 16:27:54 +10:00
parent 0b7c6c728c
commit 55747d256d
32 changed files with 256 additions and 109 deletions

View File

@ -32,10 +32,7 @@
#include "geint.h"
#include "geext.h"
/* Currently supported XGE version */
#define SERVER_GE_MAJOR 1
#define SERVER_GE_MINOR 0
#include "protocol-versions.h"
#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
@ -81,8 +78,8 @@ ProcGEQueryVersion(ClientPtr client)
rep.sequenceNumber = client->sequence;
/* return the supported version by the server */
rep.majorVersion = SERVER_GE_MAJOR;
rep.minorVersion = SERVER_GE_MINOR;
rep.majorVersion = SERVER_GE_MAJOR_VERSION;
rep.minorVersion = SERVER_GE_MINOR_VERSION;
/* Remember version the client requested */
pGEClient->major_version = stuff->majorVersion;

View File

@ -56,9 +56,7 @@ Equipment Corporation.
#include "picturestr.h"
#endif
#include "modinit.h"
#define SERVER_PANORAMIX_MAJOR_VERSION 1
#define SERVER_PANORAMIX_MINOR_VERSION 1
#include "protocol-versions.h"
#ifdef GLXPROXY
extern VisualPtr glxMatchVisual(ScreenPtr pScreen,

View File

@ -54,6 +54,7 @@ in this Software without prior written authorization from the X Consortium.
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
#endif
#include "protocol-versions.h"
#include <stdio.h>
@ -727,8 +728,8 @@ ProcScreenSaverQueryVersion (ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = ScreenSaverMajorVersion;
rep.minorVersion = ScreenSaverMinorVersion;
rep.majorVersion = SERVER_SAVER_MAJOR_VERSION;
rep.minorVersion = SERVER_SAVER_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);

View File

@ -39,6 +39,7 @@ in this Software without prior written authorization from The Open Group.
#include "securitysrv.h"
#include <X11/extensions/securproto.h>
#include "modinit.h"
#include "protocol-versions.h"
/* Extension stuff */
static int SecurityErrorBase; /* first Security error number */
@ -371,8 +372,8 @@ ProcSecurityQueryVersion(
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.majorVersion = SECURITY_MAJOR_VERSION;
rep.minorVersion = SECURITY_MINOR_VERSION;
rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
if(client->swapped)
{
char n;

View File

@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group.
#include "regionstr.h"
#include "gcstruct.h"
#include "modinit.h"
#include "protocol-versions.h"
typedef RegionPtr (*CreateDftPtr)(
WindowPtr /* pWin */
@ -259,8 +260,8 @@ ProcShapeQueryVersion (ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = SHAPE_MAJOR_VERSION;
rep.minorVersion = SHAPE_MINOR_VERSION;
rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);

View File

@ -54,6 +54,7 @@ in this Software without prior written authorization from The Open Group.
#include "xace.h"
#include <X11/extensions/shmproto.h>
#include <X11/Xfuncproto.h>
#include "protocol-versions.h"
/* Needed for Solaris cross-zone shared memory extension */
#ifdef HAVE_SHMCTL64
@ -313,8 +314,8 @@ ProcShmQueryVersion(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.sharedPixmaps = sharedPixmaps;
rep.pixmapFormat = sharedPixmaps ? ZPixmap : 0;
rep.majorVersion = SHM_MAJOR_VERSION;
rep.minorVersion = SHM_MINOR_VERSION;
rep.majorVersion = SERVER_SHM_MAJOR_VERSION;
rep.minorVersion = SERVER_SHM_MINOR_VERSION;
rep.uid = geteuid();
rep.gid = getegid();
if (client->swapped) {

View File

@ -32,6 +32,7 @@
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include "protocol-versions.h"
#include <X11/extensions/xcalibrateproto.h>
#include <X11/extensions/xcalibratewire.h>
@ -79,8 +80,8 @@ ProcXCalibrateQueryVersion (ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XCALIBRATE_MAJOR_VERSION;
rep.minorVersion = XCALIBRATE_MINOR_VERSION;
rep.majorVersion = SERVER_XCALIBRATE_MAJOR_VERSION;
rep.minorVersion = SERVER_XCALIBRATE_MINOR_VERSION;
if (client->swapped) {
int n;
swaps(&rep.sequenceNumber, n);

View File

@ -71,6 +71,7 @@
#include "gcstruct.h"
#include "dixfontstr.h"
#include "extnsionst.h"
#include "protocol-versions.h"
#include <X11/extensions/xf86bigfproto.h>
@ -338,8 +339,8 @@ ProcXF86BigfontQueryVersion(
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
reply.majorVersion = XF86BIGFONT_MAJOR_VERSION;
reply.minorVersion = XF86BIGFONT_MINOR_VERSION;
reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
reply.uid = geteuid();
reply.gid = getegid();
#ifdef HAS_SHM

View File

@ -21,6 +21,7 @@
#include "windowstr.h"
#include "gcstruct.h"
#include "modinit.h"
#include "protocol-versions.h"
static int
ProcXResQueryVersion (ClientPtr client)
@ -39,8 +40,8 @@ ProcXResQueryVersion (ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.server_major = XRES_MAJOR_VERSION;
rep.server_minor = XRES_MINOR_VERSION;
rep.server_major = SERVER_XRES_MAJOR_VERSION;
rep.server_minor = SERVER_XRES_MINOR_VERSION;
if (client->swapped) {
int n;
swaps(&rep.sequenceNumber, n);

View File

@ -20,6 +20,7 @@
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMCproto.h>
#include "xvmcext.h"
#include "protocol-versions.h"
#ifdef HAS_XVMCSHM
#include <sys/ipc.h>
@ -116,8 +117,8 @@ ProcXvMCQueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.major = XvMCVersion;
rep.minor = XvMCRevision;
rep.major = SERVER_XVMC_MAJOR_VERSION;
rep.minor = SERVER_XVMC_MINOR_VERSION;
WriteToClient(client, sizeof(xvmcQueryVersionReply), (char*)&rep);
return Success;
}

View File

@ -72,6 +72,7 @@ SOFTWARE.
#include "swaprep.h"
#include "registry.h"
#include "privates.h"
#include "protocol-versions.h"
/* modules local to Xi */
#include "allowev.h"
@ -380,11 +381,6 @@ Mask PropagateMask[MAXDEVICES];
static int XIClientPrivateKeyIndex;
DevPrivateKey XIClientPrivateKey = &XIClientPrivateKeyIndex;
static XExtensionVersion thisversion = { XI_Present,
XI_2_Major,
XI_2_Minor
};
/*****************************************************************
*
@ -1255,6 +1251,10 @@ void
XInputExtensionInit(void)
{
ExtensionEntry *extEntry;
XExtensionVersion thisversion = { XI_Present,
SERVER_XI_MAJOR_VERSION,
SERVER_XI_MINOR_VERSION,
};
if (!dixRequestPrivate(XIClientPrivateKey, sizeof(XIClientRec)))
FatalError("Cannot request private for XI.\n");

View File

@ -53,9 +53,7 @@
#include "compint.h"
#include "xace.h"
#define SERVER_COMPOSITE_MAJOR 0
#define SERVER_COMPOSITE_MINOR 4
#include "protocol-versions.h"
static CARD8 CompositeReqCode;
static int CompositeClientPrivateKeyIndex;
@ -124,12 +122,12 @@ ProcCompositeQueryVersion (ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR) {
if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;
} else {
rep.majorVersion = SERVER_COMPOSITE_MAJOR;
rep.minorVersion = SERVER_COMPOSITE_MINOR;
rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION;
}
pCompositeClient->major_version = rep.majorVersion;
pCompositeClient->minor_version = rep.minorVersion;

View File

@ -25,6 +25,7 @@
#endif
#include "damageextint.h"
#include "protocol-versions.h"
static unsigned char DamageReqCode;
static int DamageEventBase;
@ -35,13 +36,6 @@ static RESTYPE DamageExtWinType;
static int DamageClientPrivateKeyIndex;
static DevPrivateKey DamageClientPrivateKey = &DamageClientPrivateKeyIndex;
/* Version of the damage extension supported by the server, as opposed to the
* DAMAGE_* defines from damageproto for what version the proto header
* supports.
*/
#define SERVER_DAMAGE_MAJOR 1
#define SERVER_DAMAGE_MINOR 1
#define prScreen screenInfo.screens[0]
static void
@ -148,16 +142,16 @@ ProcDamageQueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (stuff->majorVersion < SERVER_DAMAGE_MAJOR) {
if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) {
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;
} else {
rep.majorVersion = SERVER_DAMAGE_MAJOR;
if (stuff->majorVersion == SERVER_DAMAGE_MAJOR &&
stuff->minorVersion < SERVER_DAMAGE_MINOR)
rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION;
if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION &&
stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION)
rep.minorVersion = stuff->minorVersion;
else
rep.minorVersion = SERVER_DAMAGE_MINOR;
rep.minorVersion = SERVER_DAMAGE_MINOR_VERSION;
}
pDamageClient->major_version = rep.majorVersion;
pDamageClient->minor_version = rep.minorVersion;

View File

@ -50,6 +50,7 @@
#include "indirect_dispatch.h"
#include "indirect_table.h"
#include "indirect_util.h"
#include "protocol-versions.h"
static int
validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
@ -738,8 +739,8 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
** client if it wants to work with older clients; however, in this
** implementation the server just returns its version number.
*/
reply.majorVersion = GLX_SERVER_MAJOR_VERSION;
reply.minorVersion = GLX_SERVER_MINOR_VERSION;
reply.majorVersion = SERVER_GLX_MAJOR_VERSION;
reply.minorVersion = SERVER_GLX_MINOR_VERSION;
reply.length = 0;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;

View File

@ -64,10 +64,6 @@ typedef struct __GLXcontext __GLXcontext;
#include "glxdrawable.h"
#include "glxcontext.h"
#define GLX_SERVER_MAJOR_VERSION 1
#define GLX_SERVER_MINOR_VERSION 2
#ifndef True
#define True 1
#endif

View File

@ -57,6 +57,7 @@
#include "dmxextension.h"
#include <X11/extensions/dmxproto.h>
#include <X11/extensions/dmx.h>
#include "protocol-versions.h"
#ifdef PANORAMIX
#include "panoramiX.h"
@ -223,9 +224,9 @@ static int ProcDMXQueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.majorVersion = DMX_EXTENSION_MAJOR;
rep.minorVersion = DMX_EXTENSION_MINOR;
rep.patchVersion = DMX_EXTENSION_PATCH;
rep.majorVersion = SERVER_DMX_MAJOR_VERSION;
rep.minorVersion = SERVER_DMX_MINOR_VERSION;
rep.patchVersion = SERVER_DMX_PATCH_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);

View File

@ -54,7 +54,7 @@
#include "hostx.h"
#define _HAVE_XALLOC_DECLS
#include "ephyrlog.h"
#include "protocol-versions.h"
typedef struct {
int foo;
@ -622,9 +622,9 @@ ProcXF86DRIQueryVersion (register ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XF86DRI_MAJOR_VERSION;
rep.minorVersion = XF86DRI_MINOR_VERSION;
rep.patchVersion = XF86DRI_PATCH_VERSION;
rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);

View File

@ -26,6 +26,7 @@
#include "swaprep.h"
#include "dgaproc.h"
#include "xf86dgaext.h"
#include "protocol-versions.h"
#include <string.h>
@ -122,8 +123,8 @@ ProcXDGAQueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XDGA_MAJOR_VERSION;
rep.minorVersion = XDGA_MINOR_VERSION;
rep.majorVersion = SERVER_XDGA_MAJOR_VERSION;
rep.minorVersion = SERVER_XDGA_MINOR_VERSION;
WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *)&rep);
return (client->noClientException);

View File

@ -46,6 +46,7 @@ from Kaleb S. KEITHLEY
#include "xf86.h"
#include "vidmodeproc.h"
#include "globals.h"
#include "protocol-versions.h"
#define DEFAULT_XF86VIDMODE_VERBOSITY 3
@ -384,8 +385,8 @@ ProcXF86VidModeQueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XF86VIDMODE_MAJOR_VERSION;
rep.minorVersion = XF86VIDMODE_MINOR_VERSION;
rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);

View File

@ -60,6 +60,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dristruct.h"
#include "xf86.h"
#include "xf86drm.h"
#include "protocol-versions.h"
static int DRIErrorBase;
@ -134,9 +135,9 @@ ProcXF86DRIQueryVersion(
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = XF86DRI_MAJOR_VERSION;
rep.minorVersion = XF86DRI_MINOR_VERSION;
rep.patchVersion = XF86DRI_PATCH_VERSION;
rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);

View File

@ -45,6 +45,7 @@
#include "xf86drm.h"
#include "xfixes.h"
#include "dri2.h"
#include "protocol-versions.h"
/* The only xf86 include */
#include "xf86Module.h"
@ -79,8 +80,8 @@ ProcDRI2QueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = 1;
rep.minorVersion = 1;
rep.majorVersion = SERVER_DRI2_MAJOR_VERSION;
rep.minorVersion = SERVER_DRI2_MAJOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);

View File

@ -50,6 +50,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/extensions/applewmproto.h>
#include "applewmExt.h"
#include "X11Application.h"
#include "protocol-versions.h"
#define DEFINE_ATOM_HELPER(func,atom_name) \
static Atom func (void) { \
@ -183,9 +184,9 @@ ProcAppleWMQueryVersion(
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = APPLE_WM_MAJOR_VERSION;
rep.minorVersion = APPLE_WM_MINOR_VERSION;
rep.patchVersion = APPLE_WM_PATCH_VERSION;
rep.majorVersion = SERVER_APPLEWM_MAJOR_VERSION;
rep.minorVersion = SERVER_APPLEWM_MINOR_VERSION;
rep.patchVersion = SERVER_APPLEWM_PATCH_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);

View File

@ -55,6 +55,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dristruct.h"
#include "xpr.h"
#include "x-hash.h"
#include "protocol-versions.h"
static int DRIErrorBase = 0;
@ -119,9 +120,9 @@ ProcAppleDRIQueryVersion(
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = APPLE_DRI_MAJOR_VERSION;
rep.minorVersion = APPLE_DRI_MINOR_VERSION;
rep.patchVersion = APPLE_DRI_PATCH_VERSION;
rep.majorVersion = SERVER_APPLEDRI_MAJOR_VERSION;
rep.minorVersion = SERVER_APPLEDRI_MINOR_VERSION;
rep.patchVersion = SERVER_APPLEDRI_PATCH_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);

View File

@ -41,6 +41,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swaprep.h"
#define _WINDOWSWM_SERVER_
#include <X11/extensions/windowswmstr.h>
#include "protocol-versions.h"
static int WMErrorBase;
@ -114,9 +115,9 @@ ProcWindowsWMQueryVersion(register ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = WINDOWS_WM_MAJOR_VERSION;
rep.minorVersion = WINDOWS_WM_MINOR_VERSION;
rep.patchVersion = WINDOWS_WM_PATCH_VERSION;
rep.majorVersion = SERVER_WINDOWSWM_MAJOR_VERSION;
rep.minorVersion = SERVER_WINDOWSWM_MINOR_VERSION;
rep.patchVersion = SERVER_WINDOWSWM_PATCH_VERSION;
if (client->swapped)
{
swaps(&rep.sequenceNumber, n);

View File

@ -65,4 +65,5 @@ AM_CFLAGS = $(DIX_CFLAGS)
EXTRA_DIST = \
dix-config-apple-verbatim.h \
eventconvert.h eventstr.h
eventconvert.h eventstr.h \
protocol-versions.h

148
include/protocol-versions.h Normal file
View File

@ -0,0 +1,148 @@
/*
* Copyright © 2009 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
/**
* This file specifies the server-supported protocol versions.
*/
#ifndef _PROTOCOL_VERSIONS_
#define _PROTOCOL_VERSIONS_
/* Apple DRI */
#define SERVER_APPLEDRI_MAJOR_VERSION 1
#define SERVER_APPLEDRI_MINOR_VERSION 0
#define SERVER_APPLEDRI_PATCH_VERSION 0
/* AppleWM */
#define SERVER_APPLEWM_MAJOR_VERSION 1
#define SERVER_APPLEWM_MINOR_VERSION 3
#define SERVER_APPLEWM_PATCH_VERSION 0
/* Composite */
#define SERVER_COMPOSITE_MAJOR_VERSION 0
#define SERVER_COMPOSITE_MINOR_VERSION 4
/* Damage */
#define SERVER_DAMAGE_MAJOR_VERSION 1
#define SERVER_DAMAGE_MINOR_VERSION 1
/* DMX */
#define SERVER_DMX_MAJOR_VERSION 2
#define SERVER_DMX_MINOR_VERSION 2
#define SERVER_DMX_PATCH_VERSION 20040604
/* DRI2 */
#define SERVER_DRI2_MAJOR_VERSION 1
#define SERVER_DRI2_MINOR_VERSION 1
/* Generic event extension */
#define SERVER_GE_MAJOR_VERSION 1
#define SERVER_GE_MINOR_VERSION 0
/* GLX */
#define SERVER_GLX_MAJOR_VERSION 1
#define SERVER_GLX_MINOR_VERSION 2
/* Xinerama */
#define SERVER_PANORAMIX_MAJOR_VERSION 1
#define SERVER_PANORAMIX_MINOR_VERSION 1
/* RandR */
#define SERVER_RANDR_MAJOR_VERSION 1
#define SERVER_RANDR_MINOR_VERSION 3
/* Record */
#define SERVER_RECORD_MAJOR_VERSION 1
#define SERVER_RECORD_MINOR_VERSION 13
/* Render */
#define SERVER_RENDER_MAJOR_VERSION 0
#define SERVER_RENDER_MINOR_VERSION 10
/* RandR Xinerama */
#define SERVER_RRXINERAMA_MAJOR_VERSION 1
#define SERVER_RRXINERAMA_MINOR_VERSION 1
/* Screensaver */
#define SERVER_SAVER_MAJOR_VERSION 1
#define SERVER_SAVER_MINOR_VERSION 1
/* Security */
#define SERVER_SECURITY_MAJOR_VERSION 1
#define SERVER_SECURITY_MINOR_VERSION 0
/* Shape */
#define SERVER_SHAPE_MAJOR_VERSION 1
#define SERVER_SHAPE_MINOR_VERSION 1
/* SHM */
#define SERVER_SHM_MAJOR_VERSION 1
#define SERVER_SHM_MINOR_VERSION 1
/* Windows WM */
#define SERVER_WINDOWSWM_MAJOR_VERSION 1
#define SERVER_WINDOWSWM_MINOR_VERSION 0
#define SERVER_WINDOWSWM_PATCH_VERSION 0
/* Xcalibrate */
#define SERVER_XCALIBRATE_MAJOR_VERSION 0
#define SERVER_XCALIBRATE_MINOR_VERSION 1
/* DGA */
#define SERVER_XDGA_MAJOR_VERSION 2
#define SERVER_XDGA_MINOR_VERSION 0
/* Big Font */
#define SERVER_XF86BIGFONT_MAJOR_VERSION 1
#define SERVER_XF86BIGFONT_MINOR_VERSION 1
/* DRI */
#define SERVER_XF86DRI_MAJOR_VERSION 4
#define SERVER_XF86DRI_MINOR_VERSION 1
#define SERVER_XF86DRI_PATCH_VERSION 20040604
/* Vidmode */
#define SERVER_XF86VIDMODE_MAJOR_VERSION 2
#define SERVER_XF86VIDMODE_MINOR_VERSION 2
/* Fixes */
#define SERVER_XFIXES_MAJOR_VERSION 4
#define SERVER_XFIXES_MINOR_VERSION 0
/* X Input */
#define SERVER_XI_MAJOR_VERSION 2
#define SERVER_XI_MINOR_VERSION 0
/* XKB */
#define SERVER_XKB_MAJOR_VERSION 1
#define SERVER_XKB_MINOR_VERSION 0
/* Resource */
#define SERVER_XRES_MAJOR_VERSION 1
#define SERVER_XRES_MINOR_VERSION 0
/* XvMC */
#define SERVER_XVMC_MAJOR_VERSION 1
#define SERVER_XVMC_MINOR_VERSION 1
#endif

View File

@ -21,9 +21,7 @@
*/
#include "randrstr.h"
#define SERVER_RANDR_MAJOR 1
#define SERVER_RANDR_MINOR 3
#include "protocol-versions.h"
Bool
RRClientKnowsRates (ClientPtr pClient)
@ -50,14 +48,14 @@ ProcRRQueryVersion (ClientPtr client)
rep.sequenceNumber = client->sequence;
if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
(SERVER_RANDR_MAJOR * 1000 + SERVER_RANDR_MINOR))
(SERVER_RANDR_MAJOR_VERSION * 1000 + SERVER_RANDR_MINOR_VERSION))
{
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;
} else
{
rep.majorVersion = SERVER_RANDR_MAJOR;
rep.minorVersion = SERVER_RANDR_MINOR;
rep.majorVersion = SERVER_RANDR_MAJOR_VERSION;
rep.minorVersion = SERVER_RANDR_MINOR_VERSION;
}
if (client->swapped) {

View File

@ -71,9 +71,7 @@
#include "randrstr.h"
#include "swaprep.h"
#include <X11/extensions/panoramiXproto.h>
#define RR_XINERAMA_MAJOR_VERSION 1
#define RR_XINERAMA_MINOR_VERSION 1
#include "protocol-versions.h"
/* Xinerama is not multi-screen capable; just report about screen 0 */
#define RR_XINERAMA_SCREEN 0
@ -98,8 +96,8 @@ ProcRRXineramaQueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = RR_XINERAMA_MAJOR_VERSION;
rep.minorVersion = RR_XINERAMA_MINOR_VERSION;
rep.majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION;
rep.minorVersion = SERVER_RRXINERAMA_MINOR_VERSION;
if(client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);

View File

@ -53,6 +53,8 @@ and Jim Haggerty of Metheus.
#include "cursor.h"
#endif
#include "protocol-versions.h"
static RESTYPE RTContext; /* internal resource type for Record contexts */
static int RecordErrorBase; /* first Record error number */
@ -1866,8 +1868,8 @@ ProcRecordQueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.majorVersion = RECORD_MAJOR_VERSION;
rep.minorVersion = RECORD_MINOR_VERSION;
rep.majorVersion = SERVER_RECORD_MAJOR_VERSION;
rep.minorVersion = SERVER_RECORD_MINOR_VERSION;
if(client->swapped)
{
swaps(&rep.sequenceNumber, n);

View File

@ -45,6 +45,7 @@
#include <X11/Xfuncproto.h>
#include "cursorstr.h"
#include "xace.h"
#include "protocol-versions.h"
#if HAVE_STDINT_H
#include <stdint.h>
@ -272,14 +273,14 @@ ProcRenderQueryVersion (ClientPtr client)
rep.sequenceNumber = client->sequence;
if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
(RENDER_MAJOR * 1000 + RENDER_MINOR))
(SERVER_RENDER_MAJOR_VERSION * 1000 + SERVER_RENDER_MINOR_VERSION))
{
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;
} else
{
rep.majorVersion = RENDER_MAJOR;
rep.minorVersion = RENDER_MINOR;
rep.majorVersion = SERVER_RENDER_MAJOR_VERSION;
rep.minorVersion = SERVER_RENDER_MINOR_VERSION;
}
if (client->swapped) {

View File

@ -52,13 +52,11 @@
#endif
#include "xfixesint.h"
#include "protocol-versions.h"
/*
* Must use these instead of the constants from xfixeswire.h. They advertise
* what we implement, not what the protocol headers define.
*/
#define SERVER_XFIXES_MAJOR 4
#define SERVER_XFIXES_MINOR 0
static unsigned char XFixesReqCode;
int XFixesEventBase;
@ -80,16 +78,16 @@ ProcXFixesQueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (stuff->majorVersion < SERVER_XFIXES_MAJOR) {
if (stuff->majorVersion < SERVER_XFIXES_MAJOR_VERSION) {
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;
} else {
rep.majorVersion = SERVER_XFIXES_MAJOR;
if (stuff->majorVersion == SERVER_XFIXES_MAJOR &&
stuff->minorVersion < SERVER_XFIXES_MINOR)
rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION;
if (stuff->majorVersion == SERVER_XFIXES_MAJOR_VERSION &&
stuff->minorVersion < SERVER_XFIXES_MINOR_VERSION)
rep.minorVersion = stuff->minorVersion;
else
rep.minorVersion = SERVER_XFIXES_MINOR;
rep.minorVersion = SERVER_XFIXES_MINOR_VERSION;
}
pXFixesClient->major_version = rep.majorVersion;
pXFixesClient->minor_version = rep.minorVersion;

View File

@ -38,6 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "extnsionst.h"
#include "xace.h"
#include "xkb.h"
#include "protocol-versions.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XKMformat.h>
@ -161,9 +162,9 @@ ProcXkbUseExtension(ClientPtr client)
int supported;
REQUEST_SIZE_MATCH(xkbUseExtensionReq);
if (stuff->wantedMajor != XkbMajorVersion) {
if (stuff->wantedMajor != SERVER_XKB_MAJOR_VERSION) {
/* pre-release version 0.65 is compatible with 1.00 */
supported= ((XkbMajorVersion==1)&&
supported= ((SERVER_XKB_MAJOR_VERSION==1)&&
(stuff->wantedMajor==0)&&(stuff->wantedMinor==65));
}
else supported = 1;
@ -178,15 +179,15 @@ ProcXkbUseExtension(ClientPtr client)
client->index,
(long)client->clientAsMask,
stuff->wantedMajor,stuff->wantedMinor,
XkbMajorVersion,XkbMinorVersion);
SERVER_XKB_MAJOR_VERSION,SERVER_XKB_MINOR_VERSION);
}
memset(&rep, 0, sizeof(xkbUseExtensionReply));
rep.type = X_Reply;
rep.supported = supported;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.serverMajor = XkbMajorVersion;
rep.serverMinor = XkbMinorVersion;
rep.serverMajor = SERVER_XKB_MAJOR_VERSION;
rep.serverMinor = SERVER_XKB_MINOR_VERSION;
if ( client->swapped ) {
swaps(&rep.sequenceNumber, n);
swaps(&rep.serverMajor, n);