mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
Android: Block for window changes/surface destruction
This commit is contained in:
parent
368820d6e9
commit
0b4363679c
|
@ -1001,10 +1001,12 @@ DEFINE_JNI_ARGS_METHOD(void, AndroidHostInterface_surfaceChanged, jobject obj, j
|
||||||
if (surface && !native_surface)
|
if (surface && !native_surface)
|
||||||
Log_ErrorPrint("ANativeWindow_fromSurface() returned null");
|
Log_ErrorPrint("ANativeWindow_fromSurface() returned null");
|
||||||
|
|
||||||
|
// We should wait for the emu to finish if the surface is being destroyed or changed.
|
||||||
AndroidHostInterface* hi = AndroidHelpers::GetNativeClass(env, obj);
|
AndroidHostInterface* hi = AndroidHelpers::GetNativeClass(env, obj);
|
||||||
|
const bool block = (!native_surface || native_surface != hi->GetSurface());
|
||||||
hi->RunOnEmulationThread(
|
hi->RunOnEmulationThread(
|
||||||
[hi, native_surface, format, width, height]() { hi->SurfaceChanged(native_surface, format, width, height); },
|
[hi, native_surface, format, width, height]() { hi->SurfaceChanged(native_surface, format, width, height); },
|
||||||
false);
|
block);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_JNI_ARGS_METHOD(void, AndroidHostInterface_setControllerType, jobject obj, jint index, jstring controller_type)
|
DEFINE_JNI_ARGS_METHOD(void, AndroidHostInterface_setControllerType, jobject obj, jint index, jstring controller_type)
|
||||||
|
|
|
@ -24,6 +24,8 @@ public:
|
||||||
AndroidHostInterface(jobject java_object, jobject context_object, std::string user_directory);
|
AndroidHostInterface(jobject java_object, jobject context_object, std::string user_directory);
|
||||||
~AndroidHostInterface() override;
|
~AndroidHostInterface() override;
|
||||||
|
|
||||||
|
ALWAYS_INLINE ANativeWindow* GetSurface() const { return m_surface; }
|
||||||
|
|
||||||
bool Initialize() override;
|
bool Initialize() override;
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue