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 >
C/C++ Source or Header  |  1999-11-02  |  2KB  |  72 lines

  1. #include "Xlib_private.h" 
  2.  
  3. HMODULE module;
  4.  
  5. Cursor XCreateFontCursor (Display *display, unsigned int shape)
  6. {
  7.     return (Cursor) WinLoadPointer(HWND_DESKTOP, module, shape + 0x1000);
  8. }
  9.  
  10. Cursor XCreatePixmapCursor(Display *display, Pixmap source, Pixmap mask,
  11.               XColor *foreground_color, XColor *background_color, unsigned int x, unsigned int y)
  12. {
  13.     DBUG_ENTER("XCreatePixmapCursor")
  14.     POINTERINFO pptriPointerInfo;
  15.         Cursor tmpcursor;
  16.         /* WARNING: This implementation has not been tested! */
  17.         /* and it doesn't work ;) - Brian */
  18.     memset(&pptriPointerInfo, 0, sizeof(POINTERINFO));
  19.     pptriPointerInfo.fPointer = TRUE;
  20.     pptriPointerInfo.xHotspot = x;
  21.     pptriPointerInfo.yHotspot = y;
  22.     if (mask) pptriPointerInfo.hbmPointer = ((Xlib_Pixmap *)mask)->hbm;
  23.     if (source) pptriPointerInfo.hbmColor = ((Xlib_Pixmap *)source)->hbm;
  24.         tmpcursor = WinCreatePointerIndirect(hwndDesktop, &pptriPointerInfo);
  25.         if(!tmpcursor)
  26.             tmpcursor = (Cursor)XCreateFontCursor(display, 0);
  27.         DBUG_RETURN(tmpcursor);
  28.     /*DBUG_RETURN((Cursor) WinCreatePointerIndirect(hwndDesktop, &pptriPointerInfo));*/
  29. }
  30.  
  31. int XDefineCursor(Display *display, Window w, Cursor cursor)
  32. {
  33.     DBUG_ENTER("XDefineCursor")
  34.     POINTL ptl;
  35.     HWND hwnd;
  36.     WinAttribData *attrib = WinQueryWindowPtr(w, QWP_WINATTRIB);
  37.  
  38.         if(!attrib)
  39.             DBUG_RETURN(0);
  40.  
  41.     WinQueryPointerPos(hwndDesktop, &ptl);
  42.     hwnd = WinWindowFromPoint(hwndDesktop,   &ptl,  TRUE);
  43.  
  44.     attrib->cursor = cursor;
  45.     if((HWND)w == hwnd)
  46.         WinSetPointer(hwndDesktop, cursor);
  47.  
  48.     DBUG_RETURN(0);
  49. }
  50.  
  51. int XUndefineCursor(Display *display, Window w)
  52. {
  53.     DBUG_ENTER("XUndefineCursor")
  54.     POINTL ptl;
  55.     HWND hwnd;
  56.     WinAttribData *attrib = WinQueryWindowPtr(w, QWP_WINATTRIB);
  57.  
  58.     WinQueryPointerPos(HWND_DESKTOP, &ptl);
  59.     hwnd = WinWindowFromPoint(HWND_DESKTOP,   &ptl,  TRUE);
  60.  
  61.     attrib->cursor = 0;
  62.     if((HWND)w == hwnd)
  63.         WinSetPointer(HWND_DESKTOP, SPTR_ARROW);
  64.  
  65.     DBUG_RETURN(0);
  66. }
  67.  
  68.  
  69.  
  70.  
  71.  
  72.