Skip to content

Commit 4589faf

Browse files
authored
Merge pull request #5585 from Susko3/add-more-logging-to-sdl-window
Add more logging to `SDL2DesktopWindow`
2 parents d12d00d + 1572436 commit 4589faf

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

osu.Framework/Platform/SDL2DesktopWindow.cs

+3
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ public virtual void Create()
206206
graphicsBackend.InitialiseBeforeWindowCreation();
207207
SDLWindowHandle = SDL.SDL_CreateWindow(title, Position.X, Position.Y, Size.Width, Size.Height, flags);
208208

209+
if (SDLWindowHandle == IntPtr.Zero)
210+
throw new InvalidOperationException($"Failed to create SDL window. SDL Error: {SDL.SDL_GetError()}");
211+
209212
Exists = true;
210213

211214
graphicsBackend.Initialise(this);

osu.Framework/Platform/SDL2DesktopWindow_Windowing.cs

+2
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ private static bool tryGetDisplayFromSDL(int displayIndex, [NotNullWhen(true)] o
336336

337337
if (SDL.SDL_GetDisplayBounds(displayIndex, out var rect) < 0)
338338
{
339+
Logger.Log($"Failed to get display bounds for display at index ({displayIndex}). SDL Error: {SDL.SDL_GetError()}");
339340
display = null;
340341
return false;
341342
}
@@ -344,6 +345,7 @@ private static bool tryGetDisplayFromSDL(int displayIndex, [NotNullWhen(true)] o
344345

345346
if (numModes <= 0)
346347
{
348+
Logger.Log($"Failed to get display modes for display at index ({displayIndex}) ({rect.w}x{rect.h}). SDL Error: {SDL.SDL_GetError()} ({numModes})");
347349
display = null;
348350
return false;
349351
}

0 commit comments

Comments
 (0)