_wayland normal dragging working
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
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:
@@ -43,6 +43,8 @@ wl_data_device_manager* WaylandDataDeviceManager = nullptr;
|
||||
xdg_wm_base* WaylandXdgWmBase = nullptr;
|
||||
wl_data_device* dataDevice;
|
||||
bool waylandDraggingActive = false;
|
||||
bool waylandDraggingWindow = false;
|
||||
StringView waylandDraggingData = nullptr;
|
||||
|
||||
// X11
|
||||
Delegate<void*> LinuxPlatform::xEventReceived;
|
||||
@@ -640,7 +642,7 @@ public:
|
||||
textData.Window = window;
|
||||
textData.dragOver = &dragOver;
|
||||
auto _window = window->GetSDLWindow();
|
||||
auto _mainwindow = dragSourceWindow->GetSDLWindow();
|
||||
auto _mainwindow = dragSourceWindow != nullptr ? dragSourceWindow->GetSDLWindow() : _window;
|
||||
//if (!window->IsVisible())
|
||||
// _window = mainwindow->GetSDLWindow();
|
||||
//wl_data_source_set_user_data(wrappedDataSource, &textData);
|
||||
@@ -845,6 +847,8 @@ DragDropEffect Window::DoDragDropWayland(const StringView& data, Window* dragSou
|
||||
}
|
||||
|
||||
waylandDraggingActive = true;
|
||||
waylandDraggingWindow = data == String("notawindow");
|
||||
waylandDraggingData = StringView(data.Get(), data.Length());
|
||||
|
||||
auto task = New<WaylandDragDropJob>();
|
||||
task->data = data;
|
||||
@@ -889,6 +893,8 @@ DragDropEffect Window::DoDragDropWayland(const StringView& data, Window* dragSou
|
||||
task->Wait();
|
||||
|
||||
waylandDraggingActive = false;
|
||||
waylandDraggingWindow = false;
|
||||
waylandDraggingData = nullptr;
|
||||
|
||||
return DragDropEffect::None;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ bool SDLPlatform::Init()
|
||||
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "x11", SDL_HINT_OVERRIDE);
|
||||
else if (CommandLine::Options.Wayland)
|
||||
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
|
||||
//else
|
||||
// SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_OVERRIDE);
|
||||
else
|
||||
SDL_SetHintWithPriority(SDL_HINT_VIDEO_DRIVER, "wayland", SDL_HINT_DEFAULT);
|
||||
#endif
|
||||
|
||||
#if PLATFORM_LINUX
|
||||
@@ -82,19 +82,6 @@ bool SDLPlatform::Init()
|
||||
SDL_SetHint(SDL_HINT_WINDOWS_RAW_KEYBOARD, "1");
|
||||
|
||||
SDL_SetHint(SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY, "1");
|
||||
|
||||
if (UsesWindows() || UsesX11())
|
||||
{
|
||||
// Disable SDL clipboard support
|
||||
SDL_SetEventEnabled(SDL_EVENT_CLIPBOARD_UPDATE, false);
|
||||
|
||||
// Disable SDL drag and drop support
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, false);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, false);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_BEGIN, false);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_COMPLETE, false);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_POSITION, false);
|
||||
}
|
||||
|
||||
//if (InitPlatform())
|
||||
// return true;
|
||||
@@ -122,6 +109,19 @@ bool SDLPlatform::Init()
|
||||
if (InitPlatform())
|
||||
return true;
|
||||
|
||||
if (UsesWindows() || UsesX11())
|
||||
{
|
||||
// Disable SDL clipboard support
|
||||
SDL_SetEventEnabled(SDL_EVENT_CLIPBOARD_UPDATE, false);
|
||||
|
||||
// Disable SDL drag and drop support
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, false);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, false);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_BEGIN, false);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_COMPLETE, false);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_POSITION, false);
|
||||
}
|
||||
|
||||
SDLInput::Init();
|
||||
|
||||
SystemDpi = (int)(SDL_GetDisplayContentScale(SDL_GetPrimaryDisplay()) * DefaultDPI);
|
||||
|
||||
@@ -46,6 +46,8 @@ extern wl_seat* WaylandSeat;
|
||||
extern wl_data_device_manager* WaylandDataDeviceManager;
|
||||
extern xdg_wm_base* WaylandXdgWmBase;
|
||||
extern bool waylandDraggingActive;
|
||||
extern bool waylandDraggingWindow;
|
||||
extern StringView waylandDraggingData;
|
||||
#endif
|
||||
|
||||
extern Window* draggedWindow;
|
||||
@@ -592,15 +594,21 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
//const Float2 mousePos = ClientToScreen({ event.drop.x * dpiScale, event.drop.y * dpiScale});
|
||||
const Float2 mousePos = dragStartPosition + Float2(event.drop.x * dpiScale, event.drop.y * dpiScale);
|
||||
DragDropEffect effect = DragDropEffect::None;
|
||||
auto daata = event.drop.data;
|
||||
String text(event.drop.data);
|
||||
|
||||
SDLDropTextData dropData;
|
||||
dropData.Text = text;
|
||||
|
||||
if (event.type == SDL_EVENT_DROP_BEGIN || event.type == SDL_EVENT_DROP_POSITION)
|
||||
{
|
||||
// We don't have the drag data during these events...
|
||||
dropData.Text = waylandDraggingData;
|
||||
}
|
||||
|
||||
|
||||
if (event.type == SDL_EVENT_DROP_BEGIN)
|
||||
{
|
||||
dragStartPosition = GetPosition();//Platform::GetMousePosition();
|
||||
dragStartPosition = waylandDraggingWindow ? GetPosition() : Float2::Zero;//Platform::GetMousePosition();
|
||||
LOG(Info, "SDL_EVENT_DROP_BEGIN: {}, mousepos: {}", dragStartPosition, mousePos);
|
||||
OnDragEnter(&dropData, mousePos, effect);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user