Skip to content

Commit

Permalink
[Switch] Fix OS_Switch::show_virtual_keyboard
Browse files Browse the repository at this point in the history
* Fixed missing arguments in OS_Switch::show_virtual_keyboard
- 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 authored Jan 20, 2024
1 parent 57f8674 commit 6b1fb9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions platform/switch/os_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,13 @@ 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) {
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) {
if (!g_swkbd_open) {
g_swkbd_open = true;

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 6b1fb9c

Please sign in to comment.