monado/src/xrt/auxiliary/android/org.freedesktop.monado.auxiliary.impl.hpp

65 lines
1.8 KiB
C++
Raw Normal View History

2021-04-30 15:35:28 +00:00
// Copyright 2020-2021, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Inline implementations for partially-generated wrapper for the
* `org.freedesktop.monado.auxiliary` Java package - do not include on its own!
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
* @ingroup aux_android
*/
#pragma once
#include "wrap/android.app.h"
#include "wrap/android.view.h"
2021-04-30 15:35:28 +00:00
namespace wrap {
namespace org::freedesktop::monado::auxiliary {
inline MonadoView
2021-01-14 14:13:48 +00:00
MonadoView::attachToActivity(android::app::Activity const &activity, void *nativePointer)
{
return MonadoView(Meta::data().clazz().call<jni::Object>(
Meta::data().attachToActivity, activity.object(),
2021-04-30 15:35:28 +00:00
static_cast<long long>(reinterpret_cast<uintptr_t>(nativePointer))));
}
2021-04-30 15:35:28 +00:00
inline MonadoView
MonadoView::attachToActivity(android::app::Activity const &activity)
{
return MonadoView(
Meta::data().clazz().call<jni::Object>(Meta::data().attachToActivity1, activity.object()));
}
inline jni::Object
MonadoView::getDisplayMetrics(android::app::Activity const &activity)
{
return Meta::data().clazz().call<jni::Object>(Meta::data().getDisplayMetrics, activity.object());
}
inline void *
MonadoView::getNativePointer()
{
assert(!isNull());
2021-04-30 15:35:28 +00:00
return reinterpret_cast<void *>(
static_cast<intptr_t>(object().call<long long>(Meta::data().getNativePointer)));
}
inline void
MonadoView::markAsDiscardedByNative()
{
assert(!isNull());
2021-01-14 14:13:48 +00:00
return object().call<void>(Meta::data().markAsDiscardedByNative);
}
2021-04-30 15:35:28 +00:00
inline android::view::SurfaceHolder
MonadoView::waitGetSurfaceHolder(int32_t wait_ms)
{
2021-04-30 15:35:28 +00:00
assert(!isNull());
return android::view::SurfaceHolder(
object().call<jni::Object>(Meta::data().waitGetSurfaceHolder, wait_ms));
}
} // namespace org::freedesktop::monado::auxiliary
} // namespace wrap