Skip to content

Commit da391ff

Browse files
committed
webOS: magic remote improvements for text entry
1 parent 5abc020 commit da391ff

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

input/common/wayland_common_webos.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ void wl_keyboard_handle_key_webos(void *data,
809809
int value = (state == WL_KEYBOARD_KEY_STATE_PRESSED) ? 1 : 0;
810810
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
811811
uint32_t keysym = key;
812+
input_driver_state_t *input_st = input_state_get_ptr();
812813

813814
/* Handle 'duplicate' inputs that correspond
814815
* to the same RETROK_* key */
@@ -830,6 +831,12 @@ void wl_keyboard_handle_key_webos(void *data,
830831
case KEY_WAYLAND_WEBOS_BLUE:
831832
keysym = KEY_A;
832833
break;
834+
case KEY_ENTER:
835+
/* When in menu and in virtual keyboard entry,
836+
* map magic remote wheel button click to LCTRL for character selection */
837+
if (input_st && (input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED))
838+
keysym = KEY_LEFTCTRL;
839+
break;
833840
case KEY_OK:
834841
case KEY_SELECT:
835842
keysym = KEY_ENTER;

input/drivers/sdl_input.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ static void sdl_input_poll(void *data)
466466
unsigned code = input_keymaps_translate_keysym_to_rk(
467467
event.key.keysym.sym);
468468
#ifdef WEBOS
469+
input_driver_state_t *input_st = input_state_get_ptr();
470+
bool osk_active = input_st && (input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED);
471+
469472
switch ((int) event.key.keysym.scancode)
470473
{
471474
case SDL_WEBOS_SCANCODE_BACK:
@@ -489,6 +492,14 @@ static void sdl_input_poll(void *data)
489492
case SDL_WEBOS_SCANCODE_EXIT:
490493
code = RETROK_F1;
491494
break;
495+
case SDL_SCANCODE_RIGHT:
496+
case SDL_SCANCODE_LEFT:
497+
case SDL_SCANCODE_DOWN:
498+
case SDL_SCANCODE_UP:
499+
/* navigation only, skip text insertion */
500+
if (osk_active)
501+
return;
502+
break;
492503
default:
493504
break;
494505
}

0 commit comments

Comments
 (0)