Bool XF86DGAViewPortChanged( Display *dpy, int screen, int n ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXF86DGAViewPortChangedReply rep; xXF86DGAViewPortChangedReq *req; XF86DGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DGAViewPortChanged, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XF86DGAViewPortChanged; req->screen = screen; req->n = n; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); return rep.result; }
void XDGAFillRectangle( Display *dpy, int screen, int x, int y, unsigned int width, unsigned int height, unsigned long color ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGAFillRectangleReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGAFillRectangle, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGAFillRectangle; req->screen = screen; req->x = x; req->y = y; req->width = width; req->height = height; req->color = color; UnlockDisplay(dpy); SyncHandle(); }
Bool XF86DGAGetVideoLL( Display* dpy, int screen, unsigned int *offset, int *width, int *bank_size, int *ram_size ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXF86DGAGetVideoLLReply rep; xXF86DGAGetVideoLLReq *req; XF86DGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DGAGetVideoLL, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XF86DGAGetVideoLL; req->screen = screen; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } *offset = rep.offset; *width = rep.width; *bank_size = rep.bank_size; *ram_size = rep.ram_size; UnlockDisplay(dpy); SyncHandle(); return True; }
void XDGACopyTransparentArea( Display *dpy, int screen, int srcx, int srcy, unsigned int width, unsigned int height, int dstx, int dsty, unsigned long key ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGACopyTransparentAreaReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGACopyTransparentArea, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGACopyTransparentArea; req->screen = screen; req->srcx = srcx; req->srcy = srcy; req->width = width; req->height = height; req->dstx = dstx; req->dsty = dsty; req->key = key; UnlockDisplay(dpy); SyncHandle(); }
Bool XF86DGAQueryDirectVideo( Display *dpy, int screen, int *flags ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXF86DGAQueryDirectVideoReply rep; xXF86DGAQueryDirectVideoReq *req; XF86DGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DGAQueryDirectVideo, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XF86DGAQueryDirectVideo; req->screen = screen; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } *flags = rep.flags; UnlockDisplay(dpy); SyncHandle(); return True; }
void XDGAChangePixmapMode( Display *dpy, int screen, int *x, int *y, int mode ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGAChangePixmapModeReq *req; xXDGAChangePixmapModeReply rep; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGAChangePixmapMode, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGAChangePixmapMode; req->screen = screen; req->x = *x; req->y = *y; req->flags = mode; _XReply(dpy, (xReply *)&rep, 0, xFalse); *x = rep.x; *y = rep.y; UnlockDisplay(dpy); SyncHandle(); }
Bool XF86DGAGetVidPage( Display* dpy, int screen, int *vpage ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXF86DGAGetVidPageReply rep; xXF86DGAGetVidPageReq *req; XF86DGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DGAGetVidPage, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XF86DGAGetVidPage; req->screen = screen; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } *vpage = rep.vpage; UnlockDisplay(dpy); SyncHandle(); return True; }
Colormap XDGACreateColormap( Display *dpy, int screen, XDGADevice *dev, int alloc ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGACreateColormapReq *req; Colormap cid; XDGACheckExtension (dpy, info, -1); LockDisplay(dpy); GetReq(XDGACreateColormap, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGACreateColormap; req->screen = screen; req->mode = dev->mode.num; req->alloc = alloc; cid = req->id = XAllocID(dpy); UnlockDisplay(dpy); SyncHandle(); return cid; }
Bool XF86DGAGetViewPortSize( Display* dpy, int screen, int *width, int *height ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXF86DGAGetViewPortSizeReply rep; xXF86DGAGetViewPortSizeReq *req; XF86DGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DGAGetViewPortSize, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XF86DGAGetViewPortSize; req->screen = screen; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } *width = rep.width; *height = rep.height; UnlockDisplay(dpy); SyncHandle(); return True; }
static Bool xdga_wire_to_event( Display *dpy, XEvent *event, xEvent *wire_ev ){ dgaEvent *wire = (dgaEvent *) wire_ev; XDGAButtonEvent *bevent; XDGAKeyEvent *kevent; XDGAMotionEvent *mevent; XExtDisplayInfo *info = xdga_find_display (dpy); XDGACheckExtension (dpy, info, False); switch((wire->u.u.type & 0x7f) - info->codes->first_event) { case MotionNotify: mevent = (XDGAMotionEvent*)event; mevent->type = wire->u.u.type & 0x7F; mevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire); mevent->display = dpy; mevent->screen = wire->u.event.screen; mevent->time = wire->u.event.time; mevent->state = wire->u.event.state; mevent->dx = wire->u.event.dx; mevent->dy = wire->u.event.dy; return True; case ButtonPress: case ButtonRelease: bevent = (XDGAButtonEvent*)event; bevent->type = wire->u.u.type & 0x7F; bevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire); bevent->display = dpy; bevent->screen = wire->u.event.screen; bevent->time = wire->u.event.time; bevent->state = wire->u.event.state; bevent->button = wire->u.u.detail; return True; case KeyPress: case KeyRelease: kevent = (XDGAKeyEvent*)event; kevent->type = wire->u.u.type & 0x7F; kevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire); kevent->display = dpy; kevent->screen = wire->u.event.screen; kevent->time = wire->u.event.time; kevent->state = wire->u.event.state; kevent->keycode = wire->u.u.detail; return True; } return False; }
Bool XDGAQueryExtension ( Display *dpy, int *event_basep, int *error_basep ){ XExtDisplayInfo *info = xdga_find_display (dpy); if (XextHasExtension(info)) { *event_basep = info->codes->first_event; *error_basep = info->codes->first_error; return True; } else { return False; } }
Bool XDGASetClientVersion( Display *dpy ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGASetClientVersionReq *req; XDGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XDGASetClientVersion, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGASetClientVersion; req->major = XDGA_MAJOR_VERSION; req->minor = XDGA_MINOR_VERSION; UnlockDisplay(dpy); SyncHandle(); return True; }
void XDGACloseFramebuffer( Display *dpy, int screen ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGACloseFramebufferReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); XDGAUnmapFramebuffer(screen); LockDisplay(dpy); GetReq(XDGACloseFramebuffer, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGACloseFramebuffer; req->screen = screen; UnlockDisplay(dpy); SyncHandle(); }
void XDGASync( Display *dpy, int screen ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGASyncReply rep; xXDGASyncReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGASync, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGASync; req->screen = screen; _XReply(dpy, (xReply *)&rep, 0, xFalse); UnlockDisplay(dpy); SyncHandle(); }
void XDGASelectInput( Display *dpy, int screen, long mask ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGASelectInputReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGASelectInput, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGASelectInput; req->screen = screen; req->mask = mask; UnlockDisplay(dpy); SyncHandle(); }
void XDGAInstallColormap( Display *dpy, int screen, Colormap cmap ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGAInstallColormapReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGAInstallColormap, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGAInstallColormap; req->screen = screen; req->cmap = cmap; UnlockDisplay(dpy); SyncHandle(); }
Bool XF86DGADirectVideoLL( Display* dpy, int screen, int enable ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXF86DGADirectVideoReq *req; XF86DGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DGADirectVideo, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XF86DGADirectVideo; req->screen = screen; req->enable = enable; UnlockDisplay(dpy); SyncHandle(); XSync(dpy,False); return True; }
Bool XF86DGASetVidPage( Display* dpy, int screen, int vpage ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXF86DGASetVidPageReq *req; XF86DGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DGASetVidPage, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XF86DGASetVidPage; req->screen = screen; req->vpage = vpage; UnlockDisplay(dpy); SyncHandle(); XSync(dpy,False); return True; }
Bool XF86DGAInstallColormap( Display* dpy, int screen, Colormap cmap ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXF86DGAInstallColormapReq *req; XF86DGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DGAInstallColormap, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XF86DGAInstallColormap; req->screen = screen; req->id = cmap; UnlockDisplay(dpy); SyncHandle(); XSync(dpy,False); return True; }
int XDGAGetViewportStatus( Display *dpy, int screen ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGAGetViewportStatusReply rep; xXDGAGetViewportStatusReq *req; int status = 0; XDGACheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(XDGAGetViewportStatus, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGAGetViewportStatus; req->screen = screen; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) status = rep.status; UnlockDisplay(dpy); SyncHandle(); return status; }
Bool XDGAQueryVersion( Display *dpy, int *majorVersion, int *minorVersion ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGAQueryVersionReply rep; xXDGAQueryVersionReq *req; XDGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XDGAQueryVersion, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGAQueryVersion; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } *majorVersion = rep.majorVersion; *minorVersion = rep.minorVersion; UnlockDisplay(dpy); SyncHandle(); if (*majorVersion >= 2) { int i, j; for (i = 0, j = info->codes->first_event; i < XF86DGANumberEvents; i++, j++) { XESetWireToEvent (dpy, j, xdga_wire_to_event); XESetEventToWire (dpy, j, xdga_event_to_wire); } XDGASetClientVersion(dpy); } return True; }
Bool XDGAOpenFramebuffer( Display *dpy, int screen ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGAOpenFramebufferReply rep; xXDGAOpenFramebufferReq *req; char *deviceName = NULL; Bool ret; XDGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XDGAOpenFramebuffer, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGAOpenFramebuffer; req->screen = screen; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } if(rep.length) { deviceName = Xmalloc(rep.length << 2); _XRead(dpy, deviceName, rep.length << 2); } ret = XDGAMapFramebuffer(screen, deviceName, (unsigned char*)(long)rep.mem1, rep.size, rep.offset, rep.extra); if(deviceName) Xfree(deviceName); UnlockDisplay(dpy); SyncHandle(); return ret; }
Bool XF86DGASetViewPort( Display* dpy, int screen, int x, int y ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXF86DGASetViewPortReq *req; XF86DGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DGASetViewPort, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XF86DGASetViewPort; req->screen = screen; req->x = x; req->y = y; UnlockDisplay(dpy); SyncHandle(); XSync(dpy,False); return True; }
void XDGASetViewport( Display *dpy, int screen, int x, int y, int flags ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGASetViewportReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGASetViewport, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGASetViewport; req->screen = screen; req->x = x; req->y = y; req->flags = flags; UnlockDisplay(dpy); SyncHandle(); }
XDGADevice * XDGASetMode( Display *dpy, int screen, int mode ){ XExtDisplayInfo *dinfo = xdga_find_display (dpy); xXDGASetModeReply rep; xXDGASetModeReq *req; XDGADevice *dev = NULL; Pixmap pid; XDGACheckExtension (dpy, dinfo, NULL); LockDisplay(dpy); GetReq(XDGASetMode, req); req->reqType = dinfo->codes->major_opcode; req->dgaReqType = X_XDGASetMode; req->screen = screen; req->mode = mode; req->pid = pid = XAllocID(dpy); if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if(rep.length) { xXDGAModeInfo info; int size; size = rep.length << 2; size -= sz_xXDGAModeInfo; /* get text size */ dev = (XDGADevice*)Xmalloc(sizeof(XDGADevice) + size); if(dev) { _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo); dev->mode.num = info.num; dev->mode.verticalRefresh = (float)info.vsync_num / (float)info.vsync_den; dev->mode.flags = info.flags; dev->mode.imageWidth = info.image_width; dev->mode.imageHeight = info.image_height; dev->mode.pixmapWidth = info.pixmap_width; dev->mode.pixmapHeight = info.pixmap_height; dev->mode.bytesPerScanline = info.bytes_per_scanline; dev->mode.byteOrder = info.byte_order; dev->mode.depth = info.depth; dev->mode.bitsPerPixel = info.bpp; dev->mode.redMask = info.red_mask; dev->mode.greenMask = info.green_mask; dev->mode.blueMask = info.blue_mask; dev->mode.visualClass = info.visual_class; dev->mode.viewportWidth = info.viewport_width; dev->mode.viewportHeight = info.viewport_height; dev->mode.xViewportStep = info.viewport_xstep; dev->mode.yViewportStep = info.viewport_ystep; dev->mode.maxViewportX = info.viewport_xmax; dev->mode.maxViewportY = info.viewport_ymax; dev->mode.viewportFlags = info.viewport_flags; dev->mode.reserved1 = info.reserved1; dev->mode.reserved2 = info.reserved2; dev->mode.name = (char*)(&dev[1]); _XRead(dpy, dev->mode.name, info.name_size); dev->pixmap = (rep.flags & XDGAPixmap) ? pid : 0; dev->data = XDGAGetMappedMemory(screen); if(dev->data) dev->data += rep.offset; } /* not sure what to do if the allocation fails */ } } UnlockDisplay(dpy); SyncHandle(); return dev; }
XDGAMode* XDGAQueryModes( Display *dpy, int screen, int *num ){ XExtDisplayInfo *dinfo = xdga_find_display (dpy); xXDGAQueryModesReply rep; xXDGAQueryModesReq *req; XDGAMode *modes = NULL; *num = 0; XDGACheckExtension (dpy, dinfo, NULL); LockDisplay(dpy); GetReq(XDGAQueryModes, req); req->reqType = dinfo->codes->major_opcode; req->dgaReqType = X_XDGAQueryModes; req->screen = screen; if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if(rep.length) { xXDGAModeInfo info; int i, size; char *offset; size = rep.length << 2; size -= rep.number * sz_xXDGAModeInfo; /* find text size */ modes = (XDGAMode*)Xmalloc((rep.number * sizeof(XDGAMode)) + size); offset = (char*)(&modes[rep.number]); /* start of text */ if(modes) { for(i = 0; i < rep.number; i++) { _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo); modes[i].num = info.num; modes[i].verticalRefresh = (float)info.vsync_num / (float)info.vsync_den; modes[i].flags = info.flags; modes[i].imageWidth = info.image_width; modes[i].imageHeight = info.image_height; modes[i].pixmapWidth = info.pixmap_width; modes[i].pixmapHeight = info.pixmap_height; modes[i].bytesPerScanline = info.bytes_per_scanline; modes[i].byteOrder = info.byte_order; modes[i].depth = info.depth; modes[i].bitsPerPixel = info.bpp; modes[i].redMask = info.red_mask; modes[i].greenMask = info.green_mask; modes[i].blueMask = info.blue_mask; modes[i].visualClass = info.visual_class; modes[i].viewportWidth = info.viewport_width; modes[i].viewportHeight = info.viewport_height; modes[i].xViewportStep = info.viewport_xstep; modes[i].yViewportStep = info.viewport_ystep; modes[i].maxViewportX = info.viewport_xmax; modes[i].maxViewportY = info.viewport_ymax; modes[i].viewportFlags = info.viewport_flags; modes[i].reserved1 = info.reserved1; modes[i].reserved2 = info.reserved2; _XRead(dpy, offset, info.name_size); modes[i].name = offset; offset += info.name_size; } *num = rep.number; } else _XEatData(dpy, rep.length << 2); } } UnlockDisplay(dpy); SyncHandle(); return modes; }