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.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c
index b5ea0db1b..77cf1c13f 100644
--- a/xorg-server/hw/xwin/wincursor.c
+++ b/xorg-server/hw/xwin/wincursor.c
@@ -43,10 +43,9 @@
#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
/*
@@ -82,7 +81,7 @@ winPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
/* Don't ignore subsequent warps */
s_fInitialWarp = FALSE;
- winErrorFVerb(2,
+ winDebug (
"winPointerWarpCursor - Discarding first warp: %d %d\n",
x, y);
@@ -164,7 +163,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);
@@ -178,7 +177,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
/* Check wether the X11 cursor is bigger than the win32 cursor */
if (pScreenPriv->cursor.sm_cx < pCursor->bits->width ||
pScreenPriv->cursor.sm_cy < pCursor->bits->height) {
- winErrorFVerb(3,
+ 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);
@@ -242,7 +241,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;
@@ -274,7 +273,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);
@@ -342,7 +341,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;
@@ -372,13 +371,12 @@ 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
+ winDebug
("winLoadCursor: CreateIconIndirect returned no cursor. Trying again.\n");
-
DestroyCursor(hCursor);
ii.fIcon = FALSE;
@@ -387,7 +385,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
hCursor = (HCURSOR) CreateIconIndirect(&ii);
if (hCursor == NULL)
- winW32Error(2,
+ winW32Error(
"winLoadCursor - CreateIconIndirect failed:");
}
/* GetIconInfo creates new bitmaps. Destroy them again */
@@ -413,7 +411,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);
@@ -468,7 +466,7 @@ winSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
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;
@@ -510,7 +508,7 @@ winSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
}
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);
@@ -601,9 +599,11 @@ winInitCursor(ScreenPtr pScreen)
pPointPriv = (miPointerScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
- pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs;
- pPointPriv->spriteFuncs = &winSpriteFuncsRec;
-
+ if (pPointPriv)
+ {
+ pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs;
+ pPointPriv->spriteFuncs = &winSpriteFuncsRec;
+ }
pScreenPriv->cursor.handle = NULL;
pScreenPriv->cursor.visible = FALSE;