@@ -152,15 +152,17 @@ _pg_repeat_callback(Uint32 interval, void *param)
152
152
int repeat_interval_copy = pg_key_repeat_interval ;
153
153
PG_UNLOCK_EVFILTER_MUTEX
154
154
155
- repeat_event_copy .type = PGE_KEYREPEAT ;
155
+ repeat_event_copy .type = SDL_KEYDOWN ;
156
156
#if SDL_VERSION_ATLEAST (3 , 0 , 0 )
157
157
repeat_event_copy .key .down = true;
158
158
repeat_event_copy .key .repeat = true;
159
159
#else
160
160
repeat_event_copy .key .state = SDL_PRESSED ;
161
161
repeat_event_copy .key .repeat = 1 ;
162
162
#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
+ SDL_PeepEvents (& repeat_event_copy , 1 , SDL_ADDEVENT , 0 , 0 );
164
166
return repeat_interval_copy ;
165
167
}
166
168
@@ -634,10 +636,6 @@ pg_event_filter(void *_, SDL_Event *event)
634
636
PG_UNLOCK_EVFILTER_MUTEX
635
637
}
636
638
637
- else if (event -> type == PGE_KEYREPEAT ) {
638
- event -> type = SDL_KEYDOWN ;
639
- }
640
-
641
639
else if (event -> type == SDL_KEYUP ) {
642
640
PG_LOCK_EVFILTER_MUTEX
643
641
/* Actual keyup is blocked, so clear unneeded cache if it exists */
@@ -2481,8 +2479,6 @@ pg_event_set_blocked(PyObject *self, PyObject *obj)
2481
2479
/* Never block SDL_WINDOWEVENT on SDL2, we need them for translation */
2482
2480
PG_SetEventEnabled (SDL_WINDOWEVENT , SDL_TRUE );
2483
2481
#endif
2484
- /* Never block PGE_KEYREPEAT too, its needed for pygame internal use */
2485
- PG_SetEventEnabled (PGE_KEYREPEAT , SDL_TRUE );
2486
2482
Py_RETURN_NONE ;
2487
2483
}
2488
2484
0 commit comments