Cleanup: simplify GHOST cursor API, no functional changes
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 16 Jun 2019 17:45:57 +0000 (19:45 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 16 Jun 2019 17:58:26 +0000 (19:58 +0200)
17 files changed:
intern/ghost/GHOST_C-api.h
intern/ghost/GHOST_IWindow.h
intern/ghost/intern/GHOST_C-api.cpp
intern/ghost/intern/GHOST_Window.cpp
intern/ghost/intern/GHOST_Window.h
intern/ghost/intern/GHOST_WindowCocoa.h
intern/ghost/intern/GHOST_WindowCocoa.mm
intern/ghost/intern/GHOST_WindowNULL.h
intern/ghost/intern/GHOST_WindowSDL.cpp
intern/ghost/intern/GHOST_WindowSDL.h
intern/ghost/intern/GHOST_WindowWin32.cpp
intern/ghost/intern/GHOST_WindowWin32.h
intern/ghost/intern/GHOST_WindowX11.cpp
intern/ghost/intern/GHOST_WindowX11.h
intern/ghost/test/multitest/MultiTest.c
source/blender/windowmanager/intern/wm_cursors.c
source/blender/windowmanager/wm_cursors.h

index b54c097..0f73571 100644 (file)
@@ -324,20 +324,6 @@ extern GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandl
 extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
                                            GHOST_TStandardCursor cursorshape);
 
-/**
- * Set the shape of the cursor to a custom cursor.
- * \param windowhandle The handle to the window
- * \param bitmap The bitmap data for the cursor.
- * \param  mask The mask data for the cursor.
- * \param hotX The X coordinate of the cursor hotspot.
- * \param hotY The Y coordinate of the cursor hotspot.
- * \return Indication of success.
- */
-extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
-                                                 GHOST_TUns8 bitmap[16][2],
-                                                 GHOST_TUns8 mask[16][2],
-                                                 int hotX,
-                                                 int hotY);
 /**
  * Set the shape of the cursor to a custom cursor of specified size.
  * \param windowhandle The handle to the window
@@ -347,18 +333,17 @@ extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle
  * \param sizey The height of the cursor
  * \param hotX The X coordinate of the cursor hotspot.
  * \param hotY The Y coordinate of the cursor hotspot.
- * \param   fg_color, bg_color  Colors of the cursor
+ * \param canInvertColor Let macOS invert cursor color to match platform convention.
  * \return Indication of success.
  */
-extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
-                                                   GHOST_TUns8 *bitmap,
-                                                   GHOST_TUns8 *mask,
-                                                   int sizex,
-                                                   int sizey,
-                                                   int hotX,
-                                                   int hotY,
-                                                   int fg_color,
-                                                   int bg_color);
+extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
+                                                 GHOST_TUns8 *bitmap,
+                                                 GHOST_TUns8 *mask,
+                                                 int sizex,
+                                                 int sizey,
+                                                 int hotX,
+                                                 int hotY,
+                                                 GHOST_TUns8 canInvertColor);
 
 /**
  * Returns the visibility state of the cursor.
index 52894a7..1a1844b 100644 (file)
@@ -287,19 +287,13 @@ class GHOST_IWindow {
    * \param   hotY    The Y coordinate of the cursor hotspot.
    * \return  Indication of success.
    */
-  virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                              GHOST_TUns8 mask[16][2],
-                                              int hotX,
-                                              int hotY) = 0;
-
   virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
                                               GHOST_TUns8 *mask,
                                               int sizex,
                                               int sizey,
                                               int hotX,
                                               int hotY,
