From 14194e3c743fb99c1d483dcfd19a077f7df8855b Mon Sep 17 00:00:00 2001 From: Alexander Gottwald Date: Wed, 15 Sep 2004 16:34:06 +0000 Subject: Pull XORG-6_8_0 to CYGWIN branch --- src/vmwarecurs.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/vmwarecurs.c') diff --git a/src/vmwarecurs.c b/src/vmwarecurs.c index 23ddc59..8a647a2 100644 --- a/src/vmwarecurs.c +++ b/src/vmwarecurs.c @@ -36,8 +36,8 @@ RedefineCursor(VMWAREPtr pVMWARE) /* Define cursor */ vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DEFINE_CURSOR); vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); - vmwareWriteWordToFIFO(pVMWARE, 0); /* HotX/HotY seem to be zero? */ - vmwareWriteWordToFIFO(pVMWARE, 0); /* HotX/HotY seem to be zero? */ + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->hwcur.hotX); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->hwcur.hotY); vmwareWriteWordToFIFO(pVMWARE, pVMWARE->CursorInfoRec->MaxWidth); vmwareWriteWordToFIFO(pVMWARE, pVMWARE->CursorInfoRec->MaxHeight); vmwareWriteWordToFIFO(pVMWARE, 1); @@ -104,6 +104,18 @@ vmwareSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) } } +static Bool +vmwareUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) +{ + ScrnInfoPtr pScrn = infoFromScreen(pScreen); + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + pVMWARE->hwcur.hotX = pCurs->bits->xhot; + pVMWARE->hwcur.hotY = pCurs->bits->yhot; + + return pScrn->bitsPerPixel > 8; +} + static void vmwareLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src ) { @@ -125,6 +137,7 @@ static Bool vmwareUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = infoFromScreen(pScreen); + return pCurs->bits->height <= MAX_CURS && pCurs->bits->width <= MAX_CURS && pScrn->bitsPerPixel > 8; @@ -141,10 +154,13 @@ vmwareLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) pVMWARE->cursorDefined = FALSE; + pVMWARE->hwcur.hotX = pCurs->bits->xhot; + pVMWARE->hwcur.hotY = pCurs->bits->yhot; + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DEFINE_ALPHA_CURSOR); vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); - vmwareWriteWordToFIFO(pVMWARE, 0); - vmwareWriteWordToFIFO(pVMWARE, 0); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->xhot); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->yhot); vmwareWriteWordToFIFO(pVMWARE, width); vmwareWriteWordToFIFO(pVMWARE, height); @@ -153,7 +169,6 @@ vmwareLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) } vmwareWaitForFB(pVMWARE); - pVMWARE->cursorDefined = TRUE; } #endif @@ -165,10 +180,12 @@ vmwareWriteCursorRegs(VMWAREPtr pVMWARE, Bool visible, Bool force) vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID); if (visible) { - vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_X, pVMWARE->hwcur.x); - vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_Y, pVMWARE->hwcur.y); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_X, + pVMWARE->hwcur.x + pVMWARE->hwcur.hotX); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_Y, + pVMWARE->hwcur.y + pVMWARE->hwcur.hotY); } - + if (force) { enableVal = visible ? SVGA_CURSOR_ON_SHOW : SVGA_CURSOR_ON_HIDE; } else { @@ -275,6 +292,7 @@ vmwareCursorInit(ScreenPtr pScreen) infoPtr->LoadCursorImage = vmwareLoadCursorImage; infoPtr->HideCursor = vmwareHideCursor; infoPtr->ShowCursor = vmwareShowCursor; + infoPtr->UseHWCursor = vmwareUseHWCursor; #ifdef ARGB_CURSOR if (pVMWARE->vmwareCapability & SVGA_CAP_ALPHA_CURSOR) { -- cgit v1.2.3