_wayland temp investigate
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled

This commit is contained in:
2025-01-10 11:28:22 +02:00
parent 2fc6e95ec3
commit 387eb90576
12 changed files with 122 additions and 77 deletions

View File

@@ -576,14 +576,14 @@ public:
int64 ExitFlag = 0;
StringView data;
SDLWindow* window;
SDLWindow* mainwindow;
int64 dragOver = 0;
int64 waitFlag = 0;
// [ThreadPoolTask]
bool Run() override
{
Scripting::GetScriptsDomain()->Dispatch();
bool dragWindow = data == String("notawindow");
wl_display* wrappedDisplay = WaylandDisplay;//(wl_display*)wl_proxy_create_wrapper(WaylandDisplay);
//wl_proxy_set_queue((wl_proxy*)wrappedDisplay, queue);
@@ -614,7 +614,7 @@ public:
/*auto */dataDevice = wl_data_device_manager_get_data_device(wrappedManager, WaylandSeat);
wl_data_device_add_listener(dataDevice, &WaylandDataDeviceListener, nullptr);
wl_display_roundtrip(wrappedDisplay);
wl_data_device_set_user_data(dataDevice, window);
wl_data_device_set_user_data(dataDevice, dragWindow ? mainwindow : window);
wrappedDataDevice = (wl_data_device*)wl_proxy_create_wrapper(dataDevice);
wl_proxy_set_queue((wl_proxy*)wrappedDataDevice, WaylandQueue);
}
@@ -623,7 +623,7 @@ public:
dataSource = wl_data_device_manager_create_data_source(wrappedManager);
wrappedDataSource = (wl_data_source*)wl_proxy_create_wrapper(dataSource);
wl_proxy_set_queue((wl_proxy*)wrappedDataSource, WaylandQueue);
if (data == String("awindow"))
if (dragWindow)
{
wl_data_source_offer(dataSource, "flaxengine/window");
wl_data_source_offer(dataSource, "text/plain;charset=utf-8"); // TODO: needs support for custom mime-types in SDL
@@ -641,6 +641,9 @@ public:
textData.Window = window;
textData.dragOver = &dragOver;
auto _window = window->GetSDLWindow();
auto _mainwindow = mainwindow->GetSDLWindow();
//if (!window->IsVisible())
// _window = mainwindow->GetSDLWindow();
//wl_data_source_set_user_data(wrappedDataSource, &textData);
wl_data_source_add_listener(dataSource, &WaylandDataSourceListener, &textData);
@@ -660,13 +663,13 @@ public:
xdg_toplevel* wrappedToplevel = nullptr;
{
wl_surface* origin = (wl_surface*)SDL_GetPointerProperty(SDL_GetWindowProperties(_window), SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, nullptr);
wl_surface* origin = (wl_surface*)SDL_GetPointerProperty(SDL_GetWindowProperties(_mainwindow), SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, nullptr);
wl_surface* icon = nullptr;
uint32 id = ImplicitGrabSerial;
//id = (uint32)SDL_GetNumberProperty(SDL_GetGlobalProperties(), "wayland.serial", 0);
wl_data_device_start_drag((wl_data_device*)SDL_GetPointerProperty(SDL_GetGlobalProperties(), "wayland.data_device", wrappedDataDevice), dataSource, origin, icon, id);
if (data == String("awindow"))
if (dragWindow)
{
if (toplevel != nullptr)
{
@@ -729,7 +732,7 @@ public:
if (wl_display_roundtrip_queue(wrappedDisplay, WaylandQueue) == -1)
LOG(Warning, "err wl_display_roundtrip_queue: {}", errno);
if (toplevel == nullptr && data == String("awindow"))
if (toplevel == nullptr && dragWindow)
{
if (Platform::AtomicRead(&waitFlag) != 0)
{
@@ -816,6 +819,7 @@ DragDropEffect Window::DoDragDropWayland(const StringView& data)
auto task = New<WaylandDragDropJob>();
task->data = data;
task->window = this;
task->mainwindow = Engine::MainWindow;
task->dragOver = 0;
Task::StartNew(task);
while (task->GetState() == TaskState::Queued)
@@ -826,15 +830,15 @@ DragDropEffect Window::DoDragDropWayland(const StringView& data)
Platform::Sleep(1);
}
Show();
//Show();
//Focus();
int counter = 100;
while (Platform::AtomicRead(&task->dragOver) == 0)
{
SDLPlatform::Tick();
Engine::OnUpdate(); // For docking updates
Engine::OnDraw();
//Scripting::Update(); // For docking updates
//Engine::OnDraw();
Platform::Sleep(1);
@@ -1720,7 +1724,7 @@ void WaylandRegistryGlobal(void* data, wl_registry *registry, uint32 id, const c
StringAnsi interfaceStr(interface);
//LOG(Info, "WaylandRegistryGlobal id: {}, interface: {}", id, String(interface));
if (interfaceStr == "xdg_toplevel_drag_manager_v1")
DragManager = (xdg_toplevel_drag_manager_v1*)wl_registry_bind(registry, id, &xdg_toplevel_drag_manager_v1_interface, 1U);
DragManager = (xdg_toplevel_drag_manager_v1*)wl_registry_bind(registry, id, &xdg_toplevel_drag_manager_v1_interface, Math::Min(1U, version));
else if (interfaceStr == "wl_seat")
{
WaylandSeat = (wl_seat*)wl_registry_bind(registry, id, &wl_seat_interface, Math::Min(9U, version));