11#ifdef WITH_OPENGL_BACKEND
14#ifdef WITH_VULKAN_BACKEND
35 invalid_window_(false),
36 sdl_custom_cursor_(nullptr),
37 preferred_device_(preferred_device)
39 SDL_WindowFlags window_flags = SDL_WINDOW_RESIZABLE;
41#ifdef WITH_OPENGL_BACKEND
42 case GHOST_kDrawingContextTypeOpenGL:
43 window_flags |= SDL_WINDOW_OPENGL;
46#ifdef WITH_VULKAN_BACKEND
47 case GHOST_kDrawingContextTypeVulkan:
48 window_flags |= SDL_WINDOW_VULKAN;
56 sdl_win_ = SDL_CreateWindow(title, width, height, window_flags);
58 SDL_SetWindowPosition(sdl_win_, left, top);
68 SDL_RaiseWindow(sdl_win_);
76 if (sdl_custom_cursor_) {
77 SDL_DestroyCursor(sdl_custom_cursor_);
82 SDL_DestroyWindow(sdl_win_);
89#ifdef WITH_OPENGL_BACKEND
90 case GHOST_kDrawingContextTypeOpenGL: {
91 for (
int minor = 6; minor >= 3; --minor) {
101 if (context->initializeDrawingContext()) {
110#ifdef WITH_VULKAN_BACKEND
111 case GHOST_kDrawingContextTypeVulkan: {
114 if (context->initializeDrawingContext()) {
130 if (invalid_window_ ==
false) {
131 system_->addDirtyWindow(
this);
132 invalid_window_ =
true;
142 SDL_SetWindowFullscreen(sdl_win_,
false);
143 SDL_RestoreWindow(sdl_win_);
146 SDL_SetWindowFullscreen(sdl_win_,
false);
147 SDL_MaximizeWindow(sdl_win_);
150 SDL_MinimizeWindow(sdl_win_);
153 SDL_SetWindowFullscreen(sdl_win_,
true);
164 SDL_WindowFlags flags = SDL_GetWindowFlags(sdl_win_);
166 if (flags & SDL_WINDOW_FULLSCREEN) {
169 if (flags & SDL_WINDOW_MAXIMIZED) {
172 if (flags & SDL_WINDOW_MINIMIZED) {
185 SDL_SetWindowTitle(sdl_win_, title);
190 return SDL_GetWindowTitle(sdl_win_);
201 SDL_GetWindowSize(sdl_win_, &
w, &h);
202 SDL_GetWindowPosition(sdl_win_, &
x, &
y);
213 SDL_GetWindowSize(sdl_win_,
nullptr, &height);
214 SDL_SetWindowSize(sdl_win_, width, height);
221 SDL_GetWindowSize(sdl_win_, &width,
nullptr);
222 SDL_SetWindowSize(sdl_win_, width, height);
228 SDL_SetWindowSize(sdl_win_, width, height);
236 SDL_GetWindowPosition(sdl_win_, &x_win, &y_win);
245 SDL_GetWindowPosition(sdl_win_, &x_win, &y_win);
253 0xef, 0x01, 0xff, 0x01, 0xff, 0x01, 0x7c, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00,
254 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xff, 0x01, 0xff, 0x01, 0xef, 0x01,
257 0x00, 0x77, 0x00, 0x1c, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08,
258 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x1c, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00,
260#define sdl_std_cursor_WIDTH_xterm 9
261#define sdl_std_cursor_HEIGHT_xterm 16
262#define sdl_std_cursor_HOT_X_xterm -3
263#define sdl_std_cursor_HOT_Y_xterm -7
266 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfe, 0x1f, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
267 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x1f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f,
270 0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0xfc, 0x0f, 0x86, 0x18, 0x83, 0x30, 0x81, 0xe0, 0xc1, 0xe1,
271 0xc1, 0xe1, 0x21, 0xe0, 0x13, 0x30, 0x06, 0x18, 0xfc, 0x0f, 0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07,
273#define sdl_std_cursor_WIDTH_watch 16
274#define sdl_std_cursor_HEIGHT_watch 16
275#define sdl_std_cursor_HOT_X_watch -15
276#define sdl_std_cursor_HOT_Y_watch -7
279 0xe8, 0x76, 0xfb, 0xdf, 0xfd, 0x3f, 0xfe, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xcf, 0x79, 0xc0, 0x01,
280 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0x80, 0x03,
283 0x88, 0x04, 0x20, 0x0a, 0xc9, 0x32, 0xf2, 0x09, 0x4c, 0x06, 0x43, 0x18, 0x40, 0x00, 0x40, 0x00,
284 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x01, 0x40, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
286#define sdl_std_cursor_WIDTH_umbrella 16
287#define sdl_std_cursor_HEIGHT_umbrella 16
288#define sdl_std_cursor_HOT_X_umbrella -7
289#define sdl_std_cursor_HOT_Y_umbrella -12
292 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f,
293 0xdc, 0x1d, 0xcc, 0x19, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
296 0xff, 0x1f, 0xff, 0x1f, 0x00, 0x00, 0x40, 0x00, 0xe0, 0x00, 0x50, 0x01, 0x48, 0x02, 0x44, 0x04,
297 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
299#define sdl_std_cursor_WIDTH_top_side 15
300#define sdl_std_cursor_HEIGHT_top_side 16
301#define sdl_std_cursor_HOT_X_top_side -6
302#define sdl_std_cursor_HOT_Y_top_side -14
305 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf0, 0xfc, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7,
306 0xc0, 0xf7, 0xe0, 0xf7, 0x70, 0xf7, 0x38, 0xf7, 0x1c, 0xf7, 0x0c, 0xf7, 0x00, 0xf0, 0x00, 0xf0,
309 0xff, 0x3f, 0xff, 0x3f, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0xfc, 0x31, 0x80, 0x31, 0x40, 0x31,
310 0x20, 0x31, 0x10, 0x31, 0x08, 0x31, 0x04, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
312#define sdl_std_cursor_WIDTH_top_right_corner 16
313#define sdl_std_cursor_HEIGHT_top_right_corner 16
314#define sdl_std_cursor_HOT_X_top_right_corner -13
315#define sdl_std_cursor_HOT_Y_top_right_corner -14
318 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x3f,
319 0xef, 0x03, 0xef, 0x07, 0xef, 0x0e, 0xef, 0x1c, 0xef, 0x38, 0xef, 0x30, 0x0f, 0x00, 0x0f, 0x00,
322 0xff, 0x3f, 0xff, 0x3f, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0xe3, 0x0f, 0x63, 0x00, 0xa3, 0x00,
323 0x23, 0x01, 0x23, 0x02, 0x23, 0x04, 0x23, 0x08, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
325#define sdl_std_cursor_WIDTH_top_left_corner 16
326#define sdl_std_cursor_HEIGHT_top_left_corner 16
327#define sdl_std_cursor_HOT_X_top_left_corner 0
328#define sdl_std_cursor_HOT_Y_top_left_corner -14
331 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00, 0xff, 0x01, 0xff, 0x01, 0x7c, 0x00, 0x7c, 0x00, 0x7c,
332 0x00, 0x7c, 0x00, 0x7c, 0x00, 0xff, 0x01, 0xff, 0x01, 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00,
335 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28,
336 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00,
338#define sdl_std_cursor_WIDTH_sb_v_double_arrow 9
339#define sdl_std_cursor_HEIGHT_sb_v_double_arrow 15
340#define sdl_std_cursor_HOT_X_sb_v_double_arrow -3
341#define sdl_std_cursor_HOT_Y_sb_v_double_arrow -8
383#define sdl_std_cursor_WIDTH_sb_h_double_arrow 15
384#define sdl_std_cursor_HEIGHT_sb_h_double_arrow 9
385#define sdl_std_cursor_HOT_X_sb_h_double_arrow -7
386#define sdl_std_cursor_HOT_Y_sb_h_double_arrow -4
389 0x00, 0xf0, 0x00, 0xf0, 0xc0, 0xf0, 0xc0, 0xf1, 0x80, 0xf3, 0x00, 0xf7, 0xff, 0xff, 0xff,
390 0xff, 0xff, 0xff, 0x00, 0xf7, 0x80, 0xf3, 0xc0, 0xf1, 0xc0, 0xf0, 0x00, 0xf0, 0x00, 0xf0,
393 0x00, 0x30, 0x00, 0x30, 0x40, 0x30, 0x80, 0x30, 0x00, 0x31, 0x00, 0x32, 0xff, 0x37, 0x00,
394 0x32, 0x00, 0x31, 0x80, 0x30, 0x40, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
396#define sdl_std_cursor_WIDTH_right_side 16
397#define sdl_std_cursor_HEIGHT_right_side 15
398#define sdl_std_cursor_HOT_X_right_side -13
399#define sdl_std_cursor_HOT_Y_right_side -7
402 0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x03, 0xf0, 0x03, 0xf8, 0x03, 0xfc, 0x03, 0xfe, 0x03,
403 0xff, 0x03, 0xff, 0x03, 0xf8, 0x03, 0xbc, 0x03, 0x3c, 0x03, 0x1e, 0x00, 0x1e, 0x00, 0x0c, 0x00,
406 0x00, 0x80, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf8, 0x00, 0xfc, 0x00, 0xfe, 0x00, 0xff,
407 0x00, 0xf8, 0x00, 0xd8, 0x00, 0x8c, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
409#define sdl_std_cursor_WIDTH_right_ptr 10
410#define sdl_std_cursor_HEIGHT_right_ptr 16
411#define sdl_std_cursor_HOT_X_right_ptr -7
412#define sdl_std_cursor_HOT_Y_right_ptr -14
415 0xf8, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0xff, 0x07, 0x8f, 0x07, 0x9f, 0x07, 0xde, 0x07, 0xfc, 0x03,
416 0xf8, 0x01, 0xf8, 0x00, 0xf8, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0xfc, 0x01, 0xf8, 0x00, 0x70, 0x00,
419 0x7c, 0x00, 0xfe, 0x00, 0xc7, 0x01, 0x83, 0x01, 0x87, 0x01, 0xc6, 0x01, 0xe0, 0x00, 0x78, 0x00,
420 0x38, 0x00, 0x28, 0x00, 0x28, 0x00, 0xee, 0x00, 0x6c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00,
422#define sdl_std_cursor_WIDTH_question_arrow 11
423#define sdl_std_cursor_HEIGHT_question_arrow 16
424#define sdl_std_cursor_HOT_X_question_arrow -4
425#define sdl_std_cursor_HOT_Y_question_arrow -8
428 0xf0, 0x03, 0xf8, 0x07, 0xfc, 0x0f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfc, 0x0f, 0xf8, 0x07, 0xf1, 0x83,
429 0xf1, 0xe3, 0xf3, 0xf3, 0xef, 0x39, 0x1e, 0x1e, 0xe0, 0x01, 0xfe, 0xc7, 0xff, 0xff, 0x0f, 0x7c,
432 0xe0, 0x01, 0xf0, 0x03, 0xf8, 0x07, 0xcc, 0x0c, 0xcc, 0x0c, 0xf8, 0x07, 0xf0, 0x03, 0xe0, 0x01,
433 0xe1, 0x21, 0xe1, 0x61, 0xc2, 0x10, 0x1c, 0x0e, 0xe0, 0x01, 0xf8, 0x47, 0x0f, 0x7c, 0x01, 0x20,
435#define sdl_std_cursor_WIDTH_pirate 16
436#define sdl_std_cursor_HEIGHT_pirate 16
437#define sdl_std_cursor_HOT_X_pirate -7
438#define sdl_std_cursor_HOT_Y_pirate -4
441 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x03, 0x8f, 0x03, 0xcf, 0x01, 0xef, 0x00, 0xff, 0xff, 0xff,
442 0xff, 0xff, 0xff, 0xef, 0x00, 0xcf, 0x01, 0x8f, 0x03, 0x0f, 0x03, 0x0f, 0x00, 0x0f, 0x00,
445 0x03, 0x00, 0x03, 0x00, 0x83, 0x00, 0x43, 0x00, 0x23, 0x00, 0x13, 0x00, 0xfb, 0x3f, 0x13,
446 0x00, 0x23, 0x00, 0x43, 0x00, 0x83, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
448#define sdl_std_cursor_WIDTH_left_side 16
449#define sdl_std_cursor_HEIGHT_left_side 15
450#define sdl_std_cursor_HOT_X_left_side 0
451#define sdl_std_cursor_HOT_Y_left_side -7
454 0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00, 0xff, 0x00, 0xff, 0x01,
455 0xff, 0x03, 0xff, 0x03, 0x7f, 0x00, 0xf7, 0x00, 0xf3, 0x00, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x00,
458 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e, 0x00, 0x7e, 0x00, 0xfe, 0x00,
459 0xfe, 0x00, 0x3e, 0x00, 0x36, 0x00, 0x62, 0x00, 0x60, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00,
461#define sdl_std_cursor_WIDTH_left_ptr 10
462#define sdl_std_cursor_HEIGHT_left_ptr 16
463#define sdl_std_cursor_HOT_X_left_ptr -8
464#define sdl_std_cursor_HOT_Y_left_ptr -14
467 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xff, 0xff, 0xff, 0xff,
468 0xff, 0xff, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
471 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x7f, 0xff,
472 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00,
474#define sdl_std_cursor_WIDTH_crosshair 16
475#define sdl_std_cursor_HEIGHT_crosshair 16
476#define sdl_std_cursor_HOT_X_crosshair -7
477#define sdl_std_cursor_HOT_Y_crosshair -8
480 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xcc, 0x19, 0xdc, 0x1d,
481 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f,
484 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x44, 0x04, 0x48, 0x02,
485 0x50, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0xff, 0x1f, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00,
487#define sdl_std_cursor_WIDTH_bottom_side 15
488#define sdl_std_cursor_HEIGHT_bottom_side 16
489#define sdl_std_cursor_HOT_X_bottom_side -6
490#define sdl_std_cursor_HOT_Y_bottom_side -1
493 0x00, 0xf0, 0x00, 0xf0, 0x0c, 0xf7, 0x1c, 0xf7, 0x38, 0xf7, 0x70, 0xf7, 0xe0, 0xf7, 0xc0, 0xf7,
494 0xfc, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
497 0x00, 0x30, 0x00, 0x30, 0x04, 0x31, 0x08, 0x31, 0x10, 0x31, 0x20, 0x31, 0x40, 0x31, 0x80, 0x31,
498 0xfc, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0xff, 0x3f, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00,
500#define sdl_std_cursor_WIDTH_bottom_right_corner 16
501#define sdl_std_cursor_HEIGHT_bottom_right_corner 16
502#define sdl_std_cursor_HOT_X_bottom_right_corner -13
503#define sdl_std_cursor_HOT_Y_bottom_right_corner -1
506 0x0f, 0x00, 0x0f, 0x00, 0xef, 0x30, 0xef, 0x38, 0xef, 0x1c, 0xef, 0x0e, 0xef, 0x07, 0xef, 0x03,
507 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x3f, 0x0f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
510 0x03, 0x00, 0x03, 0x00, 0x23, 0x08, 0x23, 0x04, 0x23, 0x02, 0x23, 0x01, 0xa3, 0x00, 0x63, 0x00,
511 0xe3, 0x0f, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0xff, 0x3f, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00,
513#define sdl_std_cursor_WIDTH_bottom_left_corner 16
514#define sdl_std_cursor_HEIGHT_bottom_left_corner 16
515#define sdl_std_cursor_HOT_X_bottom_left_corner 0
516#define sdl_std_cursor_HOT_Y_bottom_left_corner -1
519 0x00, 0xe0, 0x00, 0xf8, 0x00, 0xfe, 0x80, 0x7f, 0xe0, 0x7f, 0xf8, 0x3f, 0xfc, 0x3f, 0xfc, 0x1f,
520 0xe0, 0x1f, 0xf0, 0x0f, 0xf8, 0x0f, 0x7c, 0x07, 0x3e, 0x07, 0x1f, 0x02, 0x0e, 0x00, 0x04, 0x00,
523 0x00, 0x30, 0x00, 0x3c, 0x00, 0x1f, 0xc0, 0x1f, 0xf0, 0x0f, 0xfc, 0x0f, 0xc0, 0x07, 0xe0, 0x07,
524 0x70, 0x03, 0x38, 0x03, 0x1c, 0x01, 0x0e, 0x01, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
526#define sdl_std_cursor_WIDTH_arrow 16
527#define sdl_std_cursor_HEIGHT_arrow 16
528#define sdl_std_cursor_HOT_X_arrow -13
529#define sdl_std_cursor_HOT_Y_arrow -14
537 const uint8_t *data,
const uint8_t *
mask,
int w,
int h,
int hot_x,
int hot_y)
539 SDL_Surface *surface;
543 Uint8 datab = 0, maskb = 0;
544 const Uint32 black = 0xFF000000;
545 const Uint32 white = 0xFFFFFFFF;
546 const Uint32 transparent = 0x00000000;
552 surface = SDL_CreateSurface(
w, h, SDL_PIXELFORMAT_ARGB8888);
556 for (
y = 0;
y < h; ++
y) {
557 pixel = (Uint32 *)((Uint8 *)surface->pixels +
y * surface->pitch);
558 for (
x = 0;
x <
w; ++
x) {
564 datab = (datab * 0x0202020202ULL & 0x010884422010ULL) % 1023;
565 maskb = (maskb * 0x0202020202ULL & 0x010884422010ULL) % 1023;
568 *pixel++ = (datab & 0x80) ? white : black;
571 *pixel++ = (datab & 0x80) ? white : transparent;
578 cursor = SDL_CreateColorCursor(surface, hot_x, hot_y);
580 SDL_DestroySurface(surface);
589#define DEF_CURSOR(name, ind) \
591 sdl_std_cursor_array[int(ind)] = sdl_ghost_CreateCursor( \
592 sdl_std_cursor_##name, \
593 sdl_std_cursor_mask_##name, \
594 sdl_std_cursor_WIDTH_##name, \
595 sdl_std_cursor_HEIGHT_##name, \
596 (sdl_std_cursor_WIDTH_##name + (sdl_std_cursor_HOT_X_##name)) - 1, \
597 (sdl_std_cursor_HEIGHT_##name + (sdl_std_cursor_HOT_Y_##name)) - 1); \
598 assert(sdl_std_cursor_array[int(ind)] != nullptr); \
638 if (cursor ==
nullptr) {
642 SDL_SetCursor(cursor);
654 const int hot_spot[2],
657 if (sdl_custom_cursor_) {
658 SDL_DestroyCursor(sdl_custom_cursor_);
662 bitmap,
mask, size[0], size[1], hot_spot[0], hot_spot[1]);
664 SDL_SetCursor(sdl_custom_cursor_);
681 SDL_DisplayID display_id = SDL_GetDisplayForWindow(sdl_win_);
682 if (display_id == 0) {
686 float scale = SDL_GetDisplayContentScale(display_id);
691 return uint16_t(96.0f *
scale);
#define GHOST_OPENGL_SDL_RESET_NOTIFICATION_STRATEGY
#define GHOST_OPENGL_SDL_CONTEXT_FLAGS
@ GHOST_kWindowStateMinimized
@ GHOST_kWindowStateMaximized
@ GHOST_kWindowStateNormal
@ GHOST_kWindowStateFullScreen
@ GHOST_kStandardCursorBottomLeftCorner
@ GHOST_kStandardCursorHelp
@ GHOST_kStandardCursorCopy
@ GHOST_kStandardCursorWait
@ GHOST_kStandardCursorTopSide
@ GHOST_kStandardCursorCrosshair
@ GHOST_kStandardCursorLeftRight
@ GHOST_kStandardCursorPencil
@ GHOST_kStandardCursorUpDown
@ GHOST_kStandardCursorBottomSide
@ GHOST_kStandardCursorInfo
@ GHOST_kStandardCursorTopLeftCorner
@ GHOST_kStandardCursorBottomRightCorner
@ GHOST_kStandardCursorDefault
@ GHOST_kStandardCursorRightSide
@ GHOST_kStandardCursorRightArrow
@ GHOST_kStandardCursorTopRightCorner
@ GHOST_kStandardCursorDestroy
@ GHOST_kStandardCursorLeftSide
@ GHOST_kStandardCursorText
@ GHOST_kStandardCursorLeftArrow
#define GHOST_kStandardCursorNumCursors
GHOST_TDrawingContextType
static uchar sdl_std_cursor_mask_right_ptr[]
static uchar sdl_std_cursor_xterm[]
static uchar sdl_std_cursor_bottom_side[]
static uchar sdl_std_cursor_left_side[]
static uchar sdl_std_cursor_mask_left_side[]
static uchar sdl_std_cursor_arrow[]
static uchar sdl_std_cursor_top_side[]
static uchar sdl_std_cursor_question_arrow[]
static uchar sdl_std_cursor_right_side[]
static uchar sdl_std_cursor_mask_crosshair[]
static uchar sdl_std_cursor_mask_top_right_corner[]
static uchar sdl_std_cursor_mask_bottom_side[]
static uchar sdl_std_cursor_mask_watch[]
static uchar sdl_std_cursor_mask_right_side[]
static SDL_Cursor * sdl_std_cursor_array[int(GHOST_kStandardCursorNumCursors)]
static uchar sdl_std_cursor_top_right_corner[]
static uchar sdl_std_cursor_mask_top_left_corner[]
static SDL_Cursor * getStandardCursorShape(GHOST_TStandardCursor shape)
static SDL_Cursor * sdl_ghost_CreateCursor(const uint8_t *data, const uint8_t *mask, int w, int h, int hot_x, int hot_y)
static uchar sdl_std_cursor_mask_top_side[]
static uchar sdl_std_cursor_mask_left_ptr[]
static uchar sdl_std_cursor_mask_arrow[]
static uchar sdl_std_cursor_mask_bottom_left_corner[]
static uchar sdl_std_cursor_top_left_corner[]
static uchar sdl_std_cursor_umbrella[]
static uchar sdl_std_cursor_sb_v_double_arrow[]
static uchar sdl_std_cursor_left_ptr[]
static uchar sdl_std_cursor_mask_pirate[]
static uchar sdl_std_cursor_bottom_right_corner[]
static uchar sdl_std_cursor_watch[]
static uchar sdl_std_cursor_mask_umbrella[]
static uchar sdl_std_cursor_crosshair[]
static uchar sdl_std_cursor_sb_h_double_arrow[]
static uchar sdl_std_cursor_mask_sb_v_double_arrow[]
static uchar sdl_std_cursor_bottom_left_corner[]
static uchar sdl_std_cursor_mask_xterm[]
static uchar sdl_std_cursor_mask_question_arrow[]
static uchar sdl_std_cursor_mask_bottom_right_corner[]
static uchar sdl_std_cursor_mask_sb_h_double_arrow[]
#define DEF_CURSOR(name, ind)
static uchar sdl_std_cursor_pirate[]
static uchar sdl_std_cursor_right_ptr[]
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
GHOST_ContextSDL(const GHOST_ContextParams &context_params, SDL_Window *window, int contextProfileMask, int contextMajorVersion, int contextMinorVersion, int contextFlags, int contextResetNotificationStrategy)
GHOST_ContextVK(const GHOST_ContextParams &context_params, GHOST_TVulkanPlatformType platform, Window window, Display *display, wl_surface *wayland_surface, wl_display *wayland_display, const GHOST_ContextVK_WindowInfo *wayland_window_info, int contextMajorVersion, int contextMinorVersion, const GHOST_GPUDevice &preferred_device, const GHOST_WindowHDRInfo *hdr_info_=nullptr)
GHOST_WindowSDL(GHOST_SystemSDL *system, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type, const GHOST_ContextParams &context_params, const GHOST_GPUDevice &preferred_device, const bool exclusive=false, const GHOST_IWindow *parent_window=nullptr)
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override
std::string getTitle() const override
GHOST_TWindowState getState() const override
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
GHOST_TSuccess invalidate() override
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) override
GHOST_TSuccess setClientHeight(uint32_t height) override
GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type) override
void getClientBounds(GHOST_Rect &bounds) const override
GHOST_TSuccess setWindowCursorVisibility(bool visible) override
GHOST_TSuccess setClientWidth(uint32_t width) override
GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap, const uint8_t *mask, const int size[2], const int hot_spot[2], bool can_invert_color) override
GHOST_TSuccess setState(GHOST_TWindowState state) override
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override
void getWindowBounds(GHOST_Rect &bounds) const override
uint16_t getDPIHint() override
bool getValid() const override
void setTitle(const char *title) override
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape) override
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
GHOST_ContextParams want_context_params_
GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) override
GHOST_TSuccess releaseNativeHandles()
bool getValid() const override
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_ContextParams &context_params, const bool exclusive=false)
GHOST_WindowHDRInfo hdr_info_
float3x3 scale(float3x3 mat, float2 scale)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)