diff options
author | falkTX <falktx@falktx.com> | 2022-05-27 00:30:12 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-12-24 19:47:25 -0500 |
commit | cdfb8223301faba2c478c805b35ca457e6547629 (patch) | |
tree | f024df90192e74ff11f1e9eeb766825758f9f691 /src | |
parent | ebf23245ce3dff82d804c957ad928fe11457311f (diff) | |
download | pugl-cdfb8223301faba2c478c805b35ca457e6547629.tar.gz pugl-cdfb8223301faba2c478c805b35ca457e6547629.tar.bz2 pugl-cdfb8223301faba2c478c805b35ca457e6547629.zip |
Add diagonal cursors
Diffstat (limited to 'src')
-rw-r--r-- | src/mac.m | 17 | ||||
-rw-r--r-- | src/win.c | 16 | ||||
-rw-r--r-- | src/x11.c | 6 |
3 files changed, 30 insertions, 9 deletions
@@ -1672,6 +1672,19 @@ puglGetClipboard(PuglView* const view, } static NSCursor* +extendedCursor(const SEL cursorSelector) +{ + if (cursorSelector && [NSCursor respondsToSelector:cursorSelector]) { + const id object = [NSCursor performSelector:cursorSelector]; + if ([object isKindOfClass:[NSCursor class]]) { + return (NSCursor*)object; + } + } + + return NULL; +} + +static NSCursor* puglGetNsCursor(const PuglCursor cursor) { switch (cursor) { @@ -1689,6 +1702,10 @@ puglGetNsCursor(const PuglCursor cursor) return [NSCursor resizeLeftRightCursor]; case PUGL_CURSOR_UP_DOWN: return [NSCursor resizeUpDownCursor]; + case PUGL_CURSOR_UP_LEFT_DOWN_RIGHT: + return extendedCursor(@selector(_windowResizeNorthWestSouthEastCursor)); + case PUGL_CURSOR_UP_RIGHT_DOWN_LEFT: + return extendedCursor(@selector(_windowResizeNorthEastSouthWestCursor)); } return NULL; @@ -1295,13 +1295,15 @@ puglPaste(PuglView* const view) } static const char* const cursor_ids[] = { - IDC_ARROW, // ARROW - IDC_IBEAM, // CARET - IDC_CROSS, // CROSSHAIR - IDC_HAND, // HAND - IDC_NO, // NO - IDC_SIZEWE, // LEFT_RIGHT - IDC_SIZENS, // UP_DOWN + IDC_ARROW, // ARROW + IDC_IBEAM, // CARET + IDC_CROSS, // CROSSHAIR + IDC_HAND, // HAND + IDC_NO, // NO + IDC_SIZEWE, // LEFT_RIGHT + IDC_SIZENS, // UP_DOWN + IDC_SIZENWSE, // UP_LEFT_DOWN_RIGHT + IDC_SIZENESW, // UP_RIGHT_DOWN_LEFT }; PuglStatus @@ -66,7 +66,7 @@ enum WmClientStateMessageAction { WM_STATE_TOGGLE }; -#define NUM_CURSORS ((unsigned)PUGL_CURSOR_UP_DOWN + 1U) +#define NUM_CURSORS ((unsigned)PUGL_CURSOR_UP_RIGHT_DOWN_LEFT + 1U) #ifdef HAVE_XCURSOR static const char* const cursor_names[NUM_CURSORS] = { @@ -76,7 +76,9 @@ static const char* const cursor_names[NUM_CURSORS] = { "pointer", // HAND "not-allowed", // NO "sb_h_double_arrow", // LEFT_RIGHT - "sb_v_double_arrow" // UP_DOWN + "sb_v_double_arrow", // UP_DOWN + "size_fdiag", // UP_LEFT_DOWN_RIGHT + "size_bdiag", // UP_RIGHT_DOWN_LEFT }; #endif |