GHOST/SDL: add support for the key repeat flag

Now all ghost back-ends support the key repeat flag
(accessed as WM_EVENT_IS_REPEAT from wmEvent.flag).
This commit is contained in:
Campbell Barton 2022-07-14 09:46:14 +10:00
parent 50d832634e
commit 09a74ff8b6
1 changed files with 2 additions and 1 deletions

View File

@ -457,6 +457,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
SDL_Keycode sym = sdl_sub_evt.keysym.sym;
GHOST_TEventType type = (sdl_sub_evt.state == SDL_PRESSED) ? GHOST_kEventKeyDown :
GHOST_kEventKeyUp;
const bool is_repeat = sdl_sub_evt.repeat != 0;
GHOST_WindowSDL *window = findGhostWindow(
SDL_GetWindowFromID_fallback(sdl_sub_evt.windowID));
@ -596,7 +597,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
}
}
g_event = new GHOST_EventKey(getMilliSeconds(), type, window, gkey, sym, nullptr, false);
g_event = new GHOST_EventKey(getMilliSeconds(), type, window, gkey, sym, nullptr, is_repeat);
break;
}
}