diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2021-07-18 14:14:23 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2021-07-18 14:14:23 +0300 |
commit | ca50a1f762703d477ee84cf494dec601fd540299 (patch) | |
tree | fbd86a77e77015d7cc6becc1255a63e436a45b2a /intern/ghost/intern/GHOST_SystemSDL.cpp | |
parent | d35969a74ff7a71fc0ca233ae65a2f1c47eb9a25 (diff) | |
parent | e82c5c660778b3805f50f3f2901923692c17db2a (diff) |
Merge branch 'master' into geometry-nodes-unnamed-attributesgeometry-nodes-unnamed-attributes
Diffstat (limited to 'intern/ghost/intern/GHOST_SystemSDL.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemSDL.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp index eccef18bee2..f2f1b26b8e5 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.cpp +++ b/intern/ghost/intern/GHOST_SystemSDL.cpp @@ -50,10 +50,10 @@ GHOST_SystemSDL::~GHOST_SystemSDL() } GHOST_IWindow *GHOST_SystemSDL::createWindow(const char *title, - GHOST_TInt32 left, - GHOST_TInt32 top, - GHOST_TUns32 width, - GHOST_TUns32 height, + int32_t left, + int32_t top, + uint32_t width, + uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings, @@ -118,23 +118,23 @@ GHOST_TSuccess GHOST_SystemSDL::init() * Returns the dimensions of the main display on this system. * \return The dimension of the main display. */ -void GHOST_SystemSDL::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const +void GHOST_SystemSDL::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const { SDL_DisplayMode mode; - SDL_GetDesktopDisplayMode(0, &mode); /* note, always 0 display */ + SDL_GetDesktopDisplayMode(0, &mode); /* NOTE: always 0 display. */ width = mode.w; height = mode.h; } -void GHOST_SystemSDL::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const +void GHOST_SystemSDL::getMainDisplayDimensions(uint32_t &width, uint32_t &height) const { SDL_DisplayMode mode; - SDL_GetCurrentDisplayMode(0, &mode); /* note, always 0 display */ + SDL_GetCurrentDisplayMode(0, &mode); /* NOTE: always 0 display. */ width = mode.w; height = mode.h; } -GHOST_TUns8 GHOST_SystemSDL::getNumDisplays() const +uint8_t GHOST_SystemSDL::getNumDisplays() const { return SDL_GetNumVideoDisplays(); } @@ -356,15 +356,15 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event) int x_win, y_win; SDL_GetWindowPosition(sdl_win, &x_win, &y_win); - GHOST_TInt32 x_root = sdl_sub_evt.x + x_win; - GHOST_TInt32 y_root = sdl_sub_evt.y + y_win; + int32_t x_root = sdl_sub_evt.x + x_win; + int32_t y_root = sdl_sub_evt.y + y_win; #if 0 if (window->getCursorGrabMode() != GHOST_kGrabDisable && window->getCursorGrabMode() != GHOST_kGrabNormal) { - GHOST_TInt32 x_new = x_root; - GHOST_TInt32 y_new = y_root; - GHOST_TInt32 x_accum, y_accum; + int32_t x_new = x_root; + int32_t y_new = y_root; + int32_t x_accum, y_accum; GHOST_Rect bounds; /* fallback to window bounds */ @@ -468,8 +468,8 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event) assert(window != NULL); GHOST_TKey gkey = convertSDLKey(sdl_sub_evt.keysym.scancode); - /* note, the sdl_sub_evt.keysym.sym is truncated, - * for unicode support ghost has to be modified */ + /* NOTE: the `sdl_sub_evt.keysym.sym` is truncated, + * for unicode support ghost has to be modified. */ /* printf("%d\n", sym); */ if (sym > 127) { switch (sym) { @@ -611,7 +611,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event) } } -GHOST_TSuccess GHOST_SystemSDL::getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const +GHOST_TSuccess GHOST_SystemSDL::getCursorPosition(int32_t &x, int32_t &y) const { int x_win, y_win; SDL_Window *win = SDL_GetMouseFocus(); @@ -625,7 +625,7 @@ GHOST_TSuccess GHOST_SystemSDL::getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 return GHOST_kSuccess; } -GHOST_TSuccess GHOST_SystemSDL::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) +GHOST_TSuccess GHOST_SystemSDL::setCursorPosition(int32_t x, int32_t y) { int x_win, y_win; SDL_Window *win = SDL_GetMouseFocus(); @@ -668,14 +668,14 @@ bool GHOST_SystemSDL::processEvents(bool waitForEvent) GHOST_TimerManager *timerMgr = getTimerManager(); if (waitForEvent && m_dirty_windows.empty() && !SDL_HasEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)) { - GHOST_TUns64 next = timerMgr->nextFireTime(); + uint64_t next = timerMgr->nextFireTime(); if (next == GHOST_kFireTimeNever) { SDL_WaitEventTimeout(NULL, -1); // SleepTillEvent(m_display, -1); } else { - GHOST_TInt64 maxSleep = next - getMilliSeconds(); + int64_t maxSleep = next - getMilliSeconds(); if (maxSleep >= 0) { SDL_WaitEventTimeout(NULL, next - getMilliSeconds()); @@ -743,17 +743,17 @@ GHOST_TSuccess GHOST_SystemSDL::getButtons(GHOST_Buttons &buttons) const return GHOST_kSuccess; } -GHOST_TUns8 *GHOST_SystemSDL::getClipboard(bool selection) const +char *GHOST_SystemSDL::getClipboard(bool selection) const { - return (GHOST_TUns8 *)SDL_GetClipboardText(); + return (char *)SDL_GetClipboardText(); } -void GHOST_SystemSDL::putClipboard(GHOST_TInt8 *buffer, bool selection) const +void GHOST_SystemSDL::putClipboard(const char *buffer, bool selection) const { SDL_SetClipboardText(buffer); } -GHOST_TUns64 GHOST_SystemSDL::getMilliSeconds() +uint64_t GHOST_SystemSDL::getMilliSeconds() { - return GHOST_TUns64(SDL_GetTicks()); /* note, 32 -> 64bits */ + return uint64_t(SDL_GetTicks()); /* NOTE: 32 -> 64bits. */ } |