From 27592680920d8baf9a1dd555d41a1e9a0ec2c96a Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 9 Oct 2008 07:19:34 +0000 Subject: [PATCH] X dependency cleanup (1/3) Move the special handling of -geometry command option from LyX to GuiApplication, where it belongs git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26823 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyX.cpp | 7 ------- src/frontends/qt4/GuiApplication.cpp | 13 +++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/LyX.cpp b/src/LyX.cpp index 1c0609331c..0bcd05aa65 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -1057,13 +1057,6 @@ int parse_import(string const & type, string const & file, string & batch) int parse_geometry(string const & arg1, string const &, string &) { geometryArg = arg1; -#if defined(_WIN32) || (defined(__CYGWIN__) && defined(X_DISPLAY_MISSING)) - // remove also the arg - return 1; -#else - // don't remove "-geometry" - return -1; -#endif } diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 3a3f11bce4..a851ff56c6 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -131,6 +131,19 @@ namespace lyx { frontend::Application * createApplication(int & argc, char * argv[]) { +#ifndef Q_WS_X11 + // prune -geometry argument(s) by shifting + // the following ones 2 places down. + for (int i = 0 ; i < argc ; ++i) { + if (argv[i] == "-geometry") { + int const remove = (i+1) < argc ? 2 : 1; + argc -= remove; + for (int j = i; j < argc; ++j) + argv[j] = argv[j + remove]; + --i; + } + } +#endif return new frontend::GuiApplication(argc, argv); }