diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-10-02 20:01:27 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-10-02 20:09:48 +0300 |
commit | 25f439c573eefbc7cff2ea92952c9c68f1f0744a (patch) | |
tree | 3ee3dec438a97926280f7d6c6f1d3621beb55545 /platform/ios | |
parent | 1917bc3454e58fc56750b00e04aa25cb94d8d266 (diff) | |
download | redot-engine-25f439c573eefbc7cff2ea92952c9c68f1f0744a.tar.gz |
[DisplayServer] Implement has_hardware_keyboard method for Android and iOS.
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/display_server_ios.h | 1 | ||||
-rw-r--r-- | platform/ios/display_server_ios.mm | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/platform/ios/display_server_ios.h b/platform/ios/display_server_ios.h index 0631b50f0a..7f199db997 100644 --- a/platform/ios/display_server_ios.h +++ b/platform/ios/display_server_ios.h @@ -224,6 +224,7 @@ public: void virtual_keyboard_set_height(int height); virtual int virtual_keyboard_get_height() const override; + virtual bool has_hardware_keyboard() const override; virtual void clipboard_set(const String &p_text) override; virtual String clipboard_get() const override; diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm index e51d43bd89..dcc6ce9218 100644 --- a/platform/ios/display_server_ios.mm +++ b/platform/ios/display_server_ios.mm @@ -45,6 +45,8 @@ #import <sys/utsname.h> +#import <GameController/GameController.h> + static const float kDisplayServerIOSAcceleration = 1.f; DisplayServerIOS *DisplayServerIOS::get_singleton() { @@ -756,6 +758,14 @@ int DisplayServerIOS::virtual_keyboard_get_height() const { return virtual_keyboard_height; } +bool DisplayServerIOS::has_hardware_keyboard() const { + if (@available(iOS 14.0, *)) { + return [GCKeyboard coalescedKeyboard]; + } else { + return false; + } +} + void DisplayServerIOS::clipboard_set(const String &p_text) { [UIPasteboard generalPasteboard].string = [NSString stringWithUTF8String:p_text.utf8()]; } |