diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-16 20:45:57 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-16 20:58:26 +0300 |
commit | 087a4898676d744d4aaa46a59b47186825495820 (patch) | |
tree | a3ec2cbd2060a567f87dcd6790f507e7641187a8 | |
parent | 5767dcbe60c07cd9ef113e2f54eaad6981a47bce (diff) |
Cleanup: simplify GHOST cursor API, no functional changes
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 33 | ||||
-rw-r--r-- | intern/ghost/GHOST_IWindow.h | 8 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 26 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_Window.cpp | 14 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_Window.h | 16 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.h | 8 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 22 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowNULL.h | 10 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowSDL.cpp | 12 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowSDL.h | 8 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 11 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.h | 8 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 12 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.h | 12 | ||||
-rw-r--r-- | intern/ghost/test/multitest/MultiTest.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_cursors.c | 264 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_cursors.h | 12 |
17 files changed, 159 insertions, 319 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index b54c097c2ab..0f735711b24 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -325,20 +325,6 @@ 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 * \param bitmap The bitmap data for the cursor. @@ -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. diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h index 52894a7c38d..1a1844bfe41 100644 --- a/intern/ghost/GHOST_IWindow.h +++ b/intern/ghost/GHOST_IWindow.h @@ -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. diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index ef653c114e8..78f171af7d1 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -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) diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp index 76f2d2347db..ca19e251279 100644 --- a/intern/ghost/intern/GHOST_Window.cpp +++ b/intern/ghost/intern/GHOST_Window.cpp @@ -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; } diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h index 50a563453f6..5f9e8ffdd5e 100644 --- a/intern/ghost/intern/GHOST_Window.h +++ b/intern/ghost/intern/GHOST_Window.h @@ -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(); diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h index 5300b07523c..5e857c05a09 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.h +++ b/intern/ghost/intern/GHOST_WindowCocoa.h @@ -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; diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 45ea3c85005..9c988d075cd 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -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); -} diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h index 0ea33710ef6..1d332a7dc3e 100644 --- a/intern/ghost/intern/GHOST_WindowNULL.h +++ b/intern/ghost/intern/GHOST_WindowNULL.h @@ -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; } diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp index 9c9fffdba50..cd9863d7e72 100644 --- a/intern/ghost/intern/GHOST_WindowSDL.cpp +++ b/intern/ghost/intern/GHOST_WindowSDL.cpp @@ -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); diff --git a/intern/ghost/intern/GHOST_WindowSDL.h b/intern/ghost/intern/GHOST_WindowSDL.h index 7b3cddc5f17..bb19b62e06d 100644 --- a/intern/ghost/intern/GHOST_WindowSDL.h +++ b/intern/ghost/intern/GHOST_WindowSDL.h @@ -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); diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index def075bd47c..e8b36c59366 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -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]; diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h index 2f1f3a53c81..cf7177b0062 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.h +++ b/intern/ghost/intern/GHOST_WindowWin32.h @@ -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; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 48bdfa37565..166fea8a84b 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -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; diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index a39a186406f..83e0a2b59db 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -216,15 +216,6 @@ class GHOST_WindowX11 : 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); - - /** - * Sets the cursor shape on the window using * native window system calls (Arbitrary size/color). */ GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, @@ -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. diff --git a/intern/ghost/test/multitest/MultiTest.c b/intern/ghost/test/multitest/MultiTest.c index 25e9f6b2bf1..5c8d3527869 100644 --- a/intern/ghost/test/multitest/MultiTest.c +++ b/intern/ghost/test/multitest/MultiTest.c @@ -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) diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index 44395b0b201..905569d6da2 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -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; diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h index 46fdb4baa5b..6192b7c228e 100644 --- a/source/blender/windowmanager/wm_cursors.h +++ b/source/blender/windowmanager/wm_cursors.h @@ -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; |