From c7092239e5a64c6e7e7b0b70ba6907ce670c9725 Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Sun, 15 Feb 2009 22:06:09 +0000 Subject: [PATCH] Do not add arguments that Qt may not understand. I missed that we don't actually require current qt-copy (which is more or less 4.5) in trunk. Quick & dirty runtime Qt version detection copied from Thiago's code in kcmdlineargs.cpp. svn path=/trunk/KDE/kdebase/workspace/; revision=926646 --- main.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index 6e0bc60501..f2df628331 100644 --- a/main.cpp +++ b/main.cpp @@ -474,16 +474,24 @@ KDE_EXPORT int kdemain( int argc, char * argv[] ) aboutData.addAuthor( ki18n( "Daniel M. Duley" ),KLocalizedString(), "mosfet@kde.org" ); aboutData.addAuthor( ki18n( "Luboš Luňák" ), ki18n( "Maintainer" ), "l.lunak@kde.org" ); - // HACK: append "--graphicssystem native" to argument list to force KWin to use this backend - int myargc = argc + 2; - char **myargv = (char **)malloc( ( myargc + 1 ) * sizeof(char *) ); - for ( int i = 0; i < argc; i++ ) + int myargc = argc; + char **myargv = argv; +#if QT_VERSION >= 0x040a00 +# error Qt version larger than 4.9, please fix me +#endif + if (qVersion()[2] >= '5') { - myargv[i] = argv[i]; + // HACK: append "--graphicssystem native" to argument list to force KWin to use this backend + myargc = argc + 2; + myargv = (char **)malloc( ( myargc + 1 ) * sizeof(char *) ); + for ( int i = 0; i < argc; i++ ) + { + myargv[i] = argv[i]; + } + myargv[ argc ] = "--graphicssystem"; + myargv[ argc + 1 ] = "native"; + myargv[ argc + 2 ] = 0; } - myargv[ argc ] = "--graphicssystem"; - myargv[ argc + 1 ] = "native"; - myargv[ argc + 2 ] = 0; KCmdLineArgs::init( myargc, myargv, &aboutData );