Make Viewport input events fully Qt based (#2142)

* Make Viewport input events fully Qt based.

This should fix an issue with Qt touch event -> mouse event translation in the Editor, and may also fix issues with the Mac Editor and remote desktop (though, lacking the requisite hardware, I can test precisely none of these things personally).

See https://github.com/o3de/o3de/issues/1889

- Adapted LegacyViewportCameraController to use Movement::X & Y (mostly for testing purposes, it's on the slate for being removed soon)
- Moved cursor capture logic from RenderViewportWidget into QtEventToAzInputManager so that it can make sure it generates correct movement deltas
- Removed ViewportMouseCursorRequests::PreviousViewportCursorScreenPosition to have our viewport controllers use our dedicated Movement::X and Y channels instead, which will work in the launcher

Signed-off-by: nvsickle <nvsickle@amazon.com>

* Address review feedback

Signed-off-by: nvsickle <nvsickle@amazon.com>

* Fix Linux build

Signed-off-by: nvsickle <nvsickle@amazon.com>
This commit is contained in:
Nicholas Van Sickle
2021-07-13 20:58:48 -07:00
committed by GitHub
parent 11327b59ea
commit 867ae23664
7 changed files with 93 additions and 72 deletions
@@ -109,7 +109,6 @@ namespace AtomToolsFramework
void BeginCursorCapture() override;
void EndCursorCapture() override;
AzFramework::ScreenPoint ViewportCursorScreenPosition() override;
AZStd::optional<AzFramework::ScreenPoint> PreviousViewportCursorScreenPosition() override;
bool IsMouseOver() const override;
// AzFramework::WindowRequestBus::Handler ...
@@ -160,8 +159,6 @@ namespace AtomToolsFramework
AZ::ScriptTimePoint m_time;
// Whether the Viewport is currently hiding and capturing the cursor position.
bool m_capturingCursor = false;
// The last known position of the mouse cursor, if one is available.
AZStd::optional<QPoint> m_lastCursorPosition;
// The viewport settings (e.g. grid snapping, grid size) for this viewport.
const AzToolsFramework::ViewportInteraction::ViewportSettings* m_viewportSettings = nullptr;
// Maps our internal Qt events into AzFramework InputChannels for our ViewportControllerList.