-                                              int fg_color,
-                                              int bg_color) = 0;
+                                              bool canInvertColor) = 0;
 
   /**
    * Returns the visibility state of the cursor.
index ef653c1..78f171a 100644 (file)
@@ -265,29 +265,17 @@ GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
 }
 
 GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
-                                          GHOST_TUns8 bitmap[16][2],
-                                          GHOST_TUns8 mask[16][2],
+                                          GHOST_TUns8 *bitmap,
+                                          GHOST_TUns8 *mask,
+                                          int sizex,
+                                          int sizey,
                                           int hotX,
-                                          int hotY)
+                                          int hotY,
+                                          GHOST_TUns8 canInvertColor)
 {
   GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
 
-  return window->setCustomCursorShape(bitmap, mask, hotX, hotY);
-}
-
-GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
-                                            GHOST_TUns8 *bitmap,
-                                            GHOST_TUns8 *mask,
-                                            int sizex,
-                                            int sizey,
-                                            int hotX,
-                                            int hotY,
-                                            int fg_color,
-                                            int bg_color)
-{
-  GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
-
-  return window->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, fg_color, bg_color);
+  return window->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor);
 }
 
 int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
index 76f2d23..ca19e25 100644 (file)
@@ -192,25 +192,15 @@ GHOST_TSuccess GHOST_Window::setCursorShape(GHOST_TStandardCursor cursorShape)
   }
 }
 
-GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                                  GHOST_TUns8 mask[16][2],
-                                                  int hotX,
-                                                  int hotY)
-{
-  return setCustomCursorShape(
-      (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotX, hotY, 0, 1);
-}
-
 GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 *bitmap,
                                                   GHOST_TUns8 *mask,
                                                   int sizex,
                                                   int sizey,
                                                   int hotX,
                                                   int hotY,
-                                                  int fg_color,
-                                                  int bg_color)
+                                                  bool canInvertColor)
 {
-  if (setWindowCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, fg_color, bg_color)) {
+  if (setWindowCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, canInvertColor)) {
     m_cursorShape = GHOST_kStandardCursorCustom;
     return GHOST_kSuccess;
   }
index 50a5634..5f9e8ff 100644 (file)
@@ -124,19 +124,13 @@ class GHOST_Window : public GHOST_IWindow {
    * \param   hotY    The Y coordinate of the cursor hotspot.
    * \return  Indication of success.
    */
-  GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                      GHOST_TUns8 mask[16][2],
-                                      int hotX,
-                                      int hotY);
-
   GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
                                       GHOST_TUns8 *mask,
                                       int sizex,
                                       int sizey,
                                       int hotX,
                                       int hotY,
-                                      int fg_color,
-                                      int bg_color);
+                                      bool canInvertColor);
 
   /**
    * Returns the visibility state of the cursor.
@@ -347,19 +341,13 @@ class GHOST_Window : public GHOST_IWindow {
    * Sets the cursor shape on the window using
    * native window system calls.
    */
-  virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                                    GHOST_TUns8 mask[16][2],
-                                                    int hotX,
-                                                    int hotY) = 0;
-
   virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
                                                     GHOST_TUns8 *mask,
                                                     int szx,
                                                     int szy,
                                                     int hotX,
                                                     int hotY,
-                                                    int fg,
-                                                    int bg) = 0;
+                                                    bool canInvertColor) = 0;
 
   GHOST_TSuccess releaseNativeHandles();
 
index 5300b07..5e857c0 100644 (file)
@@ -307,13 +307,7 @@ class GHOST_WindowCocoa : public GHOST_Window {
                                             int sizey,
                                             int hotX,
                                             int hotY,
-                                            int fg_color,
-                                            int bg_color);
-
-  GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                            GHOST_TUns8 mask[16][2],
-                                            int hotX,
-                                            int hotY);
+                                            bool canInvertColor);
 
   /** The window containing the view */
   CocoaWindow *m_window;
index 45ea3c8..9c988d0 100644 (file)
@@ -1086,8 +1086,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
                                                              int sizey,
                                                              int hotX,
                                                              int hotY,
