home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
evbl0627.zip
/
everblue_20010627.zip
/
x11
/
Xlib_Cursor.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-11-02
|
2KB
|
72 lines
#include "Xlib_private.h"
HMODULE module;
Cursor XCreateFontCursor (Display *display, unsigned int shape)
{
return (Cursor) WinLoadPointer(HWND_DESKTOP, module, shape + 0x1000);
}
Cursor XCreatePixmapCursor(Display *display, Pixmap source, Pixmap mask,
XColor *foreground_color, XColor *background_color, unsigned int x, unsigned int y)
{
DBUG_ENTER("XCreatePixmapCursor")
POINTERINFO pptriPointerInfo;
Cursor tmpcursor;
/* WARNING: This implementation has not been tested! */
/* and it doesn't work ;) - Brian */
memset(&pptriPointerInfo, 0, sizeof(POINTERINFO));
pptriPointerInfo.fPointer = TRUE;
pptriPointerInfo.xHotspot = x;
pptriPointerInfo.yHotspot = y;
if (mask) pptriPointerInfo.hbmPointer = ((Xlib_Pixmap *)mask)->hbm;
if (source) pptriPointerInfo.hbmColor = ((Xlib_Pixmap *)source)->hbm;
tmpcursor = WinCreatePointerIndirect(hwndDesktop, &pptriPointerInfo);
if(!tmpcursor)
tmpcursor = (Cursor)XCreateFontCursor(display, 0);
DBUG_RETURN(tmpcursor);
/*DBUG_RETURN((Cursor) WinCreatePointerIndirect(hwndDesktop, &pptriPointerInfo));*/
}
int XDefineCursor(Display *display, Window w, Cursor cursor)
{
DBUG_ENTER("XDefineCursor")
POINTL ptl;
HWND hwnd;
WinAttribData *attrib = WinQueryWindowPtr(w, QWP_WINATTRIB);
if(!attrib)
DBUG_RETURN(0);
WinQueryPointerPos(hwndDesktop, &ptl);
hwnd = WinWindowFromPoint(hwndDesktop, &ptl, TRUE);
attrib->cursor = cursor;
if((HWND)w == hwnd)
WinSetPointer(hwndDesktop, cursor);
DBUG_RETURN(0);
}
int XUndefineCursor(Display *display, Window w)
{
DBUG_ENTER("XUndefineCursor")
POINTL ptl;
HWND hwnd;
WinAttribData *attrib = WinQueryWindowPtr(w, QWP_WINATTRIB);
WinQueryPointerPos(HWND_DESKTOP, &ptl);
hwnd = WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE);
attrib->cursor = 0;
if((HWND)w == hwnd)
WinSetPointer(HWND_DESKTOP, SPTR_ARROW);
DBUG_RETURN(0);
}