_wayland fixes
Some checks are pending
Build Android / Game (Android, Release ARM64) (push) Waiting to run
Build iOS / Game (iOS, Release ARM64) (push) Waiting to run
Build Linux / Editor (Linux, Development x64) (push) Waiting to run
Build Linux / Game (Linux, Release x64) (push) Waiting to run
Build macOS / Editor (Mac, Development ARM64) (push) Waiting to run
Build macOS / Game (Mac, Release ARM64) (push) Waiting to run
Build Windows / Editor (Windows, Development x64) (push) Waiting to run
Build Windows / Game (Windows, Release x64) (push) Waiting to run
Cooker / Cook (Mac) (push) Waiting to run
Tests / Tests (Linux) (push) Waiting to run
Tests / Tests (Windows) (push) Waiting to run
Some checks are pending
Build Android / Game (Android, Release ARM64) (push) Waiting to run
Build iOS / Game (iOS, Release ARM64) (push) Waiting to run
Build Linux / Editor (Linux, Development x64) (push) Waiting to run
Build Linux / Game (Linux, Release x64) (push) Waiting to run
Build macOS / Editor (Mac, Development ARM64) (push) Waiting to run
Build macOS / Game (Mac, Release ARM64) (push) Waiting to run
Build Windows / Editor (Windows, Development x64) (push) Waiting to run
Build Windows / Game (Windows, Release x64) (push) Waiting to run
Cooker / Cook (Mac) (push) Waiting to run
Tests / Tests (Linux) (push) Waiting to run
Tests / Tests (Windows) (push) Waiting to run
This commit is contained in:
@@ -54,7 +54,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
window.MouseUp += OnMouseUp;
|
||||
|
||||
// Update rectangles
|
||||
UpdateRects();
|
||||
UpdateRects(Platform.MousePosition);
|
||||
|
||||
_dragSourceWindow = dragSourceWindow;
|
||||
if (_dragSourceWindow != null) // Detaching a tab from existing window
|
||||
@@ -63,13 +63,14 @@ namespace FlaxEditor.GUI.Docking
|
||||
|
||||
// TODO: when detaching tab in floating window (not main window), the drag source window is still main window?
|
||||
var dragSourceWindowWayland = toMove.MasterPanel?.RootWindow.Window ?? Editor.Instance.Windows.MainWindow;
|
||||
window.DoDragDrop("", _dragOffset, dragSourceWindowWayland);
|
||||
window.DoDragDrop(window.Title, _dragOffset, dragSourceWindowWayland);
|
||||
|
||||
_dragSourceWindow.MouseUp += OnMouseUp; // The mouse up event is sent to the source window on Windows
|
||||
}
|
||||
else
|
||||
{
|
||||
window.DoDragDrop("", _dragOffset, window);
|
||||
_dragOffset = window.MousePosition;
|
||||
window.DoDragDrop(window.Title, _dragOffset, window);
|
||||
}
|
||||
|
||||
// Ensure the dragged window stays on top of every other window
|
||||
@@ -163,7 +164,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// Start dragging a floating dock panel.
|
||||
/// </summary>
|
||||
/// <param name="toMove">Floating dock panel to move.</param>
|
||||
/// <returns>The dock hint window object.</returns>
|
||||
/// <returns>The window drag helper object.</returns>
|
||||
public static WindowDragHelper StartDragging(FloatWindowDockPanel toMove)
|
||||
{
|
||||
if (toMove == null)
|
||||
@@ -176,7 +177,8 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// Start dragging a docked panel into a floating window.
|
||||
/// </summary>
|
||||
/// <param name="toMove">Dock window to move.</param>
|
||||
/// <returns>The dock hint window object.</returns>
|
||||
/// <param name="dragSourceWindow">The window where dragging started from.</param>
|
||||
/// <returns>The window drag helper object.</returns>
|
||||
public static WindowDragHelper StartDragging(DockWindow toMove, Window dragSourceWindow)
|
||||
{
|
||||
if (toMove == null)
|
||||
@@ -235,10 +237,10 @@ namespace FlaxEditor.GUI.Docking
|
||||
_dockHintDown = _dockHintUp = _dockHintLeft = _dockHintRight = _dockHintCenter = null;
|
||||
}
|
||||
|
||||
private void UpdateRects()
|
||||
private void UpdateRects(Float2 mousePos)
|
||||
{
|
||||
// Cache mouse position
|
||||
_mouse = Platform.MousePosition;
|
||||
_mouse = mousePos;
|
||||
|
||||
// Check intersection with any dock panel
|
||||
DockPanel dockPanel = null;
|
||||
@@ -430,6 +432,9 @@ namespace FlaxEditor.GUI.Docking
|
||||
private void OnUpdate()
|
||||
{
|
||||
var mousePos = Platform.MousePosition;
|
||||
if (_toMove.Window.Window.IsFocused)
|
||||
return; // Filter out mouse updates after dragging is over in dragged window
|
||||
|
||||
if (_mouse != mousePos)
|
||||
OnMouseMove(mousePos);
|
||||
}
|
||||
@@ -437,9 +442,9 @@ namespace FlaxEditor.GUI.Docking
|
||||
private void OnMouseMove(Float2 mousePos)
|
||||
{
|
||||
if (_dragSourceWindow != null)
|
||||
_toMove.Window.Window.Position = mousePos - _dragOffset;
|
||||
_toMove.Window.Window.Position = mousePos - _dragOffset; // Ignored on Wayland
|
||||
|
||||
UpdateRects();
|
||||
UpdateRects(mousePos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +82,8 @@ bool SDLPlatform::Init()
|
||||
SDL_SetHint(SDL_HINT_WINDOWS_RAW_KEYBOARD, "1");
|
||||
|
||||
SDL_SetHint(SDL_HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY, "1");
|
||||
|
||||
//#if PLATFORM_WINDOWS
|
||||
//if (UsesWindows() || UsesX11())
|
||||
|
||||
if (UsesWindows() || UsesX11())
|
||||
{
|
||||
// Disable SDL clipboard support
|
||||
SDL_SetEventEnabled(SDL_EVENT_CLIPBOARD_UPDATE, false);
|
||||
@@ -96,7 +95,6 @@ bool SDLPlatform::Init()
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_COMPLETE, false);
|
||||
SDL_SetEventEnabled(SDL_EVENT_DROP_POSITION, false);
|
||||
}
|
||||
//#endif
|
||||
|
||||
//if (InitPlatform())
|
||||
// return true;
|
||||
|
||||
@@ -572,7 +572,7 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
}
|
||||
return;
|
||||
}
|
||||
#if true
|
||||
#if PLATFORM_LINUX
|
||||
case SDL_EVENT_CLIPBOARD_UPDATE:
|
||||
{
|
||||
LOG(Info, "SDL_EVENT_CLIPBOARD_UPDATE");
|
||||
@@ -584,45 +584,48 @@ void SDLWindow::HandleEvent(SDL_Event& event)
|
||||
case SDL_EVENT_DROP_TEXT:
|
||||
case SDL_EVENT_DROP_COMPLETE:
|
||||
{
|
||||
//LOG(Info, "SDL_EVENT_DROP_BEGIN");
|
||||
if (SDLPlatform::UsesWayland())
|
||||
{
|
||||
static Float2 dragStartPosition = Float2::Zero;
|
||||
|
||||
static Float2 dragStartPosition = Float2::Zero;
|
||||
auto dpiScale = GetDpiScale();
|
||||
//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;
|
||||
|
||||
auto dpiScale = GetDpiScale();
|
||||
//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;
|
||||
|
||||
SDLDropTextData dropData;
|
||||
SDLDropTextData dropData;
|
||||
|
||||
|
||||
|
||||
if (event.type == SDL_EVENT_DROP_BEGIN)
|
||||
{
|
||||
dragStartPosition = Platform::GetMousePosition();
|
||||
OnDragEnter(&dropData, mousePos, effect);
|
||||
if (event.type == SDL_EVENT_DROP_BEGIN)
|
||||
{
|
||||
dragStartPosition = GetPosition();//Platform::GetMousePosition();
|
||||
LOG(Info, "SDL_EVENT_DROP_BEGIN: {}, mousepos: {}", dragStartPosition, mousePos);
|
||||
OnDragEnter(&dropData, mousePos, effect);
|
||||
}
|
||||
else if (event.type == SDL_EVENT_DROP_POSITION)
|
||||
{
|
||||
LOG(Info, "SDL_EVENT_DROP_POSITION: {}", mousePos);
|
||||
Input::Mouse->OnMouseMove(mousePos, this);
|
||||
OnDragOver(&dropData, mousePos, effect);
|
||||
}
|
||||
else if (event.type == SDL_EVENT_DROP_FILE)
|
||||
OnDragDrop(&dropData, mousePos, effect);
|
||||
else if (event.type == SDL_EVENT_DROP_TEXT)
|
||||
OnDragDrop(&dropData, mousePos, effect);
|
||||
else if (event.type == SDL_EVENT_DROP_COMPLETE)
|
||||
OnDragLeave();
|
||||
/*Focus();
|
||||
Float2 mousePosition;
|
||||
SDL_GetGlobalMouseState(&mousePosition.X, &mousePosition.Y);
|
||||
mousePosition = ScreenToClient(mousePosition);
|
||||
|
||||
DragDropEffect effect;
|
||||
SDLDropTextData dropData;
|
||||
OnDragEnter(&dropData, mousePosition, effect);
|
||||
OnDragOver(&dropData, mousePosition, effect);*/
|
||||
}
|
||||
else if (event.type == SDL_EVENT_DROP_POSITION)
|
||||
{
|
||||
Input::Mouse->OnMouseMove(mousePos, this);
|
||||
OnDragOver(&dropData, mousePos, effect);
|
||||
}
|
||||
else if (event.type == SDL_EVENT_DROP_FILE)
|
||||
OnDragDrop(&dropData, mousePos, effect);
|
||||
else if (event.type == SDL_EVENT_DROP_TEXT)
|
||||
OnDragDrop(&dropData, mousePos, effect);
|
||||
else if (event.type == SDL_EVENT_DROP_COMPLETE)
|
||||
OnDragLeave();
|
||||
/*Focus();
|
||||
Float2 mousePosition;
|
||||
SDL_GetGlobalMouseState(&mousePosition.X, &mousePosition.Y);
|
||||
mousePosition = ScreenToClient(mousePosition);
|
||||
|
||||
DragDropEffect effect;
|
||||
SDLDropTextData dropData;
|
||||
OnDragEnter(&dropData, mousePosition, effect);
|
||||
OnDragOver(&dropData, mousePosition, effect);*/
|
||||
break;
|
||||
}
|
||||
/*case SDL_EVENT_DROP_POSITION:
|
||||
|
||||
Reference in New Issue
Block a user