diff --git a/Apps/Playground/X11/App.cpp b/Apps/Playground/X11/App.cpp index af59771b3..252d4a375 100644 --- a/Apps/Playground/X11/App.cpp +++ b/Apps/Playground/X11/App.cpp @@ -75,7 +75,8 @@ namespace Babylon::DebugTrace::SetTraceOutput([](const char* trace) { printf("%s\n", trace); fflush(stdout); }); Babylon::Graphics::Configuration graphicsConfig{}; - graphicsConfig.Window = window; + Display* display = XOpenDisplay(NULL); + graphicsConfig.Window = std::make_tuple(window, display); graphicsConfig.Width = static_cast(width); graphicsConfig.Height = static_cast(height); graphicsConfig.MSAASamples = 4; diff --git a/Apps/UnitTests/X11/App.cpp b/Apps/UnitTests/X11/App.cpp index d3ad4fbd0..e6b367b01 100644 --- a/Apps/UnitTests/X11/App.cpp +++ b/Apps/UnitTests/X11/App.cpp @@ -46,7 +46,7 @@ int main() XStoreName(display, window, applicationName); Babylon::Graphics::Configuration config{}; - config.Window = window; + config.Window = std::make_tuple(window, display); config.Width = static_cast(width); config.Height = static_cast(height); @@ -54,4 +54,4 @@ int main() Babylon::DebugTrace::SetTraceOutput([](const char* trace) { printf("%s\n", trace); fflush(stdout); }); return RunTests(config); -} \ No newline at end of file +} diff --git a/Core/Graphics/Include/Platform/Unix/Babylon/Graphics/Platform.h b/Core/Graphics/Include/Platform/Unix/Babylon/Graphics/Platform.h index 4ae32778a..d129c30ef 100644 --- a/Core/Graphics/Include/Platform/Unix/Babylon/Graphics/Platform.h +++ b/Core/Graphics/Include/Platform/Unix/Babylon/Graphics/Platform.h @@ -2,7 +2,9 @@ #include +#include + namespace Babylon::Graphics { - using WindowT = Window; + using WindowT = std::tuple; } diff --git a/Core/Graphics/Source/DeviceImpl_Unix.cpp b/Core/Graphics/Source/DeviceImpl_Unix.cpp index 80c9df92e..dd4f8b254 100644 --- a/Core/Graphics/Source/DeviceImpl_Unix.cpp +++ b/Core/Graphics/Source/DeviceImpl_Unix.cpp @@ -5,19 +5,20 @@ namespace Babylon::Graphics { void DeviceImpl::ConfigureBgfxPlatformData(bgfx::PlatformData& pd, WindowT window) { - pd.nwh = reinterpret_cast(window); + pd.nwh = reinterpret_cast(std::get<0>(window)); + pd.ndt = reinterpret_cast(std::get<1>(window)); } void DeviceImpl::ConfigureBgfxRenderType(bgfx::PlatformData& /*pd*/, bgfx::RendererType::Enum& /*renderType*/) { } - float DeviceImpl::GetDevicePixelRatio(WindowT) + float DeviceImpl::GetDevicePixelRatio(WindowT window) { // TODO: We should persist a Display object instead of opening a new display. // See https://github.com/BabylonJS/BabylonNative/issues/625 - auto display = XOpenDisplay(nullptr); + auto display = std::get<1>(window); auto screen = DefaultScreen(display); auto width = DisplayWidthMM(display, screen); @@ -36,4 +37,4 @@ namespace Babylon::Graphics return 1; } -} \ No newline at end of file +} diff --git a/Plugins/TestUtils/Source/Unix/TestUtilsImpl.cpp b/Plugins/TestUtils/Source/Unix/TestUtilsImpl.cpp index ee30b66f0..5dfb2c7cb 100644 --- a/Plugins/TestUtils/Source/Unix/TestUtilsImpl.cpp +++ b/Plugins/TestUtils/Source/Unix/TestUtilsImpl.cpp @@ -17,7 +17,7 @@ namespace Babylon::Plugins::Internal { void TestUtils::Exit(const Napi::CallbackInfo& info) { - auto window = (Window)m_implData->m_window; + auto window = (Window)std::get<0>(m_implData->m_window); const int32_t exitCode = info[0].As().Int32Value(); Plugins::TestUtils::errorCode = exitCode; Display* display = XOpenDisplay(NULL); @@ -38,7 +38,7 @@ namespace Babylon::Plugins::Internal { const auto title = info[0].As().Utf8Value(); Display* display = XOpenDisplay(NULL); - auto window = (Window)m_implData->m_window; + auto window = (Window)std::get<0>(m_implData->m_window); XStoreName(display, window, title.c_str()); } @@ -64,4 +64,4 @@ namespace Babylon::Plugins::TestUtils auto implData{std::make_shared(window)}; Internal::TestUtils::CreateInstance(env, implData); } -} \ No newline at end of file +}