UI: Hand Cursors

Add multiple "hand" mouse cursors. These are mostly needed for Mac,
which needs open, close, and pointing hand cursors. This also adds
similar for Windows, but just for completeness and testing.

Pull Request: https://projects.blender.org/blender/blender/pulls/127164
This commit is contained in:
Harley Acheson
2024-09-06 19:05:59 +02:00
committed by Harley Acheson
parent eab640e044
commit 458c60269b
11 changed files with 36 additions and 2 deletions

View File

@@ -363,6 +363,9 @@ typedef enum {
GHOST_kStandardCursorLeftHandle,
GHOST_kStandardCursorRightHandle,
GHOST_kStandardCursorBothHandles,
GHOST_kStandardCursorHandOpen,
GHOST_kStandardCursorHandClosed,
GHOST_kStandardCursorHandPoint,
GHOST_kStandardCursorCustom,
#define GHOST_kStandardCursorNumCursors (int(GHOST_kStandardCursorCustom) + 1)

View File

@@ -2246,6 +2246,9 @@ static const GWL_Cursor_ShapeInfo ghost_wl_cursors = []() -> GWL_Cursor_ShapeInf
CASE_CURSOR(GHOST_kStandardCursorZoomIn, "zoom-in");
CASE_CURSOR(GHOST_kStandardCursorZoomOut, "zoom-out");
CASE_CURSOR(GHOST_kStandardCursorMove, "move");
CASE_CURSOR(GHOST_kStandardCursorHandOpen, "move");
CASE_CURSOR(GHOST_kStandardCursorHandClosed, "move");
CASE_CURSOR(GHOST_kStandardCursorHandPoint, "move");
CASE_CURSOR(GHOST_kStandardCursorNSEWScroll, "all-scroll");
CASE_CURSOR(GHOST_kStandardCursorNSScroll, "size_ver");
CASE_CURSOR(GHOST_kStandardCursorEWScroll, "size_hor");

View File

@@ -971,6 +971,12 @@ NSCursor *GHOST_WindowCocoa::getStandardCursor(GHOST_TStandardCursor shape) cons
return [NSCursor operationNotAllowedCursor];
case GHOST_kStandardCursorMove:
return [NSCursor openHandCursor];
case GHOST_kStandardCursorHandOpen:
return [NSCursor openHandCursor];
case GHOST_kStandardCursorHandClosed:
return [NSCursor closedHandCursor];
case GHOST_kStandardCursorHandPoint:
return [NSCursor pointingHandCursor];
case GHOST_kStandardCursorDefault:
return [NSCursor arrowCursor];
case GHOST_kStandardCursorKnife:

View File

@@ -758,8 +758,17 @@ HCURSOR GHOST_WindowWin32::getStandardCursor(GHOST_TStandardCursor shape) const
cursor = ::LoadImage(module, "zoomout_cursor", IMAGE_CURSOR, cx, cy, flags);
break;
case GHOST_kStandardCursorMove:
cursor = ::LoadImage(nullptr, IDC_SIZEALL, IMAGE_CURSOR, cx, cy, flags);
break;
case GHOST_kStandardCursorHandOpen:
cursor = ::LoadImage(module, "handopen_cursor", IMAGE_CURSOR, cx, cy, flags);
break;
case GHOST_kStandardCursorHandClosed:
cursor = ::LoadImage(module, "handclosed_cursor", IMAGE_CURSOR, cx, cy, flags);
break;
case GHOST_kStandardCursorHandPoint:
cursor = ::LoadImage(module, "handpoint_cursor", IMAGE_CURSOR, cx, cy, flags);
break;
case GHOST_kStandardCursorNSEWScroll:
cursor = ::LoadImage(module, "scrollnsew_cursor", IMAGE_CURSOR, cx, cy, flags);
break;

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -26,6 +26,8 @@ crossC_cursor CURSOR "cursors/crossc.cur"
eraser_cursor CURSOR "cursors/eraser.cur"
eyedropper_cursor CURSOR "cursors/eyedropper.cur"
handopen_cursor CURSOR "cursors/handopen.cur"
handclosed_cursor CURSOR "cursors/handclosed.cur"
handpoint_cursor CURSOR "cursors/handpoint.cur"
knife_cursor CURSOR "cursors/knife.cur"
pencil_cursor CURSOR "cursors/pencil.cur"
scrollew_cursor CURSOR "cursors/scrollew.cur"

View File

@@ -45,7 +45,9 @@ const EnumPropertyItem rna_enum_window_cursor_items[] = {
{WM_CURSOR_PAINT, "PAINT_CROSS", 0, "Paint Cross", ""},
{WM_CURSOR_DOT, "DOT", 0, "Dot Cursor", ""},
{WM_CURSOR_ERASER, "ERASER", 0, "Eraser", ""},
{WM_CURSOR_HAND, "HAND", 0, "Hand", ""},
{WM_CURSOR_HAND, "HAND", 0, "Open Hand", ""},
{WM_CURSOR_HAND_POINT, "HAND_POINT", 0, "Pointing Hand", ""},
{WM_CURSOR_HAND_CLOSED, "HAND_CLOSED", 0, "Closed Hand", ""},
{WM_CURSOR_EW_SCROLL, "SCROLL_X", 0, "Scroll-X", ""},
{WM_CURSOR_NS_SCROLL, "SCROLL_Y", 0, "Scroll-Y", ""},
{WM_CURSOR_NSEW_SCROLL, "SCROLL_XY", 0, "Scroll-XY", ""},

View File

@@ -49,6 +49,8 @@ static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs)
case WM_CURSOR_EDIT:
case WM_CURSOR_CROSS:
return GHOST_kStandardCursorCrosshair;
case WM_CURSOR_MOVE:
return GHOST_kStandardCursorMove;
case WM_CURSOR_X_MOVE:
return GHOST_kStandardCursorLeftRight;
case WM_CURSOR_Y_MOVE:
@@ -56,7 +58,11 @@ static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs)
case WM_CURSOR_COPY:
return GHOST_kStandardCursorCopy;
case WM_CURSOR_HAND:
return GHOST_kStandardCursorMove;
return GHOST_kStandardCursorHandOpen;
case WM_CURSOR_HAND_CLOSED:
return GHOST_kStandardCursorHandClosed;
case WM_CURSOR_HAND_POINT:
return GHOST_kStandardCursorHandPoint;
case WM_CURSOR_H_SPLIT:
return GHOST_kStandardCursorHorizontalSplit;
case WM_CURSOR_V_SPLIT:

View File

@@ -18,7 +18,10 @@ enum WMCursorType {
WM_CURSOR_STOP,
WM_CURSOR_EDIT,
WM_CURSOR_COPY,
WM_CURSOR_MOVE,
WM_CURSOR_HAND,
WM_CURSOR_HAND_CLOSED,
WM_CURSOR_HAND_POINT,
WM_CURSOR_CROSS,
WM_CURSOR_PAINT,