2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2005-2007 Blender Foundation
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): Matt Ebb
25 * ***** END GPL/BL DUAL LICENSE BLOCK *****
28 /** \file blender/windowmanager/intern/wm_cursors.c
36 #include "GHOST_C-api.h"
38 #include "BLI_utildefines.h"
40 #include "BLI_sys_types.h"
42 #include "DNA_listBase.h"
43 #include "DNA_userdef_types.h"
45 #include "BKE_context.h"
46 #include "BKE_global.h"
51 #include "wm_cursors.h"
52 #include "wm_window.h"
54 /* XXX this still is mess from old code */
58 /* Some simple ghost <-> blender conversions */
59 static GHOST_TStandardCursor convert_cursor(int curs)
63 case CURSOR_STD: return GHOST_kStandardCursorDefault;
64 case CURSOR_FACESEL: return GHOST_kStandardCursorRightArrow;
65 case CURSOR_WAIT: return GHOST_kStandardCursorWait;
66 case CURSOR_EDIT: return GHOST_kStandardCursorCrosshair;
69 return GHOST_kStandardCursorLeftRight;
71 return GHOST_kStandardCursorHelp;
73 case CURSOR_X_MOVE: return GHOST_kStandardCursorLeftRight;
74 case CURSOR_Y_MOVE: return GHOST_kStandardCursorUpDown;
75 case CURSOR_PENCIL: return GHOST_kStandardCursorPencil;
76 case CURSOR_COPY: return GHOST_kStandardCursorCopy;
80 static void window_set_custom_cursor(wmWindow *win, unsigned char mask[16][2],
81 unsigned char bitmap[16][2], int hotx, int hoty)
83 GHOST_SetCustomCursorShape(win->ghostwin, bitmap, mask, hotx, hoty);
86 static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useBig)
89 GHOST_SetCustomCursorShapeEx(win->ghostwin,
90 (GHOST_TUns8 *)cursor->big_bm, (GHOST_TUns8 *)cursor->big_mask,
91 cursor->big_sizex, cursor->big_sizey,
92 cursor->big_hotx, cursor->big_hoty,
93 cursor->fg_color, cursor->bg_color);
96 GHOST_SetCustomCursorShapeEx(win->ghostwin,
97 (GHOST_TUns8 *)cursor->small_bm, (GHOST_TUns8 *)cursor->small_mask,
98 cursor->small_sizex, cursor->small_sizey,
99 cursor->small_hotx, cursor->small_hoty,
100 cursor->fg_color, cursor->bg_color);
106 static BCursor *BlenderCursor[BC_NUMCURSORS]; /*Points to static BCursor Structs */
108 void WM_cursor_set(wmWindow *win, int curs)
111 if (win == NULL || G.background) {
112 return; /* Can't set custom cursor before Window init */
115 if (curs == CURSOR_NONE) {
116 GHOST_SetCursorVisibility(win->ghostwin, 0);
121 /* the default win32 cross cursor is barely visible,
122 * only 1 pixel thick, use another one instead */
123 if (curs == CURSOR_EDIT)
124 curs = BC_CROSSCURSOR;
127 GHOST_SetCursorVisibility(win->ghostwin, 1);
129 if (curs == CURSOR_STD && win->modalcursor)
130 curs = win->modalcursor;
134 /* detect if we use system cursor or Blender cursor */
135 if (curs >= BC_GHOST_CURSORS) {
136 GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
139 if ((curs < SYSCURSOR) || (curs >= BC_NUMCURSORS)) return;
141 if (curs == SYSCURSOR) { /* System default Cursor */
142 GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD));
144 else if ( (U.curssize == 0) || (BlenderCursor[curs]->big_bm == NULL) ) {
145 window_set_custom_cursor_ex(win, BlenderCursor[curs], 0);
148 window_set_custom_cursor_ex(win, BlenderCursor[curs], 1);
153 void WM_cursor_modal_set(wmWindow *win, int val)
155 if (win->lastcursor == 0)
156 win->lastcursor = win->cursor;
157 win->modalcursor = val;
158 WM_cursor_set(win, val);
161 void WM_cursor_modal_restore(wmWindow *win)
163 win->modalcursor = 0;
165 WM_cursor_set(win, win->lastcursor);
169 /* to allow usage all over, we do entire WM */
170 void WM_cursor_wait(bool val)
173 wmWindowManager *wm = G.main->wm.first;
174 wmWindow *win = wm ? wm->windows.first : NULL;
176 for (; win; win = win->next) {
178 WM_cursor_modal_set(win, BC_WAITCURSOR);
181 WM_cursor_modal_restore(win);
188 * \param bounds can be NULL
190 void WM_cursor_grab_enable(wmWindow *win, bool wrap, bool hide, int bounds[4])
192 /* Only grab cursor when not running debug.
193 * It helps not to get a stuck WM when hitting a breakpoint
195 GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
196 float fac = GHOST_GetNativePixelSize(win->ghostwin);
198 /* in case pixel coords differ from window/mouse coords */
207 mode = GHOST_kGrabHide;
210 mode = GHOST_kGrabWrap;
212 if ((G.debug & G_DEBUG) == 0) {
214 const GHOST_TabletData *tabletdata = GHOST_GetTabletData(win->ghostwin);
216 /* Note: There is no tabletdata on Windows if no tablet device is connected. */
218 GHOST_SetCursorGrab(win->ghostwin, mode, bounds, NULL);
219 else if (tabletdata->Active == GHOST_kTabletModeNone)
220 GHOST_SetCursorGrab(win->ghostwin, mode, bounds, NULL);
222 win->grabcursor = mode;
227 void WM_cursor_grab_disable(wmWindow *win, int mouse_ungrab_xy[2])
229 if ((G.debug & G_DEBUG) == 0) {
230 if (win && win->ghostwin) {
231 GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL, mouse_ungrab_xy);
232 win->grabcursor = GHOST_kGrabDisable;
237 static void wm_cursor_warp_relative(wmWindow *win, int x, int y)
239 /* note: don't use wmEvent coords because of continuous grab [#36409] */
241 wm_get_cursor_position(win, &cx, &cy);
242 WM_cursor_warp(win, cx + x, cy + y);
245 /* give it a modal keymap one day? */
246 int wm_cursor_arrow_move(wmWindow *win, wmEvent *event)
248 if (win && event->val == KM_PRESS) {
249 if (event->type == UPARROWKEY) {
250 wm_cursor_warp_relative(win, 0, 1);
253 else if (event->type == DOWNARROWKEY) {
254 wm_cursor_warp_relative(win, 0, -1);
257 else if (event->type == LEFTARROWKEY) {
258 wm_cursor_warp_relative(win, -1, 0);
261 else if (event->type == RIGHTARROWKEY) {
262 wm_cursor_warp_relative(win, 1, 0);
270 /* afer this you can call restore too */
271 void WM_cursor_time(wmWindow *win, int nr)
274 static char number_bitmaps[10][8] = {
275 {0, 56, 68, 68, 68, 68, 68, 56},
276 {0, 24, 16, 16, 16, 16, 16, 56},
277 {0, 60, 66, 32, 16, 8, 4, 126},
278 {0, 124, 32, 16, 56, 64, 66, 60},
279 {0, 32, 48, 40, 36, 126, 32, 32},
280 {0, 124, 4, 60, 64, 64, 68, 56},
281 {0, 56, 4, 4, 60, 68, 68, 56},
282 {0, 124, 64, 32, 16, 8, 8, 8},
283 {0, 60, 66, 66, 60, 66, 66, 60},
284 {0, 56, 68, 68, 120, 64, 68, 56}
286 unsigned char mask[16][2];
287 unsigned char bitmap[16][2] = {{0}};
290 if (win->lastcursor == 0)
291 win->lastcursor = win->cursor;
293 memset(&mask, 0xFF, sizeof(mask));
295 /* print number bottom right justified */
296 for (idx = 3; nr && idx >= 0; idx--) {
297 char *digit = number_bitmaps[nr % 10];
301 for (i = 0; i < 8; i++)
302 bitmap[i + y * 8][x] = digit[i];
306 window_set_custom_cursor(win, mask, bitmap, 7, 7);
310 /* ******************************************************************
311 * Custom Cursor Description:
313 * Each bit represents a pixel, so 1 byte = 8 pixels,
314 * the bytes go Left to Right. Top to bottom
315 * the bits in a byte go right to left
316 * (ie; 0x01, 0x80 represents a line of 16 pix with the first and last pix set.)
318 * A 0 in the bitmap = bg_color, a 1 fg_color
319 * a 0 in the mask = transparent pix.
321 * Until 32x32 cursors are supported on all platforms, the size of the
322 * small cursors MUST be 16x16.
324 * Large cursors have a MAXSIZE of 32x32.
326 * Other than that, the specified size of the cursors is just a guideline,
327 * However, the char array that defines the BM and MASK must be byte aligned.
328 * ie a 17x17 cursor needs 3 bytes (cols) * 17 bytes (rows)
329 * (3 bytes = 17 bits rounded up to nearest whole byte). Pad extra bits
332 * Setting big_bm = NULL disables the large version of the cursor.
334 * *******************************************************************
336 * There is a nice Python GUI utility that can be used for drawing cursors in
337 * this format in the Blender source distribution, in
338 * blender/source/tools/MakeCursor.py . Start it with $ python MakeCursor.py
339 * It will copy its output to the console when you press 'Do it'.
343 /* Because defining a cursor mixes declarations and executable code
344 * each cursor needs it's own scoping block or it would be split up
345 * over several hundred lines of code. To enforce/document this better
346 * I define 2 pretty brain-dead macros so it's obvious what the extra "[]"
349 #define BEGIN_CURSOR_BLOCK {
350 #define END_CURSOR_BLOCK }
352 void wm_init_cursor_data(void)
354 /********************** NW_ARROW Cursor **************************/
356 static char nw_sbm[] = {
357 0x03, 0x00, 0x05, 0x00, 0x09, 0x00, 0x11, 0x00,
358 0x21, 0x00, 0x41, 0x00, 0x81, 0x00, 0x01, 0x01,
359 0x01, 0x02, 0xc1, 0x03, 0x49, 0x00, 0x8d, 0x00,
360 0x8b, 0x00, 0x10, 0x01, 0x90, 0x01, 0x60, 0x00,
363 static char nw_smsk[] = {
364 0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00,
365 0x3f, 0x00, 0x7f, 0x00, 0xff, 0x00, 0xff, 0x01,
366 0xff, 0x03, 0xff, 0x03, 0x7f, 0x00, 0xff, 0x00,
367 0xfb, 0x00, 0xf0, 0x01, 0xf0, 0x01, 0x60, 0x00,
370 static BCursor NWArrowCursor = {
383 BlenderCursor[BC_NW_ARROWCURSOR] = &NWArrowCursor;
386 ///********************** NS_ARROW Cursor *************************/
388 static char ns_sbm[] = {
389 0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0x08, 0x08,
390 0x04, 0x10, 0x3c, 0x1e, 0x20, 0x02, 0x20, 0x02,
391 0x20, 0x02, 0x20, 0x02, 0x3c, 0x1e, 0x04, 0x10,
392 0x08, 0x08, 0x10, 0x04, 0x20, 0x02, 0x40, 0x01
395 static char ns_smsk[] = {
396 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f,
397 0xfc, 0x1f, 0xfc, 0x1f, 0xe0, 0x03, 0xe0, 0x03,
398 0xe0, 0x03, 0xe0, 0x03, 0xfc, 0x1f, 0xfc, 0x1f,
399 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01
402 static BCursor NSArrowCursor = {
415 BlenderCursor[BC_NS_ARROWCURSOR] = &NSArrowCursor;
418 /********************** EW_ARROW Cursor *************************/
420 static char ew_sbm[] = {
421 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x38, 0x1c,
422 0x2c, 0x34, 0xe6, 0x67, 0x03, 0xc0, 0x01, 0x80,
423 0x03, 0xc0, 0xe6, 0x67, 0x2c, 0x34, 0x38, 0x1c,
424 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
427 static char ew_smsk[] = {
428 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x38, 0x1c,
429 0x3c, 0x3c, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff,
430 0xff, 0xff, 0xfe, 0x7f, 0x3c, 0x3c, 0x38, 0x1c,
431 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
434 static BCursor EWArrowCursor = {
447 BlenderCursor[BC_EW_ARROWCURSOR] = &EWArrowCursor;
450 /********************** Wait Cursor *****************************/
452 static char wait_sbm[] = {
453 0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40, 0x84, 0x21,
454 0xc8, 0x13, 0xd0, 0x0b, 0xa0, 0x04, 0x20, 0x05,
455 0xa0, 0x04, 0x10, 0x09, 0x88, 0x11, 0xc4, 0x23,
456 0xe2, 0x47, 0xfa, 0x5f, 0x02, 0x40, 0xfe, 0x7f,
459 static char wait_smsk[] = {
460 0xfe, 0x7f, 0xfe, 0x7f, 0x06, 0x60, 0x8c, 0x31,
461 0xd8, 0x1b, 0xf0, 0x0f, 0xe0, 0x06, 0x60, 0x07,
462 0xe0, 0x06, 0x30, 0x0d, 0x98, 0x19, 0xcc, 0x33,
463 0xe6, 0x67, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
466 static char wait_lbm[] = {
467 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
468 0x0c, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x30,
469 0x0c, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x18,
470 0x18, 0xc0, 0x03, 0x0c, 0x30, 0x20, 0x07, 0x06,
471 0x60, 0xf0, 0x0f, 0x03, 0xc0, 0xd0, 0x8d, 0x01,
472 0x80, 0x79, 0xcf, 0x00, 0x00, 0xf3, 0x67, 0x00,
473 0x00, 0x66, 0x37, 0x00, 0x00, 0x8c, 0x33, 0x00,
474 0x00, 0x0c, 0x32, 0x00, 0x00, 0xcc, 0x33, 0x00,
475 0x00, 0x8c, 0x30, 0x00, 0x00, 0x46, 0x61, 0x00,
476 0x00, 0x03, 0xc3, 0x00, 0x80, 0x01, 0x83, 0x01,
477 0xc0, 0xc0, 0x03, 0x03, 0x60, 0xa0, 0x05, 0x06,
478 0x30, 0xf0, 0x0f, 0x0c, 0x18, 0xf8, 0x1d, 0x18,
479 0x0c, 0x5c, 0x3f, 0x30, 0x0c, 0xff, 0x5f, 0x30,
480 0x0c, 0xf7, 0xfe, 0x31, 0xcc, 0xfb, 0x9f, 0x33,
481 0x0c, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x30,
482 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
485 static char wait_lmsk[] = {
486 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
487 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
488 0x3c, 0x00, 0x00, 0x3c, 0x3c, 0x00, 0x00, 0x1e,
489 0x78, 0xc0, 0x03, 0x0f, 0xf0, 0xa0, 0x87, 0x07,
490 0xe0, 0xf1, 0xcf, 0x03, 0xc0, 0xf3, 0xef, 0x01,
491 0x80, 0xff, 0xff, 0x00, 0x00, 0xff, 0x7f, 0x00,
492 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xfc, 0x3f, 0x00,
493 0x00, 0x3c, 0x3f, 0x00, 0x00, 0xfc, 0x3f, 0x00,
494 0x00, 0xbc, 0x3c, 0x00, 0x00, 0xde, 0x79, 0x00,
495 0x00, 0x0f, 0xf3, 0x00, 0x80, 0x07, 0xe3, 0x01,
496 0xc0, 0xc3, 0xc3, 0x03, 0xe0, 0xe1, 0x87, 0x07,
497 0xf0, 0xf0, 0x0f, 0x0f, 0x78, 0xf8, 0x1f, 0x1e,
498 0x3c, 0x7c, 0x3f, 0x3c, 0x3c, 0xff, 0x7f, 0x3c,
499 0xbc, 0xff, 0xff, 0x3d, 0xfc, 0xfb, 0xbf, 0x3f,
500 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
501 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
504 static BCursor WaitCursor = {
517 BlenderCursor[BC_WAITCURSOR] = &WaitCursor;
520 /********************** Cross Cursor ***************************/
522 static char cross_sbm[] = {
523 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
524 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x7e, 0x7e,
525 0x7e, 0x7e, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
526 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00,
529 static char cross_smsk[] = {
530 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
531 0x80, 0x01, 0x80, 0x01, 0xc0, 0x03, 0x7f, 0xfe,
532 0x7f, 0xfe, 0xc0, 0x03, 0x80, 0x01, 0x80, 0x01,
533 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
535 static char cross_lbm[] = {
536 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
537 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
538 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
539 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
540 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
541 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00,
542 0x00, 0xc0, 0x03, 0x00, 0x00, 0x40, 0x02, 0x00,
543 0x00, 0x78, 0x1e, 0x00, 0xfc, 0x1f, 0xf8, 0x3f,
544 0xfc, 0x1f, 0xf8, 0x3f, 0x00, 0x78, 0x1e, 0x00,
545 0x00, 0x40, 0x02, 0x00, 0x00, 0xc0, 0x03, 0x00,
546 0x00, 0xc0, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00,
547 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
548 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
549 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
550 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
551 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
554 static char cross_lmsk[] = {
555 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
556 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
557 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
558 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
559 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
560 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00,
561 0x00, 0xe0, 0x07, 0x00, 0x00, 0x70, 0x0e, 0x00,
562 0x00, 0x78, 0x1e, 0x00, 0xff, 0x1f, 0xf8, 0xff,
563 0xff, 0x1f, 0xf8, 0xff, 0x00, 0x78, 0x1e, 0x00,
564 0x00, 0x70, 0x0e, 0x00, 0x00, 0xe0, 0x07, 0x00,
565 0x00, 0xc0, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00,
566 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
567 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
568 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
569 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
570 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
573 static BCursor CrossCursor = {
575 cross_sbm, cross_smsk,
579 cross_lbm, cross_lmsk,
586 BlenderCursor[BC_CROSSCURSOR] = &CrossCursor;
589 /********************** EditCross Cursor ***********************/
591 static char editcross_sbm[] = {
592 0x0e, 0x00, 0x11, 0x00, 0x1d, 0x00, 0x19, 0x03,
593 0x1d, 0x03, 0x11, 0x03, 0x0e, 0x03, 0x00, 0x03,
594 0xf8, 0x7c, 0xf8, 0x7c, 0x00, 0x03, 0x00, 0x03,
595 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00,
598 static char editcross_smsk[] = {
599 0x0e, 0x00, 0x1f, 0x00, 0x1f, 0x03, 0x1f, 0x03,
600 0x1f, 0x03, 0x1f, 0x03, 0x0e, 0x03, 0x80, 0x07,
601 0xfc, 0xfc, 0xfc, 0xfc, 0x80, 0x07, 0x00, 0x03,
602 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03,
605 static BCursor EditCrossCursor = {
607 editcross_sbm, editcross_smsk,
618 BlenderCursor[BC_EDITCROSSCURSOR] = &EditCrossCursor;
621 /********************** Box Select *************************/
623 static char box_sbm[32] = {
624 0x7f, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x06,
625 0x41, 0x06, 0x41, 0x06, 0x7f, 0x06, 0x00, 0x06,
626 0xe0, 0x79, 0xe0, 0x79, 0x00, 0x06, 0x00, 0x06,
627 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00,
630 static char box_smsk[32] = {
631 0x7f, 0x00, 0x7f, 0x00, 0x63, 0x06, 0x63, 0x06,
632 0x63, 0x06, 0x7f, 0x06, 0x7f, 0x06, 0x00, 0x0f,
633 0xf0, 0xf9, 0xf0, 0xf9, 0x00, 0x0f, 0x00, 0x06,
634 0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06,
638 static BCursor BoxSelCursor = {
651 BlenderCursor[BC_BOXSELCURSOR] = &BoxSelCursor;
654 /********************** Knife Cursor ***********************/
656 static char knife_sbm[] = {
657 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c,
658 0x00, 0x5a, 0x00, 0x34, 0x00, 0x2a, 0x00, 0x17,
659 0x80, 0x06, 0x40, 0x03, 0xa0, 0x03, 0xd0, 0x01,
660 0x68, 0x00, 0x1c, 0x00, 0x06, 0x00, 0x00, 0x00
663 static char knife_smsk[] = {
664 0x00, 0x60, 0x00, 0xf0, 0x00, 0xfc, 0x00, 0xfe,
665 0x00, 0xfe, 0x00, 0x7e, 0x00, 0x7f, 0x80, 0x3f,
666 0xc0, 0x0e, 0x60, 0x07, 0xb0, 0x07, 0xd8, 0x03,
667 0xec, 0x01, 0x7e, 0x00, 0x1f, 0x00, 0x07, 0x00
670 static char knife_lbm[] = {
671 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
672 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
673 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c,
674 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7f,
675 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0xc0, 0x5f,
676 0x00, 0x00, 0xc0, 0x6f, 0x00, 0x00, 0xc0, 0x37,
677 0x00, 0x00, 0xa8, 0x1b, 0x00, 0x00, 0x54, 0x0d,
678 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x54, 0x00,
679 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x53, 0x00,
680 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00,
681 0x00, 0xd0, 0x0f, 0x00, 0x00, 0xe8, 0x07, 0x00,
682 0x00, 0xf4, 0x07, 0x00, 0x00, 0xfa, 0x00, 0x00,
683 0x00, 0x3d, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00,
684 0xc0, 0x03, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
685 0x30, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
686 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
690 static char knife_lmsk[] = {
691 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
692 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
693 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x7e,
694 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x80, 0xff,
695 0x00, 0x00, 0xc0, 0xbf, 0x00, 0x00, 0xe0, 0xdf,
696 0x00, 0x00, 0xe0, 0xef, 0x00, 0x00, 0xf8, 0x77,
697 0x00, 0x00, 0xfc, 0x3b, 0x00, 0x00, 0xfe, 0x1d,
698 0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0xfe, 0x01,
699 0x00, 0x00, 0xff, 0x01, 0x00, 0xc0, 0xff, 0x00,
700 0x00, 0xe0, 0x7f, 0x00, 0x00, 0xf0, 0x1f, 0x00,
701 0x00, 0xd8, 0x1f, 0x00, 0x00, 0xec, 0x0f, 0x00,
702 0x00, 0xf6, 0x0f, 0x00, 0x00, 0xfb, 0x06, 0x00,
703 0x80, 0xbd, 0x01, 0x00, 0xc0, 0x6e, 0x00, 0x00,
704 0xe0, 0x1b, 0x00, 0x00, 0xf0, 0x06, 0x00, 0x00,
705 0xb8, 0x01, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
706 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
710 static BCursor KnifeCursor = {
712 knife_sbm, knife_smsk,
716 knife_lbm, knife_lmsk,
723 BlenderCursor[BC_KNIFECURSOR] = &KnifeCursor;
727 /********************** Loop Select Cursor ***********************/
730 static char vloop_sbm[] = {
731 0x00, 0x00, 0x7e, 0x00, 0x3e, 0x00, 0x1e, 0x00,
732 0x0e, 0x00, 0x66, 0x60, 0x62, 0x6f, 0x00, 0x00,
733 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
734 0x00, 0x00, 0x60, 0x60, 0x60, 0x6f, 0x00, 0x00,
737 static char vloop_smsk[] = {
738 0xff, 0x01, 0xff, 0x00, 0x7f, 0x00, 0x3f, 0x00,
739 0xff, 0xf0, 0xff, 0xff, 0xf7, 0xff, 0xf3, 0xf0,
740 0x61, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
741 0xf0, 0xf0, 0xf0, 0xff, 0xf0, 0xff, 0xf0, 0xf0,
746 static char vloop_lbm[] = {
747 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
748 0xfc, 0x3f, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00,
749 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00,
750 0xfc, 0x03, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00,
751 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00,
752 0x3c, 0x3c, 0x00, 0x3c, 0x3c, 0x3c, 0x00, 0x3c,
753 0x0c, 0x3c, 0xff, 0x3c, 0x0c, 0x3c, 0xff, 0x3c,
754 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
755 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c,
756 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c,
757 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c,
758 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c,
759 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
760 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c,
761 0x00, 0x3c, 0xff, 0x3c, 0x00, 0x3c, 0xff, 0x3c,
762 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
765 static char vloop_lmsk[] = {
766 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x03, 0x00,
767 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
768 0xff, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00,
769 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
770 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff,
771 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
772 0x3f, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff,
773 0x0f, 0xff, 0x00, 0xff, 0x0f, 0xff, 0x00, 0xff,
774 0x03, 0x3c, 0x00, 0x3c, 0x03, 0x3c, 0x00, 0x3c,
775 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c,
776 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c,
777 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c,
778 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
779 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff,
780 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff,
781 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
786 static BCursor VLoopCursor = {
788 vloop_sbm, vloop_smsk,
792 vloop_lbm, vloop_lmsk,
799 BlenderCursor[BC_VLOOPCURSOR] = &VLoopCursor;
804 /********************** TextEdit Cursor ***********************/
806 static char textedit_sbm[] = {
807 0xe0, 0x03, 0x10, 0x04, 0x60, 0x03, 0x40, 0x01,
808 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
809 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
810 0x40, 0x01, 0x60, 0x03, 0x10, 0x04, 0xe0, 0x03,
813 static char textedit_smsk[] = {
814 0xe0, 0x03, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01,
815 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
816 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
817 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xe0, 0x03,
820 static BCursor TextEditCursor = {
822 textedit_sbm, textedit_smsk,
833 BlenderCursor[BC_TEXTEDITCURSOR] = &TextEditCursor;
837 /********************** Paintbrush Cursor ***********************/
839 static char paintbrush_sbm[] = {
841 0x00, 0xe0, 0x00, 0x98, 0x00, 0x44, 0x00, 0x42,
842 0x00, 0x21, 0x80, 0x20, 0x40, 0x13, 0x40, 0x17,
843 0xa0, 0x0b, 0x98, 0x05, 0x04, 0x02, 0x02, 0x01,
844 0x02, 0x01, 0x02, 0x01, 0x81, 0x00, 0x7f, 0x00,
850 static char paintbrush_smsk[] = {
851 0x00, 0xe0, 0x00, 0xf8, 0x00, 0x7c, 0x00, 0x7e,
852 0x00, 0x3f, 0x80, 0x3f, 0xc0, 0x1f, 0xc0, 0x1f,
853 0xe0, 0x0f, 0xf8, 0x07, 0xfc, 0x03, 0xfe, 0x01,
854 0xfe, 0x01, 0xfe, 0x01, 0xff, 0x00, 0x7f, 0x00,
859 static BCursor PaintBrushCursor = {
861 paintbrush_sbm, paintbrush_smsk,
872 BlenderCursor[BC_PAINTBRUSHCURSOR] = &PaintBrushCursor;
876 /********************** Hand Cursor ***********************/
879 static char hand_sbm[] = {
880 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x80, 0x0d,
881 0x98, 0x6d, 0x98, 0x6d, 0xb0, 0x6d, 0xb0, 0x6d,
882 0xe0, 0x6f, 0xe6, 0x7f, 0xee, 0x7f, 0xfc, 0x3f,
883 0xf8, 0x3f, 0xf0, 0x1f, 0xc0, 0x1f, 0xc0, 0x1f,
886 static char hand_smsk[] = {
887 0x00, 0x00, 0x80, 0x01, 0xc0, 0x0f, 0xd8, 0x7f,
888 0xfc, 0xff, 0xfc, 0xff, 0xf8, 0xff, 0xf8, 0xff,
889 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f,
890 0xfc, 0x7f, 0xf8, 0x3f, 0xf0, 0x3f, 0xe0, 0x3f,
894 static BCursor HandCursor = {
907 BlenderCursor[BC_HANDCURSOR] = &HandCursor;
911 /********************** NSEW Scroll Cursor ***********************/
914 static char nsewscroll_sbm[] = {
915 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03,
916 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x0e, 0x70,
917 0x0e, 0x70, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00,
918 0xc0, 0x03, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00,
921 static char nsewscroll_smsk[] = {
922 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07,
923 0xc0, 0x03, 0x0c, 0x30, 0x1e, 0x78, 0x1f, 0xf8,
924 0x1f, 0xf8, 0x1e, 0x78, 0x0c, 0x30, 0xc0, 0x03,
925 0xe0, 0x07, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01,
929 static BCursor NSEWScrollCursor = {
931 nsewscroll_sbm, nsewscroll_smsk,
942 BlenderCursor[BC_NSEW_SCROLLCURSOR] = &NSEWScrollCursor;
947 /********************** NS Scroll Cursor ***********************/
950 static char nsscroll_sbm[] = {
951 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03,
952 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
953 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
954 0xc0, 0x03, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00,
957 static char nsscroll_smsk[] = {
958 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07,
959 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
960 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03,
961 0xe0, 0x07, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01,
965 static BCursor NSScrollCursor = {
967 nsscroll_sbm, nsscroll_smsk,
978 BlenderCursor[BC_NS_SCROLLCURSOR] = &NSScrollCursor;
983 /********************** EW Scroll Cursor ***********************/
986 static char ewscroll_sbm[] = {
987 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
988 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x0e, 0x70,
989 0x0e, 0x70, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00,
990 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
993 static char ewscroll_smsk[] = {
994 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
995 0x00, 0x00, 0x0c, 0x30, 0x1e, 0x78, 0x1f, 0xf8,
996 0x1f, 0xf8, 0x1e, 0x78, 0x0c, 0x30, 0x00, 0x00,
997 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1001 static BCursor EWScrollCursor = {
1003 ewscroll_sbm, ewscroll_smsk,
1014 BlenderCursor[BC_EW_SCROLLCURSOR] = &EWScrollCursor;
1018 /********************** Eyedropper Cursor ***********************/
1021 static char eyedropper_sbm[] = {
1022 0x00, 0x30, 0x00, 0x48, 0x00, 0x85, 0x80, 0x82,
1023 0x40, 0x40, 0x80, 0x20, 0x40, 0x11, 0xa0, 0x23,
1024 0xd0, 0x15, 0xe8, 0x0a, 0x74, 0x01, 0xb4, 0x00,
1025 0x4a, 0x00, 0x35, 0x00, 0x08, 0x00, 0x04, 0x00,
1028 static char eyedropper_smsk[] = {
1029 0x00, 0x30, 0x00, 0x78, 0x00, 0xfd, 0x80, 0xff,
1030 0xc0, 0x7f, 0x80, 0x3f, 0xc0, 0x1f, 0xe0, 0x3f,
1031 0xf0, 0x1f, 0xf8, 0x0b, 0xfc, 0x01, 0xfc, 0x00,
1032 0x7e, 0x00, 0x3f, 0x00, 0x0c, 0x00, 0x04, 0x00,
1036 static BCursor EyedropperCursor = {
1038 eyedropper_sbm, eyedropper_smsk,
1049 BlenderCursor[BC_EYEDROPPER_CURSOR] = &EyedropperCursor;
1053 /********************** Swap Area Cursor ***********************/
1055 static char swap_sbm[] = {
1056 0xc0, 0xff, 0x40, 0x80, 0x40, 0x80, 0x40, 0x9c,
1057 0x40, 0x98, 0x40, 0x94, 0x00, 0x82, 0xfe, 0x80,
1058 0x7e, 0xfd, 0xbe, 0x01, 0xda, 0x01, 0xe2, 0x01,
1059 0xe2, 0x01, 0xc2, 0x01, 0xfe, 0x01, 0x00, 0x00,
1062 static char swap_smsk[] = {
1063 0xc0, 0xff, 0xc0, 0xff, 0xc0, 0xff, 0xc0, 0xff,
1064 0xc0, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff,
1065 0xff, 0xff, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03,
1066 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03,
1069 static BCursor SwapCursor = {
1071 swap_sbm, swap_smsk,
1082 BlenderCursor[BC_SWAPAREA_CURSOR] = &SwapCursor;
1085 /********************** Put the cursors in the array ***********************/