📄 xf86vmode.c
字号:
return BadAlloc; } vsyncdata = ALLOCATE_LOCAL(mptr->n_vrefresh * sizeof(CARD32)); if (!vsyncdata) { DEALLOCATE_LOCAL(hsyncdata); return BadAlloc; } for (i = 0; i < mptr->n_hsync; i++) { hsyncdata[i] = (unsigned short)(mptr->hsync[i].lo * 100.0) | (unsigned short)(mptr->hsync[i].hi * 100.0) << 16; } for (i = 0; i < mptr->n_vrefresh; i++) { vsyncdata[i] = (unsigned short)(mptr->vrefresh[i].lo * 100.0) | (unsigned short)(mptr->vrefresh[i].hi * 100.0) << 16; } if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n);#if 0 swapl(&rep.bandwidth, n);#endif } WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *)&rep); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, mptr->n_hsync * sizeof(CARD32), hsyncdata); WriteSwappedDataToClient(client, mptr->n_vrefresh * sizeof(CARD32), vsyncdata); if (rep.vendorLength) WriteToClient(client, rep.vendorLength, mptr->vendor); if (rep.modelLength) WriteToClient(client, rep.modelLength, mptr->model); DEALLOCATE_LOCAL(hsyncdata); DEALLOCATE_LOCAL(vsyncdata); return (client->noClientException);}static intProcXF86VidModeGetViewPort(client) register ClientPtr client;{ REQUEST(xXF86VidModeGetViewPortReq); xXF86VidModeGetViewPortReply rep; ScrnInfoPtr vptr; int n; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.x = vptr->frameX0; rep.y = vptr->frameY0; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.x, n); swapl(&rep.y, n); } WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *)&rep); return (client->noClientException);}static intProcXF86VidModeSetViewPort(client) register ClientPtr client;{ REQUEST(xXF86VidModeSetViewPortReq); ScrnInfoPtr vptr; int x, y; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq); if (stuff->x < 0) x = 0; else if (stuff->x + vptr->modes->HDisplay + 1 > vptr->virtualX) x = vptr->virtualX - vptr->modes->HDisplay - 1; else x = stuff->x; if (stuff->y < 0) y = 0; else if (stuff->y + vptr->modes->VDisplay + 1 > vptr->virtualY) y = vptr->virtualY - vptr->modes->VDisplay - 1; else y = stuff->y; if (vptr->AdjustFrame && xf86VTSema) { vptr->AdjustFrame(x, y); vptr->frameX0 = x; vptr->frameX1 = x + vptr->modes->HDisplay - 1; vptr->frameY0 = y; vptr->frameY1 = y + vptr->modes->VDisplay - 1; } return (client->noClientException);}static intProcXF86VidModeDispatch (client) register ClientPtr client;{ REQUEST(xReq); switch (stuff->data) { case X_XF86VidModeQueryVersion: return ProcXF86VidModeQueryVersion(client); case X_XF86VidModeGetModeLine: return ProcXF86VidModeGetModeLine(client); case X_XF86VidModeGetAllModeLines: return ProcXF86VidModeGetAllModeLines(client); case X_XF86VidModeGetMonitor: return ProcXF86VidModeGetMonitor(client); case X_XF86VidModeValidateModeLine: return ProcXF86VidModeValidateModeLine(client); case X_XF86VidModeGetViewPort: return ProcXF86VidModeGetViewPort(client); default: if (!xf86VidModeEnabled) return vidmodeErrorBase + XF86VidModeExtensionDisabled; if (xf86VidModeAllowNonLocal || LocalClient (client)) { switch (stuff->data) { case X_XF86VidModeAddModeLine: return ProcXF86VidModeAddModeLine(client); case X_XF86VidModeDeleteModeLine: return ProcXF86VidModeDeleteModeLine(client); case X_XF86VidModeModModeLine: return ProcXF86VidModeModModeLine(client); case X_XF86VidModeSwitchMode: return ProcXF86VidModeSwitchMode(client); case X_XF86VidModeSwitchToMode: return ProcXF86VidModeSwitchToMode(client); case X_XF86VidModeLockModeSwitch: return ProcXF86VidModeLockModeSwitch(client); case X_XF86VidModeSetViewPort: return ProcXF86VidModeSetViewPort(client); default: return BadRequest; } } else return vidmodeErrorBase + XF86VidModeClientNotLocal; }}static intSProcXF86VidModeQueryVersion(client) register ClientPtr client;{ register int n; REQUEST(xXF86VidModeQueryVersionReq); swaps(&stuff->length, n); return ProcXF86VidModeQueryVersion(client);}static intSProcXF86VidModeGetModeLine(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeGetModeLineReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq); swaps(&stuff->screen, n); return ProcXF86VidModeGetModeLine(client);}static intSProcXF86VidModeGetAllModeLines(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeGetAllModeLinesReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq); swaps(&stuff->screen, n); return ProcXF86VidModeGetAllModeLines(client);}static intSProcXF86VidModeAddModeLine(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeAddModeLineReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq); swapl(&stuff->screen, n); swaps(&stuff->hdisplay, n); swaps(&stuff->hsyncstart, n); swaps(&stuff->hsyncend, n); swaps(&stuff->htotal, n); swaps(&stuff->vdisplay, n); swaps(&stuff->vsyncstart, n); swaps(&stuff->vsyncend, n); swaps(&stuff->vtotal, n); swapl(&stuff->flags, n); swapl(&stuff->privsize, n); SwapRestL(stuff); return ProcXF86VidModeAddModeLine(client);}static intSProcXF86VidModeDeleteModeLine(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeDeleteModeLineReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq); swapl(&stuff->screen, n); swaps(&stuff->hdisplay, n); swaps(&stuff->hsyncstart, n); swaps(&stuff->hsyncend, n); swaps(&stuff->htotal, n); swaps(&stuff->vdisplay, n); swaps(&stuff->vsyncstart, n); swaps(&stuff->vsyncend, n); swaps(&stuff->vtotal, n); swapl(&stuff->flags, n); swapl(&stuff->privsize, n); SwapRestL(stuff); return ProcXF86VidModeDeleteModeLine(client);}static intSProcXF86VidModeModModeLine(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeModModeLineReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq); swapl(&stuff->screen, n); swaps(&stuff->hdisplay, n); swaps(&stuff->hsyncstart, n); swaps(&stuff->hsyncend, n); swaps(&stuff->htotal, n); swaps(&stuff->vdisplay, n); swaps(&stuff->vsyncstart, n); swaps(&stuff->vsyncend, n); swaps(&stuff->vtotal, n); swapl(&stuff->flags, n); swapl(&stuff->privsize, n); SwapRestL(stuff); return ProcXF86VidModeModModeLine(client);}static intSProcXF86VidModeValidateModeLine(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeValidateModeLineReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq); swapl(&stuff->screen, n); swaps(&stuff->hdisplay, n); swaps(&stuff->hsyncstart, n); swaps(&stuff->hsyncend, n); swaps(&stuff->htotal, n); swaps(&stuff->vdisplay, n); swaps(&stuff->vsyncstart, n); swaps(&stuff->vsyncend, n); swaps(&stuff->vtotal, n); swapl(&stuff->flags, n); swapl(&stuff->privsize, n); SwapRestL(stuff); return ProcXF86VidModeValidateModeLine(client);}static intSProcXF86VidModeSwitchMode(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeSwitchModeReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq); swaps(&stuff->screen, n); swaps(&stuff->zoom, n); return ProcXF86VidModeSwitchMode(client);}static intSProcXF86VidModeSwitchToMode(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeSwitchToModeReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq); swaps(&stuff->screen, n); return ProcXF86VidModeSwitchToMode(client);}static intSProcXF86VidModeLockModeSwitch(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeLockModeSwitchReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq); swaps(&stuff->screen, n); swaps(&stuff->lock, n); return ProcXF86VidModeLockModeSwitch(client);}static intSProcXF86VidModeGetMonitor(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeGetMonitorReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq); swaps(&stuff->screen, n); return ProcXF86VidModeGetMonitor(client);}static intSProcXF86VidModeGetViewPort(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeGetViewPortReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq); swaps(&stuff->screen, n); return ProcXF86VidModeGetViewPort(client);}static intSProcXF86VidModeSetViewPort(client) ClientPtr client;{ register int n; REQUEST(xXF86VidModeSetViewPortReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq); swaps(&stuff->screen, n); swapl(&stuff->x, n); swapl(&stuff->y, n); return ProcXF86VidModeSetViewPort(client);}static intSProcXF86VidModeDispatch (client) register ClientPtr client;{ REQUEST(xReq); switch (stuff->data) { case X_XF86VidModeQueryVersion: return SProcXF86VidModeQueryVersion(client); case X_XF86VidModeGetModeLine: return SProcXF86VidModeGetModeLine(client); case X_XF86VidModeGetAllModeLines: return SProcXF86VidModeGetAllModeLines(client); case X_XF86VidModeGetMonitor: return SProcXF86VidModeGetMonitor(client); case X_XF86VidModeGetViewPort: return SProcXF86VidModeGetViewPort(client); case X_XF86VidModeValidateModeLine: return SProcXF86VidModeValidateModeLine(client); default: if (!xf86VidModeEnabled) return vidmodeErrorBase + XF86VidModeExtensionDisabled; if (xf86VidModeAllowNonLocal || LocalClient(client)) { switch (stuff->data) { case X_XF86VidModeAddModeLine: return SProcXF86VidModeAddModeLine(client); case X_XF86VidModeDeleteModeLine: return SProcXF86VidModeDeleteModeLine(client); case X_XF86VidModeModModeLine: return SProcXF86VidModeModModeLine(client); case X_XF86VidModeSwitchMode: return SProcXF86VidModeSwitchMode(client); case X_XF86VidModeSwitchToMode: return SProcXF86VidModeSwitchToMode(client); case X_XF86VidModeLockModeSwitch: return SProcXF86VidModeLockModeSwitch(client); case X_XF86VidModeSetViewPort: return SProcXF86VidModeSetViewPort(client); default: return BadRequest; } } else return vidmodeErrorBase + XF86VidModeClientNotLocal; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -