MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / update_mouse_cursor

Function update_mouse_cursor

src/ui/system.cpp:69–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static void update_mouse_cursor()
70{
71 // Use native cursor when it's possible/available/configured to do so.
72
73 she::NativeCursor nativeCursor = she::kNoCursor;
74 Cursor* cursor = nullptr;
75
76 if (use_native_mouse_cursor ||
77 mouse_cursor_type == kOutsideDisplay) {
78 switch (mouse_cursor_type) {
79 case ui::kOutsideDisplay:
80 nativeCursor = she::kArrowCursor;
81 break;
82 case ui::kNoCursor: break;
83 case ui::kArrowCursor:
84 case ui::kArrowPlusCursor:
85 nativeCursor = she::kArrowCursor;
86 break;
87 case ui::kForbiddenCursor:
88 nativeCursor = she::kForbiddenCursor;
89 break;
90 case ui::kHandCursor:
91 nativeCursor = she::kLinkCursor;
92 break;
93 case ui::kScrollCursor:
94 case ui::kMoveCursor:
95 nativeCursor = she::kMoveCursor;
96 break;
97 case ui::kSizeNSCursor: nativeCursor = she::kSizeNSCursor; break;
98 case ui::kSizeWECursor: nativeCursor = she::kSizeWECursor; break;
99 case ui::kSizeNCursor: nativeCursor = she::kSizeNCursor; break;
100 case ui::kSizeNECursor: nativeCursor = she::kSizeNECursor; break;
101 case ui::kSizeECursor: nativeCursor = she::kSizeECursor; break;
102 case ui::kSizeSECursor: nativeCursor = she::kSizeSECursor; break;
103 case ui::kSizeSCursor: nativeCursor = she::kSizeSCursor; break;
104 case ui::kSizeSWCursor: nativeCursor = she::kSizeSWCursor; break;
105 case ui::kSizeWCursor: nativeCursor = she::kSizeWCursor; break;
106 case ui::kSizeNWCursor: nativeCursor = she::kSizeNWCursor; break;
107 }
108 }
109
110 // Set native cursor
111 if (mouse_display) {
112 bool ok = mouse_display->setNativeMouseCursor(nativeCursor);
113
114 // It looks like the specific native cursor is not supported,
115 // so we can should use the internal overlay (even when we
116 // have use_native_mouse_cursor flag enabled).
117 if (!ok)
118 nativeCursor = she::kNoCursor;
119 }
120
121 // Use a software cursor with the overlay.
122 if (nativeCursor == she::kNoCursor &&
123 mouse_cursor_type != ui::kOutsideDisplay &&
124 CurrentTheme::get()) {
125 cursor = CurrentTheme::get()->getCursor(mouse_cursor_type);
126 }

Callers 3

set_use_native_cursorsFunction · 0.85
set_mouse_cursorFunction · 0.85
show_mouse_cursorFunction · 0.85

Calls 4

update_mouse_overlayFunction · 0.85
getCursorMethod · 0.80
getFunction · 0.50
setNativeMouseCursorMethod · 0.45

Tested by

no test coverage detected