X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fevents.c;h=b610ff8b7a05b211daf6393031e0694df00e0a7d;hp=b21f3706fef27c21a7d176820c7a117733aa0066;hb=6cf34a189f4a3707c9131652621dd67731f14f6b;hpb=a97d51220232bd25cc77bddb2c655fb521ccf519 diff --git a/src/events.c b/src/events.c index b21f3706..b610ff8b 100644 --- a/src/events.c +++ b/src/events.c @@ -347,6 +347,23 @@ void EventLoop(void) } } +void ClearAutoRepeatKeyEvents() +{ + while (PendingEvent()) + { + Event next_event; + + PeekEvent(&next_event); + + /* if event is repeated key press event, remove it from event queue */ + if (next_event.type == EVENT_KEYPRESS && + next_event.key.repeat) + WaitEvent(&next_event); + else + break; + } +} + void ClearEventQueue() { Event event; @@ -1370,6 +1387,8 @@ static void HandleButtonOrFinger(int mx, int my, int button) HandleButtonOrFinger_WipeGestures_MM(mx, my, button); else if (strEqual(setup.touch.control_type, TOUCH_CONTROL_FOLLOW_FINGER)) HandleButtonOrFinger_FollowFinger_MM(mx, my, button); + else if (strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS)) + SetPlayerMouseAction(mx, my, button); /* special case */ } else { @@ -1554,16 +1573,16 @@ void HandleButton(int mx, int my, int button, int button_nr) strEqual(setup.touch.control_type, TOUCH_CONTROL_FOLLOW_FINGER)); #endif - if (handle_gadgets && HandleGadgets(mx, my, button)) + if (HandleGlobalAnimClicks(mx, my, button)) { /* do not handle this button event anymore */ - mx = my = -32; /* force mouse event to be outside screen tiles */ + return; /* force mouse event not to be handled at all */ } - if (HandleGlobalAnimClicks(mx, my, button)) + if (handle_gadgets && HandleGadgets(mx, my, button)) { /* do not handle this button event anymore */ - return; /* force mouse event not to be handled at all */ + mx = my = -32; /* force mouse event to be outside screen tiles */ } if (button_hold && game_status == GAME_MODE_PLAYING && tape.pausing) @@ -2031,7 +2050,7 @@ void HandleKey(Key key, int key_status) if (game_status == GAME_MODE_MAIN && (key == setup.shortcut.toggle_pause || key == KSYM_space)) { - StartGameActions(options.network, setup.autorecord, level.random_seed); + StartGameActions(network.enabled, setup.autorecord, level.random_seed); return; } @@ -2222,10 +2241,8 @@ void HandleEventActions() HandleJoystick(); } -#if defined(NETWORK_AVALIABLE) - if (options.network) + if (network.enabled) HandleNetworking(); -#endif switch (game_status) { @@ -2496,3 +2513,18 @@ void HandleSpecialGameControllerKeys(Key key, int key_status) #endif #endif } + +boolean DoKeysymAction(int keysym) +{ + if (keysym < 0) + { + Key key = (Key)(-keysym); + + HandleKey(key, KEY_PRESSED); + HandleKey(key, KEY_RELEASED); + + return TRUE; + } + + return FALSE; +}