summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-09-08 05:14:35 +1000
committer Vas Crabb <vas@vastheman.com>2023-09-08 05:14:35 +1000
commit44eb5ea3c69dcec37e2b687e479297af5303efc3 (patch)
tree2784753bdf56564ce3b4cf0f410bf07709854fdd /3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
parent1147d8fc44c701ed0235e9374f97d218fae37b32 (diff)
Revert "Updated bgfx, bx and bimg to current upstream versions. (#11493)"
This reverts commit 1c61ccfe840cdae7a9f92292946a45f3b47e2412.
Diffstat (limited to '3rdparty/bgfx/examples/common/entry/entry_sdl.cpp')
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_sdl.cpp67
1 files changed, 22 insertions, 45 deletions
diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
index 2d5e9c15e76..8744b98e763 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2022 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
@@ -50,24 +50,21 @@ namespace entry
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
# if ENTRY_CONFIG_USE_WAYLAND
- if (wmi.subsystem == SDL_SYSWM_WAYLAND)
- {
- wl_egl_window *win_impl = (wl_egl_window*)SDL_GetWindowData(_window, "wl_egl_window");
- if(!win_impl)
- {
- int width, height;
- SDL_GetWindowSize(_window, &width, &height);
- struct wl_surface* surface = wmi.info.wl.surface;
- if(!surface)
- return nullptr;
- win_impl = wl_egl_window_create(surface, width, height);
- SDL_SetWindowData(_window, "wl_egl_window", win_impl);
- }
- return (void*)(uintptr_t)win_impl;
- }
- else
-# endif // ENTRY_CONFIG_USE_WAYLAND
- return (void*)wmi.info.x11.window;
+ wl_egl_window *win_impl = (wl_egl_window*)SDL_GetWindowData(_window, "wl_egl_window");
+ if(!win_impl)
+ {
+ int width, height;
+ SDL_GetWindowSize(_window, &width, &height);
+ struct wl_surface* surface = wmi.info.wl.surface;
+ if(!surface)
+ return nullptr;
+ win_impl = wl_egl_window_create(surface, width, height);
+ SDL_SetWindowData(_window, "wl_egl_window", win_impl);
+ }
+ return (void*)(uintptr_t)win_impl;
+# else
+ return (void*)wmi.info.x11.window;
+# endif
# elif BX_PLATFORM_OSX || BX_PLATFORM_IOS
return wmi.info.cocoa.window;
# elif BX_PLATFORM_WINDOWS
@@ -508,7 +505,7 @@ namespace entry
{
bx::AllocatorI* allocator = getAllocator();
uint32_t size = (uint32_t)bx::getSize(reader);
- void* data = bx::alloc(allocator, size + 1);
+ void* data = BX_ALLOC(allocator, size + 1);
bx::read(reader, data, size, bx::ErrorAssert{});
bx::close(reader);
((char*)data)[size] = '\0';
@@ -517,7 +514,7 @@ namespace entry
DBG("SDL game controller add mapping failed: %s", SDL_GetError());
}
- bx::free(allocator, data);
+ BX_FREE(allocator, data);
}
bool exit = false;
@@ -1148,35 +1145,15 @@ namespace entry
{
return NULL;
}
-# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
-# if ENTRY_CONFIG_USE_WAYLAND
- if (wmi.subsystem == SDL_SYSWM_WAYLAND)
- return wmi.info.wl.display;
- else
-# endif // ENTRY_CONFIG_USE_WAYLAND
- return wmi.info.x11.display;
-# else
- return NULL;
-# endif // BX_PLATFORM_*
- }
- bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
- {
- SDL_SysWMinfo wmi;
- SDL_VERSION(&wmi.version);
- if (!SDL_GetWindowWMInfo(s_ctx.m_window[_handle.idx], &wmi) )
- {
- return bgfx::NativeWindowHandleType::Default;
- }
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
# if ENTRY_CONFIG_USE_WAYLAND
- if (wmi.subsystem == SDL_SYSWM_WAYLAND)
- return bgfx::NativeWindowHandleType::Wayland;
- else
+ return wmi.info.wl.display;
+# else
+ return wmi.info.x11.display;
# endif // ENTRY_CONFIG_USE_WAYLAND
- return bgfx::NativeWindowHandleType::Default;
# else
- return bgfx::NativeWindowHandleType::Default;
+ return NULL;
# endif // BX_PLATFORM_*
}