File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,24 +96,6 @@ std::unique_ptr<papki::file> application::get_res_file(std::string_view path) co
9696{
9797 return std::make_unique<papki::fs_file>(path);
9898}
99-
100- # if CFG_OS_NAME != CFG_OS_NAME_EMSCRIPTEN
101- void application::show_virtual_keyboard () noexcept
102- {
103- utki::log_debug ([](auto & o) {
104- o << " application::show_virtual_keyboard(): invoked" << std::endl;
105- });
106- // do nothing
107- }
108-
109- void application::hide_virtual_keyboard () noexcept
110- {
111- utki::log_debug ([](auto & o) {
112- o << " application::hide_virtual_keyboard(): invoked" << std::endl;
113- });
114- // do nothing
115- }
116- # endif
11799#endif
118100
119101ruis::real application::get_pixels_per_pp (
Original file line number Diff line number Diff line change @@ -158,22 +158,6 @@ class application : public utki::intrusive_singleton<application>
158158
159159 ~application () override ;
160160
161- /* *
162- * @brief Bring up the virtual keyboard.
163- * On mobile platforms this function will summon the on-screen keyboard.
164- * On desktop platforms this function does nothing.
165- */
166- // TODO: move to window?
167- void show_virtual_keyboard () noexcept ;
168-
169- /* *
170- * @brief Hide virtual keyboard.
171- * On mobile platforms this function hides the on-screen keyboard.
172- * On desktop platforms this function does nothing.
173- */
174- // TODO: move to window?
175- void hide_virtual_keyboard () noexcept ;
176-
177161public:
178162 /* *
179163 * @brief Requests application to exit.
Original file line number Diff line number Diff line change @@ -182,25 +182,3 @@ void ruisapp::application::quit() noexcept
182182 utki::assert (globals_wrapper::native_activity, SL);
183183 ANativeActivity_finish (globals_wrapper::native_activity);
184184}
185-
186- void ruisapp::application::show_virtual_keyboard () noexcept
187- {
188- // NOTE:
189- // ANativeActivity_showSoftInput(native_activity,
190- // ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED); did not work for some reason.
191-
192- auto & glob = get_glob ();
193-
194- glob.java_functions .show_virtual_keyboard ();
195- }
196-
197- void ruisapp::application::hide_virtual_keyboard () noexcept
198- {
199- // NOTE:
200- // ANativeActivity_hideSoftInput(native_activity,
201- // ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS); did not work for some reason
202-
203- auto & glob = get_glob ();
204-
205- glob.java_functions .hide_virtual_keyboard ();
206- }
Original file line number Diff line number Diff line change @@ -168,3 +168,22 @@ void native_window::set_fullscreen_internal(bool enable)
168168 );
169169 }
170170}
171+
172+ void naitve_window::set_virtual_keyboard_visible (bool visible) noexcept
173+ {
174+ auto & glob = get_glob ();
175+
176+ if (visible) {
177+ // NOTE:
178+ // ANativeActivity_showSoftInput(native_activity,
179+ // ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED); did not work for some reason.
180+
181+ glob.java_functions .show_virtual_keyboard ();
182+ } else {
183+ // NOTE:
184+ // ANativeActivity_hideSoftInput(native_activity,
185+ // ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS); did not work for some reason
186+
187+ glob.java_functions .hide_virtual_keyboard ();
188+ }
189+ }
Original file line number Diff line number Diff line change @@ -53,5 +53,7 @@ public:
5353 r4::vector2<unsigned > get_dims ();
5454
5555 void set_fullscreen_internal (bool enable) override ;
56+
57+ void set_virtual_keyboard_visible (bool visible) noexcept override ;
5658};
5759} // namespace
Original file line number Diff line number Diff line change @@ -364,14 +364,6 @@ - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
364364 // do nothing, ios swaps frame buffers automatically
365365}
366366
367- void application::show_virtual_keyboard ()noexcept {
368- // TODO:
369- }
370-
371- void application::hide_virtual_keyboard ()noexcept {
372- // TODO:
373- }
374-
375367std::unique_ptr<papki::file> application::get_res_file (std::string_view path)const {
376368 std::string dir ([[[NSBundle mainBundle ] resourcePath ] fileSystemRepresentation ]);
377369
Original file line number Diff line number Diff line change @@ -276,15 +276,3 @@ void ruisapp::application::destroy_window(ruisapp::window& w)
276276 glue.destroy_window (app_win.ruis_native_window .get ().get_id ());
277277#endif
278278}
279-
280- #if CFG_OS_NAME == CFG_OS_NAME_EMSCRIPTEN
281- void ruisapp::application::show_virtual_keyboard () noexcept
282- {
283- SDL_StartTextInput ();
284- }
285-
286- void ruisapp::application::hide_virtual_keyboard () noexcept
287- {
288- SDL_StopTextInput ();
289- }
290- #endif
Original file line number Diff line number Diff line change @@ -317,3 +317,12 @@ void native_window::set_mouse_cursor(ruis::mouse_cursor c)
317317{
318318 this ->display .get ().set_cursor (c);
319319}
320+
321+ void native_window::set_virtual_keyboard_visible (bool visible) noexcept
322+ {
323+ if (visible) {
324+ SDL_StartTextInput ();
325+ } else {
326+ SDL_StopTextInput ();
327+ }
328+ }
Original file line number Diff line number Diff line change @@ -178,5 +178,7 @@ public:
178178 ));
179179 }
180180 }
181+
182+ void set_virtual_keyboard_visible (bool visible) noexcept override ;
181183};
182184} // namespace
You can’t perform that action at this time.
0 commit comments