Blender V4.3
wm_cursors.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005-2007 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#include <cstdio>
12#include <cstring>
13
14#include "GHOST_C-api.h"
15
16#include "BLI_utildefines.h"
17
18#include "DNA_listBase.h"
19#include "DNA_userdef_types.h"
20#include "DNA_workspace_types.h"
21
22#include "BKE_global.hh"
23#include "BKE_main.hh"
24
25#include "WM_api.hh"
26#include "WM_types.hh"
27#include "wm_cursors.hh"
28#include "wm_window.hh"
29
30/* Blender custom cursor. */
31struct BCursor {
32 char *bitmap;
33 char *mask;
34 char hotx;
35 char hoty;
37};
38
39static BCursor *BlenderCursor[WM_CURSOR_NUM] = {nullptr};
40
41/* Blender cursor to GHOST standard cursor conversion. */
43{
44 switch (curs) {
47 case WM_CURSOR_WAIT:
49 case WM_CURSOR_EDIT:
50 case WM_CURSOR_CROSS:
52 case WM_CURSOR_MOVE:
58 case WM_CURSOR_COPY:
60 case WM_CURSOR_HAND:
70 case WM_CURSOR_STOP:
72 case WM_CURSOR_KNIFE:
86 case WM_CURSOR_PAINT:
88 case WM_CURSOR_DOT:
112 default:
114 }
115}
116
118 wmWindow *win, const uchar mask[16][2], const uchar bitmap[16][2], int hotx, int hoty)
119{
120 GHOST_SetCustomCursorShape(static_cast<GHOST_WindowHandle>(win->ghostwin),
121 (uint8_t *)bitmap,
122 (uint8_t *)mask,
123 16,
124 16,
125 hotx,
126 hoty,
127 true);
128}
129
131{
132 GHOST_SetCustomCursorShape(static_cast<GHOST_WindowHandle>(win->ghostwin),
133 (uint8_t *)cursor->bitmap,
134 (uint8_t *)cursor->mask,
135 16,
136 16,
137 cursor->hotx,
138 cursor->hoty,
139 cursor->can_invert_color);
140}
141
142void WM_cursor_set(wmWindow *win, int curs)
143{
144 if (win == nullptr || G.background) {
145 return; /* Can't set custom cursor before Window init. */
146 }
147
148 if (curs == WM_CURSOR_DEFAULT && win->modalcursor) {
149 curs = win->modalcursor;
150 }
151
152 if (curs == WM_CURSOR_NONE) {
153 GHOST_SetCursorVisibility(static_cast<GHOST_WindowHandle>(win->ghostwin), false);
154 return;
155 }
156
157 GHOST_SetCursorVisibility(static_cast<GHOST_WindowHandle>(win->ghostwin), true);
158
159 if (win->cursor == curs) {
160 return; /* Cursor is already set. */
161 }
162
163 win->cursor = curs;
164
165 if (curs < 0 || curs >= WM_CURSOR_NUM) {
166 BLI_assert_msg(0, "Invalid cursor number");
167 return;
168 }
169
171
172 if (ghost_cursor != GHOST_kStandardCursorCustom &&
173 GHOST_HasCursorShape(static_cast<GHOST_WindowHandle>(win->ghostwin), ghost_cursor))
174 {
175 /* Use native GHOST cursor when available. */
176 GHOST_SetCursorShape(static_cast<GHOST_WindowHandle>(win->ghostwin), ghost_cursor);
177 }
178 else {
179 BCursor *bcursor = BlenderCursor[curs];
180 if (bcursor) {
181 /* Use custom bitmap cursor. */
182 window_set_custom_cursor_ex(win, bcursor);
183 }
184 else {
185 /* Fallback to default cursor if no bitmap found. */
186 GHOST_SetCursorShape(static_cast<GHOST_WindowHandle>(win->ghostwin),
188 }
189 }
190}
191
192bool WM_cursor_set_from_tool(wmWindow *win, const ScrArea *area, const ARegion *region)
193{
194 if (region && !ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW)) {
195 return false;
196 }
197
198 bToolRef_Runtime *tref_rt = (area && area->runtime.tool) ? area->runtime.tool->runtime : nullptr;
199 if (tref_rt && tref_rt->cursor != WM_CURSOR_DEFAULT) {
200 if (win->modalcursor == 0) {
201 WM_cursor_set(win, tref_rt->cursor);
202 win->cursor = tref_rt->cursor;
203 return true;
204 }
205 }
206 return false;
207}
208
209void WM_cursor_modal_set(wmWindow *win, int val)
210{
211 if (win->lastcursor == 0) {
212 win->lastcursor = win->cursor;
213 }
214 win->modalcursor = val;
215 WM_cursor_set(win, val);
216}
217
219{
220 win->modalcursor = 0;
221 if (win->lastcursor) {
222 WM_cursor_set(win, win->lastcursor);
223 }
224 win->lastcursor = 0;
225}
226
227void WM_cursor_wait(bool val)
228{
229 if (!G.background) {
230 wmWindowManager *wm = static_cast<wmWindowManager *>(G_MAIN->wm.first);
231 wmWindow *win = static_cast<wmWindow *>(wm ? wm->windows.first : nullptr);
232
233 for (; win; win = win->next) {
234 if (val) {
236 }
237 else {
239 }
240 }
241 }
242}
243
246 const rcti *wrap_region,
247 const bool hide)
248{
249 int _wrap_region_buf[4];
250 int *wrap_region_screen = nullptr;
251
252 /* Only grab cursor when not running debug.
253 * It helps not to get a stuck WM when hitting a break-point. */
256
257 if (wrap_region) {
258 wrap_region_screen = _wrap_region_buf;
259 wrap_region_screen[0] = wrap_region->xmin;
260 wrap_region_screen[1] = wrap_region->ymax;
261 wrap_region_screen[2] = wrap_region->xmax;
262 wrap_region_screen[3] = wrap_region->ymin;
263 wm_cursor_position_to_ghost_screen_coords(win, &wrap_region_screen[0], &wrap_region_screen[1]);
264 wm_cursor_position_to_ghost_screen_coords(win, &wrap_region_screen[2], &wrap_region_screen[3]);
265 }
266
267 if (hide) {
268 mode = GHOST_kGrabHide;
269 }
270 else if (wrap != WM_CURSOR_WRAP_NONE) {
271 mode = GHOST_kGrabWrap;
272
273 if (wrap == WM_CURSOR_WRAP_X) {
274 mode_axis = GHOST_kAxisX;
275 }
276 else if (wrap == WM_CURSOR_WRAP_Y) {
277 mode_axis = GHOST_kAxisY;
278 }
279 }
280
281 if ((G.debug & G_DEBUG) == 0) {
282 if (win->ghostwin) {
283 if (win->eventstate->tablet.is_motion_absolute == false) {
284 GHOST_SetCursorGrab(static_cast<GHOST_WindowHandle>(win->ghostwin),
285 mode,
286 mode_axis,
287 wrap_region_screen,
288 nullptr);
289 }
290
291 win->grabcursor = mode;
292 }
293 }
294}
295
296void WM_cursor_grab_disable(wmWindow *win, const int mouse_ungrab_xy[2])
297{
298 if ((G.debug & G_DEBUG) == 0) {
299 if (win && win->ghostwin) {
300 if (mouse_ungrab_xy) {
301 int mouse_xy[2] = {mouse_ungrab_xy[0], mouse_ungrab_xy[1]};
302 wm_cursor_position_to_ghost_screen_coords(win, &mouse_xy[0], &mouse_xy[1]);
303 GHOST_SetCursorGrab(static_cast<GHOST_WindowHandle>(win->ghostwin),
306 nullptr,
307 mouse_xy);
308 }
309 else {
310 GHOST_SetCursorGrab(static_cast<GHOST_WindowHandle>(win->ghostwin),
313 nullptr,
314 nullptr);
315 }
316
318 }
319 }
320}
321
322static void wm_cursor_warp_relative(wmWindow *win, int x, int y)
323{
324 /* NOTE: don't use wmEvent coords because of continuous grab #36409. */
325 int cx, cy;
326 if (wm_cursor_position_get(win, &cx, &cy)) {
327 WM_cursor_warp(win, cx + x, cy + y);
328 }
329}
330
331bool wm_cursor_arrow_move(wmWindow *win, const wmEvent *event)
332{
333 /* TODO: give it a modal keymap? Hard coded for now. */
334
335 if (win && event->val == KM_PRESS) {
336 /* Must move at least this much to avoid rounding in WM_cursor_warp. */
337 float fac = GHOST_GetNativePixelSize(static_cast<GHOST_WindowHandle>(win->ghostwin));
338
339 if (event->type == EVT_UPARROWKEY) {
340 wm_cursor_warp_relative(win, 0, fac);
341 return true;
342 }
343 if (event->type == EVT_DOWNARROWKEY) {
344 wm_cursor_warp_relative(win, 0, -fac);
345 return true;
346 }
347 if (event->type == EVT_LEFTARROWKEY) {
348 wm_cursor_warp_relative(win, -fac, 0);
349 return true;
350 }
351 if (event->type == EVT_RIGHTARROWKEY) {
352 wm_cursor_warp_relative(win, fac, 0);
353 return true;
354 }
355 }
356 return false;
357}
358
359void WM_cursor_time(wmWindow *win, int nr)
360{
361 /* 10 8x8 digits. */
362 const char number_bitmaps[10][8] = {
363 {0, 56, 68, 68, 68, 68, 68, 56},
364 {0, 24, 16, 16, 16, 16, 16, 56},
365 {0, 60, 66, 32, 16, 8, 4, 126},
366 {0, 124, 32, 16, 56, 64, 66, 60},
367 {0, 32, 48, 40, 36, 126, 32, 32},
368 {0, 124, 4, 60, 64, 64, 68, 56},
369 {0, 56, 4, 4, 60, 68, 68, 56},
370 {0, 124, 64, 32, 16, 8, 8, 8},
371 {0, 60, 66, 66, 60, 66, 66, 60},
372 {0, 56, 68, 68, 120, 64, 68, 56},
373 };
374 uchar mask[16][2];
375 uchar bitmap[16][2] = {{0}};
376
377 if (win->lastcursor == 0) {
378 win->lastcursor = win->cursor;
379 }
380
381 memset(&mask, 0xFF, sizeof(mask));
382
383 /* Print number bottom right justified. */
384 for (int idx = 3; nr && idx >= 0; idx--) {
385 const char *digit = number_bitmaps[nr % 10];
386 int x = idx % 2;
387 int y = idx / 2;
388
389 for (int i = 0; i < 8; i++) {
390 bitmap[i + y * 8][x] = digit[i];
391 }
392 nr /= 10;
393 }
394
395 window_set_custom_cursor(win, mask, bitmap, 7, 7);
396 /* Unset current cursor value so it's properly reset to wmWindow.lastcursor. */
397 win->cursor = 0;
398}
399
431#define BEGIN_CURSOR_BLOCK \
432 { \
433 ((void)0)
434#define END_CURSOR_BLOCK \
435 } \
436 ((void)0)
437
439{
440 /********************** NW_ARROW Cursor **************************/
442 static char nw_bitmap[] = {
443 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e,
444 0x00, 0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0xfe, 0x03, 0xfe, 0x07,
445 0x7e, 0x00, 0x6e, 0x00, 0xc6, 0x00, 0xc2, 0x00, 0x00, 0x00,
446 };
447
448 static char nw_mask[] = {
449 0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f,
450 0x00, 0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x07, 0xff, 0x0f,
451 0xff, 0x0f, 0xff, 0x00, 0xef, 0x01, 0xe7, 0x01, 0xc3, 0x00,
452 };
453
454 static BCursor NWArrowCursor = {
455 nw_bitmap,
456 nw_mask,
457 0,
458 0,
459 true,
460 };
461
462 BlenderCursor[WM_CURSOR_DEFAULT] = &NWArrowCursor;
463 BlenderCursor[WM_CURSOR_COPY] = &NWArrowCursor;
464 BlenderCursor[WM_CURSOR_NW_ARROW] = &NWArrowCursor;
466
467 /************************ NS_ARROW Cursor *************************/
469 static char ns_bitmap[] = {
470 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0x80,
471 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
472 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00,
473 };
474
475 static char ns_mask[] = {
476 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc,
477 0x1f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xfc, 0x1f,
478 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00,
479 };
480
481 static BCursor NSArrowCursor = {
482 ns_bitmap,
483 ns_mask,
484 7,
485 7,
486 true,
487 };
488
489 BlenderCursor[WM_CURSOR_Y_MOVE] = &NSArrowCursor;
490 BlenderCursor[WM_CURSOR_NS_ARROW] = &NSArrowCursor;
492
493 /********************** EW_ARROW Cursor *************************/
495 static char ew_bitmap[] = {
496 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x18,
497 0x18, 0x1c, 0x38, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18, 0x10, 0x08,
498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
499 };
500
501 static char ew_mask[] = {
502 0x00, 0x00, 0x00, 0x00, 0x20, 0x04, 0x30, 0x0c, 0x38, 0x1c, 0x3c,
503 0x3c, 0xfe, 0x7f, 0xff, 0xff, 0xfe, 0x7f, 0x3c, 0x3c, 0x38, 0x1c,
504 0x30, 0x0c, 0x20, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
505 };
506
507 static BCursor EWArrowCursor = {
508 ew_bitmap,
509 ew_mask,
510 7,
511 7,
512 true,
513 };
514
515 BlenderCursor[WM_CURSOR_X_MOVE] = &EWArrowCursor;
516 BlenderCursor[WM_CURSOR_EW_ARROW] = &EWArrowCursor;
518
519 /********************** Wait Cursor *****************************/
521 static char wait_bitmap[] = {
522 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf0, 0x07, 0xb0, 0x06, 0x60,
523 0x03, 0xc0, 0x01, 0x80, 0x00, 0x80, 0x00, 0xc0, 0x01, 0x60, 0x03,
524 0x30, 0x06, 0x10, 0x04, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00,
525 };
526
527 static char wait_mask[] = {
528 0xfc, 0x1f, 0xfc, 0x1f, 0xf8, 0x0f, 0xf8, 0x0f, 0xf8, 0x0f, 0xf0,
529 0x07, 0xe0, 0x03, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07,
530 0xf8, 0x0f, 0xf8, 0x0f, 0xf8, 0x0f, 0xfc, 0x1f, 0xfc, 0x1f,
531 };
532
533 static BCursor WaitCursor = {
534 wait_bitmap,
535 wait_mask,
536 7,
537 7,
538 false,
539 };
540
541 BlenderCursor[WM_CURSOR_WAIT] = &WaitCursor;
543
544 /********************** Mute Cursor ***********************/
546 static char mute_bitmap[] = {
547 0x00, 0x00, 0x22, 0x00, 0x14, 0x00, 0x08, 0x03, 0x14, 0x03, 0x22,
548 0x03, 0x00, 0x03, 0x00, 0x03, 0xf8, 0x7c, 0xf8, 0x7c, 0x00, 0x03,
549 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00,
550 };
551
552 static char mute_mask[] = {
553 0x63, 0x00, 0x77, 0x00, 0x3e, 0x03, 0x1c, 0x03, 0x3e, 0x03, 0x77,
554 0x03, 0x63, 0x03, 0x80, 0x07, 0xfc, 0xfc, 0xfc, 0xfc, 0x80, 0x07,
555 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03,
556 };
557
558 static BCursor MuteCursor = {
559 mute_bitmap,
560 mute_mask,
561 9,
562 8,
563 true,
564 };
565
566 BlenderCursor[WM_CURSOR_MUTE] = &MuteCursor;
568
569 /****************** Normal Cross Cursor ************************/
571 static char cross_bitmap[] = {
572 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80,
573 0x01, 0x00, 0x00, 0x3e, 0x7c, 0x3e, 0x7c, 0x00, 0x00, 0x80, 0x01,
574 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00,
575 };
576
577 static char cross_mask[] = {
578 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0,
579 0x03, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0xff, 0xff, 0xc0, 0x03,
580 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03,
581 };
582
583 static BCursor CrossCursor = {
584 cross_bitmap,
585 cross_mask,
586 7,
587 7,
588 false,
589 };
590
591 BlenderCursor[WM_CURSOR_EDIT] = &CrossCursor;
592 BlenderCursor[WM_CURSOR_CROSS] = &CrossCursor;
594
595 /****************** Painting Cursor ************************/
597 static char paint_bitmap[] = {
598 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
599 0x00, 0x00, 0x00, 0x8f, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
600 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00,
601 };
602
603 static char paint_mask[] = {
604 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00, 0x00,
605 0x00, 0x8f, 0x78, 0xcf, 0x79, 0x8f, 0x78, 0x00, 0x00, 0x00, 0x00,
606 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00,
607 };
608
609 static BCursor PaintCursor = {
610 paint_bitmap,
611 paint_mask,
612 7,
613 7,
614 false,
615 };
616
617 BlenderCursor[WM_CURSOR_PAINT] = &PaintCursor;
619
620 /********************** Dot Cursor ***********************/
622 static char dot_bitmap[] = {
623 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
624 0x00, 0x00, 0x00, 0x8f, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
625 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00,
626 };
627
628 static char dot_mask[] = {
629 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
630 0x00, 0x80, 0x00, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
631 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
632 };
633
634 static BCursor DotCursor = {
635 dot_bitmap,
636 dot_mask,
637 7,
638 7,
639 false,
640 };
641
642 BlenderCursor[WM_CURSOR_DOT] = &DotCursor;
644
645 /************* Minimal Crosshair Cursor ***************/
647 static char crossc_bitmap[] = {
648 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
649 0x00, 0x80, 0x00, 0x55, 0x55, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00,
650 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
651 };
652
653 static char crossc_mask[] = {
654 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
655 0x00, 0x80, 0x00, 0x7f, 0x7f, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
656 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00,
657 };
658
659 static BCursor CrossCursorC = {
660 crossc_bitmap,
661 crossc_mask,
662 7,
663 7,
664 false,
665 };
666
667 BlenderCursor[WM_CURSOR_CROSSC] = &CrossCursorC;
669
670 /********************** Knife Cursor ***********************/
672 static char knife_bitmap[] = {
673 0x00, 0x00, 0x00, 0x40, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00,
674 0x0c, 0x00, 0x06, 0x00, 0x0f, 0x80, 0x07, 0xc0, 0x03, 0xe0, 0x01,
675 0xf0, 0x00, 0x78, 0x00, 0x3c, 0x00, 0x0e, 0x00, 0x00, 0x00,
676 };
677
678 static char knife_mask[] = {
679 0x00, 0x40, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0x78, 0x00, 0x3c, 0x00,
680 0x1e, 0x00, 0x0f, 0x80, 0x1f, 0xc0, 0x0f, 0xe0, 0x07, 0xf0, 0x03,
681 0xf8, 0x01, 0xfc, 0x00, 0x7e, 0x00, 0x3f, 0x00, 0x0f, 0x00,
682 };
683
684 static BCursor KnifeCursor = {
685 knife_bitmap,
686 knife_mask,
687 0,
688 15,
689 false,
690 };
691
692 BlenderCursor[WM_CURSOR_KNIFE] = &KnifeCursor;
694
695 /********************** Loop Select Cursor ***********************/
697 static char vloop_bitmap[] = {
698 0x00, 0x00, 0x7e, 0x00, 0x3e, 0x00, 0x1e, 0x00, 0xfe, 0xf0, 0x96,
699 0x9f, 0x92, 0x90, 0xf0, 0xf0, 0x20, 0x40, 0x20, 0x40, 0x20, 0x40,
700 0x20, 0x40, 0xf0, 0xf0, 0x90, 0x90, 0x90, 0x9f, 0xf0, 0xf0,
701 };
702
703 static char vloop_mask[] = {
704 0xff, 0x01, 0xff, 0x00, 0x7f, 0x00, 0x3f, 0x00, 0xff, 0xf0, 0xff,
705 0xff, 0xf7, 0xff, 0xf3, 0xf0, 0x61, 0x60, 0x60, 0x60, 0x60, 0x60,
706 0x60, 0x60, 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xf0,
707 };
708
709 static BCursor VLoopCursor = {
710 vloop_bitmap,
711 vloop_mask,
712 0,
713 0,
714 false,
715 };
716
717 BlenderCursor[WM_CURSOR_VERTEX_LOOP] = &VLoopCursor;
719
720 /********************** TextEdit Cursor ***********************/
722 static char textedit_bitmap[] = {
723 0x00, 0x00, 0x70, 0x07, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
724 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
725 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x70, 0x07, 0x00, 0x00,
726 };
727
728 static char textedit_mask[] = {
729 0x70, 0x07, 0xf8, 0x0f, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
730 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
731 0xc0, 0x01, 0xc0, 0x01, 0xf0, 0x07, 0xf8, 0x0f, 0x70, 0x07,
732 };
733
734 static BCursor TextEditCursor = {
735 textedit_bitmap,
736 textedit_mask,
737 7,
738 7,
739 false,
740 };
741
742 BlenderCursor[WM_CURSOR_TEXT_EDIT] = &TextEditCursor;
744
745 /********************** Paintbrush Cursor ***********************/
747 static char paintbrush_bitmap[] = {
748 0x00, 0x00, 0x00, 0x30, 0x00, 0x78, 0x00, 0x74, 0x00, 0x2e, 0x00,
749 0x1f, 0x80, 0x0f, 0xc0, 0x07, 0xe0, 0x03, 0xf0, 0x01, 0xf8, 0x00,
750 0x7c, 0x00, 0x3e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x00, 0x00,
751 };
752
753 static char paintbrush_mask[] = {
754 0x00, 0x30, 0x00, 0x78, 0x00, 0xfc, 0x00, 0xfe, 0x00, 0x7f, 0x80,
755 0x3f, 0xc0, 0x1f, 0xe0, 0x0f, 0xf0, 0x07, 0xf8, 0x03, 0xfc, 0x01,
756 0xfe, 0x00, 0x7f, 0x00, 0x3f, 0x00, 0x1f, 0x00, 0x0f, 0x00,
757 };
758
759 static BCursor PaintBrushCursor = {
760 paintbrush_bitmap,
761 paintbrush_mask,
762 0,
763 15,
764 false,
765 };
766
767 BlenderCursor[WM_CURSOR_PAINT_BRUSH] = &PaintBrushCursor;
769
770 /********************** Eraser Cursor ***********************/
772 static char eraser_bitmap[] = {
773 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
774 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x07,
775 0xfe, 0x03, 0xfe, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
776 };
777
778 static char eraser_mask[] = {
779 0x00, 0x00, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x1f, 0x80, 0x3f, 0xc0,
780 0x7f, 0xe0, 0xff, 0xf0, 0x7f, 0xf8, 0x3f, 0xfc, 0x1f, 0xfe, 0x0f,
781 0xff, 0x07, 0xff, 0x03, 0xff, 0x01, 0xff, 0x00, 0x00, 0x00,
782 };
783
784 static BCursor EraserCursor = {
785 eraser_bitmap,
786 eraser_mask,
787 0,
788 14,
789 false,
790 };
791
792 BlenderCursor[WM_CURSOR_ERASER] = &EraserCursor;
794
795 /********************** Hand Cursor ***********************/
797 static char hand_bitmap[] = {
798 0x00, 0x00, 0x80, 0x01, 0x80, 0x0d, 0x98, 0x6d, 0xb8, 0x6d, 0xb0,
799 0x6d, 0xb0, 0x6d, 0xe0, 0x6f, 0xe6, 0x7f, 0xee, 0x7f, 0x7c, 0x35,
800 0x78, 0x35, 0x70, 0x15, 0x60, 0x15, 0xc0, 0x1f, 0xc0, 0x1f,
801 };
802
803 static char hand_mask[] = {
804 0x80, 0x01, 0xc0, 0x0f, 0xd8, 0x7f, 0xfc, 0xff, 0xfc, 0xff, 0xf8,
805 0xff, 0xf8, 0xff, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f,
806 0xfc, 0x7f, 0xf8, 0x3f, 0xf0, 0x3f, 0xe0, 0x3f, 0xe0, 0x3f,
807 };
808
809 static BCursor HandCursor = {
810 hand_bitmap,
811 hand_mask,
812 8,
813 8,
814 false,
815 };
816
817 BlenderCursor[WM_CURSOR_HAND] = &HandCursor;
819
820 /********************** NSEW Scroll Cursor ***********************/
822 static char nsewscroll_bitmap[] = {
823 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0x40, 0x02, 0x00, 0x00, 0x00,
824 0x00, 0x0c, 0x30, 0x06, 0x60, 0x06, 0x60, 0x0c, 0x30, 0x00, 0x00,
825 0x00, 0x00, 0x40, 0x02, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00,
826 };
827
828 static char nsewscroll_mask[] = {
829 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, 0x40, 0x02, 0x0c,
830 0x30, 0x1e, 0x78, 0x0f, 0xf0, 0x0f, 0xf8, 0x1e, 0x78, 0x0c, 0x30,
831 0x40, 0x02, 0xe0, 0x07, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01,
832 };
833
834 static BCursor NSEWScrollCursor = {
835 nsewscroll_bitmap,
836 nsewscroll_mask,
837 7,
838 7,
839 true,
840 };
841
842 BlenderCursor[WM_CURSOR_NSEW_SCROLL] = &NSEWScrollCursor;
844
845 /********************** NS Scroll Cursor ***********************/
847 static char nsscroll_bitmap[] = {
848 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0x70, 0x07, 0x20,
849 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02,
850 0x70, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00,
851 };
852
853 static char nsscroll_mask[] = {
854 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0x70,
855 0x07, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x70, 0x07,
856 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00,
857 };
858
859 static BCursor NSScrollCursor = {
860 nsscroll_bitmap,
861 nsscroll_mask,
862 7,
863 7,
864 true,
865 };
866
867 BlenderCursor[WM_CURSOR_NS_SCROLL] = &NSScrollCursor;
869
870 /********************** EW Scroll Cursor ***********************/
872 static char ewscroll_bitmap[] = {
873 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x38,
874 0x1c, 0x1c, 0x38, 0x0e, 0x70, 0x1c, 0x38, 0x38, 0x1c, 0x10, 0x08,
875 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
876 };
877
878 static char ewscroll_mask[] = {
879 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x38, 0x1c, 0x7c,
880 0x3e, 0x3e, 0x7c, 0x1f, 0xf8, 0x3e, 0x7c, 0x7c, 0x3e, 0x38, 0x1c,
881 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
882 };
883
884 static BCursor EWScrollCursor = {
885 ewscroll_bitmap,
886 ewscroll_mask,
887 7,
888 7,
889 true,
890 };
891
892 BlenderCursor[WM_CURSOR_EW_SCROLL] = &EWScrollCursor;
894
895 /********************** Eyedropper Cursor ***********************/
897 static char eyedropper_bitmap[] = {
898 0x00, 0x00, 0x00, 0x60, 0x00, 0x70, 0x00, 0x3a, 0x00, 0x17, 0x00,
899 0x0e, 0x00, 0x1d, 0x80, 0x0b, 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00,
900 0x38, 0x00, 0x1c, 0x00, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00,
901 };
902
903 static char eyedropper_mask[] = {
904 0x00, 0x60, 0x00, 0xf0, 0x00, 0xfa, 0x00, 0x7f, 0x80, 0x3f, 0x00,
905 0x1f, 0x80, 0x3f, 0xc0, 0x1f, 0xe0, 0x0b, 0xf0, 0x01, 0xf8, 0x00,
906 0x7c, 0x00, 0x3e, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x03, 0x00,
907 };
908
909 static BCursor EyedropperCursor = {
910 eyedropper_bitmap,
911 eyedropper_mask,
912 0,
913 15,
914 false,
915 };
916
917 BlenderCursor[WM_CURSOR_EYEDROPPER] = &EyedropperCursor;
919
920 /********************** Swap Area Cursor ***********************/
922 static char swap_bitmap[] = {
923 0xc0, 0xff, 0x40, 0x80, 0x40, 0xbc, 0x40, 0xb8, 0x40, 0xb8, 0x40,
924 0xa4, 0x00, 0x82, 0xfe, 0x81, 0x7e, 0x81, 0xbe, 0xfd, 0xda, 0x01,
925 0xe2, 0x01, 0xe2, 0x01, 0xc2, 0x01, 0xfe, 0x01, 0x00, 0x00,
926 };
927
928 static char swap_mask[] = {
929 0xc0, 0xff, 0xc0, 0xff, 0xc0, 0xff, 0xc0, 0xff, 0xc0, 0xff, 0xc0,
930 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03,
931 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03,
932 };
933
934 static BCursor SwapCursor = {
935 swap_bitmap,
936 swap_mask,
937 7,
938 7,
939 false,
940 };
941
942 BlenderCursor[WM_CURSOR_SWAP_AREA] = &SwapCursor;
944
945 /********************** Vertical Split Cursor ***********************/
947 static char vsplit_bitmap[] = {
948 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x88,
949 0x11, 0x8c, 0x31, 0x86, 0x61, 0x86, 0x61, 0x8c, 0x31, 0x88, 0x11,
950 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
951 };
952
953 static char vsplit_mask[] = {
954 0xe0, 0x07, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc8, 0x13, 0xdc,
955 0x3b, 0xde, 0x7b, 0xcf, 0xf3, 0xcf, 0xf3, 0xde, 0x7b, 0xdc, 0x3b,
956 0xc8, 0x13, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07,
957 };
958
959 static BCursor VSplitCursor = {
960 vsplit_bitmap,
961 vsplit_mask,
962 7,
963 7,
964 true,
965 };
966
967 BlenderCursor[WM_CURSOR_V_SPLIT] = &VSplitCursor;
969
970 /********************** Horizontal Split Cursor ***********************/
972 static char hsplit_bitmap[] = {
973 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0x60, 0x06, 0x00, 0x00, 0x00,
974 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
975 0x00, 0x00, 0x60, 0x06, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00,
976 };
977
978 static char hsplit_mask[] = {
979 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x60, 0x06, 0x01,
980 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x80,
981 0x60, 0x06, 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01,
982 };
983
984 static BCursor HSplitCursor = {
985 hsplit_bitmap,
986 hsplit_mask,
987 7,
988 7,
989 true,
990 };
991
992 BlenderCursor[WM_CURSOR_H_SPLIT] = &HSplitCursor;
994
995 /********************** North Arrow Cursor ***********************/
997 static char narrow_bitmap[] = {
998 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8,
999 0x0f, 0x7c, 0x1f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 0x00, 0x00,
1000 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1001 };
1002
1003 static char narrow_mask[] = {
1004 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc,
1005 0x1f, 0xfe, 0x3f, 0x7f, 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08,
1006 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1007 };
1008
1009 static BCursor NArrowCursor = {
1010 narrow_bitmap,
1011 narrow_mask,
1012 7,
1013 5,
1014 true,
1015 };
1016
1017 BlenderCursor[WM_CURSOR_N_ARROW] = &NArrowCursor;
1019
1020 /********************** South Arrow Cursor ***********************/
1022 static char sarrow_bitmap[] = {
1023 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1024 0x00, 0x08, 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7c, 0x1f, 0xf8, 0x0f,
1025 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00,
1026 };
1027
1028 static char sarrow_mask[] = {
1029 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
1030 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7f, 0x7f, 0xfe, 0x3f, 0xfc, 0x1f,
1031 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00,
1032 };
1033
1034 static BCursor SArrowCursor = {
1035 sarrow_bitmap,
1036 sarrow_mask,
1037 7,
1038 10,
1039 true,
1040 };
1041
1042 BlenderCursor[WM_CURSOR_S_ARROW] = &SArrowCursor;
1044
1045 /********************** East Arrow Cursor ***********************/
1047 static char earrow_bitmap[] = {
1048 0x00, 0x00, 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0x80, 0x0f, 0x00,
1049 0x1f, 0x00, 0x3e, 0x00, 0x7c, 0x00, 0x3e, 0x00, 0x1f, 0x80, 0x0f,
1050 0xc0, 0x07, 0x80, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
1051 };
1052
1053 static char earrow_mask[] = {
1054 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xc0, 0x1f, 0x80,
1055 0x3f, 0x00, 0x7f, 0x00, 0xfe, 0x00, 0x7f, 0x80, 0x3f, 0xc0, 0x1f,
1056 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03, 0x00, 0x01, 0x00, 0x00,
1057 };
1058
1059 static BCursor EArrowCursor = {
1060 earrow_bitmap,
1061 earrow_mask,
1062 10,
1063 7,
1064 true,
1065 };
1066
1067 BlenderCursor[WM_CURSOR_E_ARROW] = &EArrowCursor;
1069
1070 /********************** West Arrow Cursor ***********************/
1072 static char warrow_bitmap[] = {
1073 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x01, 0xf8,
1074 0x00, 0x7c, 0x00, 0x3e, 0x00, 0x7c, 0x00, 0xf8, 0x00, 0xf0, 0x01,
1075 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
1076 };
1077
1078 static char warrow_mask[] = {
1079 0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x03, 0xfc,
1080 0x01, 0xfe, 0x00, 0x7f, 0x00, 0xfe, 0x00, 0xfc, 0x01, 0xf8, 0x03,
1081 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00,
1082 };
1083
1084 static BCursor WArrowCursor = {
1085 warrow_bitmap,
1086 warrow_mask,
1087 5,
1088 7,
1089 true,
1090 };
1091
1092 BlenderCursor[WM_CURSOR_W_ARROW] = &WArrowCursor;
1094
1095 /********************** Stop Sign Cursor ***********************/
1097 static char stop_bitmap[] = {
1098 0x00, 0x00, 0xe0, 0x07, 0xf8, 0x1f, 0x1c, 0x3c, 0x3c, 0x30, 0x76,
1099 0x70, 0xe6, 0x60, 0xc6, 0x61, 0x86, 0x63, 0x06, 0x67, 0x0e, 0x6e,
1100 0x0c, 0x3c, 0x3c, 0x38, 0xf8, 0x1f, 0xe0, 0x07, 0x00, 0x00,
1101 };
1102
1103 static char stop_mask[] = {
1104 0xe0, 0x07, 0xf8, 0x1f, 0xfc, 0x3f, 0xfe, 0x7f, 0x7e, 0x7c, 0xff,
1105 0xf8, 0xff, 0xf1, 0xef, 0xf3, 0xcf, 0xf7, 0x8f, 0xff, 0x1f, 0xff,
1106 0x3e, 0x7e, 0xfe, 0x7f, 0xfc, 0x3f, 0xf8, 0x1f, 0xe0, 0x07,
1107 };
1108
1109 static BCursor StopCursor = {
1110 stop_bitmap,
1111 stop_mask,
1112 7,
1113 7,
1114 false,
1115 };
1116
1117 BlenderCursor[WM_CURSOR_STOP] = &StopCursor;
1119
1120 /********************** Zoom In Cursor ***********************/
1122 static char zoomin_bitmap[] = {
1123 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xf8, 0x03, 0xb8, 0x03, 0xbc,
1124 0x07, 0x0c, 0x06, 0xbc, 0x07, 0xb8, 0x03, 0xf8, 0x0b, 0xe0, 0x14,
1125 0x00, 0x22, 0x00, 0x44, 0x00, 0x88, 0x00, 0x90, 0x00, 0x60,
1126 };
1127
1128 static char zoomin_mask[] = {
1129 0x00, 0x00, 0xe0, 0x00, 0xf8, 0x03, 0xfc, 0x07, 0xfc, 0x07, 0xfe,
1130 0x0f, 0xfe, 0x0f, 0xfe, 0x0f, 0xfc, 0x07, 0xfc, 0x0f, 0xf8, 0x1f,
1131 0xe0, 0x3e, 0x00, 0x7c, 0x00, 0xf8, 0x00, 0xf0, 0x00, 0x60,
1132 };
1133
1134 static BCursor ZoomInCursor = {
1135 zoomin_bitmap,
1136 zoomin_mask,
1137 6,
1138 6,
1139 false,
1140 };
1141
1142 BlenderCursor[WM_CURSOR_ZOOM_IN] = &ZoomInCursor;
1144
1145 /********************** Zoom Out Cursor ***********************/
1147 static char zoomout_bitmap[] = {
1148 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xf8, 0x03, 0xf8, 0x03, 0xfc,
1149 0x07, 0x0c, 0x06, 0xfc, 0x07, 0xf8, 0x03, 0xf8, 0x0b, 0xe0, 0x14,
1150 0x00, 0x22, 0x00, 0x44, 0x00, 0x88, 0x00, 0x90, 0x00, 0x60,
1151 };
1152
1153 static char zoomout_mask[] = {
1154 0x00, 0x00, 0xe0, 0x00, 0xf8, 0x03, 0xfc, 0x07, 0xfc, 0x07, 0xfe,
1155 0x0f, 0xfe, 0x0f, 0xfe, 0x0f, 0xfc, 0x07, 0xfc, 0x0f, 0xf8, 0x1f,
1156 0xe0, 0x3e, 0x00, 0x7c, 0x00, 0xf8, 0x00, 0xf0, 0x00, 0x60,
1157 };
1158
1159 static BCursor ZoomOutCursor = {
1160 zoomout_bitmap,
1161 zoomout_mask,
1162 6,
1163 6,
1164 false,
1165 };
1166
1167 BlenderCursor[WM_CURSOR_ZOOM_OUT] = &ZoomOutCursor;
1169
1170 /********************** Area Pick Cursor ***********************/
1172
1173 static char pick_area_bitmap[] = {
1174 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xfe, 0x00, 0x10,
1175 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0xbf, 0x00, 0x81, 0x00, 0x81,
1176 0x00, 0x81, 0x00, 0x81, 0x00, 0x81, 0x00, 0x80, 0x00, 0xff,
1177 };
1178
1179 static char pick_area_mask[] = {
1180 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0xff, 0x01, 0xff, 0x01, 0xff,
1181 0x01, 0x38, 0x00, 0xb8, 0x7f, 0xb8, 0xff, 0x80, 0xc1, 0x80, 0xc1,
1182 0x80, 0xc1, 0x80, 0xc1, 0x80, 0xc1, 0x80, 0xff, 0x00, 0xff,
1183 };
1184
1185 static BCursor PickAreaCursor = {
1186 pick_area_bitmap,
1187 pick_area_mask,
1188 4,
1189 4,
1190 false,
1191 };
1192
1193 BlenderCursor[WM_CURSOR_PICK_AREA] = &PickAreaCursor;
1195
1196 /********************** Right handle cursor ***********************/
1198
1199 static char right_handle_bitmap[] = {
1200 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x70, 0x00, 0x70, 0x08, 0x70,
1201 0x18, 0x70, 0x38, 0x70, 0x78, 0x70, 0x78, 0x70, 0x38, 0x70, 0x18,
1202 0x70, 0x08, 0x70, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00,
1203 };
1204
1205 static char right_handle_mask[] = {
1206 0xff, 0x00, 0xff, 0x00, 0xff, 0x04, 0xff, 0x0c, 0xf8, 0x1c, 0xf8,
1207 0x3c, 0xf8, 0x7c, 0xf8, 0xfc, 0xf8, 0xfc, 0xf8, 0x7c, 0xf8, 0x3c,
1208 0xf8, 0x1c, 0xff, 0x0c, 0xff, 0x04, 0xff, 0x00, 0xff, 0x00,
1209 };
1210
1211 static BCursor RightHandleCursor = {
1212 right_handle_bitmap,
1213 right_handle_mask,
1214 7,
1215 7,
1216 false,
1217 };
1218
1219 BlenderCursor[WM_CURSOR_RIGHT_HANDLE] = &RightHandleCursor;
1221
1222 /********************** Left handle cursor ***********************/
1224
1225 static char left_handle_bitmap[] = {
1226 0x00, 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x0e, 0x10, 0x0e, 0x18,
1227 0x0e, 0x1c, 0x0e, 0x1e, 0x0e, 0x1e, 0x0e, 0x1c, 0x0e, 0x18, 0x0e,
1228 0x10, 0x0e, 0x00, 0x0e, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00,
1229 };
1230
1231 static char left_handle_mask[] = {
1232 0x00, 0xff, 0x00, 0xff, 0x20, 0xff, 0x30, 0xff, 0x38, 0x1f, 0x3c,
1233 0x1f, 0x3e, 0x1f, 0x3f, 0x1f, 0x3f, 0x1f, 0x3e, 0x1f, 0x3c, 0x1f,
1234 0x38, 0x1f, 0x30, 0xff, 0x20, 0xff, 0x00, 0xff, 0x00, 0xff,
1235 };
1236
1237 static BCursor LeftHandleCursor = {
1238 left_handle_bitmap,
1239 left_handle_mask,
1240 7,
1241 7,
1242 false,
1243 };
1244
1245 BlenderCursor[WM_CURSOR_LEFT_HANDLE] = &LeftHandleCursor;
1247
1248 /********************** both handles cursor ***********************/
1250
1251 static char both_handles_bitmap[] = {
1252 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x60, 0x06, 0x60, 0x06, 0x64,
1253 0x26, 0x66, 0x66, 0x67, 0xe6, 0x67, 0xe6, 0x66, 0x66, 0x64, 0x26,
1254 0x60, 0x06, 0x60, 0x06, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00,
1255 };
1256
1257 static char both_handles_mask[] = {
1258 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xfe,
1259 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f,
1260 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1261 };
1262
1263 static BCursor BothHandlesCursor = {
1264 both_handles_bitmap,
1265 both_handles_mask,
1266 7,
1267 7,
1268 false,
1269 };
1270
1271 BlenderCursor[WM_CURSOR_BOTH_HANDLES] = &BothHandlesCursor;
1273
1274 /********************** Put the cursors in the array ***********************/
1275}
#define G_MAIN
@ G_DEBUG
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:57
unsigned char uchar
#define ELEM(...)
These structs are the foundation for all linked lists in the library system.
@ RGN_TYPE_WINDOW
@ RGN_TYPE_PREVIEW
GHOST C-API function and type declarations.
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle, uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle, GHOST_TStandardCursor cursorshape)
GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, GHOST_TGrabCursorMode mode, GHOST_TAxisFlag wrap_axis, const int bounds[4], const int mouse_ungrab_xy[2])
GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, bool visible)
float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle, GHOST_TStandardCursor cursorshape)
GHOST_TStandardCursor
@ GHOST_kStandardCursorLeftHandle
@ GHOST_kStandardCursorHandClosed
@ GHOST_kStandardCursorHandOpen
@ GHOST_kStandardCursorZoomIn
@ GHOST_kStandardCursorVerticalSplit
@ GHOST_kStandardCursorCopy
@ GHOST_kStandardCursorWait
@ GHOST_kStandardCursorRightHandle
@ GHOST_kStandardCursorHorizontalSplit
@ GHOST_kStandardCursorStop
@ GHOST_kStandardCursorCrosshair
@ GHOST_kStandardCursorCustom
@ GHOST_kStandardCursorNSEWScroll
@ GHOST_kStandardCursorLeftRight
@ GHOST_kStandardCursorPencil
@ GHOST_kStandardCursorNSScroll
@ GHOST_kStandardCursorCrosshairA
@ GHOST_kStandardCursorUpDown
@ GHOST_kStandardCursorUpArrow
@ GHOST_kStandardCursorHandPoint
@ GHOST_kStandardCursorBothHandles
@ GHOST_kStandardCursorEyedropper
@ GHOST_kStandardCursorKnife
@ GHOST_kStandardCursorMove
@ GHOST_kStandardCursorCrosshairB
@ GHOST_kStandardCursorDownArrow
@ GHOST_kStandardCursorEraser
@ GHOST_kStandardCursorDefault
@ GHOST_kStandardCursorEWScroll
@ GHOST_kStandardCursorRightArrow
@ GHOST_kStandardCursorCrosshairC
@ GHOST_kStandardCursorZoomOut
@ GHOST_kStandardCursorText
@ GHOST_kStandardCursorLeftArrow
GHOST_TAxisFlag
@ GHOST_kAxisX
@ GHOST_kAxisY
@ GHOST_kAxisNone
GHOST_TGrabCursorMode
@ GHOST_kGrabWrap
@ GHOST_kGrabDisable
@ GHOST_kGrabHide
@ GHOST_kGrabNormal
@ KM_PRESS
Definition WM_types.hh:284
eWM_CursorWrapAxis
Definition WM_types.hh:205
@ WM_CURSOR_WRAP_X
Definition WM_types.hh:207
@ WM_CURSOR_WRAP_Y
Definition WM_types.hh:208
@ WM_CURSOR_WRAP_NONE
Definition WM_types.hh:206
#define G(x, y, z)
float wrap(float value, float max, float min)
Definition node_math.h:71
unsigned char uint8_t
Definition stdint.h:78
char hoty
Definition wm_cursors.cc:35
char * mask
Definition wm_cursors.cc:33
bool can_invert_color
Definition wm_cursors.cc:36
char hotx
Definition wm_cursors.cc:34
char * bitmap
Definition wm_cursors.cc:32
void * first
int ymin
int ymax
int xmin
int xmax
short val
Definition WM_types.hh:724
wmTabletData tablet
Definition WM_types.hh:751
short type
Definition WM_types.hh:722
char is_motion_absolute
Definition WM_types.hh:677
struct wmEvent * eventstate
struct wmWindow * next
void WM_cursor_modal_set(wmWindow *win, int val)
static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor)
void WM_cursor_set(wmWindow *win, int curs)
bool wm_cursor_arrow_move(wmWindow *win, const wmEvent *event)
#define BEGIN_CURSOR_BLOCK
static BCursor * BlenderCursor[WM_CURSOR_NUM]
Definition wm_cursors.cc:39
static void window_set_custom_cursor(wmWindow *win, const uchar mask[16][2], const uchar bitmap[16][2], int hotx, int hoty)
bool WM_cursor_set_from_tool(wmWindow *win, const ScrArea *area, const ARegion *region)
void WM_cursor_modal_restore(wmWindow *win)
static GHOST_TStandardCursor convert_to_ghost_standard_cursor(WMCursorType curs)
Definition wm_cursors.cc:42
void WM_cursor_wait(bool val)
#define END_CURSOR_BLOCK
void WM_cursor_time(wmWindow *win, int nr)
void wm_init_cursor_data()
static void wm_cursor_warp_relative(wmWindow *win, int x, int y)
void WM_cursor_grab_enable(wmWindow *win, const eWM_CursorWrapAxis wrap, const rcti *wrap_region, const bool hide)
void WM_cursor_grab_disable(wmWindow *win, const int mouse_ungrab_xy[2])
WMCursorType
Definition wm_cursors.hh:14
@ WM_CURSOR_WAIT
Definition wm_cursors.hh:17
@ WM_CURSOR_COPY
Definition wm_cursors.hh:20
@ WM_CURSOR_HAND
Definition wm_cursors.hh:22
@ WM_CURSOR_NSEW_SCROLL
Definition wm_cursors.hh:51
@ WM_CURSOR_CROSS
Definition wm_cursors.hh:26
@ WM_CURSOR_DEFAULT
Definition wm_cursors.hh:15
@ WM_CURSOR_RIGHT_HANDLE
Definition wm_cursors.hh:64
@ WM_CURSOR_HAND_CLOSED
Definition wm_cursors.hh:23
@ WM_CURSOR_BOTH_HANDLES
Definition wm_cursors.hh:65
@ WM_CURSOR_H_SPLIT
Definition wm_cursors.hh:40
@ WM_CURSOR_PAINT
Definition wm_cursors.hh:27
@ WM_CURSOR_S_ARROW
Definition wm_cursors.hh:47
@ WM_CURSOR_Y_MOVE
Definition wm_cursors.hh:39
@ WM_CURSOR_PICK_AREA
Definition wm_cursors.hh:61
@ WM_CURSOR_TEXT_EDIT
Definition wm_cursors.hh:16
@ WM_CURSOR_PAINT_BRUSH
Definition wm_cursors.hh:33
@ WM_CURSOR_NS_SCROLL
Definition wm_cursors.hh:52
@ WM_CURSOR_MOVE
Definition wm_cursors.hh:21
@ WM_CURSOR_EW_ARROW
Definition wm_cursors.hh:45
@ WM_CURSOR_E_ARROW
Definition wm_cursors.hh:48
@ WM_CURSOR_DOT
Definition wm_cursors.hh:28
@ WM_CURSOR_ZOOM_OUT
Definition wm_cursors.hh:56
@ WM_CURSOR_EDIT
Definition wm_cursors.hh:19
@ WM_CURSOR_LEFT_HANDLE
Definition wm_cursors.hh:63
@ WM_CURSOR_ZOOM_IN
Definition wm_cursors.hh:55
@ WM_CURSOR_N_ARROW
Definition wm_cursors.hh:46
@ WM_CURSOR_KNIFE
Definition wm_cursors.hh:31
@ WM_CURSOR_NW_ARROW
Definition wm_cursors.hh:43
@ WM_CURSOR_STOP
Definition wm_cursors.hh:18
@ WM_CURSOR_CROSSC
Definition wm_cursors.hh:29
@ WM_CURSOR_EYEDROPPER
Definition wm_cursors.hh:35
@ WM_CURSOR_VERTEX_LOOP
Definition wm_cursors.hh:32
@ WM_CURSOR_ERASER
Definition wm_cursors.hh:34
@ WM_CURSOR_HAND_POINT
Definition wm_cursors.hh:24
@ WM_CURSOR_EW_SCROLL
Definition wm_cursors.hh:53
@ WM_CURSOR_V_SPLIT
Definition wm_cursors.hh:41
@ WM_CURSOR_SWAP_AREA
Definition wm_cursors.hh:37
@ WM_CURSOR_MUTE
Definition wm_cursors.hh:59
@ WM_CURSOR_NONE
Definition wm_cursors.hh:58
@ WM_CURSOR_X_MOVE
Definition wm_cursors.hh:38
@ WM_CURSOR_W_ARROW
Definition wm_cursors.hh:49
@ WM_CURSOR_NUM
Definition wm_cursors.hh:68
@ WM_CURSOR_NS_ARROW
Definition wm_cursors.hh:44
@ EVT_DOWNARROWKEY
@ EVT_RIGHTARROWKEY
@ EVT_UPARROWKEY
@ EVT_LEFTARROWKEY
void wm_cursor_position_to_ghost_screen_coords(wmWindow *win, int *x, int *y)
void WM_cursor_warp(wmWindow *win, int x, int y)
bool wm_cursor_position_get(wmWindow *win, int *r_x, int *r_y)