Cleanup
This commit is contained in:
@@ -41,22 +41,21 @@ void LinuxVulkanPlatform::CreateSurface(Window* window, GPUDeviceVulkan* device,
|
||||
VALIDATE_VULKAN_RESULT(vkCreateXlibSurfaceKHR(instance, &surfaceCreateInfo, nullptr, surface));
|
||||
#else
|
||||
SDLWindow* sdlWindow = static_cast<Window*>(window);
|
||||
X11::Window x11Window = (X11::Window)sdlWindow->GetX11WindowHandle();
|
||||
wl_surface* waylandSurface = (wl_surface*)sdlWindow->GetWaylandSurfacePtr();
|
||||
if (waylandSurface != nullptr)
|
||||
void* windowHandle = window->GetNativePtr();
|
||||
if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
VkWaylandSurfaceCreateInfoKHR surfaceCreateInfo;
|
||||
RenderToolsVulkan::ZeroStruct(surfaceCreateInfo, VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR);
|
||||
surfaceCreateInfo.display = (wl_display*)sdlWindow->GetWaylandDisplay();
|
||||
surfaceCreateInfo.surface = waylandSurface;
|
||||
surfaceCreateInfo.surface = (wl_surface*)windowHandle;
|
||||
VALIDATE_VULKAN_RESULT(vkCreateWaylandSurfaceKHR(instance, &surfaceCreateInfo, nullptr, surface));
|
||||
}
|
||||
else if (x11Window != 0)
|
||||
else if (SDLPlatform::UsesX11())
|
||||
{
|
||||
VkXlibSurfaceCreateInfoKHR surfaceCreateInfo;
|
||||
RenderToolsVulkan::ZeroStruct(surfaceCreateInfo, VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR);
|
||||
surfaceCreateInfo.dpy = (X11::Display*)sdlWindow->GetX11Display();
|
||||
surfaceCreateInfo.window = x11Window;
|
||||
surfaceCreateInfo.window = (X11::Window)windowHandle;
|
||||
VALIDATE_VULKAN_RESULT(vkCreateXlibSurfaceKHR(instance, &surfaceCreateInfo, nullptr, surface));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -656,7 +656,7 @@ DragDropEffect Window::DoDragDropX11(const StringView& data)
|
||||
#if !PLATFORM_SDL
|
||||
X11::Window mainWindow = _window;
|
||||
#else
|
||||
X11::Window mainWindow = static_cast<X11::Window>(GetX11WindowHandle());
|
||||
X11::Window mainWindow = reinterpret_cast<X11::Window>(GetNativePtr());
|
||||
#endif
|
||||
|
||||
// Make sure SDL hasn't grabbed the pointer, and force ungrab it
|
||||
@@ -1105,7 +1105,7 @@ void SDLClipboard::SetText(const StringView& text)
|
||||
|
||||
if (X11Impl::xDisplay)
|
||||
{
|
||||
X11::Window window = (X11::Window)(mainWindow->GetX11WindowHandle());
|
||||
X11::Window window = (X11::Window)(mainWindow->GetNativePtr());
|
||||
X11Impl::ClipboardText.Set(text.Get(), text.Length());
|
||||
X11::XSetSelectionOwner(X11Impl::xDisplay, X11Impl::xAtomClipboard, window, CurrentTime); // CLIPBOARD
|
||||
//X11::XSetSelectionOwner(xDisplay, xAtomPrimary, window, CurrentTime); // XA_PRIMARY
|
||||
@@ -1135,7 +1135,7 @@ String SDLClipboard::GetText()
|
||||
return result;
|
||||
if (X11Impl::xDisplay)
|
||||
{
|
||||
X11::Window window = static_cast<X11::Window>(mainWindow->GetX11WindowHandle());
|
||||
X11::Window window = reinterpret_cast<X11::Window>(mainWindow->GetNativePtr());
|
||||
|
||||
X11Impl::ClipboardGetText(result, X11Impl::xAtomClipboard, X11Impl::xAtomUTF8String, window);
|
||||
if (result.HasChars())
|
||||
|
||||
@@ -221,21 +221,11 @@ SDL_Window* SDLWindow::GetSDLWindow() const
|
||||
|
||||
#if PLATFORM_LINUX
|
||||
|
||||
void* SDLWindow::GetWaylandSurfacePtr() const
|
||||
{
|
||||
return SDL_GetPointerProperty(SDL_GetWindowProperties(_window), SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, nullptr);
|
||||
}
|
||||
|
||||
void* SDLWindow::GetWaylandDisplay() const
|
||||
{
|
||||
return SDL_GetPointerProperty(SDL_GetWindowProperties(_window), SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER, nullptr);
|
||||
}
|
||||
|
||||
uintptr SDLWindow::GetX11WindowHandle() const
|
||||
{
|
||||
return (uintptr)SDL_GetNumberProperty(SDL_GetWindowProperties(_window), SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0);
|
||||
}
|
||||
|
||||
void* SDLWindow::GetX11Display() const
|
||||
{
|
||||
return SDL_GetPointerProperty(SDL_GetWindowProperties(_window), SDL_PROP_WINDOW_X11_DISPLAY_POINTER, nullptr);
|
||||
|
||||
@@ -56,7 +56,6 @@ public:
|
||||
~SDLWindow();
|
||||
|
||||
private:
|
||||
|
||||
static SDLWindow* GetWindowFromEvent(const SDL_Event& event);
|
||||
static SDLWindow* GetWindowWithSDLWindow(SDL_Window* window);
|
||||
void HandleEvent(SDL_Event& event);
|
||||
@@ -64,18 +63,10 @@ private:
|
||||
void CheckForWindowResize();
|
||||
void UpdateCursor();
|
||||
|
||||
#if PLATFORM_LINUX
|
||||
DragDropEffect DoDragDropWayland(const StringView& data, Window* dragSourceWindow = nullptr, Float2 dragOffset = Float2::Zero);
|
||||
DragDropEffect DoDragDropX11(const StringView& data);
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
SDL_Window* GetSDLWindow() const;
|
||||
#if PLATFORM_LINUX
|
||||
void* GetWaylandSurfacePtr() const;
|
||||
void* GetWaylandDisplay() const;
|
||||
uintptr GetX11WindowHandle() const;
|
||||
void* GetX11Display() const;
|
||||
#endif
|
||||
|
||||
@@ -128,6 +119,10 @@ public:
|
||||
Windows::HRESULT __stdcall DragLeave() override;
|
||||
Windows::HRESULT __stdcall Drop(Windows::IDataObject* pDataObj, Windows::DWORD grfKeyState, Windows::POINTL pt, Windows::DWORD* pdwEffect) override;
|
||||
#endif
|
||||
#if PLATFORM_LINUX
|
||||
DragDropEffect DoDragDropWayland(const StringView& data, Window* dragSourceWindow = nullptr, Float2 dragOffset = Float2::Zero);
|
||||
DragDropEffect DoDragDropX11(const StringView& data);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user