⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 window.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 5 页
字号:
	    {			pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID,						RT_PIXMAP, SecurityReadAccess);		if (pPixmap != (PixmapPtr) NULL)		{		    if	((pPixmap->drawable.depth != pWin->drawable.depth) ||			 (pPixmap->drawable.pScreen != pScreen))		    {			error = BadMatch;			goto PatchUp;		    }		    if (pWin->backgroundState == BackgroundPixmap)			(*pScreen->DestroyPixmap)(pWin->background.pixmap);		    pWin->backgroundState = BackgroundPixmap;		    pWin->background.pixmap = pPixmap;		    pPixmap->refcnt++;		}		else		{		    error = BadPixmap;		    client->errorValue = pixID;		    goto PatchUp;		}	    }	    break;	  case CWBackPixel:	    if (pWin->backgroundState == ParentRelative)		borderRelative = TRUE;	    if (pWin->backgroundState == BackgroundPixmap)		(*pScreen->DestroyPixmap)(pWin->background.pixmap);	    pWin->backgroundState = BackgroundPixel;	    pWin->background.pixel = (CARD32 ) *pVlist;		   /* background pixel overrides background pixmap,		      so don't let the ddx layer see both bits */	    vmaskCopy &= ~CWBackPixmap;	    pVlist++;	    break;	  case CWBorderPixmap:	    pixID = (Pixmap ) *pVlist;	    pVlist++;	    if (pixID == CopyFromParent)	    {		if (!pWin->parent ||		    (pWin->drawable.depth != pWin->parent->drawable.depth))		{		    error = BadMatch;		    goto PatchUp;		}		if (pWin->borderIsPixel == FALSE)		    (*pScreen->DestroyPixmap)(pWin->border.pixmap);		pWin->border = pWin->parent->border;		if ((pWin->borderIsPixel = pWin->parent->borderIsPixel) == TRUE)		{		    index2 = CWBorderPixel;		}		else		{		    pWin->parent->border.pixmap->refcnt++;		}	    }	    else	    {			pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID,					RT_PIXMAP, SecurityReadAccess);		if (pPixmap)		{		    if	((pPixmap->drawable.depth != pWin->drawable.depth) ||			 (pPixmap->drawable.pScreen != pScreen))		    {			error = BadMatch;			goto PatchUp;		    }		    if (pWin->borderIsPixel == FALSE)			(*pScreen->DestroyPixmap)(pWin->border.pixmap);		    pWin->borderIsPixel = FALSE;		    pWin->border.pixmap = pPixmap;		    pPixmap->refcnt++;		}		else		{		    error = BadPixmap;		    client->errorValue = pixID;		    goto PatchUp;		}	    }	    break;	  case CWBorderPixel:	    if (pWin->borderIsPixel == FALSE)		(*pScreen->DestroyPixmap)(pWin->border.pixmap);	    pWin->borderIsPixel = TRUE;	    pWin->border.pixel = (CARD32) *pVlist;		    /* border pixel overrides border pixmap,		       so don't let the ddx layer see both bits */	    vmaskCopy &= ~CWBorderPixmap;	    pVlist++;	    break;	  case CWBitGravity:	    val = (CARD8 )*pVlist;	    pVlist++;	    if (val > StaticGravity)	    {		error = BadValue;		client->errorValue = val;		goto PatchUp;	    }	    pWin->bitGravity = val;	    break;	  case CWWinGravity:	    val = (CARD8 )*pVlist;	    pVlist++;	    if (val > StaticGravity)	    {		error = BadValue;		client->errorValue = val;		goto PatchUp;	    }	    pWin->winGravity = val;	    break;	  case CWBackingStore:	    val = (CARD8 )*pVlist;	    pVlist++;	    if ((val != NotUseful) && (val != WhenMapped) && (val != Always))	    {		error = BadValue;		client->errorValue = val;		goto PatchUp;	    }	    pWin->backingStore = val;	    pWin->forcedBS = FALSE;	    break;	  case CWBackingPlanes:	    if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) {		if (!pWin->optional && !MakeWindowOptional (pWin))		{		    error = BadAlloc;		    goto PatchUp;		}		pWin->optional->backingBitPlanes = (CARD32) *pVlist;		if ((CARD32)*pVlist == (CARD32)~0L)		    checkOptional = TRUE;	    }	    pVlist++;	    break;	  case CWBackingPixel:	    if (pWin->optional || (CARD32) *pVlist) {		if (!pWin->optional && !MakeWindowOptional (pWin))		{		    error = BadAlloc;		    goto PatchUp;		}		pWin->optional->backingPixel = (CARD32) *pVlist;		if (!*pVlist)		    checkOptional = TRUE;	    }	    pVlist++;	    break;	  case CWSaveUnder:	    val = (BOOL) *pVlist;	    pVlist++;	    if ((val != xTrue) && (val != xFalse))	    {		error = BadValue;		client->errorValue = val;		goto PatchUp;	    }#ifdef DO_SAVE_UNDERS	    if (pWin->parent && (pWin->saveUnder != val) && (pWin->viewable) &&		DO_SAVE_UNDERS(pWin))	    {		/*		 * Re-check all siblings and inferiors for obscurity or		 * exposition (hee hee).		 */		if (pWin->saveUnder)		    deltaSaveUndersViewable--;		else		    deltaSaveUndersViewable++;		pWin->saveUnder = val;		if (pWin->firstChild)		{                    pLayerWin = (*pScreen->GetLayerWindow)(pWin);                   if ((*pScreen->ChangeSaveUnder)(pLayerWin->parent, pWin->nextSib))                       (*pScreen->PostChangeSaveUnder)(pLayerWin->parent,                                                       pWin->nextSib);               }               else               {                   if ((*pScreen->ChangeSaveUnder)(pWin, pWin->nextSib))                       (*pScreen->PostChangeSaveUnder)(pWin,                                                       pWin->nextSib);               }                                   	    }	    else	    {		/*  If we're changing the saveUnder attribute of the root 		 *  window, all we do is set pWin->saveUnder so that		 *  GetWindowAttributes returns the right value.  We don't		 *  do the "normal" save-under processing (as above).		 *  Hope that doesn't cause any problems.		 */		pWin->saveUnder = val;	    }#else	    pWin->saveUnder = val;#endif /* DO_SAVE_UNDERS */	    break;	  case CWEventMask:	    result = EventSelectForWindow(pWin, client, (Mask )*pVlist);	    if (result)	    {		error = result;		goto PatchUp;	    }	    pVlist++;	    break;	  case CWDontPropagate:	    result = EventSuppressForWindow(pWin, client, (Mask )*pVlist,					    &checkOptional);	    if (result)	    {		error = result;		goto PatchUp;	    }	    pVlist++;	    break;	  case CWOverrideRedirect:	    val = (BOOL ) *pVlist;	    pVlist++;	    if ((val != xTrue) && (val != xFalse))	    {		error = BadValue;		client->errorValue = val;		goto PatchUp;	    }	    pWin->overrideRedirect = val;	    break;	  case CWColormap:	    cmap = (Colormap) *pVlist;	    pVlist++;	    if (cmap == CopyFromParent)	    {#ifdef XAPPGROUP		Colormap ag_colormap;		ClientPtr win_owner;		/*		 * win_owner == client for CreateWindow, other clients		 * can ChangeWindowAttributes		 */		win_owner = LookupClient (pWin->drawable.id, client);		if ( win_owner && win_owner->appgroup &&		    !pWin->parent->parent &&		    (ag_colormap = XagDefaultColormap (win_owner)))		    cmap = ag_colormap;		else#endif		if (pWin->parent &&		    (!pWin->optional ||		     pWin->optional->visual == wVisual (pWin->parent)))		{		    cmap = wColormap (pWin->parent);		}		else		    cmap = None;	    }	    if (cmap == None)	    {		error = BadMatch;		goto PatchUp;	    }	    pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap,					      RT_COLORMAP, SecurityReadAccess);	    if (!pCmap)	    {		error = BadColor;		client->errorValue = cmap;		goto PatchUp;	    }	    if (pCmap->pVisual->vid != wVisual (pWin) ||		pCmap->pScreen != pScreen)	    {		error = BadMatch;		goto PatchUp;	    }	    if (cmap != wColormap (pWin))	    {		if (!pWin->optional)		{		    if (!MakeWindowOptional (pWin))		    {			error = BadAlloc;			goto PatchUp;		    }		}		else if (pWin->parent && cmap == wColormap (pWin->parent))		    checkOptional = TRUE;		/*		 * propagate the original colormap to any children		 * inheriting it		 */		for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)		{		    if (!pChild->optional && !MakeWindowOptional (pChild))		    {			error = BadAlloc;			goto PatchUp;		    }		}		pWin->optional->colormap = cmap;		/*		 * check on any children now matching the new colormap		 */		for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)		{		    if (pChild->optional->colormap == cmap)			CheckWindowOptionalNeed (pChild);		}		xE.u.u.type = ColormapNotify;		xE.u.colormap.window = pWin->drawable.id;		xE.u.colormap.colormap = cmap;		xE.u.colormap.new = xTrue;		xE.u.colormap.state = IsMapInstalled(cmap, pWin);		DeliverEvents(pWin, &xE, 1, NullWindow);	    }	    break;	  case CWCursor:	    cursorID = (Cursor ) *pVlist;	    pVlist++;	    /*	     * install the new	     */	    if ( cursorID == None)	    {		if (pWin == WindowTable[pWin->drawable.pScreen->myNum])		    pCursor = rootCursor;		else		    pCursor = (CursorPtr) None;	    }	    else	    {		pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID,						RT_CURSOR, SecurityReadAccess);		if (!pCursor)		{		    error = BadCursor;		    client->errorValue = cursorID;		    goto PatchUp;		}	    }	    if (pCursor != wCursor (pWin))	    {		/*		 * patch up child windows so they don't lose cursors.		 */		for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)		{		    if (!pChild->optional && !pChild->cursorIsNone &&			!MakeWindowOptional (pChild))		    {			error = BadAlloc;			goto PatchUp;		    }		}		pOldCursor = 0;		if (pCursor == (CursorPtr) None)		{		    pWin->cursorIsNone = TRUE;		    if (pWin->optional)		    {			pOldCursor = pWin->optional->cursor;			pWin->optional->cursor = (CursorPtr) None;			checkOptional = TRUE;		    }		} else {		    if (!pWin->optional)		    {			if (!MakeWindowOptional (pWin))			{			    error = BadAlloc;			    goto PatchUp;			}		    }		    else if (pWin->parent && pCursor == wCursor (pWin->parent))			checkOptional = TRUE;		    pOldCursor = pWin->optional->cursor;		    pWin->optional->cursor = pCursor;		    pCursor->refcnt++;		    pWin->cursorIsNone = FALSE;		    /*		     * check on any children now matching the new cursor		     */		    for (pChild=pWin->firstChild; pChild; pChild=pChild->nextSib)		    {			if (pChild->optional &&			    (pChild->optional->cursor == pCursor))			    CheckWindowOptionalNeed (pChild);		    }		}		if (pWin->realized)		    WindowHasNewCursor( pWin);		/* Can't free cursor until here - old cursor		 * is needed in WindowHasNewCursor		 */		if (pOldCursor)		    FreeCursor (pOldCursor, (Cursor)0);	    }	    break;	 default:	    error = BadValue;	    client->errorValue = vmask;	    goto PatchUp;      }      vmaskCopy |= index2;    }PatchUp:    if (checkOptional)	CheckWindowOptionalNeed (pWin);	/* We SHOULD check for an error value here XXX */    (*pScreen->ChangeWindowAttributes)(pWin, vmaskCopy);    /* 	If the border contents have changed, redraw the border. 	Note that this has to be done AFTER pScreen->ChangeWindowAttributes	for the tile to be rotated, and the correct function selected.    */    if (((vmaskCopy & (CWBorderPixel | CWBorderPixmap)) || borderRelative)	&& pWin->viewable && HasBorder (pWin))    {	RegionRec exposed;	REGION_INIT(pScreen, &exposed, NullBox, 0);	REGION_SUBTRACT(pScreen, &exposed, &pWin->borderClip, &pWin->winSize);	(*pWin->drawable.pScreen->PaintWindowBorder)(pWin, &exposed, PW_BORDER);	REGION_UNINIT(pScreen, &exposed);    }    return error;}/***** * GetWindowAttributes *    Notice that this is different than ChangeWindowAttributes *****/voidGetWindowAttributes(pWin, client, wa)    register WindowPtr pWin;    ClientPtr client;    xGetWindowAttributesReply *wa;{    wa->type = X_Reply;    wa->bitGravity = pWin->bitGravity;    wa->winGravity = pWin->winGravity;    if (pWin->forcedBS && pWin->backingStore != Always)	wa->backingStore = NotUseful;    else	wa->backingStore = pWin->backingStore;    wa->length = (sizeof(xGetWindowAttributesReply) -		 sizeof(xGenericReply)) >> 2;    wa->sequenceNumber = client->sequence;    wa->backingBitPlanes =  wBackingBitPlanes (pWin);    wa->backingPixel =  wBackingPixel (pWin);    wa->saveUnder = (BOOL)pWin->saveUnder;    wa->override = pWin->overrideRedirect;    if (!pWin->mapped)	wa->mapState = IsUnmapped;    else if (pWin->realized)	wa->mapState = IsViewable;    else	wa->mapState = IsUnviewable;    wa->colormap =  wColormap (pWin);    wa->mapInstalled = (wa->colormap == None) ? xFalse				: IsMapInstalled(wa->colormap, pWin);    wa->yourEventMask = EventMaskForClient(pWin, client);    wa->allEventMasks = pWin->eventMask | wOtherEventMasks (pWin);    wa->doNotPropagateMask = wDontPropagateMask (pWin);    wa->class = pWin->drawable.class;    wa->visualID = wVisual (pWin);}WindowPtrMoveWindowInStack(pWin, pNextSib)    register WindowPtr pWin, pNextSib;{    register WindowPtr pParent = pWin->parent;    WindowPtr pFirstChange = pWin; /* highest window where list changes */    if (pWin->nextSib != pNextSib)    {	if (!pNextSib)	      /* move to bottom */	{	    if (pParent->firstChild == pWin)		pParent->firstChild = pWin->nextSib;	    /* if (pWin->nextSib) */	 /* is always True: pNextSib == NULL					  * and pWin->nextSib != pNextSib					  * therefore pWin->nextSib != NULL */	    pFirstChange = pWin->nextSib;	    pWin->nextSib->prevSib = pWin->prevSib;	    if (pWin->prevSib)		pWin->prevSib->nextSib = pWin->nextSib;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -