summaryrefslogtreecommitdiffstats
path: root/platform/ios/display_server_ios.mm
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-10-04 11:22:02 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-10-04 11:22:02 +0200
commit5ac62a68631efcae639f7eb18b1bd8e1e09d994d (patch)
tree184c93d9119ca1ec6f67605201077f6e6b68e38f /platform/ios/display_server_ios.mm
parent6e03910578f240b465f5e56952eb5694dc513787 (diff)
parent25f439c573eefbc7cff2ea92952c9c68f1f0744a (diff)
downloadredot-engine-5ac62a68631efcae639f7eb18b1bd8e1e09d994d.tar.gz
Merge pull request #97743 from bruvzg/has_kbd
[DisplayServer] Implement `has_hardware_keyboard` method for Android and iOS.
Diffstat (limited to 'platform/ios/display_server_ios.mm')
-rw-r--r--platform/ios/display_server_ios.mm10
1 files changed, 10 insertions, 0 deletions
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()];
}