projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20131202-1-src
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index ebcb5e1d1ee1427fb767c0f8583182e5935abca0..122311d1a527345b924ce8bca12673dca7d216e8 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-29,17
+29,28
@@
static boolean cursor_inside_playfield = FALSE;
static boolean playfield_cursor_set = FALSE;
static boolean cursor_inside_playfield = FALSE;
static boolean playfield_cursor_set = FALSE;
-static unsigned
long
playfield_cursor_delay = 0;
+static unsigned
int
playfield_cursor_delay = 0;
/* event filter especially needed for SDL event filtering due to
delay problems with lots of mouse motion events when mouse button
not pressed (X11 can handle this with 'PointerMotionHintMask') */
/* event filter especially needed for SDL event filtering due to
delay problems with lots of mouse motion events when mouse button
not pressed (X11 can handle this with 'PointerMotionHintMask') */
-int FilterMouseMotionEvents(const Event *event)
+/* event filter addition for SDL2: as SDL2 does not have a function to enable
+ or disable keyboard auto-repeat, filter repeated keyboard events instead */
+
+int FilterEvents(const Event *event)
{
MotionEvent *motion;
{
MotionEvent *motion;
+#if defined(TARGET_SDL2)
+ /* skip repeated key press events if keyboard auto-repeat is disabled */
+ if (event->type == EVENT_KEYPRESS &&
+ event->key.repeat &&
+ !keyrepeat_status)
+ return 0;
+#endif
+
/* non-motion events are directly passed to event handler functions */
if (event->type != EVENT_MOTIONNOTIFY)
return 1;
/* non-motion events are directly passed to event handler functions */
if (event->type != EVENT_MOTIONNOTIFY)
return 1;
@@
-59,8
+70,8
@@
int FilterMouseMotionEvents(const Event *event)
if (button_status == MB_RELEASED &&
game_status != GAME_MODE_EDITOR && game_status != GAME_MODE_PLAYING)
return 0;
if (button_status == MB_RELEASED &&
game_status != GAME_MODE_EDITOR && game_status != GAME_MODE_PLAYING)
return 0;
- else
-
return 1;
+
+ return 1;
}
/* to prevent delay problems, skip mouse motion events if the very next
}
/* to prevent delay problems, skip mouse motion events if the very next
@@
-318,7
+329,7
@@
void SleepWhileUnmapped()
void HandleExposeEvent(ExposeEvent *event)
{
void HandleExposeEvent(ExposeEvent *event)
{
-#if
ndef TARGET_SDL
+#if
!defined(TARGET_SDL)
RedrawPlayfield(FALSE, event->x, event->y, event->width, event->height);
FlushDisplay();
#endif
RedrawPlayfield(FALSE, event->x, event->y, event->width, event->height);
FlushDisplay();
#endif
@@
-1012,7
+1023,7
@@
void HandleKey(Key key, int key_status)
}
break;
}
break;
- case KSYM_
S
:
+ case KSYM_
s
:
if (!global.fps_slowdown)
{
global.fps_slowdown = TRUE;
if (!global.fps_slowdown)
{
global.fps_slowdown = TRUE;
@@
-1141,7
+1152,7
@@
void HandleJoystick()
case GAME_MODE_SETUP:
case GAME_MODE_INFO:
{
case GAME_MODE_SETUP:
case GAME_MODE_INFO:
{
- static unsigned
long
joystickmove_delay = 0;
+ static unsigned
int
joystickmove_delay = 0;
if (joystick && !button &&
!DelayReached(&joystickmove_delay, GADGET_FRAME_DELAY))
if (joystick && !button &&
!DelayReached(&joystickmove_delay, GADGET_FRAME_DELAY))