static Bool xf86RandRSetConfig (ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int px, py; Bool useVirtual = FALSE; randrp->rotation = rotation; miPointerPosition (&px, &py); for (mode = scrp->modes; ; mode = mode->next) { if (mode->HDisplay == pSize->width && mode->VDisplay == pSize->height && (rate == 0 || xf86RandRModeRefresh (mode) == rate)) break; if (mode->next == scrp->modes) { if (pSize->width == randrp->virtualX && pSize->height == randrp->virtualY) { mode = scrp->modes; useVirtual = TRUE; break; } return FALSE; } } /* Have the driver do its thing. */ if (scrp->RRFunc) { xorgRRRotation RRRotation; RRRotation.RRConfig.rotation = rotation; RRRotation.RRConfig.rate = rate; RRRotation.RRConfig.width = pSize->width; RRRotation.RRConfig.height = pSize->height; if (!(*scrp->RRFunc)(scrp, RR_SET_CONFIG, &RRRotation)) return FALSE; } if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) return FALSE; /* * Move the cursor back where it belongs; SwitchMode repositions it */ if (pScreen == miPointerCurrentScreen ()) { if (px < pSize->width && py < pSize->height) (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE); } return TRUE; }
_X_EXPORT Bool xf86RandR12SetConfig (ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int px, py; Bool useVirtual = FALSE; int maxX = 0, maxY = 0; Rotation oldRotation = randrp->rotation; randrp->rotation = rotation; if (randrp->virtualX == -1 || randrp->virtualY == -1) { randrp->virtualX = scrp->virtualX; randrp->virtualY = scrp->virtualY; } miPointerPosition (&px, &py); for (mode = scrp->modes; ; mode = mode->next) { if (randrp->maxX == 0 || randrp->maxY == 0) { if (maxX < mode->HDisplay) maxX = mode->HDisplay; if (maxY < mode->VDisplay) maxY = mode->VDisplay; } if (mode->HDisplay == pSize->width && mode->VDisplay == pSize->height && (rate == 0 || xf86RandR12ModeRefresh (mode) == rate)) break; if (mode->next == scrp->modes) { if (pSize->width == randrp->virtualX && pSize->height == randrp->virtualY) { mode = scrp->modes; useVirtual = TRUE; break; } if (randrp->maxX == 0 || randrp->maxY == 0) { randrp->maxX = maxX; randrp->maxY = maxY; } return FALSE; } } if (randrp->maxX == 0 || randrp->maxY == 0) { randrp->maxX = maxX; randrp->maxY = maxY; } if (!xf86RandR12SetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) { randrp->rotation = oldRotation; return FALSE; } /* * Move the cursor back where it belongs; SwitchMode repositions it */ if (pScreen == miPointerCurrentScreen ()) { px = (px >= pScreen->width ? (pScreen->width - 1) : px); py = (py >= pScreen->height ? (pScreen->height - 1) : py); xf86SetViewport(pScreen, px, py); (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE); } return TRUE; }
void ProcessInputEvents () { int x, y; #ifdef INHERIT_LOCK_STATE static int generation = 0; #endif #ifdef AMOEBA #define MAXEVENTS 32 #define BUTTON_PRESS 0x1000 #define MAP_BUTTON(ev,but) (((ev) == EV_ButtonPress) ? \ ((but) | BUTTON_PRESS) : ((but) & ~BUTTON_PRESS)) #define KEY_RELEASE 0x80 #define MAP_KEY(ev, key) (((ev) == EV_KeyReleaseEvent) ? \ ((key) | KEY_RELEASE) : ((key) & ~KEY_RELEASE)) register IOPEvent *e, *elast; IOPEvent events[MAXEVENTS]; int dx, dy, nevents; #endif /* * With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock * and ScrollLock will be set to match that of the VT the server is * running on. */ #ifdef INHERIT_LOCK_STATE if (generation != serverGeneration) { xEvent kevent; DevicePtr pKeyboard = xf86Info.pKeyboard; extern unsigned int xf86InitialCaps, xf86InitialNum, xf86InitialScroll; generation = serverGeneration; kevent.u.keyButtonPointer.time = GetTimeInMillis(); kevent.u.keyButtonPointer.rootX = 0; kevent.u.keyButtonPointer.rootY = 0; kevent.u.u.type = KeyPress; if (xf86InitialCaps) { kevent.u.u.detail = xf86InitialCaps; (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1); xf86InitialCaps = 0; } if (xf86InitialNum) { kevent.u.u.detail = xf86InitialNum; (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1); xf86InitialNum = 0; } if (xf86InitialScroll) { kevent.u.u.detail = xf86InitialScroll; (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1); xf86InitialScroll = 0; } } #endif xf86Info.inputPending = FALSE; #ifdef XINPUT xf86eqProcessInputEvents(); #else mieqProcessInputEvents(); #endif miPointerUpdate(); miPointerPosition(&x, &y); //xf86SetViewport(xf86Info.currentScreen, x, y); //added010509 }
static Bool xf86RandRSetConfig (ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); DisplayModePtr mode; int px, py; Bool useVirtual = FALSE; Rotation oldRotation = randrp->rotation; miPointerPosition (&px, &py); for (mode = scrp->modes; ; mode = mode->next) { if (mode->HDisplay == pSize->width && mode->VDisplay == pSize->height && (rate == 0 || xf86RandRModeRefresh (mode) == rate)) break; if (mode->next == scrp->modes) { if (pSize->width == randrp->virtualX && pSize->height == randrp->virtualY) { mode = scrp->modes; useVirtual = TRUE; break; } return FALSE; } } if (randrp->rotation != rotation) { /* Have the driver do its thing. */ if (scrp->DriverFunc) { xorgRRRotation RRRotation; RRRotation.RRConfig.rotation = rotation; RRRotation.RRConfig.rate = rate; RRRotation.RRConfig.width = pSize->width; RRRotation.RRConfig.height = pSize->height; /* * Currently we need to rely on HW support for rotation. */ if (!(*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation)) return FALSE; } else return FALSE; randrp->rotation = rotation; } if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) { if(randrp->rotation != oldRotation) { /* Have the driver undo its thing. */ if (scrp->DriverFunc) { xorgRRRotation RRRotation; RRRotation.RRConfig.rotation = oldRotation; RRRotation.RRConfig.rate = xf86RandRModeRefresh (scrp->currentMode); RRRotation.RRConfig.width = pScreen->width; RRRotation.RRConfig.height = pScreen->height; (*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation); } randrp->rotation = oldRotation; } return FALSE; } /* * Move the cursor back where it belongs; SwitchMode repositions it */ if (pScreen == miPointerCurrentScreen ()) { px = (px >= pScreen->width ? (pScreen->width - 1) : px); py = (py >= pScreen->height ? (pScreen->height - 1) : py); xf86SetViewport(pScreen, px, py); (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE); } return TRUE; }