|
|
|
@@ -1,6 +1,6 @@ |
|
|
|
/* |
|
|
|
* DISTRHO Plugin Framework (DPF) |
|
|
|
* Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> |
|
|
|
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> |
|
|
|
* |
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any purpose with |
|
|
|
* or without fee is hereby granted, provided that the above copyright notice and this |
|
|
|
@@ -27,20 +27,20 @@ typedef std::list<DGL_NAMESPACE::Window*>::reverse_iterator WindowListReverseIte |
|
|
|
|
|
|
|
static d_ThreadHandle getCurrentThreadHandle() noexcept |
|
|
|
{ |
|
|
|
#ifdef DISTRHO_OS_WINDOWS |
|
|
|
#ifdef DISTRHO_OS_WINDOWS |
|
|
|
return GetCurrentThread(); |
|
|
|
#else |
|
|
|
#else |
|
|
|
return pthread_self(); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
static bool isThisTheMainThread(const d_ThreadHandle mainThreadHandle) noexcept |
|
|
|
{ |
|
|
|
#ifdef DISTRHO_OS_WINDOWS |
|
|
|
#ifdef DISTRHO_OS_WINDOWS |
|
|
|
return GetCurrentThread() == mainThreadHandle; // IsGUIThread ? |
|
|
|
#else |
|
|
|
#else |
|
|
|
return pthread_equal(getCurrentThreadHandle(), mainThreadHandle) != 0; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
@@ -66,12 +66,16 @@ Application::PrivateData::PrivateData(const bool standalone) |
|
|
|
{ |
|
|
|
DISTRHO_SAFE_ASSERT_RETURN(world != nullptr,); |
|
|
|
|
|
|
|
#ifdef DGL_USING_SDL |
|
|
|
SDL_Init(SDL_INIT_EVENTS|SDL_INIT_TIMER|SDL_INIT_VIDEO); |
|
|
|
#else |
|
|
|
puglSetWorldHandle(world, this); |
|
|
|
#ifdef __EMSCRIPTEN__ |
|
|
|
puglSetWorldString(world, PUGL_CLASS_NAME, "canvas"); |
|
|
|
#else |
|
|
|
puglSetWorldString(world, PUGL_CLASS_NAME, DISTRHO_MACRO_AS_STRING(DGL_NAMESPACE)); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
Application::PrivateData::~PrivateData() |
|
|
|
@@ -82,8 +86,12 @@ Application::PrivateData::~PrivateData() |
|
|
|
windows.clear(); |
|
|
|
idleCallbacks.clear(); |
|
|
|
|
|
|
|
#ifdef DGL_USING_SDL |
|
|
|
SDL_Quit(); |
|
|
|
#else |
|
|
|
if (world != nullptr) |
|
|
|
puglFreeWorld(world); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
@@ -149,13 +157,13 @@ void Application::PrivateData::quit() |
|
|
|
|
|
|
|
isQuitting = true; |
|
|
|
|
|
|
|
#ifndef DPF_TEST_APPLICATION_CPP |
|
|
|
#ifndef DPF_TEST_APPLICATION_CPP |
|
|
|
for (WindowListReverseIterator rit = windows.rbegin(), rite = windows.rend(); rit != rite; ++rit) |
|
|
|
{ |
|
|
|
DGL_NAMESPACE::Window* const window(*rit); |
|
|
|
window->close(); |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
double Application::PrivateData::getTime() const |
|
|
|
|