-                                                             int fg_color,
-                                                             int bg_color)
+                                                             bool canInvertColor)
 {
   int y, nbUns16;
   NSPoint hotSpotPoint;
@@ -1120,12 +1119,18 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
 
   for (y = 0; y < nbUns16; y++) {
 #if !defined(__LITTLE_ENDIAN__)
-    cursorBitmap[y] = ~uns16ReverseBits((bitmap[2 * y] << 0) | (bitmap[2 * y + 1] << 8));
+    cursorBitmap[y] = uns16ReverseBits((bitmap[2 * y] << 0) | (bitmap[2 * y + 1] << 8));
     cursorBitmap[nbUns16 + y] = uns16ReverseBits((mask[2 * y] << 0) | (mask[2 * y + 1] << 8));
 #else
-    cursorBitmap[y] = ~uns16ReverseBits((bitmap[2 * y + 1] << 0) | (bitmap[2 * y] << 8));
+    cursorBitmap[y] = uns16ReverseBits((bitmap[2 * y + 1] << 0) | (bitmap[2 * y] << 8));
     cursorBitmap[nbUns16 + y] = uns16ReverseBits((mask[2 * y + 1] << 0) | (mask[2 * y] << 8));
 #endif
+
+    /* Flip white cursor with black outline to black cursor with white outline
+     * to match macOS platform conventions. */
+    if (canInvertColor) {
+      cursorBitmap[y] = ~cursorBitmap[y];
+    }
   }
 
   imSize.width = sizex;
@@ -1148,12 +1153,3 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
   [pool drain];
   return GHOST_kSuccess;
 }
-
-GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                                             GHOST_TUns8 mask[16][2],
-                                                             int hotX,
-                                                             int hotY)
-{
-  return setWindowCustomCursorShape(
-      (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotX, hotY, 0, 1);
-}
index 0ea3371..1d332a7 100644 (file)
@@ -68,21 +68,13 @@ class GHOST_WindowNULL : public GHOST_Window {
   {
     return GHOST_kSuccess;
   }
-  GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                            GHOST_TUns8 mask[16][2],
-                                            int hotX,
-                                            int hotY)
-  {
-    return GHOST_kSuccess;
-  }
   GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
                                             GHOST_TUns8 *mask,
                                             int sizex,
                                             int sizey,
                                             int hotX,
                                             int hotY,
-                                            int fg_color,
-                                            int bg_color)
+                                            bool canInvertColor)
   {
     return GHOST_kSuccess;
   }
index 9c9fffd..cd9863d 100644 (file)
@@ -642,23 +642,13 @@ GHOST_TSuccess GHOST_WindowSDL::setWindowCursorShape(GHOST_TStandardCursor shape
   return GHOST_kSuccess;
 }
 
-GHOST_TSuccess GHOST_WindowSDL::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                                           GHOST_TUns8 mask[16][2],
-                                                           int hotX,
-                                                           int hotY)
-{
-  return setWindowCustomCursorShape(
-      (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotX, hotY, 0, 1);
-}
-
 GHOST_TSuccess GHOST_WindowSDL::setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
                                                            GHOST_TUns8 *mask,
                                                            int sizex,
                                                            int sizey,
                                                            int hotX,
                                                            int hotY,
-                                                           int fg_color,
-                                                           int bg_color)
+                                                           bool canInvertColor)
 {
   if (m_sdl_custom_cursor) {
     SDL_FreeCursor(m_sdl_custom_cursor);
index 7b3cddc..bb19b62 100644 (file)
@@ -101,19 +101,13 @@ class GHOST_WindowSDL : public GHOST_Window {
 
   GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape);
 
-  GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                            GHOST_TUns8 mask[16][2],
-                                            int hotX,
-                                            int hotY);
-
   GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
                                             GHOST_TUns8 *mask,
                                             int sizex,
                                             int sizey,
                                             int hotX,
                                             int hotY,
-                                            int fg_color,
-                                            int bg_color);
+                                            bool canInvertColor);
 
   GHOST_TSuccess setWindowCursorVisibility(bool visible);
 
index def075b..e8b36c5 100644 (file)
@@ -1189,14 +1189,6 @@ static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
   return shrt;
 }
 #endif
-GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                                             GHOST_TUns8 mask[16][2],
-                                                             int hotX,
-                                                             int hotY)
-{
-  return setWindowCustomCursorShape(
-      (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotX, hotY, 0, 1);
-}
 
 GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
                                                              GHOST_TUns8 *mask,
@@ -1204,8 +1196,7 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
                                                              int sizeY,
                                                              int hotX,
                                                              int hotY,
-                                                             int fg_color,
-                                                             int bg_color)
+                                                             bool canInvertColor)
 {
   GHOST_TUns32 andData[32];
   GHOST_TUns32 xorData[32];
index 2f1f3a5..cf7177b 100644 (file)
@@ -461,19 +461,13 @@ class GHOST_WindowWin32 : public GHOST_Window {
    * Sets the cursor shape on the window using
    * native window system calls.
    */
-  GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                            GHOST_TUns8 mask[16][2],
-                                            int hotX,
-                                            int hotY);
-
   GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
                                             GHOST_TUns8 *mask,
                                             int sizex,
                                             int sizey,
                                             int hotX,
                                             int hotY,
-                                            int fg_color,
-                                            int bg_color);
+                                            bool canInvertColor);
 
   /** Pointer to system */
   GHOST_SystemWin32 *m_system;
index 48bdfa3..166fea8 100644 (file)
@@ -1473,23 +1473,13 @@ GHOST_TSuccess GHOST_WindowX11::setWindowCursorShape(GHOST_TStandardCursor shape
   return GHOST_kSuccess;
 }
 
