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

📄 appgroup.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 2 页
字号:
    ClientPtr client;    int attrib_mask;    AppGroupPtr pAppGrp;{    WindowPtr pWin;    int idepth, ivids, found;    ScreenPtr pScreen;    DepthPtr pDepth;    ColormapPtr pColormap;    pWin = LookupWindow (pAppGrp->default_root, client);    /* XXX check that pWin is not NULL */    pScreen = pWin->drawable.pScreen;    if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root)	return BadWindow;    pDepth = pScreen->allowedDepths;    if (pAppGrp->root_visual) {	found = FALSE;	for (idepth = 0; idepth < pScreen->numDepths; idepth++, pDepth++) {	    for (ivids = 0; ivids < pDepth->numVids; ivids++) {		if (pAppGrp->root_visual == pDepth->vids[ivids]) {		    found = TRUE;		    break;		}	    }	}	if (!found)	    return BadMatch;    }    if (pAppGrp->default_colormap) {	pColormap = (ColormapPtr)LookupIDByType (pAppGrp->default_colormap, RT_COLORMAP);	/* XXX check that pColormap is not NULL */	if (pColormap->pScreen != pScreen)	    return BadColor;	if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual))	    return BadMatch;    }    return client->noClientException;}/* static */int ProcXagCreate (client)    register ClientPtr client;{    REQUEST (xXagCreateReq);    AppGroupPtr pAppGrp;    int ret;    REQUEST_AT_LEAST_SIZE (xXagCreateReq);    LEGAL_NEW_RESOURCE (stuff->app_group, client);    pAppGrp = CreateAppGroup (client, stuff->app_group, 		stuff->attrib_mask, (CARD32*) &stuff[1]);    if (!pAppGrp)	return BadAlloc;    ret = AttrValidate (client, stuff->attrib_mask, pAppGrp);    if (ret != Success) {	XagAppGroupFree ((pointer)pAppGrp, (XID)0);	return ret;    }    if (pAppGrp->single_screen) {	CreateConnectionInfo (pAppGrp);	if (!pAppGrp->ConnectionInfo)	    return BadAlloc;    }    if (!AddResource (stuff->app_group, RT_APPGROUP, (pointer)pAppGrp))	return BadAlloc;    if (XagCallbackRefCount++ == 0)	(void) AddCallback (&ClientStateCallback, XagClientStateChange, NULL);    return client->noClientException;}/* static */int ProcXagDestroy (client)    register ClientPtr client;{    AppGroupPtr pAppGrp;    REQUEST (xXagDestroyReq);    REQUEST_SIZE_MATCH (xXagDestroyReq);    pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client, 		(XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);    if (!pAppGrp) return XagBadAppGroup;    FreeResource ((XID)stuff->app_group, RT_NONE);    if (--XagCallbackRefCount == 0)	(void) DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL);    return client->noClientException;}static int ProcXagGetAttr (client)    register ClientPtr client;{    AppGroupPtr pAppGrp;    REQUEST (xXagGetAttrReq);    xXagGetAttrReply rep;    int n;    REQUEST_SIZE_MATCH (xXagGetAttrReq);    pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client, 		(XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess);    if (!pAppGrp) return XagBadAppGroup;    rep.default_root = pAppGrp->default_root;    rep.root_visual = pAppGrp->root_visual;    rep.default_colormap = pAppGrp->default_colormap;    rep.single_screen = pAppGrp->single_screen;    rep.app_group_leader = (pAppGrp->leader) ? 1 : 0;    if (client->swapped) {    	swaps (&rep.sequence_number, n);    	swapl (&rep.length, n);    	swapl (&rep.default_root, n);    	swapl (&rep.root_visual, n);    	swapl (&rep.default_colormap, n);    }    WriteToClient (client, sizeof (xXagGetAttrReply), (char *)&rep);    return client->noClientException;}static int ProcXagQuery (client)    register ClientPtr client;{    ClientPtr pClient;    AppGroupPtr pAppGrp;    REQUEST (xXagQueryReq);    int n;    REQUEST_SIZE_MATCH (xXagQueryReq);    pClient = LookupClient (stuff->resource, client);    for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)	for (n = 0; n < pAppGrp->nclients; n++)	    if (pAppGrp->clients[n] == pClient) {		xXagQueryReply rep;		rep.type = X_Reply;		rep.length = 0;		rep.sequence_number = client->sequence;		rep.app_group = pAppGrp->appgroupId;		if (client->swapped) {		    swaps (&rep.sequence_number, n);		    swapl (&rep.length, n);		    swapl (&rep.app_group, n);		}		WriteToClient (client, sizeof (xXagQueryReply), (char *)&rep);		return client->noClientException;	    }    return BadMatch;}static int ProcXagCreateAssoc (client)    register ClientPtr client;{    REQUEST (xXagCreateAssocReq);    REQUEST_SIZE_MATCH (xXagCreateAssocReq);#ifdef WIN32    if (stuff->window_type != XagWindowTypeWin32)#else    if (stuff->window_type != XagWindowTypeX11)#endif	return BadMatch;#ifdef WIN32 /* and Mac, etc */    if (!LocalClient (client))	return BadAccess;#endif/* Macintosh, OS/2, and MS-Windows servers have some work to do here */    return client->noClientException;}static int ProcXagDestroyAssoc (client)    register ClientPtr client;{    REQUEST (xXagDestroyAssocReq);    REQUEST_SIZE_MATCH (xXagDestroyAssocReq);/* Macintosh, OS/2, and MS-Windows servers have some work to do here */    return client->noClientException;}static int ProcXagDispatch (client)    register ClientPtr	client;{    REQUEST (xReq);    switch (stuff->data)    {    case X_XagQueryVersion:	return ProcXagQueryVersion (client);    case X_XagCreate:	return ProcXagCreate (client);    case X_XagDestroy:	return ProcXagDestroy (client);    case X_XagGetAttr:	return ProcXagGetAttr (client);    case X_XagQuery:	return ProcXagQuery (client);    case X_XagCreateAssoc:	return ProcXagCreateAssoc (client);    case X_XagDestroyAssoc:	return ProcXagDestroyAssoc (client);    default:	return BadRequest;    }}static int SProcXagQueryVersion (client)    register ClientPtr	client;{    register int n;    REQUEST(xXagQueryVersionReq);    swaps(&stuff->length, n);    return ProcXagQueryVersion(client);}static int SProcXagCreate (client)    ClientPtr client;{    register int n;    REQUEST (xXagCreateReq);    swaps (&stuff->length, n);    REQUEST_AT_LEAST_SIZE (xXagCreateReq);    swapl (&stuff->app_group, n);    swapl (&stuff->attrib_mask, n);    SwapRestL (stuff);    return ProcXagCreate (client);}static int SProcXagDestroy (client)    ClientPtr client;{    register int n;    REQUEST (xXagDestroyReq);    swaps (&stuff->length, n);    REQUEST_SIZE_MATCH (xXagDestroyReq);    swapl (&stuff->app_group, n);    return ProcXagDestroy (client);}static int SProcXagGetAttr (client)    ClientPtr client;{    register int n;    REQUEST (xXagGetAttrReq);    swaps (&stuff->length, n);    REQUEST_SIZE_MATCH (xXagGetAttrReq);    swapl (&stuff->app_group, n);    return ProcXagGetAttr (client);}static int SProcXagQuery (client)    ClientPtr client;{    register int n;    REQUEST (xXagQueryReq);    swaps (&stuff->length, n);    REQUEST_SIZE_MATCH (xXagQueryReq);    swapl (&stuff->resource, n);    return ProcXagQuery (client);}static int SProcXagCreateAssoc (client)    ClientPtr client;{    register int n;    REQUEST (xXagCreateAssocReq);    swaps (&stuff->length, n);    REQUEST_SIZE_MATCH (xXagCreateAssocReq);    swapl (&stuff->window, n);    swapl (&stuff->window_type, n);    swaps (&stuff->system_window_len, n);    return ProcXagCreateAssoc (client);}static int SProcXagDestroyAssoc (client)    ClientPtr client;{    register int n;    REQUEST (xXagDestroyAssocReq);    swaps (&stuff->length, n);    REQUEST_SIZE_MATCH (xXagDestroyAssocReq);    swapl (&stuff->window, n);    return ProcXagDestroyAssoc (client);}static int SProcXagDispatch (client)    register ClientPtr	client;{    REQUEST(xReq);    switch (stuff->data)    {    case X_XagQueryVersion:	return SProcXagQueryVersion (client);    case X_XagCreate:	return SProcXagCreate (client);    case X_XagDestroy:	return SProcXagDestroy (client);    case X_XagGetAttr:	return SProcXagGetAttr (client);    case X_XagQuery:	return SProcXagQuery (client);    case X_XagCreateAssoc:	return SProcXagCreateAssoc (client);    case X_XagDestroyAssoc:	return SProcXagDestroyAssoc (client);    default:	return BadRequest;    }}Colormap XagDefaultColormap (client)    ClientPtr client;{    return (client->appgroup ? client->appgroup->default_colormap : None);}VisualID XagRootVisual (client)    ClientPtr client;{    return (client->appgroup ? client->appgroup->root_visual : 0);}ClientPtr XagLeader (client)    ClientPtr client;{    return (client->appgroup ? client->appgroup->leader : NULL);}/* * Return whether the Map request event should be sent to the appgroup leader. * We don't want to send it to the leader when the window is on a different * screen, e.g. a print screen. */Bool XagIsControlledRoot (client, pParent)    ClientPtr client;    WindowPtr pParent;{    if (client->appgroup) {	if (client->appgroup->single_screen && 	    pParent->drawable.id == client->appgroup->default_root)	    return TRUE;	else if (!pParent->parent)	    return TRUE;	else	    return FALSE;    }    return FALSE; }void XagConnectionInfo (client, conn_prefix, conn_info, num_screen)    ClientPtr client;    xConnSetupPrefix** conn_prefix;    char** conn_info;    int* num_screen;{    if (client->appgroup && client->appgroup->ConnectionInfo) {	*conn_prefix = &client->appgroup->connSetupPrefix;	*conn_info = client->appgroup->ConnectionInfo;	*num_screen = ((xConnSetup*)(client->appgroup->ConnectionInfo))->numRoots;    } }XID XagId (client)    ClientPtr client;{    return (client->appgroup ? client->appgroup->appgroupId : 0);}void XagGetDeltaInfo (client, buf)    ClientPtr client;    CARD32* buf;{    *buf++ = (CARD32) client->appgroup->default_root;    *buf++ = (CARD32) client->appgroup->root_visual;    *buf++ = (CARD32) client->appgroup->default_colormap;    *buf++ = (CARD32) client->appgroup->black_pixel;    *buf = (CARD32) client->appgroup->white_pixel;}void XagCallClientStateChange (client)    ClientPtr client;{    if (appGrpList) {	NewClientInfoRec clientinfo;	clientinfo.client = client;	XagClientStateChange (NULL, NULL, (pointer)&clientinfo);    }}

⌨️ 快捷键说明

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