diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-28 17:20:58 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-28 17:20:58 +1000 |
commit | d7aef3f663f4b5d861799f8615dcd301d5ce2906 (patch) | |
tree | 3a5ed1b3dc7e83536979578e3da99f2860f44b11 /dix | |
parent | a25f248fc3bd0375d91ca8a44320200d445ecfbb (diff) | |
parent | e08c6a0752772745f35f7afcf6c2b1c927b91cc0 (diff) |
Merge branch 'master' into xi2
Conflicts:
Xext/geext.c
Xi/chdevcur.c
Xi/extgrbdev.c
Xi/xiproperty.c
configure.ac
dix/ptrveloc.c
hw/xfree86/common/xf86Config.c
mi/mipointer.h
test/input.c
xkb/xkb.c
Diffstat (limited to 'dix')
-rw-r--r-- | dix/colormap.c | 26 | ||||
-rw-r--r-- | dix/cursor.c | 5 | ||||
-rw-r--r-- | dix/deprecated.c | 8 | ||||
-rw-r--r-- | dix/dispatch.c | 15 | ||||
-rw-r--r-- | dix/dixfonts.c | 61 | ||||
-rw-r--r-- | dix/dixutils.c | 11 | ||||
-rw-r--r-- | dix/events.c | 28 | ||||
-rw-r--r-- | dix/ptrveloc.c | 36 | ||||
-rw-r--r-- | dix/resource.c | 22 | ||||
-rw-r--r-- | dix/window.c | 87 |
10 files changed, 169 insertions, 130 deletions
diff --git a/dix/colormap.c b/dix/colormap.c index 6a5eb74a1..a5a006e60 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -893,9 +893,9 @@ AllocColor (ColormapPtr pmap, if (pmap->mid != pmap->pScreen->defColormap && pmap->pVisual->vid == pmap->pScreen->rootVisual) { - ColormapPtr prootmap = (ColormapPtr) - SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, DixReadAccess); + ColormapPtr prootmap; + dixLookupResourceByType((pointer *)&prootmap, pmap->pScreen->defColormap, + RT_COLORMAP, clients[client], DixReadAccess); if (pmap->class == prootmap->class) FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb, @@ -910,9 +910,9 @@ AllocColor (ColormapPtr pmap, if (pmap->mid != pmap->pScreen->defColormap && pmap->pVisual->vid == pmap->pScreen->rootVisual) { - ColormapPtr prootmap = (ColormapPtr) - SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, DixReadAccess); + ColormapPtr prootmap; + dixLookupResourceByType((pointer *)&prootmap, pmap->pScreen->defColormap, + RT_COLORMAP, clients[client], DixReadAccess); if (pmap->class == prootmap->class) { @@ -1550,12 +1550,14 @@ FreePixels(ColormapPtr pmap, int client) int FreeClientPixels (pointer value, XID fakeid) { - ColormapPtr pmap; - colorResource *pcr = (colorResource *)value; - - pmap = (ColormapPtr) LookupIDByType(pcr->mid, RT_COLORMAP); - if (pmap) - FreePixels(pmap, pcr->client); + pointer pmap; + colorResource *pcr = value; + int rc; + + rc = dixLookupResourceByType(&pmap, pcr->mid, RT_COLORMAP, serverClient, + DixRemoveAccess); + if (rc == Success) + FreePixels((ColormapPtr)pmap, pcr->client); xfree(pcr); return Success; } diff --git a/dix/cursor.c b/dix/cursor.c index 7ab15df0c..086d008e0 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -545,8 +545,9 @@ CreateRootCursor(char *unused1, unsigned int unused2) if (err != Success) return NullCursor; - cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT); - if (!cursorfont) + err = dixLookupResourceByType((pointer *)&cursorfont, fontID, RT_FONT, + serverClient, DixReadAccess); + if (err != Success) return NullCursor; if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0, &curs, serverClient, (XID)0) != Success) diff --git a/dix/deprecated.c b/dix/deprecated.c index 5487b64bc..8123886ca 100644 --- a/dix/deprecated.c +++ b/dix/deprecated.c @@ -148,14 +148,18 @@ SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, pointer LookupIDByType(XID id, RESTYPE rtype) { - return SecurityLookupIDByType(NullClient, id, rtype, DixUnknownAccess); + pointer val; + dixLookupResourceByType(&val, id, rtype, NullClient, DixUnknownAccess); + return val; } /* replaced by dixLookupResourceByClass */ pointer LookupIDByClass(XID id, RESTYPE classes) { - return SecurityLookupIDByClass(NullClient, id, classes, DixUnknownAccess); + pointer val; + dixLookupResourceByClass(&val, id, classes, NullClient, DixUnknownAccess); + return val; } /* replaced by dixLookupResourceBy{Type,Class} */ diff --git a/dix/dispatch.c b/dix/dispatch.c index 16a51bdc5..dbb97e05f 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -413,12 +413,6 @@ Dispatch(void) } client->sequence++; -#ifdef DEBUG - if (client->requestLogIndex == MAX_REQUEST_LOG) - client->requestLogIndex = 0; - client->requestLog[client->requestLogIndex] = MAJOROP; - client->requestLogIndex++; -#endif #ifdef XSERVER_DTRACE XSERVER_REQUEST_START(LookupMajorName(MAJOROP), MAJOROP, ((xReq *)client->requestBuffer)->length, @@ -1252,12 +1246,13 @@ int ProcCloseFont(ClientPtr client) { FontPtr pFont; + int rc; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - DixDestroyAccess); - if ( pFont != (FontPtr)NULL) /* id was valid */ + rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT, + client, DixDestroyAccess); + if (rc == Success) { FreeResource(stuff->id, RT_NONE); return(client->noClientException); @@ -1265,7 +1260,7 @@ ProcCloseFont(ClientPtr client) else { client->errorValue = stuff->id; - return (BadFont); + return (rc == BadValue) ? BadFont : rc; } } diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 79489e81f..8b6e7a329 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -137,8 +137,9 @@ SetDefaultFont(char *defaultfontname) (unsigned) strlen(defaultfontname), defaultfontname); if (err != Success) return FALSE; - pf = (FontPtr) LookupIDByType(fid, RT_FONT); - if (pf == (FontPtr) NULL) + err = dixLookupResourceByType((pointer *)&pf, fid, RT_FONT, serverClient, + DixReadAccess); + if (err != Success) return FALSE; defaultFont = pf; return TRUE; @@ -1201,17 +1202,18 @@ doPolyText(ClientPtr client, PTclosurePtr c) } /* Make sure our drawable hasn't disappeared while we slept. */ - if (c->slept && - c->pDraw && - c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, - RC_DRAWABLE, DixWriteAccess)) + if (c->slept && c->pDraw) { - /* Our drawable has disappeared. Treat like client died... ask - the FPE code to clean up after client and avoid further - rendering while we clean up after ourself. */ - fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); - c->pDraw = (DrawablePtr)0; + DrawablePtr pDraw; + dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess); + if (c->pDraw != pDraw) { + /* Our drawable has disappeared. Treat like client died... ask + the FPE code to clean up after client and avoid further + rendering while we clean up after ourself. */ + fpe = c->pGC->font->fpe; + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + c->pDraw = (DrawablePtr)0; + } } client_state = c->slept ? SLEEPING : NEVER_SLEPT; @@ -1233,12 +1235,11 @@ doPolyText(ClientPtr client, PTclosurePtr c) | ((Font)*(c->pElt+3)) << 8 | ((Font)*(c->pElt+2)) << 16 | ((Font)*(c->pElt+1)) << 24; - pFont = (FontPtr)SecurityLookupIDByType(client, fid, RT_FONT, - DixReadAccess); - if (!pFont) + err = dixLookupResourceByType((pointer *)&pFont, fid, RT_FONT, + client, DixReadAccess); + if (err != Success) { - client->errorValue = fid; - err = BadFont; + err = (err == BadValue) ? BadFont : err; /* restore pFont and fid for step 4 (described below) */ pFont = oldpFont; fid = oldfid; @@ -1486,17 +1487,18 @@ doImageText(ClientPtr client, ITclosurePtr c) } /* Make sure our drawable hasn't disappeared while we slept. */ - if (c->slept && - c->pDraw && - c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, - RC_DRAWABLE, DixWriteAccess)) + if (c->slept && c->pDraw) { - /* Our drawable has disappeared. Treat like client died... ask - the FPE code to clean up after client. */ - fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); - err = Success; - goto bail; + DrawablePtr pDraw; + dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess); + if (c->pDraw != pDraw) { + /* Our drawable has disappeared. Treat like client died... ask + the FPE code to clean up after client. */ + fpe = c->pGC->font->fpe; + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + err = Success; + goto bail; + } } lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, c->itemSize, c->data); @@ -2013,8 +2015,9 @@ FreeFonts(void) FontPtr find_old_font(XID id) { - return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE, - DixUnknownAccess); + pointer pFont; + dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess); + return (FontPtr)pFont; } Font diff --git a/dix/dixutils.c b/dix/dixutils.c index 1bdeee064..5cede5f43 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -240,14 +240,9 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access) int dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) { - GCPtr pTmp = (GCPtr)SecurityLookupIDByType(client, id, RT_GC, access); - if (pTmp) { - *pGC = pTmp; - return Success; - } - client->errorValue = id; - *pGC = NULL; - return BadGC; + int rc; + rc = dixLookupResourceByType((pointer *)pGC, id, RT_GC, client, access); + return (rc == BadValue) ? BadGC : rc; } int diff --git a/dix/events.c b/dix/events.c index 503a58d76..0d0c4194d 100644 --- a/dix/events.c +++ b/dix/events.c @@ -583,16 +583,17 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin) PanoramiXNumScreens*sizeof(WindowPtr)); } else { PanoramiXRes *win; - int i; - - win = (PanoramiXRes*)LookupIDByType(pWin->drawable.id, XRT_WINDOW); + int rc, i; - if(!win) + rc = dixLookupResourceByType((pointer *)&win, pWin->drawable.id, + XRT_WINDOW, serverClient, DixReadAccess); + if (rc != Success) return FALSE; for(i = 0; i < PanoramiXNumScreens; i++) { - pSprite->windows[i] = LookupIDByType(win->info[i].id, RT_WINDOW); - if(!pSprite->windows[i]) /* window is being unmapped */ + rc = dixLookupWindow(pSprite->windows + i, win->info[i].id, + serverClient, DixReadAccess); + if (rc != Success) /* window is being unmapped */ return FALSE; } } @@ -664,7 +665,7 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev, void SetMaskForEvent(int deviceid, Mask mask, int event) { - if (deviceid < 0 || deviceid > MAXDEVICES) + if (deviceid < 0 || deviceid >= MAXDEVICES) FatalError("SetMaskForEvent: bogus device id"); filters[deviceid][event] = mask; } @@ -4246,8 +4247,7 @@ CoreEnterLeaveEvent( if ((type == EnterNotify) && (mask & KeymapStateMask)) { xKeymapEvent ke; - ClientPtr client = grab ? rClient(grab) - : clients[CLIENT_ID(pWin->drawable.id)]; + ClientPtr client = grab ? rClient(grab) : wClient(pWin); if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess)) bzero((char *)&ke.map[0], 31); else @@ -4354,11 +4354,11 @@ CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) { xKeymapEvent ke; - ClientPtr client = clients[CLIENT_ID(pWin->drawable.id)]; - if (XaceHook(XACE_DEVICE_ACCESS, client, dev, FALSE)) - memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); - else + ClientPtr client = wClient(pWin); + if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess)) bzero((char *)&ke.map[0], 31); + else + memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); ke.type = KeymapNotify; DeliverEventsToWindow(dev, pWin, (xEvent *)&ke, 1, @@ -5425,7 +5425,7 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources) to None */ #ifdef NOTDEF - || clients[CLIENT_ID(parent->drawable.id)]->clientGone + || wClient(parent)->clientGone #endif ); if (!ActivateFocusInGrab(keybd, pWin, parent)) diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index 7fa42008f..dd264770a 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -77,9 +77,12 @@ GetAccelerationProfile(DeviceVelocityPtr s, int profile_num); #endif /******************************** - * Init/Uninit etc + * Init/Uninit *******************************/ +/* some int which is not a profile number */ +#define PROFILE_UNINITIALIZE (-100) + /** * Init struct so it should match the average case */ @@ -108,7 +111,7 @@ InitVelocityData(DeviceVelocityPtr s) static void FreeVelocityData(DeviceVelocityPtr s){ xfree(s->tracker); - SetAccelerationProfile(s, -1); + SetAccelerationProfile(s, PROFILE_UNINITIALIZE); } @@ -824,6 +827,16 @@ LinearProfile( } +static float +NoProfile( + DeviceVelocityPtr pVel, + float velocity, + float threshold, + float acc) +{ + return 1.0f; +} + static PointerAccelerationProfileFunc GetAccelerationProfile( DeviceVelocityPtr s, @@ -844,8 +857,8 @@ GetAccelerationProfile( return PowerProfile; case AccelProfileLinear: return LinearProfile; - case AccelProfileReserved: - /* reserved for future use, e.g. a user-defined profile */ + case AccelProfileNone: + return NoProfile; default: return NULL; } @@ -856,8 +869,10 @@ GetAccelerationProfile( * Intended to make profiles exchangeable at runtime. * If you created a profile, give it a number here and in the header to * make it selectable. In case some profile-specific init is needed, here - * would be a good place, since FreeVelocityData() also calls this with -1. - * returns FALSE (0) if profile number is unavailable. + * would be a good place, since FreeVelocityData() also calls this with + * PROFILE_UNINITIALIZE. + * + * returns FALSE if profile number is unavailable, TRUE otherwise. */ int SetAccelerationProfile( @@ -867,7 +882,7 @@ SetAccelerationProfile( PointerAccelerationProfileFunc profile; profile = GetAccelerationProfile(s, profile_num); - if(profile == NULL && profile_num != -1) + if(profile == NULL && profile_num != PROFILE_UNINITIALIZE) return FALSE; if(s->profile_private != NULL){ @@ -955,6 +970,11 @@ acceleratePointerPredictable( if (!num_valuators || !valuators || !velocitydata) return; + if (velocitydata->statistics.profile_number == AccelProfileNone && + velocitydata->const_acceleration == 1.0f) { + return; /*we're inactive anyway, so skip the whole thing.*/ + } + if (first_valuator == 0) { dx = valuators[0]; px = &valuators[0]; @@ -988,7 +1008,7 @@ acceleratePointerPredictable( /* Since it may not be apparent: lrintf() does not offer * strong statements about rounding; however because we * process each axis conditionally, there's no danger - * of a toggling remainder. Its lack of guarantees hopefully + * of a toggling remainder. Its lack of guarantees likely * makes it faster on the average target. */ *px = lrintf(tmp); pDev->last.remainder[0] = tmp - (float)*px; diff --git a/dix/resource.c b/dix/resource.c index dc6945dd1..73bc3a998 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -392,13 +392,16 @@ unsigned int GetXIDList(ClientPtr pClient, unsigned count, XID *pids) { unsigned int found = 0; - XID id = pClient->clientAsMask; + XID rc, id = pClient->clientAsMask; XID maxid; + pointer val; maxid = id | RESOURCE_ID_MASK; while ( (found < count) && (id <= maxid) ) { - if (!LookupIDByClass(id, RC_ANY)) + rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient, + DixGetAttrAccess); + if (rc == BadValue) { pids[found++] = id; } @@ -826,6 +829,8 @@ FreeAllResources(void) Bool LegalNewID(XID id, ClientPtr client) { + pointer val; + int rc; #ifdef PANORAMIX XID minid, maxid; @@ -838,9 +843,16 @@ LegalNewID(XID id, ClientPtr client) return TRUE; } #endif /* PANORAMIX */ - return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) && - ((clientTable[client->index].expectID <= id) || - !LookupIDByClass(id, RC_ANY))); + if (client->clientAsMask == (id & ~RESOURCE_ID_MASK)) + { + if (clientTable[client->index].expectID <= id) + return TRUE; + + rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient, + DixGetAttrAccess); + return (rc == BadValue); + } + return FALSE; } int diff --git a/dix/window.c b/dix/window.c index 44cd99ae7..99b594b63 100644 --- a/dix/window.c +++ b/dix/window.c @@ -2,25 +2,24 @@ Copyright (c) 2006, Red Hat, Inc. -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. +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 shall be included in -all copies or substantial portions of the Software. +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 -RED HAT 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. - -Except as contained in this notice, the name of Red Hat shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from Red Hat. +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. Copyright 1987, 1998 The Open Group @@ -2775,6 +2774,7 @@ UnrealizeTree( WindowPtr pChild; UnrealizeWindowProcPtr Unrealize; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; + int rc; Unrealize = pWin->drawable.pScreen->UnrealizeWindow; MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow; @@ -2788,9 +2788,10 @@ UnrealizeTree( #ifdef PANORAMIX if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) { PanoramiXRes *win; - win = (PanoramiXRes*)LookupIDByType(pChild->drawable.id, - XRT_WINDOW); - if(win) + rc = dixLookupResourceByType((pointer *)&win, + pChild->drawable.id, XRT_WINDOW, + serverClient, DixWriteAccess); + if (rc == Success) win->u.win.visibility = VisibilityNotViewable; } #endif @@ -3052,7 +3053,7 @@ SendVisibilityNotify(WindowPtr pWin) if(!noPanoramiXExtension) { PanoramiXRes *win; WindowPtr pWin2; - int i, Scrnum; + int rc, i, Scrnum; Scrnum = pWin->drawable.pScreen->myNum; @@ -3066,9 +3067,10 @@ SendVisibilityNotify(WindowPtr pWin) for(i = 0; i < PanoramiXNumScreens; i++) { if(i == Scrnum) continue; - pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW); + rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient, + DixWriteAccess); - if (pWin2) { + if (rc == Success) { if(pWin2->visibility == VisibilityPartiallyObscured) return; @@ -3078,17 +3080,19 @@ SendVisibilityNotify(WindowPtr pWin) break; case VisibilityPartiallyObscured: if(Scrnum) { - pWin2 = (WindowPtr)LookupIDByType(win->info[0].id, RT_WINDOW); - if (pWin2) pWin = pWin2; + rc = dixLookupWindow(&pWin2, win->info[0].id, serverClient, + DixWriteAccess); + if (rc == Success) pWin = pWin2; } break; case VisibilityFullyObscured: for(i = 0; i < PanoramiXNumScreens; i++) { if(i == Scrnum) continue; - pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW); + rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient, + DixWriteAccess); - if (pWin2) { + if (rc == Success) { if(pWin2->visibility != VisibilityFullyObscured) return; @@ -3704,7 +3708,7 @@ DrawLogo(WindowPtr pWin) int x, y; unsigned int width, height, size; GC *pGC; - int thin, gap, d31; + int rc, thin, gap, d31; DDXPointRec poly[4]; ChangeGCVal fore[2], back[2]; xrgb rgb[2]; @@ -3725,20 +3729,23 @@ DrawLogo(WindowPtr pWin) fore[0].val = pScreen->whitePixel; else fore[0].val = pScreen->blackPixel; - if ((pWin->backgroundState == BackgroundPixel) && - (cmap = (ColormapPtr)LookupIDByType(wColormap (pWin), RT_COLORMAP))) { - Pixel querypixels[2]; - - querypixels[0] = fore[0].val; - querypixels[1] = pWin->background.pixel; - QueryColors(cmap, 2, querypixels, rgb); - if ((rgb[0].red == rgb[1].red) && - (rgb[0].green == rgb[1].green) && - (rgb[0].blue == rgb[1].blue)) { - if (fore[0].val == pScreen->blackPixel) - fore[0].val = pScreen->whitePixel; - else - fore[0].val = pScreen->blackPixel; + if (pWin->backgroundState == BackgroundPixel) { + rc = dixLookupResourceByType((pointer *)&cmap, wColormap(pWin), + RT_COLORMAP, serverClient, DixReadAccess); + if (rc == Success) { + Pixel querypixels[2]; + + querypixels[0] = fore[0].val; + querypixels[1] = pWin->background.pixel; + QueryColors(cmap, 2, querypixels, rgb); + if ((rgb[0].red == rgb[1].red) && + (rgb[0].green == rgb[1].green) && + (rgb[0].blue == rgb[1].blue)) { + if (fore[0].val == pScreen->blackPixel) + fore[0].val = pScreen->whitePixel; + else + fore[0].val = pScreen->blackPixel; + } } } fore[1].val = FillSolid; |