Fix loss of window size and position, if it was maximized.

This commit is contained in:
Bartosz Taudul 2018-10-05 20:23:54 +02:00
parent 3b241baa52
commit 28c176d3aa

View File

@ -348,14 +348,16 @@ int main( int argc, char** argv )
FILE* f = fopen( winPosFile.c_str(), "wb" ); FILE* f = fopen( winPosFile.c_str(), "wb" );
if( f ) if( f )
{ {
glfwGetWindowPos( window, &x, &y );
glfwGetWindowSize( window, &w, &h );
#ifdef GLFW_MAXIMIZED #ifdef GLFW_MAXIMIZED
uint32_t maximized = glfwGetWindowAttrib( window, GLFW_MAXIMIZED ); uint32_t maximized = glfwGetWindowAttrib( window, GLFW_MAXIMIZED );
if( maximized ) glfwRestoreWindow( window );
#else #else
uint32_t maximized = 0; uint32_t maximized = 0;
#endif #endif
glfwGetWindowPos( window, &x, &y );
glfwGetWindowSize( window, &w, &h );
uint32_t data[5] = { uint32_t( x ), uint32_t( y ), uint32_t( w ), uint32_t( h ), maximized }; uint32_t data[5] = { uint32_t( x ), uint32_t( y ), uint32_t( w ), uint32_t( h ), maximized };
fwrite( data, 1, sizeof( data ), f ); fwrite( data, 1, sizeof( data ), f );
fclose( f ); fclose( f );