The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/android: Add some partially-generated wrappers for our own Java code.

+191
+3
src/xrt/auxiliary/CMakeLists.txt
··· 10 10 android/android_globals.h 11 11 android/android_load_class.cpp 12 12 android/android_load_class.hpp 13 + android/org.freedesktop.monado.auxiliary.cpp 14 + android/org.freedesktop.monado.auxiliary.hpp 15 + android/org.freedesktop.monado.auxiliary.impl.hpp 13 16 ) 14 17 15 18 set(MATH_SOURCE_FILES
+27
src/xrt/auxiliary/android/org.freedesktop.monado.auxiliary.cpp
··· 1 + // Copyright 2020, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Out-of-line implementations for partially-generated wrapper for the 6 + * `org.freedesktop.monado.auxiliary` Java package. 7 + * @author Ryan Pavlik <ryan.pavlik@collabora.com> 8 + * @ingroup aux_android 9 + */ 10 + 11 + #include "org.freedesktop.monado.auxiliary.hpp" 12 + 13 + namespace wrap { 14 + namespace org::freedesktop::monado::auxiliary { 15 + MonadoView::Meta::Meta(jni::jclass clazz) 16 + : MetaBase(MonadoView::getTypeName(), clazz), 17 + attachToActivity(classRef().getStaticMethod( 18 + "attachToActivity", 19 + "(Landroid/app/Activity;)Lorg/freedesktop/monado/" 20 + "auxiliary/MonadoView;")), 21 + waitGetSurfaceHolder(classRef().getMethod( 22 + "waitGetSurfaceHolder", "(I)Landroid/view/SurfaceHolder;")), 23 + markAsDiscardedByNative( 24 + classRef().getMethod("markAsDiscardedByNative", "()V")) 25 + {} 26 + } // namespace org::freedesktop::monado::auxiliary 27 + } // namespace wrap
+120
src/xrt/auxiliary/android/org.freedesktop.monado.auxiliary.hpp
··· 1 + // Copyright 2020, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Partially-generated wrapper for the 6 + * `org.freedesktop.monado.auxiliary` Java package. 7 + * @author Ryan Pavlik <ryan.pavlik@collabora.com> 8 + * @ingroup aux_android 9 + */ 10 + 11 + #pragma once 12 + 13 + #include "wrap/ObjectWrapperBase.h" 14 + 15 + namespace wrap { 16 + namespace android::app { 17 + class Activity; 18 + } // namespace android::app 19 + 20 + namespace android::view { 21 + class SurfaceHolder; 22 + } // namespace android::view 23 + 24 + namespace org::freedesktop::monado::auxiliary { 25 + class MonadoView; 26 + } // namespace org::freedesktop::monado::auxiliary 27 + 28 + } // namespace wrap 29 + 30 + namespace wrap { 31 + namespace org::freedesktop::monado::auxiliary { 32 + /*! 33 + * Wrapper for org.freedesktop.monado.auxiliary.MonadoView objects. 34 + */ 35 + class MonadoView : public ObjectWrapperBase 36 + { 37 + public: 38 + using ObjectWrapperBase::ObjectWrapperBase; 39 + static constexpr const char * 40 + getTypeName() noexcept 41 + { 42 + return "org/freedesktop/monado/auxiliary/MonadoView"; 43 + } 44 + 45 + /*! 46 + * Wrapper for the attachToActivity static method 47 + * 48 + * Java prototype: 49 + * `public static org.freedesktop.monado.auxiliary.MonadoView 50 + * attachToActivity(android.app.Activity);` 51 + * 52 + * JNI signature: 53 + * (Landroid/app/Activity;)Lorg/freedesktop/monado/auxiliary/MonadoView; 54 + * 55 + */ 56 + static MonadoView 57 + attachToActivity(android::app::Activity const &activity); 58 + 59 + /*! 60 + * Wrapper for the waitGetSurfaceHolder method 61 + * 62 + * Java prototype: 63 + * `public android.view.SurfaceHolder 64 + * waitGetSurfaceHolder(int);` 65 + * 66 + * JNI signature: (I)Landroid/view/SurfaceHolder; 67 + * 68 + */ 69 + android::view::SurfaceHolder 70 + waitGetSurfaceHolder(int32_t wait_ms); 71 + 72 + /*! 73 + * Wrapper for the markAsDiscardedByNative method 74 + * 75 + * Java prototype: 76 + * `public void markAsDiscardedByNative();` 77 + * 78 + * JNI signature: ()V 79 + * 80 + */ 81 + void 82 + markAsDiscardedByNative(); 83 + 84 + 85 + /*! 86 + * Initialize the static metadata of this wrapper with a known 87 + * (non-null) Java class. 88 + */ 89 + static void 90 + staticInitClass(jni::jclass clazz) 91 + { 92 + Meta::data(clazz); 93 + } 94 + 95 + /*! 96 + * Class metadata 97 + */ 98 + struct Meta : public MetaBase 99 + { 100 + jni::method_t attachToActivity; 101 + jni::method_t waitGetSurfaceHolder; 102 + jni::method_t markAsDiscardedByNative; 103 + 104 + /*! 105 + * Singleton accessor 106 + */ 107 + static Meta & 108 + data(jni::jclass clazz = nullptr) 109 + { 110 + static Meta instance{clazz}; 111 + return instance; 112 + } 113 + 114 + private: 115 + Meta(jni::jclass clazz); 116 + }; 117 + }; 118 + } // namespace org::freedesktop::monado::auxiliary 119 + } // namespace wrap 120 + #include "org.freedesktop.monado.auxiliary.impl.hpp"
+41
src/xrt/auxiliary/android/org.freedesktop.monado.auxiliary.impl.hpp
··· 1 + // Copyright 2020, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Inline implementations for partially-generated wrapper for the 6 + * `org.freedesktop.monado.auxiliary` Java package - do not include on its own! 7 + * @author Ryan Pavlik <ryan.pavlik@collabora.com> 8 + * @ingroup aux_android 9 + */ 10 + 11 + #pragma once 12 + 13 + #include "wrap/android.app.h" 14 + #include "wrap/android.view.h" 15 + 16 + namespace wrap { 17 + namespace org::freedesktop::monado::auxiliary { 18 + inline MonadoView 19 + MonadoView::attachToActivity(android::app::Activity const &activity) 20 + { 21 + return MonadoView(Meta::data().clazz().call<jni::Object>( 22 + Meta::data().attachToActivity, activity.object())); 23 + } 24 + 25 + inline android::view::SurfaceHolder 26 + MonadoView::waitGetSurfaceHolder(int32_t wait_ms) 27 + { 28 + assert(!isNull()); 29 + return android::view::SurfaceHolder(object().call<jni::Object>( 30 + Meta::data().waitGetSurfaceHolder, wait_ms)); 31 + } 32 + 33 + inline void 34 + MonadoView::markAsDiscardedByNative() 35 + { 36 + assert(!isNull()); 37 + return object().call<void>( 38 + Meta::data().markAsDiscardedByNative); 39 + } 40 + } // namespace org::freedesktop::monado::auxiliary 41 + } // namespace wrap