-GHOST_TSuccess GHOST_WindowX11::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                                           GHOST_TUns8 mask[16][2],
-                                                           int hotX,
-                                                           int hotY)
-{
-  setWindowCustomCursorShape((GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotX, hotY, 0, 1);
-  return GHOST_kSuccess;
-}
-
 GHOST_TSuccess GHOST_WindowX11::setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
                                                            GHOST_TUns8 *mask,
                                                            int sizex,
                                                            int sizey,
                                                            int hotX,
                                                            int hotY,
-                                                           int /*fg_color*/,
-                                                           int /*bg_color*/)
+                                                           bool /*canInvertColor*/)
 {
   Colormap colormap = DefaultColormap(m_display, m_visualInfo->screen);
   Pixmap bitmap_pix, mask_pix;
index a39a186..83e0a2b 100644 (file)
@@ -214,15 +214,6 @@ class GHOST_WindowX11 : public GHOST_Window {
    */
   GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape);
 
-  /**
-   * Sets the cursor shape on the window using
-   * native window system calls.
-   */
-  GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                            GHOST_TUns8 mask[16][2],
-                                            int hotX,
-                                            int hotY);
-
   /**
    * Sets the cursor shape on the window using
    * native window system calls (Arbitrary size/color).
@@ -233,8 +224,7 @@ class GHOST_WindowX11 : public GHOST_Window {
                                             int sizey,
                                             int hotX,
                                             int hotY,
-                                            int fg_color,
-                                            int bg_color);
+                                            bool canInvertColor);
 
  private:
   /// Force use of public constructor.
index 25e9f6b..5c8d352 100644 (file)
@@ -736,7 +736,7 @@ static void extrawindow_spin_cursor(ExtraWindow *ew, GHOST_TUns64 time)
     mask[y][x / 8] |= (1 << (x % 8));
   }
 
-  GHOST_SetCustomCursorShape(ew->win, bitmap, mask, 0, 0);
+  GHOST_SetCustomCursorShape(ew->win, bitmap, mask, 16, 16, 0, 0, true);
 }
 
 static void extrawindow_handle(void *priv, GHOST_EventHandle evt)
index 44395b0..905569d 100644 (file)
@@ -80,32 +80,31 @@ static GHOST_TStandardCursor convert_cursor(int curs)
 static void window_set_custom_cursor(
     wmWindow *win, unsigned char mask[16][2], unsigned char bitmap[16][2], int hotx, int hoty)
 {
-  GHOST_SetCustomCursorShape(win->ghostwin, bitmap, mask, hotx, hoty);
+  GHOST_SetCustomCursorShape(
+      win->ghostwin, (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotx, hoty, true);
 }
 
 static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useBig)
 {
   if (useBig) {
-    GHOST_SetCustomCursorShapeEx(win->ghostwin,
-                                 (GHOST_TUns8 *)cursor->big_bm,
-                                 (GHOST_TUns8 *)cursor->big_mask,
-                                 cursor->big_sizex,
-                                 cursor->big_sizey,
-                                 cursor->big_hotx,
-                                 cursor->big_hoty,
-                                 cursor->fg_color,
-                                 cursor->bg_color);
+    GHOST_SetCustomCursorShape(win->ghostwin,
+                               (GHOST_TUns8 *)cursor->big_bm,
+                               (GHOST_TUns8 *)cursor->big_mask,
+                               cursor->big_sizex,
+                               cursor->big_sizey,
+                               cursor->big_hotx,
+                               cursor->big_hoty,
+                               cursor->can_invert_color);
   }
   else {
-    GHOST_SetCustomCursorShapeEx(win->ghostwin,
-                                 (GHOST_TUns8 *)cursor->small_bm,
-                                 (GHOST_TUns8 *)cursor->small_mask,
-                                 cursor->small_sizex,
-                                 cursor->small_sizey,
-                                 cursor->small_hotx,
-                                 cursor->small_hoty,
-                                 cursor->fg_color,
-                                 cursor->bg_color);
+    GHOST_SetCustomCursorShape(win->ghostwin,
+                               (GHOST_TUns8 *)cursor->small_bm,
+                               (GHOST_TUns8 *)cursor->small_mask,
+                               cursor->small_sizex,
+                               cursor->small_sizey,
+                               cursor->small_hotx,
+                               cursor->small_hoty,
+                               cursor->can_invert_color);
   }
 }
 
@@ -363,7 +362,7 @@ void WM_cursor_time(wmWindow *win, int nr)
  * the bits in a byte go right to left
  * (ie;  0x01, 0x80  represents a line of 16 pix with the first and last pix set.)
  *
- * - A 0 in the bitmap = bg_color, a 1 fg_color
+ * - A 0 in the bitmap = white, a 1 black
  * - a 0 in the mask   = transparent pix.
  *
  * Until 32x32 cursors are supported on all platforms, the size of the
@@ -420,23 +419,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor NWArrowCursor = {
-      /*small*/
+      /* small */
       nw_sbm,
       nw_smsk,
       16,
       16,
       6,
       7,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_NW_ARROWCURSOR] = &NWArrowCursor;
@@ -457,23 +455,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor NSArrowCursor = {
-      /*small*/
+      /* small */
       ns_sbm,
       ns_smsk,
       16,
       16,
       6,
       7,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_NS_ARROWCURSOR] = &NSArrowCursor;
@@ -494,23 +491,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor EWArrowCursor = {
-      /*small*/
+      /* small */
       ew_sbm,
       ew_smsk,
       16,
       16,
       7,
       6,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_EW_ARROWCURSOR] = &EWArrowCursor;
@@ -555,23 +551,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor WaitCursor = {
-      /*small*/
+      /* small */
       wait_sbm,
       wait_smsk,
       16,
       16,
       7,
       7,
-      /*big*/
+      /* big */
       wait_lbm,
       wait_lmsk,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_WAITCURSOR] = &WaitCursor;
@@ -615,23 +610,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor CrossCursor = {
-      /*small*/
+      /* small */
       cross_sbm,
       cross_smsk,
       16,
       16,
       7,
       7,
-      /*big*/
+      /* big */
       cross_lbm,
       cross_lmsk,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_CROSSCURSOR] = &CrossCursor;
