diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-05-06 11:00:37 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-05-07 21:56:36 -0700 |
commit | 35761d5f811406bc0b6a68c1b02bdb699142745c (patch) | |
tree | 5286fcdbbc0fcf47f4c29ca55ee8f235bd4d23cb /dix | |
parent | 2eab697adba4b1858a530750e9a35fba79a7bf26 (diff) |
Introduce dixLookupFontable for "FONT or GC" parameters.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/dispatch.c | 26 | ||||
-rw-r--r-- | dix/dixutils.c | 18 |
2 files changed, 22 insertions, 22 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c index 982c808c7..a2cffacda 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1283,22 +1283,13 @@ ProcQueryFont(ClientPtr client) { xQueryFontReply *reply; FontPtr pFont; - GC *pGC; int rc; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - client->errorValue = stuff->id; /* EITHER font or gc */ - rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT, client, - DixGetAttrAccess); - if (rc == BadValue) { - rc = dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC, client, - DixGetAttrAccess); - if (rc == Success) - pFont = pGC->font; - } + rc = dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess); if (rc != Success) - return (rc == BadValue) ? BadFont: rc; + return rc; { xCharInfo *pmax = FONTINKMAX(pFont); @@ -1339,24 +1330,15 @@ ProcQueryTextExtents(ClientPtr client) { xQueryTextExtentsReply reply; FontPtr pFont; - GC *pGC; ExtentInfoRec info; unsigned long length; int rc; REQUEST(xQueryTextExtentsReq); REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq); - client->errorValue = stuff->fid; /* EITHER font or gc */ - rc = dixLookupResourceByType((pointer *)&pFont, stuff->fid, RT_FONT, client, - DixGetAttrAccess); - if (rc == BadValue) { - rc = dixLookupResourceByType((pointer *)&pGC, stuff->fid, RT_GC, client, - DixGetAttrAccess); - if (rc == Success) - pFont = pGC->font; - } + rc = dixLookupFontable(&pFont, stuff->fid, client, DixGetAttrAccess); if (rc != Success) - return (rc == BadValue) ? BadFont: rc; + return rc; length = client->req_len - bytes_to_int32(sizeof(xQueryTextExtentsReq)); length = length << 1; diff --git a/dix/dixutils.c b/dix/dixutils.c index 8278d444b..d61083609 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -92,6 +92,7 @@ Author: Adobe Systems Incorporated #include "windowstr.h" #include "dixstruct.h" #include "pixmapstr.h" +#include "gcstruct.h" #include "scrnintstr.h" #define XK_LATIN1 #include <X11/keysymdef.h> @@ -236,6 +237,23 @@ dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) } int +dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access) +{ + int rc; + GC *pGC; + client->errorValue = id; /* EITHER font or gc */ + rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client, access); + if (rc != BadValue) + return rc; + rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access); + if (rc == BadValue) + return BadFont; + if (rc == Success) + *pFont = pGC->font; + return rc; +} + +int dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access) { pointer pRes; |