Forward repeated volume events

Send repeated events when holding volume up/down shortcuts.
This commit is contained in:
Romain Vimont 2018-06-24 21:48:34 +02:00
parent c12c64ed41
commit 49b2e63d13

View file

@ -147,13 +147,6 @@ void input_manager_process_key(struct input_manager *input_manager,
// capture all Ctrl events // capture all Ctrl events
if (ctrl) { if (ctrl) {
SDL_bool repeat = event->repeat;
// ignore repeated events
if (repeat) {
return;
}
SDL_bool shift = event->keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT); SDL_bool shift = event->keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT);
if (shift) { if (shift) {
// currently, there is no shortcut involving SHIFT // currently, there is no shortcut involving SHIFT
@ -162,51 +155,64 @@ void input_manager_process_key(struct input_manager *input_manager,
SDL_Keycode keycode = event->keysym.sym; SDL_Keycode keycode = event->keysym.sym;
int action = event->type == SDL_KEYDOWN ? ACTION_DOWN : ACTION_UP; int action = event->type == SDL_KEYDOWN ? ACTION_DOWN : ACTION_UP;
SDL_bool repeat = event->repeat;
switch (keycode) { switch (keycode) {
case SDLK_h: case SDLK_h:
if (!repeat) {
action_home(input_manager->controller, action); action_home(input_manager->controller, action);
}
return; return;
case SDLK_b: // fall-through case SDLK_b: // fall-through
case SDLK_BACKSPACE: case SDLK_BACKSPACE:
if (!repeat) {
action_back(input_manager->controller, action); action_back(input_manager->controller, action);
}
return; return;
case SDLK_s: case SDLK_s:
if (!repeat) {
action_app_switch(input_manager->controller, action); action_app_switch(input_manager->controller, action);
}
return; return;
case SDLK_m: case SDLK_m:
if (!repeat) {
action_menu(input_manager->controller, action); action_menu(input_manager->controller, action);
}
return; return;
case SDLK_p: case SDLK_p:
if (!repeat) {
action_power(input_manager->controller, action); action_power(input_manager->controller, action);
}
return; return;
case SDLK_DOWN: case SDLK_DOWN:
// forward repeated events
action_volume_down(input_manager->controller, action); action_volume_down(input_manager->controller, action);
return; return;
case SDLK_UP: case SDLK_UP:
// forward repeated events
action_volume_up(input_manager->controller, action); action_volume_up(input_manager->controller, action);
return; return;
case SDLK_v: case SDLK_v:
if (event->type == SDL_KEYDOWN) { if (!repeat && event->type == SDL_KEYDOWN) {
clipboard_paste(input_manager->controller); clipboard_paste(input_manager->controller);
} }
return; return;
case SDLK_f: case SDLK_f:
if (event->type == SDL_KEYDOWN) { if (!repeat && event->type == SDL_KEYDOWN) {
screen_switch_fullscreen(input_manager->screen); screen_switch_fullscreen(input_manager->screen);
} }
return; return;
case SDLK_x: case SDLK_x:
if (event->type == SDL_KEYDOWN) { if (!repeat && event->type == SDL_KEYDOWN) {
screen_resize_to_fit(input_manager->screen); screen_resize_to_fit(input_manager->screen);
} }
return; return;
case SDLK_g: case SDLK_g:
if (event->type == SDL_KEYDOWN) { if (!repeat && event->type == SDL_KEYDOWN) {
screen_resize_to_pixel_perfect(input_manager->screen); screen_resize_to_pixel_perfect(input_manager->screen);
} }
return; return;
case SDLK_i: case SDLK_i:
if (event->type == SDL_KEYDOWN) { if (!repeat && event->type == SDL_KEYDOWN) {
switch_fps_counter_state(input_manager->frames); switch_fps_counter_state(input_manager->frames);
} }
return; return;