@@ -652,23 +646,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor EditCrossCursor = {
-      /*small*/
+      /* small */
       editcross_sbm,
       editcross_smsk,
       16,
       16,
       9,
       8,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_EDITCROSSCURSOR] = &EditCrossCursor;
@@ -689,23 +682,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor BoxSelCursor = {
-      /*small*/
+      /* small */
       box_sbm,
       box_smsk,
       16,
       16,
       9,
       8,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_BOXSELCURSOR] = &BoxSelCursor;
@@ -750,23 +742,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor KnifeCursor = {
-      /*small*/
+      /* small */
       knife_sbm,
       knife_smsk,
       16,
       16,
       0,
       15,
-      /*big*/
+      /* big */
       knife_lbm,
       knife_lmsk,
       32,
       32,
       0,
       31,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_KNIFECURSOR] = &KnifeCursor;
@@ -813,23 +804,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor VLoopCursor = {
-      /*small*/
+      /* small */
       vloop_sbm,
       vloop_smsk,
       16,
       16,
       0,
       0,
-      /*big*/
+      /* big */
       vloop_lbm,
       vloop_lmsk,
       32,
       32,
       0,
       0,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_VLOOPCURSOR] = &VLoopCursor;
@@ -851,23 +841,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor TextEditCursor = {
-      /*small*/
+      /* small */
       textedit_sbm,
       textedit_smsk,
       16,
       16,
       9,
       8,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_TEXTEDITCURSOR] = &TextEditCursor;
@@ -889,23 +878,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor PaintBrushCursor = {
-      /*small*/
+      /* small */
       paintbrush_sbm,
       paintbrush_smsk,
       16,
       16,
       0,
       15,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_PAINTBRUSHCURSOR] = &PaintBrushCursor;
@@ -927,23 +915,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor HandCursor = {
-      /*small*/
+      /* small */
       hand_sbm,
       hand_smsk,
       16,
       16,
       8,
       8,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_HANDCURSOR] = &HandCursor;
@@ -966,23 +953,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor NSEWScrollCursor = {
-      /*small*/
+      /* small */
       nsewscroll_sbm,
       nsewscroll_smsk,
       16,
       16,
       8,
       8,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_NSEW_SCROLLCURSOR] = &NSEWScrollCursor;
@@ -1005,23 +991,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor NSScrollCursor = {
-      /*small*/
+      /* small */
       nsscroll_sbm,
       nsscroll_smsk,
       16,
       16,
       8,
       8,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_NS_SCROLLCURSOR] = &NSScrollCursor;
@@ -1044,23 +1029,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor EWScrollCursor = {
-      /*small*/
+      /* small */
       ewscroll_sbm,
       ewscroll_smsk,
       16,
       16,
       8,
       8,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_EW_SCROLLCURSOR] = &EWScrollCursor;
@@ -1083,23 +1067,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor EyedropperCursor = {
-      /*small*/
+      /* small */
       eyedropper_sbm,
       eyedropper_smsk,
       16,
       16,
       1,
       15,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_EYEDROPPER_CURSOR] = &EyedropperCursor;
@@ -1121,23 +1104,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor SwapCursor = {
-      /*small*/
+      /* small */
       swap_sbm,
       swap_smsk,
       16,
       16,
       8,
       8,
-      /*big*/
+      /* big */
       NULL,
       NULL,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_YELLOW,
-      BC_BLUE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_SWAPAREA_CURSOR] = &SwapCursor;
@@ -1182,23 +1164,22 @@ void wm_init_cursor_data(void)
       0x00, 0xC0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00};
 
   static BCursor HSplitCursor = {
-      /*small*/
+      /* small */
       hsplit_sbm,
       hsplit_smsk,
       16,
       16,
       7,
       7,
-      /*big*/
+      /* big */
       hsplit_lbm,
       hsplit_lmsk,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_H_SPLITCURSOR] = &HSplitCursor;
