Files
libultraship/include/fast/WindowEvent.h
CopilotandKenix3 8813b8233d Remove cross-layer includes from ship namespace (#1097)
* refactor: remove cross-layer includes from Ship namespace

- Remove unused consolevariablebridge.h include from MobileImpl.cpp
- Decouple Context.cpp from fast/debug/GfxDebugger.h by making
  InitGfxDebugger() accept a shared_ptr parameter (like InitWindow/InitControlDeck)
- Remove LUS::GfxDebuggerWindow instantiation from Gui.cpp (should be
  registered from the libultraship layer instead)
- Decouple Config.cpp from fast/backends/gfx_metal.h by using Window's
  available backends list for default fallback selection

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/cc9a3aa8-4ee7-48f2-aa6b-47c2832803a0

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* fix: add null checks for GfxDebugger parameter and Window in Config

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/cc9a3aa8-4ee7-48f2-aa6b-47c2832803a0

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* revert: restore Context.cpp/Context.h GfxDebugger changes to original state

Fast::GfxDebugger is still referenced in Context.h (forward declaration,
GetGfxDebugger return type, mGfxDebugger member), so the previous changes
did not actually decouple the ship layer from fast. Revert to original
InitGfxDebugger() with no parameters; will be addressed in the component
refactor instead.

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/72144527-4404-4a09-8ee6-97c61130d219

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* fix: remove extra blank lines in Config.cpp (clang-format)

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/b4b91158-e788-4d5a-8121-89f36b69cde8

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* fix: add WindowBackend::NONE and return it when no Window is available

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/3a67e462-03be-4cc7-ac96-b56ddbf5d78a

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* refactor: move WindowBackend enum to Fast namespace; use int32_t in ship::Window API

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/526c1d54-6cac-4d86-b948-c31d3abae19f

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* refactor: move all Fast3d ImGui backend dispatch to virtual methods on Window

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/22c50f87-dcd3-4c27-a1a0-cfa9c7a3145b

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* refactor: create Fast3dGui class and restore Window.Backend.Name config string

Addresses review feedback:
1. Move ImGui backend dispatch from Window virtuals to Gui virtuals with
   a new Fast3dGui subclass (extends Ship::Gui). This removes all
   Fast::WindowBackend references from Gui.cpp and places backend-specific
   ImGui logic in the Fast namespace where it belongs.
2. Restore the Window.Backend.Name config string by adding a virtual
   GetWindowBackendName() on Window, overridden in Fast3dWindow.
3. Fast3dWindow default constructors now use Fast3dGui instead of Ship::Gui.

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/314d6c8c-e74d-4055-9d11-b6194fffe3a1

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* style: fix clang-format-14 alignment issues

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/314d6c8c-e74d-4055-9d11-b6194fffe3a1

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* refactor: move WindowEvent to Fast namespace; HandleWindowEvents only on Fast3dGui

Fixes issue #926 (ship including fast):
- WindowEvent was defined in Ship::Gui but only ever used in fast backends
  (gfx_sdl2.cpp, gfx_dxgi.cpp) and Fast3dGui. Moved to Fast::WindowEvent in
  include/fast/WindowEvent.h.
- HandleWindowEvents removed from Ship::Gui virtual interface; it is now a
  plain (non-virtual) method only on Fast3dGui.
- gfx_sdl2 and gfx_dxgi now dynamic_cast the Gui to Fast3dGui with SPDLOG_ERROR
  error handling before dispatching window events.

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/c2e05218-2994-4bc0-ad73-a2ca0dff25ec

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Move window backend persistence from Config to Window

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/4cb4a129-b887-4a82-8512-8383cff2fcba

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Add SetCurrentDimensions and GetPrimaryMonitorRect to Window/Fast3dWindow (PR #785)

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/4cb4a129-b887-4a82-8512-8383cff2fcba

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Push texture cache and Interpreter from Gui down to Fast3dGui

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/4cb4a129-b887-4a82-8512-8383cff2fcba

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Move audio backend persistence from Config to Audio

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/18622f13-a54b-4445-bcd2-7c786d413f81

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Fix migration save, throttle one-time log warnings in SDL2/DXGI backends

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/18622f13-a54b-4445-bcd2-7c786d413f81

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Move GetCurrentAudioChannelsSetting from Config to Audio; move GfxDebugger from Context to Fast3dWindow/Interpreter

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/b347a7d2-c361-44bf-a8fd-fadb3548368e

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Fix Gui.cpp missing GuiTexture.h include; fix GfxDebuggerWindow texture method calls; apply clang-format

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/b347a7d2-c361-44bf-a8fd-fadb3548368e

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Fix clang-format-14 formatting issues in interpreter.cpp and Gui.h

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/3af3f34e-fb61-46b9-afe8-22d4b972a116

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Move InputEditorWindow to libultraship layer (namespace LUS); remove auto-registration from Gui

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/aeb70820-2942-4146-b30a-578c94c0e96d

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Move GuiWindowInitData from Ship::Gui to Fast::Fast3dGui; fix Input Editor null dereference

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/c7448a65-b6af-4808-b92b-05d6a3b80b05

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Fix CI: add Ship:: qualifiers to InputEditorWindow (no using namespace)

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/d5c2b6d8-024a-4809-930d-c35733dd795d

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Fix CI: qualify remaining unqualified Ship:: types in InputEditorWindow

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/5f67d2e4-1fb8-4c76-98f3-aa034a32be9c

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

* Fix CI: qualify Ship::Mobile in Fast3dGui.cpp for Android/iOS builds

Agent-Logs-Url: https://github.com/Kenix3/libultraship/sessions/9812efcb-d1fc-4831-8ed1-db3ecad52b68

Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Kenix3 <18299654+Kenix3@users.noreply.github.com>
2026-05-04 00:00:23 -04:00

33 lines
1.1 KiB
C++

#pragma once
// Fixes issue #926: ship/window/gui/Gui.h previously defined WindowEvent in the Ship namespace,
// but this type is only ever constructed and consumed by Fast3D backend code (gfx_sdl2.cpp,
// gfx_dxgi.cpp) and processed by Fast3dGui::HandleWindowEvents. Moving it to the Fast namespace
// enforces the correct include hierarchy: fast can include fast, ship cannot include fast.
namespace Fast {
/**
* @brief Platform-agnostic wrapper around a window system event.
*
* Constructed by the Fast3D backends (gfx_sdl2, gfx_dxgi) and passed to
* Fast3dGui::HandleWindowEvents() so that the ImGui backend can process input
* events without the ship layer depending on any Fast3D or platform-specific type.
*/
typedef union {
struct {
void* Handle; ///< HWND
int Msg; ///< Windows message ID.
int Param1; ///< WPARAM
int Param2; ///< LPARAM
} Win32;
struct {
void* Event; ///< SDL_Event*
} Sdl;
struct {
void* Input; ///< GX2 input structure pointer.
} Gx2;
} WindowEvent;
} // namespace Fast