summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-01-14 12:41:04 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-01-14 13:36:32 +0200
commit89f37d410557c9062b45f090f08d006453bc4fc9 (patch)
tree79310768abf1c16b950e0a05a74a1119256b728f /platform/android
parent4e8bf74d564fc404c2ebf8b56611bcae54bcdd90 (diff)
Add support for getting native display, window, and view handles.
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/display_server_android.cpp18
-rw-r--r--platform/android/display_server_android.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp
index 5b9ca44180..e31e1d8c03 100644
--- a/platform/android/display_server_android.cpp
+++ b/platform/android/display_server_android.cpp
@@ -243,6 +243,24 @@ DisplayServer::WindowID DisplayServerAndroid::get_window_at_screen_position(cons
return MAIN_WINDOW_ID;
}
+int64_t DisplayServerAndroid::window_get_native_handle(HandleType p_handle_type, WindowID p_window) const {
+ ERR_FAIL_COND_V(p_window != MAIN_WINDOW_ID, 0);
+ switch (p_handle_type) {
+ case DISPLAY_HANDLE: {
+ return 0; // Not supported.
+ }
+ case WINDOW_HANDLE: {
+ return (int64_t)((OS_Android *)OS::get_singleton())->get_godot_java()->get_activity();
+ }
+ case WINDOW_VIEW: {
+ return 0; // Not supported.
+ }
+ default: {
+ return 0;
+ }
+ }
+}
+
void DisplayServerAndroid::window_attach_instance_id(ObjectID p_instance, DisplayServer::WindowID p_window) {
window_attached_instance_id = p_instance;
}
diff --git a/platform/android/display_server_android.h b/platform/android/display_server_android.h
index 8538b6e660..aa5c511de8 100644
--- a/platform/android/display_server_android.h
+++ b/platform/android/display_server_android.h
@@ -123,6 +123,9 @@ public:
virtual Vector<WindowID> get_window_list() const override;
virtual WindowID get_window_at_screen_position(const Point2i &p_position) const override;
+
+ virtual int64_t window_get_native_handle(HandleType p_handle_type, WindowID p_window = MAIN_WINDOW_ID) const override;
+
virtual void window_attach_instance_id(ObjectID p_instance, WindowID p_window = MAIN_WINDOW_ID) override;
virtual ObjectID window_get_attached_instance_id(WindowID p_window = MAIN_WINDOW_ID) const override;
virtual void window_set_title(const String &p_title, WindowID p_window = MAIN_WINDOW_ID) override;