MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / setCursor

Method setCursor

platform/sdl/knativescreenSDL.cpp:596–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

594}
595
596void KNativeScreenSDL::setCursor(const std::shared_ptr<XCursor>& cursor) {
597 if (KSystem::videoOption == VIDEO_NO_WINDOW) {
598 return;
599 }
600 SDL_Cursor* sdlCursor;
601
602 {
603 BOXEDWINE_CRITICAL_SECTION_WITH_MUTEX(cursorsMutex);
604 sdlCursor = cursors.get(cursor->id);
605 }
606 if (!sdlCursor) {
607 switch (cursor->shape) {
608 case 0:
609 if (!KSystem::disableHideCursor && cursor->fg.red == 0 && cursor->fg.blue == 0 && cursor->fg.green == 0 && cursor->bg.red == 0 && cursor->bg.green == 0 && cursor->bg.blue == 0) {
610 sdlCursor = nullptr;
611 } else {
612 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
613 }
614 break;
615 case 22: // XC_center_ptr
616 // :TODO:
617 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
618 break;
619 case 52: // XC_fleur
620 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL);
621 break;
622 case 60: // XC_hand2
623 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
624 break;
625 case 64: // XC_icon
626 // :TODO:
627 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT);
628 break;
629 case 68: // XC_left_ptr
630 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
631 break;
632 case 88: // XC_pirate
633 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
634 break;
635 case 108: // XC_sb_h_double_arrow
636 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
637 break;
638 case 116: // XC_sb_v_double_arrow
639 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS);
640 break;
641 case 130: // XC_tcross
642 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_CROSSHAIR);
643 break;
644 case 132: // XC_top_left_arrow
645 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
646 break;
647 case 134: // XC_top_left_corner
648 case 136: // XC_top_right_corner
649 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL);
650 break;
651 case 150: // XC_watch
652 sdlCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAITARROW);
653 break;

Callers 4

updateCursorMethod · 0.80
mouseMoveMethod · 0.80
grabPointerMethod · 0.80
ungrabPointerMethod · 0.80

Calls 5

SDL_CreateSystemCursorFunction · 0.85
klog_fmtFunction · 0.85
SDL_ShowCursorFunction · 0.85
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected