@@ -152,15 +152,21 @@ _pg_repeat_callback(Uint32 interval, void *param)
152152 int repeat_interval_copy = pg_key_repeat_interval ;
153153 PG_UNLOCK_EVFILTER_MUTEX
154154
155- repeat_event_copy .type = PGE_KEYREPEAT ;
155+ repeat_event_copy .type = SDL_KEYDOWN ;
156156#if SDL_VERSION_ATLEAST (3 , 0 , 0 )
157157 repeat_event_copy .key .down = true;
158158 repeat_event_copy .key .repeat = true;
159159#else
160160 repeat_event_copy .key .state = SDL_PRESSED ;
161161 repeat_event_copy .key .repeat = 1 ;
162162#endif
163- SDL_PushEvent (& repeat_event_copy );
163+ /* Use SDL_PeepEvents and not SDL_PushEvent because we don't want
164+ * this to go through our event filter.
165+ * Because this doesn't go through our filter we have to check event
166+ * blocking beforehand. */
167+ if (PG_EventEnabled (_pg_pgevent_proxify (repeat_event_copy .type ))) {
168+ SDL_PeepEvents (& repeat_event_copy , 1 , SDL_ADDEVENT , 0 , 0 );
169+ }
164170 return repeat_interval_copy ;
165171}
166172
@@ -634,10 +640,6 @@ pg_event_filter(void *_, SDL_Event *event)
634640 PG_UNLOCK_EVFILTER_MUTEX
635641 }
636642
637- else if (event -> type == PGE_KEYREPEAT ) {
638- event -> type = SDL_KEYDOWN ;
639- }
640-
641643 else if (event -> type == SDL_KEYUP ) {
642644 PG_LOCK_EVFILTER_MUTEX
643645 /* Actual keyup is blocked, so clear unneeded cache if it exists */
@@ -2481,8 +2483,6 @@ pg_event_set_blocked(PyObject *self, PyObject *obj)
24812483 /* Never block SDL_WINDOWEVENT on SDL2, we need them for translation */
24822484 PG_SetEventEnabled (SDL_WINDOWEVENT , SDL_TRUE );
24832485#endif
2484- /* Never block PGE_KEYREPEAT too, its needed for pygame internal use */
2485- PG_SetEventEnabled (PGE_KEYREPEAT , SDL_TRUE );
24862486 Py_RETURN_NONE ;
24872487}
24882488
0 commit comments