_dragging fixes windows
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:
2025-01-19 22:43:50 +02:00
parent 427c18c54c
commit 692183e1dd
5 changed files with 28 additions and 58 deletions

View File

@@ -159,7 +159,7 @@ namespace FlaxEditor.GUI.Docking
if (_toMove == null)
return;
_toMove.Window?.Window.StopDragging();
_toMove.Window.Window.Opacity = 1.0f;
// Check if window won't be docked
if (_toSet == DockState.Float)
@@ -392,6 +392,9 @@ namespace FlaxEditor.GUI.Docking
// Make sure the all the dock hint areas are not under other windows
_toDock?.RootWindow.Window.BringToFront();
_toMove.RootWindow.Window.BringToFront();
// Make the dragged window transparent when dock hints are visible
_toMove.Window.Window.Opacity = _toDock == null ? 1.0f : 0.4f;
}
// Check dock state to use

View File

@@ -748,23 +748,6 @@ public:
/// <returns>True during the frame the user releases the button</returns>
API_FUNCTION() bool GetMouseButtonUp(MouseButton button) const;
public:
/// <summary>
/// Start dragging the window.
/// </summary>
/// <param name="offset">The position offset for drag from top-left corner.</param>
/// <param name="dragSourceWindow">The source window where the dragging is started from. For attached tabs, this is the parent window</param>
API_FUNCTION() virtual void StartDragging(const Float2& offset, Window* dragSourceWindow)
{
}
/// <summary>
/// Ends dragging the window.
/// </summary>
API_FUNCTION() virtual void StopDragging()
{
}
public:
void OnShow();
void OnResize(int32 width, int32 height);

View File

@@ -53,21 +53,19 @@ bool SDLCALL SDLPlatform::EventMessageHook(void* userdata, MSG* msg)
draggedWindow = window;
draggedWindowStartPosition = draggedWindow->GetClientPosition();
draggedWindowMousePosition.X = static_cast<float>(static_cast<LONG>(WINDOWS_GET_X_LPARAM(msg->lParam)));
draggedWindowMousePosition.Y = static_cast<float>(static_cast<LONG>(WINDOWS_GET_Y_LPARAM(msg->lParam)));
Float2 mousePos(static_cast<float>(static_cast<LONG>(WINDOWS_GET_X_LPARAM(msg->lParam))), static_cast<float>(static_cast<LONG>(WINDOWS_GET_Y_LPARAM(msg->lParam))));
draggedWindowMousePosition = mousePos;
draggedWindowMousePosition -= draggedWindowStartPosition;
//auto hit = static_cast<WindowHitCodes>(msg->wParam);
//if (SDLPlatform::CheckWindowDragging(window, hit))
// return false;
//bool result = false;
//window->OnLeftButtonHit(static_cast<WindowHitCodes>(msg->wParam), result);
//if (result)
bool result = false;
WindowHitCodes hit = static_cast<WindowHitCodes>(msg->wParam);
window->OnHitTest(mousePos, hit, result);
//if (result && hit != WindowHitCodes::Caption)
// return false;
//::ClientToScreen(static_cast<HWND>(window->GetNativePtr()), &p);
//const Float2 mousePos(static_cast<float>(p.x), static_cast<float>(p.y));
SDL_Event event{0};
if (hit == WindowHitCodes::Caption)
{
SDL_Event event{ 0 };
event.button.type = SDL_EVENT_MOUSE_BUTTON_DOWN;
event.button.down = true;
event.button.timestamp = SDL_GetTicksNS();
@@ -79,6 +77,7 @@ bool SDLCALL SDLPlatform::EventMessageHook(void* userdata, MSG* msg)
SDL_PushEvent(&event);
}
}
/*else if (msg->message == WM_NCLBUTTONUP || msg->message == WM_CAPTURECHANGED)
{
windowDragging = false;

View File

@@ -1310,7 +1310,6 @@ DragDropEffect SDLWindow::DoDragDrop(const StringView& data, const Float2& offse
#endif
}
//SetOpacity(0.1f);
#if PLATFORM_LINUX
if (SDLPlatform::UsesWayland()
DoDragDropWayland(String("notawindow"), dragSourceWindow, dragOffset);
@@ -1353,17 +1352,5 @@ DragDropEffect SDLWindow::DoDragDrop(const StringView& data, const Float2& offse
return DragDropEffect::None;
}
void SDLWindow::StartDragging(const Float2& offset, Window* dragSourceWindow)
{
}
void SDLWindow::StopDragging()
{
LOG(Info, "StopDragging");
SetOpacity(1.0f);
//draggingActive = false;
}
#endif

View File

@@ -109,8 +109,6 @@ public:
void StartClippingCursor(const Rectangle& bounds) override;
void EndClippingCursor() override;
void SetCursor(CursorType type) override;
void StartDragging(const Float2& offset, Window* dragSourceWindow) override;
void StopDragging() override;
#if USE_EDITOR && PLATFORM_WINDOWS
// [IUnknown]