summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-05-11 12:20:50 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-05-13 09:41:50 +1000
commitffd4874798ba54f86acac75779a15b4babeaa5f3 (patch)
tree8c6d1954542686e82734fa4f0999cddddd9284dd /randr
parentc4f9c3a07dbb05b81c8e2193a083102f710ebb27 (diff)
include: add version_compare helper function
Compare two version numbers in the major.minor form. Switch the few users of manual version switching over to the new function. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'randr')
-rw-r--r--randr/rrdispatch.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index 213550475..d1c99c288 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -28,8 +28,8 @@ RRClientKnowsRates (ClientPtr pClient)
{
rrClientPriv(pClient);
- return (pRRClient->major_version > 1 ||
- (pRRClient->major_version == 1 && pRRClient->minor_version >= 1));
+ return version_compare(pRRClient->major_version, pRRClient->minor_version,
+ 1, 1) >= 0;
}
static int
@@ -47,8 +47,8 @@ ProcRRQueryVersion (ClientPtr client)
rep.length = 0;
rep.sequenceNumber = client->sequence;
- if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
- (SERVER_RANDR_MAJOR_VERSION * 1000 + SERVER_RANDR_MINOR_VERSION))
+ if (version_compare(stuff->majorVersion, stuff->minorVersion,
+ SERVER_RANDR_MAJOR_VERSION, SERVER_RANDR_MINOR_VERSION) < 0)
{
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;