diff options
Diffstat (limited to 'xorg-server/hw/xwin/wincursor.c')
-rw-r--r-- | xorg-server/hw/xwin/wincursor.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c index ce98162ef..32ee560df 100644 --- a/xorg-server/hw/xwin/wincursor.c +++ b/xorg-server/hw/xwin/wincursor.c @@ -45,10 +45,9 @@ extern Bool g_fSoftwareCursor; #define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114) -#if 0 -# define WIN_DEBUG_MSG winDebug -#else -# define WIN_DEBUG_MSG(...) +#ifdef _MSC_VER +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define max(a,b) (((a) > (b)) ? (a) : (b)) #endif /* @@ -87,7 +86,7 @@ winPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) /* Don't ignore subsequent warps */ s_fInitialWarp = FALSE; - winErrorFVerb (2, "winPointerWarpCursor - Discarding first warp: %d %d\n", + winDebug ("winPointerWarpCursor - Discarding first warp: %d %d\n", x, y); return; @@ -172,7 +171,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) BITMAPINFO *pbmi; unsigned long *lpBits; - WIN_DEBUG_MSG("winLoadCursor: Win32: %dx%d X11: %dx%d hotspot: %d,%d\n", + winDebug("winLoadCursor: Win32: %dx%d X11: %dx%d hotspot: %d,%d\n", pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, pCursor->bits->width, pCursor->bits->height, pCursor->bits->xhot, pCursor->bits->yhot @@ -188,7 +187,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) if (pScreenPriv->cursor.sm_cx < pCursor->bits->width || pScreenPriv->cursor.sm_cy < pCursor->bits->height) { - winErrorFVerb (2, "winLoadCursor - Windows requires %dx%d cursor\n" + ErrorF ("winLoadCursor - Windows requires %dx%d cursor\n" "\tbut X requires %dx%d\n", pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, pCursor->bits->width, pCursor->bits->height); @@ -251,7 +250,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) /* We have a truecolor alpha-blended cursor and can use it! */ if (pCursor->bits->argb) { - WIN_DEBUG_MSG("winLoadCursor: Trying truecolor alphablended cursor\n"); + winDebug("winLoadCursor: Trying truecolor alphablended cursor\n"); memset (&bi, 0, sizeof (BITMAPV4HEADER)); bi.bV4Size = sizeof(BITMAPV4HEADER); bi.bV4Width = pScreenPriv->cursor.sm_cx; @@ -282,7 +281,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) if (!lpBits) { /* Bicolor, use a palettized DIB */ - WIN_DEBUG_MSG("winLoadCursor: Trying two color cursor\n"); + winDebug("winLoadCursor: Trying two color cursor\n"); pbmi = (BITMAPINFO*)&bi; memset (pbmi, 0, sizeof (BITMAPINFOHEADER)); pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -346,7 +345,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) /* If one of the previous two methods gave us the bitmap we need, make a cursor */ if (lpBits) { - WIN_DEBUG_MSG("winLoadCursor: Creating bitmap cursor: hotspot %d,%d\n", + winDebug("winLoadCursor: Creating bitmap cursor: hotspot %d,%d\n", pCursor->bits->xhot, pCursor->bits->yhot); hAnd = NULL; @@ -374,14 +373,14 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) hCursor = (HCURSOR) CreateIconIndirect( &ii ); if (hCursor == NULL) - winW32Error(2, "winLoadCursor - CreateIconIndirect failed:"); + winW32Error("winLoadCursor - CreateIconIndirect failed:"); else { if (GetIconInfo(hCursor, &ii)) { if (ii.fIcon) { - WIN_DEBUG_MSG("winLoadCursor: CreateIconIndirect returned no cursor. Trying again.\n"); + winDebug("winLoadCursor: CreateIconIndirect returned no cursor. Trying again.\n"); DestroyCursor(hCursor); @@ -391,7 +390,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) hCursor = (HCURSOR) CreateIconIndirect( &ii ); if (hCursor == NULL) - winW32Error(2, "winLoadCursor - CreateIconIndirect failed:"); + winW32Error("winLoadCursor - CreateIconIndirect failed:"); } /* GetIconInfo creates new bitmaps. Destroy them again */ if (ii.hbmMask) @@ -417,7 +416,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy, pAnd, pXor); if (hCursor == NULL) - winW32Error(2, "winLoadCursor - CreateCursor failed:"); + winW32Error("winLoadCursor - CreateCursor failed:"); } free (pAnd); free (pXor); @@ -472,7 +471,7 @@ winSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, in RECT rcClient; BOOL bInhibit; winScreenPriv(pScreen); - WIN_DEBUG_MSG("winSetCursor: cursor=%p\n", pCursor); + winDebug("winSetCursor: cursor=%p\n", pCursor); /* Inhibit changing the cursor if the mouse is not in a client area */ bInhibit = FALSE; @@ -523,7 +522,7 @@ winSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, in } pScreenPriv->cursor.handle = winLoadCursor (pScreen, pCursor, pScreen->myNum); - WIN_DEBUG_MSG("winSetCursor: handle=%p\n", pScreenPriv->cursor.handle); + winDebug("winSetCursor: handle=%p\n", pScreenPriv->cursor.handle); if (!bInhibit) SetCursor (pScreenPriv->cursor.handle); @@ -558,7 +557,7 @@ static void winDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr) { winScreenPriv(pScr); - return pScreenPriv->cursor.spriteFuncs->DeviceCursorCleanup(pDev, pScr); + pScreenPriv->cursor.spriteFuncs->DeviceCursorCleanup(pDev, pScr); } static miPointerSpriteFuncRec winSpriteFuncsRec = { @@ -617,9 +616,11 @@ winInitCursor (ScreenPtr pScreen) pPointPriv = (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); + if (pPointPriv) + { pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs; pPointPriv->spriteFuncs = &winSpriteFuncsRec; - + } pScreenPriv->cursor.handle = NULL; pScreenPriv->cursor.visible = FALSE; |