@@ -1243,23 +1224,22 @@ void wm_init_cursor_data(void)
       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
   static BCursor VSplitCursor = {
-      /*small*/
+      /* small */
       vsplit_sbm,
       vsplit_smsk,
       16,
       16,
       7,
       7,
-      /*big*/
+      /* big */
       vsplit_lbm,
       vsplit_lmsk,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_V_SPLITCURSOR] = &VSplitCursor;
@@ -1304,23 +1284,22 @@ void wm_init_cursor_data(void)
       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
   static BCursor NArrowCursor = {
-      /*small*/
+      /* small */
       narrow_sbm,
       narrow_smsk,
       16,
       16,
       7,
       4,
-      /*big*/
+      /* big */
       narrow_lbm,
       narrow_lmsk,
       32,
       32,
       15,
       10,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_N_ARROWCURSOR] = &NArrowCursor;
@@ -1365,23 +1344,22 @@ void wm_init_cursor_data(void)
       0x00, 0xC0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00};
 
   static BCursor SArrowCursor = {
-      /*small*/
+      /* small */
       sarrow_sbm,
       sarrow_smsk,
       16,
       16,
       7,
       11,
-      /*big*/
+      /* big */
       sarrow_lbm,
       sarrow_lmsk,
       32,
       32,
       15,
       21,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_S_ARROWCURSOR] = &SArrowCursor;
@@ -1426,23 +1404,22 @@ void wm_init_cursor_data(void)
       0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00};
 
   static BCursor EArrowCursor = {
-      /*small*/
+      /* small */
       earrow_sbm,
       earrow_smsk,
       16,
       16,
       11,
       7,
-      /*big*/
+      /* big */
       earrow_lbm,
       earrow_lmsk,
       32,
       32,
       15,
       22,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_E_ARROWCURSOR] = &EArrowCursor;
@@ -1487,23 +1464,22 @@ void wm_init_cursor_data(void)
       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
   static BCursor WArrowCursor = {
-      /*small*/
+      /* small */
       warrow_sbm,
       warrow_smsk,
       16,
       16,
       4,
       7,
-      /*big*/
+      /* big */
       warrow_lbm,
       warrow_lmsk,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_W_ARROWCURSOR] = &WArrowCursor;
@@ -1548,23 +1524,22 @@ void wm_init_cursor_data(void)
       0x00, 0xFE, 0x7F, 0x00, 0x00, 0xF0, 0x0F, 0x00};
 
   static BCursor StopCursor = {
-      /*small*/
+      /* small */
       stop_sbm,
       stop_smsk,
       16,
       16,
       7,
       7,
-      /*big*/
+      /* big */
       stop_lbm,
       stop_lmsk,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_STOPCURSOR] = &StopCursor;
@@ -1610,23 +1585,22 @@ void wm_init_cursor_data(void)
   };
 
   static BCursor PaintCrossCursor = {
-      /*small*/
+      /* small */
       paintcross_sbm,
       paintcross_smsk,
       16,
       16,
       7,
       7,
-      /*big*/
+      /* big */
       paintcross_sbm_large,
       paintcross_smsk_large,
       32,
       32,
       15,
       15,
-      /*color*/
-      BC_BLACK,
-      BC_WHITE,
+      /* can invert color */
+      true,
   };
 
   BlenderCursor[BC_PAINTCROSSCURSOR] = &PaintCrossCursor;
index 46fdb4b..6192b7c 100644 (file)
@@ -61,8 +61,7 @@ typedef struct BCursor {
   char big_hotx;
   char big_hoty;
 
-  char fg_color;
-  char bg_color;
+  bool can_invert_color;
 
 } BCursor;
 
@@ -97,15 +96,6 @@ enum {
   BC_NUMCURSORS,
 };
 
-enum {
-  BC_BLACK = 0,
-  BC_WHITE,
-  BC_RED,
-  BC_BLUE,
-  BC_GREEN,
-  BC_YELLOW,
-};
-
 struct wmEvent;
 struct wmWindow;