Skip to content

Commit

Permalink
Check for negative window positions and set sensible default.
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rgb committed Sep 10, 2017
1 parent 733e156 commit 34e5309
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/sdl_milton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,17 @@ milton_main(char* file_to_open)
milton_die_gracefully("SDL could not create window\n");
}

// Sometimes SDL sets the window position such that it's impossible to move
// without using Windows shortcuts that not everyone knows. Check if this
// is the case and set a good default.
{
int x = 0, y = 0;
SDL_GetWindowPosition(window, &x, &y);
if ( x < 0 && y < 0 ) {
SDL_SetWindowPosition(window, 100, 100);
}
}

SDL_GLContext gl_context = SDL_GL_CreateContext(window);

if ( !gl_context ) {
Expand Down

0 comments on commit 34e5309

Please sign in to comment.