Skip to content

Commit

Permalink
Fixed missing arguments in OS_Switch::show_virtual_keyboard
Browse files Browse the repository at this point in the history
- was missing the p_multiline, p_cursor_start and p_cursor_end args
(don't urgently need to do anything with those vars, the software keyboard already appears to handle cursor position for editing in the middle of text if that's where you press the touch screen first)
- keyboard height is actually 400, and now reports as such
- removed old printf debugging for hiding software keyboard, it's one of the only places where that remains and shouldn't still be present in release
  • Loading branch information
hokaze committed Jan 20, 2024
1 parent 57f8674 commit b49da7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions platform/switch/os_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,10 @@ void OS_Switch::run() {
}
}

swkbdInlineUpdate(&inline_keyboard, NULL);
joypad->process();
input->flush_buffered_events();

swkbdInlineUpdate(&inline_keyboard, NULL);

if (Main::iteration())
break;
}
Expand All @@ -478,15 +477,15 @@ bool OS_Switch::has_virtual_keyboard() const {
}

int OS_Switch::get_virtual_keyboard_height() const {
// todo: actually figure this out
if (!g_swkbd_open) {
return 0;
}
return 300;
return 400;
}

void OS_Switch::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, int p_max_input_length) {
if (!g_swkbd_open) {
void OS_Switch::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, bool p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
printf("Showing kbd!\n");
if (!g_swkbd_open) {
g_swkbd_open = true;

SwkbdAppearArg appear_arg;
Expand All @@ -501,7 +500,6 @@ void OS_Switch::show_virtual_keyboard(const String &p_existing_text, const Rect2
}

void OS_Switch::hide_virtual_keyboard() {
printf("Hiding kbd!\n");
g_swkbd_open = false;
swkbdInlineDisappear(&inline_keyboard);
}
Expand Down
2 changes: 1 addition & 1 deletion platform/switch/os_switch.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class OS_Switch : public OS {
virtual bool has_touchscreen_ui_hint() const;

virtual bool has_virtual_keyboard() const;
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), int p_max_input_length = -1);
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), bool p_multiline = false, int p_max_input_length = -1, int p_cursor_start = -1, int p_cursor_end = -1);
virtual void hide_virtual_keyboard();
virtual int get_virtual_keyboard_height() const;

Expand Down

0 comments on commit b49da7f

Please sign in to comment.