aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/wincursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/wincursor.c')
-rw-r--r--xorg-server/hw/xwin/wincursor.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c
index 7f1935a5d..a29e90c66 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 (3, "winLoadCursor - Windows requires %dx%d cursor but X requires %dx%d\n",
+ ErrorF ("winLoadCursor - Windows requires %dx%d cursor but X requires %dx%d\n",
pScreenPriv->cursor.sm_cx, pScreenPriv->cursor.sm_cy,
pCursor->bits->width, pCursor->bits->height);
}
@@ -250,7 +249,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;
@@ -281,7 +280,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);
@@ -345,7 +344,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;
@@ -373,14 +372,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);
@@ -390,7 +389,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)
@@ -416,7 +415,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);
@@ -471,7 +470,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;
@@ -522,7 +521,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);
@@ -557,7 +556,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 = {
@@ -616,9 +615,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;