Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 1 addition & 35 deletions Platforms/Game/.SDL2/SDLGameWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,16 +537,6 @@ internal void EndScreenDeviceChange(int clientWidth, int clientHeight, bool will
_height = clientHeight;
}

if (!_wasMoved)
{
int posX = prevBounds.X + ((prevBounds.Width - clientWidth) / 2);
int posY = prevBounds.Y + ((prevBounds.Height - clientHeight) / 2);
SDL.WINDOW.GetBorderSize(_handle, out int borderTop, out int borderLeft, out int borderBottom, out int borderRight);
posX = Math.Max(posX, borderLeft);
posY = Math.Max(posY, borderTop);
SDL.WINDOW.SetPosition(Handle, posX, posY);
}

if (!_isFullScreen)
OnClientSizeChanged();

Expand All @@ -568,19 +558,7 @@ internal void EndScreenDeviceChange(int clientWidth, int clientHeight, bool will

if (!_wasMoved)
{
if (_isFullScreen)
{
// This centering only occurs when exiting fullscreen
// so it should center the window on the current display.

// We need to get the display information again in case
// the resolution of it was changed.
SDL.DISPLAY.GetBounds(windowDisplayIndex, out displayBounds);
int posX = displayBounds.X + displayBounds.Width / 2 - clientWidth / 2;
int posY = displayBounds.Y + displayBounds.Height / 2 - clientHeight / 2;
SDL.WINDOW.SetPosition(Handle, posX, posY);
}
else
if (!_isFullScreen)
{
int posX = prevBounds.X + ((prevBounds.Width - clientWidth) / 2);
int posY = prevBounds.Y + ((prevBounds.Height - clientHeight) / 2);
Expand All @@ -605,8 +583,6 @@ internal void EndScreenDeviceChange(int clientWidth, int clientHeight, bool will

internal void EndCreateDevice(int clientWidth, int clientHeight, bool willBeFullScreen, bool willBeExclusiveFullScreen)
{
Rectangle prevBounds = ClientBounds;

int windowDisplayIndex = SDL.DISPLAY.GetWindowDisplayIndex(Handle);
SDL.DISPLAY.GetBounds(windowDisplayIndex, out Sdl.Rectangle displayBounds);

Expand All @@ -633,16 +609,6 @@ internal void EndCreateDevice(int clientWidth, int clientHeight, bool willBeFull
_height = clientHeight;
}

if (!_wasMoved)
{
int posX = prevBounds.X + ((prevBounds.Width - clientWidth) / 2);
int posY = prevBounds.Y + ((prevBounds.Height - clientHeight) / 2);
SDL.WINDOW.GetBorderSize(_handle, out int borderTop, out int borderLeft, out int borderBottom, out int borderRight);
posX = Math.Max(posX, borderLeft);
posY = Math.Max(posY, borderTop);
SDL.WINDOW.SetPosition(Handle, posX, posY);
}

OnClientSizeChanged();

_isFullScreen = true;
Expand Down
Loading