Refine editor native window frame contract
This commit is contained in:
@@ -43,6 +43,43 @@ struct EditorHostWindowRuntimeInitializationParams {
|
||||
bool autoCaptureOnStartup = false;
|
||||
};
|
||||
|
||||
struct EditorNativeWindowRuntimeSurface {
|
||||
void* nativeWindowHandle = nullptr;
|
||||
std::uint32_t widthPixels = 0u;
|
||||
std::uint32_t heightPixels = 0u;
|
||||
float dpiScale = 1.0f;
|
||||
|
||||
bool IsValid() const {
|
||||
return nativeWindowHandle != nullptr && widthPixels > 0u && heightPixels > 0u;
|
||||
}
|
||||
};
|
||||
|
||||
struct EditorNativeWindowFrameSnapshot {
|
||||
std::uint32_t widthPixels = 0u;
|
||||
std::uint32_t heightPixels = 0u;
|
||||
float widthDips = 0.0f;
|
||||
float heightDips = 0.0f;
|
||||
float dpiScale = 1.0f;
|
||||
::XCEngine::UI::UIRect workspaceBounds = {};
|
||||
std::vector<::XCEngine::UI::UIInputEvent> inputEvents = {};
|
||||
std::optional<EditorWindowScreenPoint> cursorScreenPoint = {};
|
||||
bool useDetachedTitleBarTabStrip = false;
|
||||
|
||||
bool IsValid() const {
|
||||
return widthPixels > 0u && heightPixels > 0u &&
|
||||
widthDips > 0.0f && heightDips > 0.0f;
|
||||
}
|
||||
};
|
||||
|
||||
struct EditorNativeWindowFrameCommands {
|
||||
bool applyShellRuntimePointerCapture = false;
|
||||
bool applyCurrentCursor = false;
|
||||
};
|
||||
|
||||
struct EditorNativeWindowMetrics {
|
||||
float dpiScale = 1.0f;
|
||||
};
|
||||
|
||||
class EditorWindowNativePeer;
|
||||
|
||||
class EditorHostWindow {
|
||||
@@ -121,27 +158,17 @@ public:
|
||||
virtual ~EditorWindowNativePeer() = default;
|
||||
|
||||
virtual bool HasLiveHostWindow() const = 0;
|
||||
virtual void* GetNativeWindowHandle() const = 0;
|
||||
virtual bool QueryCurrentClientPixelSize(
|
||||
std::uint32_t& outWidth,
|
||||
std::uint32_t& outHeight) const = 0;
|
||||
virtual bool ResolveRenderClientPixelSize(
|
||||
std::uint32_t& outWidth,
|
||||
std::uint32_t& outHeight) const = 0;
|
||||
virtual float GetDpiScale() const = 0;
|
||||
virtual float PixelsToDips(float pixels) const = 0;
|
||||
virtual ::XCEngine::UI::UIRect ResolveWorkspaceBounds(
|
||||
virtual EditorNativeWindowMetrics CaptureMetrics() const = 0;
|
||||
virtual bool CaptureRuntimeSurface(
|
||||
const EditorHostWindow& window,
|
||||
float clientWidthDips,
|
||||
float clientHeightDips) const = 0;
|
||||
virtual bool ShouldUseDetachedTitleBarTabStrip(
|
||||
const EditorHostWindow& window) const = 0;
|
||||
virtual std::vector<::XCEngine::UI::UIInputEvent> TakePendingInputEvents() = 0;
|
||||
virtual std::optional<EditorWindowScreenPoint> QueryCursorScreenPoint() const = 0;
|
||||
virtual void SyncShellCapturedPointerButtonsFromSystemState(
|
||||
const UIEditorShellInteractionState& shellState) = 0;
|
||||
virtual void ApplyShellRuntimePointerCapture(const EditorHostWindow& window) = 0;
|
||||
virtual bool ApplyCurrentCursor() const = 0;
|
||||
EditorNativeWindowRuntimeSurface& outSurface) = 0;
|
||||
virtual bool CaptureFrameSnapshot(
|
||||
const EditorHostWindow& window,
|
||||
const UIEditorShellInteractionState& shellState,
|
||||
EditorNativeWindowFrameSnapshot& outSnapshot) = 0;
|
||||
virtual void ApplyFrameCommands(
|
||||
const EditorHostWindow& window,
|
||||
const EditorNativeWindowFrameCommands& commands) = 0;
|
||||
virtual void AppendChrome(
|
||||
const EditorHostWindow& window,
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
|
||||
Reference in New Issue
Block a user