[Bf-blender-cvs] [09a74ff8b6e] master: GHOST/SDL: add support for the key repeat flag

Campbell Barton noreply at git.blender.org
Thu Jul 14 01:47:50 CEST 2022


Commit: 09a74ff8b6e815f3642229355be0a08dc1bcb391
Author: Campbell Barton
Date:   Thu Jul 14 09:46:14 2022 +1000
Branches: master
https://developer.blender.org/rB09a74ff8b6e815f3642229355be0a08dc1bcb391

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).

===================================================================

M	intern/ghost/intern/GHOST_SystemSDL.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index a29bfd9489d..0ca37adced6 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -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;
     }
   }



More information about the Bf-blender-cvs mailing list