allow closing text input windows with cancel button

This commit is contained in:
Toad King 2015-06-18 21:37:48 -05:00
parent 909513e7ca
commit 8929887f25
2 changed files with 19 additions and 12 deletions

View File

@ -1,7 +1,7 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
*
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
@ -211,7 +211,7 @@ static void dinput_poll(void *data)
di->mouse_r = mouse_state.rgbButtons[1];
di->mouse_m = mouse_state.rgbButtons[2];
/* No simple way to get absolute coordinates
/* No simple way to get absolute coordinates
* for RETRO_DEVICE_POINTER. Just use Win32 APIs. */
POINT point = {0};
GetCursorPos(&point);
@ -243,7 +243,7 @@ static bool dinput_is_pressed(struct dinput_input *di,
if (id >= RARCH_BIND_LIST_END)
return false;
return dinput_keyboard_pressed(di, bind->key) ||
return (!di->blocked && dinput_keyboard_pressed(di, bind->key)) ||
input_joypad_pressed(di->joypad, port, binds, id);
}
@ -293,9 +293,9 @@ static int16_t dinput_lightgun_state(struct dinput_input *di, unsigned id)
case RETRO_DEVICE_ID_LIGHTGUN_TURBO:
return di->mouse_r;
case RETRO_DEVICE_ID_LIGHTGUN_START:
return di->mouse_m && di->mouse_r;
return di->mouse_m && di->mouse_r;
case RETRO_DEVICE_ID_LIGHTGUN_PAUSE:
return di->mouse_m && di->mouse_l;
return di->mouse_m && di->mouse_l;
}
return 0;
@ -535,11 +535,11 @@ bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lPa
{
struct dinput_input *di = (struct dinput_input *)dinput;
settings_t *settings = config_get_ptr();
/* WM_POINTERDOWN : Arrives for each new touch event
/* WM_POINTERDOWN : Arrives for each new touch event
* with a new ID - add to list.
* WM_POINTERUP : Arrives once the pointer is no
* WM_POINTERUP : Arrives once the pointer is no
* longer down - remove from list.
* WM_POINTERUPDATE : arrives for both pressed and
* WM_POINTERUPDATE : arrives for both pressed and
* hovering pointers - ignore hovering
*/
@ -547,7 +547,7 @@ bool dinput_handle_message(void *dinput, UINT message, WPARAM wParam, LPARAM lPa
{
case WM_POINTERDOWN:
{
struct pointer_status *new_pointer =
struct pointer_status *new_pointer =
(struct pointer_status *)malloc(sizeof(struct pointer_status));
if (!new_pointer)

View File

@ -555,7 +555,7 @@ int menu_input_bind_iterate(void)
menu_input->binds.begin - MENU_SETTINGS_BIND_BEGIN].desc);
menu_driver_render_messagebox(msg);
if (bind_mode_kb)
return menu_input_bind_iterate_keyboard(current, timeout);
@ -658,7 +658,7 @@ static int menu_input_mouse(unsigned *action)
menu_input->mouse.scrolldown = (menu_input->mouse.y == (int)frame_buf->height - 5);
if (
(menu_input->mouse.dx != 0) ||
(menu_input->mouse.dx != 0) ||
(menu_input->mouse.dy !=0) ||
menu_input->mouse.left ||
menu_input->mouse.wheelup ||
@ -1017,8 +1017,15 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
menu_input->delay.count += disp->animation->delta_time / IDEAL_DT;
if (input_driver_keyboard_mapping_is_blocked())
if (menu_input->keyboard.display)
{
// send return key to close keyboard input window
if (trigger_input & (1ULL << settings->menu_cancel_btn))
input_keyboard_event(true, '\n', '\n', 0, RETRO_DEVICE_KEYBOARD);
trigger_input = 0;
}
if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_UP))
ret = MENU_ACTION_UP;
else if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN))