Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Fixing window positioning bug in Mac OS X #225

Merged
merged 2 commits into from May 18, 2014
Merged

Fixing window positioning bug in Mac OS X #225

merged 2 commits into from May 18, 2014

Conversation

ghost
Copy link

@ghost ghost commented May 18, 2014

by moving the call to SDL_GetWindowPosition before SDL_SetWindowSize since OS X windows resize from the bottom left corner (not the top left as in Windows) which means that resizing the window will push the top edge up higher, but SDL_GetWindowPosition returns the top-left corner of the window, which has now shifted up. So we have to query the position prior to resizing if we want the proper previous location values.

This fixes both the default window position (which was wrong if you set anything other than the default resolution) as well as the position of the window when resizing it programmatically.

…etWindowPosition before SDL_SetWindowSize since OS X windows resize from the bottom left corner (not the top left as in Windows).
@@ -213,6 +213,15 @@ int clientHeight
IsBorderless ? SDL.SDL_bool.SDL_FALSE : SDL.SDL_bool.SDL_TRUE
);

// Because Mac resizes from the bottom, we have to get the position before changing
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiline comments use /* */ blocks, per the not-at-all-hidden style guide:

#147

Other than that, this all seems fine to me. To be honest I'm not sure how well this previously worked on certain Linux setups, either...

flibitijibibo added a commit that referenced this pull request May 18, 2014
…ter-osx

Fixing window positioning bug in Mac OS X
@flibitijibibo flibitijibibo merged commit 90183e9 into flibitijibibo:monogame-sdl2 May 18, 2014
@ghost ghost deleted the brushfiregames/window-center-osx branch May 19, 2014 02:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant