From 515f0243b9183f8ab285a8cec61c7f1debcf9e70 Mon Sep 17 00:00:00 2001 From: Achim Settelmeier Date: Tue, 5 May 2009 23:33:53 +0200 Subject: [PATCH] MainWindow: fixed problems with maximized window-state when using FVWM2 Added a workaround for FVWM2 as showMaximized() does not work with it unless the window is already visible. --- src/core/main.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index d170ceef6..9406d2c48 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -100,6 +100,7 @@ int main( int argc, char * * argv ) initBasicOps(); bool core_only = false; + bool fullscreen = true; bool exit_after_import = false; QString file_to_load, file_to_save, file_to_import, render_out; @@ -111,7 +112,14 @@ int main( int argc, char * * argv ) QString( argv[i] ) == "-h" ) ) ) { core_only = true; - break; + } + else if( argc > i && QString( argv[i] ) == "-geometry" ) + { + // option -geometry is filtered by Qt later, + // so we need to check its presence now to + // determine, if the application should run in + // fullscreen mode (default, no -geometry given). + fullscreen = false; } } @@ -436,7 +444,11 @@ int main( int argc, char * * argv ) // we try to load given file if( !file_to_load.isEmpty() ) { - engine::getMainWindow()->showMaximized(); + engine::getMainWindow()->show(); + if( fullscreen ) + { + engine::getMainWindow()->showMaximized(); + } engine::getSong()->loadProject( file_to_load ); } else if( !file_to_import.isEmpty() ) @@ -447,12 +459,24 @@ int main( int argc, char * * argv ) { return 0; } - engine::getMainWindow()->showMaximized(); + + engine::getMainWindow()->show(); + if( fullscreen ) + { + engine::getMainWindow()->showMaximized(); + } } else { engine::getSong()->createNewProject(); - engine::getMainWindow()->showMaximized(); + + // [Settel] workaround: showMaximized() doesn't work with + // FVWM2 unless the window is already visible -> show() first + engine::getMainWindow()->show(); + if( fullscreen ) + { + engine::getMainWindow()->showMaximized(); + } } } else