fix(window): ensure SDL3/Wayland window is mapped by pumping events after ShowWindow

- Remove ALWAYS_ON_TOP and debug print hacks.
- Pump SDL events after SDL_ShowWindow so the Wayland compositor maps the window.
- Clean run.sh: do not force DISPLAY or SDL_VIDEODRIVER, let SDL3 auto-detect.
This commit is contained in:
emil28092005
2026-06-18 00:38:16 +03:00
parent aa93b55a74
commit ee98e4ad08
2 changed files with 8 additions and 7 deletions
+3 -7
View File
@@ -11,13 +11,9 @@ ENGINE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
export DOTNET_ROOT="${DOTNET_ROOT:-$HOME/.dotnet}" export DOTNET_ROOT="${DOTNET_ROOT:-$HOME/.dotnet}"
export PATH="$DOTNET_ROOT:$PATH" export PATH="$DOTNET_ROOT:$PATH"
# Prefer Wayland if available, fall back to X11 # Auto-detect Wayland. SDL3 bundled with ppy.SDL3-CS supports both Wayland and X11;
if [ -n "$WAYLAND_DISPLAY" ]; then # let it choose based on available display servers. Do NOT force DISPLAY here.
export SDL_VIDEODRIVER="${SDL_VIDEODRIVER:-wayland}" unset SDL_VIDEODRIVER 2>/dev/null
else
export DISPLAY="${DISPLAY:-:0}"
export SDL_VIDEODRIVER="${SDL_VIDEODRIVER:-x11}"
fi
cd "$ENGINE_DIR" cd "$ENGINE_DIR"
exec dotnet run --project "$ENGINE_DIR/src/CortexEngine.App/CortexEngine.App.csproj" -c Debug -- "$@" exec dotnet run --project "$ENGINE_DIR/src/CortexEngine.App/CortexEngine.App.csproj" -c Debug -- "$@"
+5
View File
@@ -46,6 +46,11 @@ public sealed unsafe class Sdl3Window : IWindow
SDL3.SDL_ShowWindow(_window); SDL3.SDL_ShowWindow(_window);
SDL3.SDL_RaiseWindow(_window); SDL3.SDL_RaiseWindow(_window);
// On Wayland, the compositor needs an event round-trip before mapping
// the window. Pump events to flush the show request without blocking.
SDL_Event flushEvt;
while (SDL3.SDL_PollEvent(&flushEvt)) { }
} }
public void PumpEvents() public void PumpEvents()