diff options
Diffstat (limited to 'intern/ghost/intern/GHOST_SystemSDL.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemSDL.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp index d912b57f049..9174664adc4 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.cpp +++ b/intern/ghost/intern/GHOST_SystemSDL.cpp @@ -5,6 +5,7 @@ */ #include <cassert> +#include <stdexcept> #include "GHOST_ContextSDL.h" #include "GHOST_SystemSDL.h" @@ -20,7 +21,7 @@ GHOST_SystemSDL::GHOST_SystemSDL() : GHOST_System() { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - printf("Error initializing SDL: %s\n", SDL_GetError()); + throw std::runtime_error("Error initializing SDL: " + std::string(SDL_GetError())); } SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); @@ -41,7 +42,6 @@ GHOST_IWindow *GHOST_SystemSDL::createWindow(const char *title, uint32_t width, uint32_t height, GHOST_TWindowState state, - GHOST_TDrawingContextType type, GHOST_GLSettings glSettings, const bool exclusive, const bool /* is_dialog */, @@ -56,7 +56,7 @@ GHOST_IWindow *GHOST_SystemSDL::createWindow(const char *title, width, height, state, - type, + glSettings.context_type, ((glSettings.flags & GHOST_glStereoVisual) != 0), exclusive, parentWindow); @@ -160,7 +160,8 @@ GHOST_TSuccess GHOST_SystemSDL::getModifierKeys(GHOST_ModifierKeys &keys) const keys.set(GHOST_kModifierKeyRightControl, (mod & KMOD_RCTRL) != 0); keys.set(GHOST_kModifierKeyLeftAlt, (mod & KMOD_LALT) != 0); keys.set(GHOST_kModifierKeyRightAlt, (mod & KMOD_RALT) != 0); - keys.set(GHOST_kModifierKeyOS, (mod & (KMOD_LGUI | KMOD_RGUI)) != 0); + keys.set(GHOST_kModifierKeyLeftOS, (mod & KMOD_LGUI) != 0); + keys.set(GHOST_kModifierKeyRightOS, (mod & KMOD_RGUI) != 0); return GHOST_kSuccess; } @@ -218,8 +219,8 @@ static GHOST_TKey convertSDLKey(SDL_Scancode key) GXMAP(type, SDL_SCANCODE_RCTRL, GHOST_kKeyRightControl); GXMAP(type, SDL_SCANCODE_LALT, GHOST_kKeyLeftAlt); GXMAP(type, SDL_SCANCODE_RALT, GHOST_kKeyRightAlt); - GXMAP(type, SDL_SCANCODE_LGUI, GHOST_kKeyOS); - GXMAP(type, SDL_SCANCODE_RGUI, GHOST_kKeyOS); + GXMAP(type, SDL_SCANCODE_LGUI, GHOST_kKeyLeftOS); + GXMAP(type, SDL_SCANCODE_RGUI, GHOST_kKeyRightOS); GXMAP(type, SDL_SCANCODE_APPLICATION, GHOST_kKeyApp); GXMAP(type, SDL_SCANCODE_INSERT, GHOST_kKeyInsert); @@ -411,7 +412,7 @@ static char convert_keyboard_event_to_ascii(const SDL_KeyboardEvent &sdl_sub_evt } } } - return (char)sym; + return char(sym); } /** |