mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Streamline -geometry command-line option support
Instead of baking our own support for -geometry command line option on
Windows (Qt only does that for Xcb), use the fact that Qt 5 provides
the equivalent -qwindowgeometry flag.
All we need to do is to replace the -geometry option with -qwindowgeometry.
This is part of the effort in ticket #13086 to get rid of the
compile-time QPA_XCB define.
(cherry picked from commit ce9de28f06
)
This commit is contained in:
parent
76ef192214
commit
390f458122
23
src/LyX.cpp
23
src/LyX.cpp
@ -127,8 +127,6 @@ namespace {
|
|||||||
string cl_system_support;
|
string cl_system_support;
|
||||||
string cl_user_support;
|
string cl_user_support;
|
||||||
|
|
||||||
string geometryArg;
|
|
||||||
|
|
||||||
LyX * singleton_ = nullptr;
|
LyX * singleton_ = nullptr;
|
||||||
|
|
||||||
void showFileError(string const & error)
|
void showFileError(string const & error)
|
||||||
@ -611,7 +609,7 @@ void LyX::execCommands()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create the first main window
|
// create the first main window
|
||||||
lyx::dispatch(FuncRequest(LFUN_WINDOW_NEW, geometryArg));
|
lyx::dispatch(FuncRequest(LFUN_WINDOW_NEW));
|
||||||
|
|
||||||
if (!pimpl_->files_to_load_.empty()) {
|
if (!pimpl_->files_to_load_.empty()) {
|
||||||
// if some files were specified at command-line we assume that the
|
// if some files were specified at command-line we assume that the
|
||||||
@ -1342,20 +1340,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(QPA_XCB)
|
|
||||||
// don't remove "-geometry", it will be pruned out later in the
|
|
||||||
// frontend if need be.
|
|
||||||
return -1;
|
|
||||||
#else
|
|
||||||
// but that is only done if QPA_XCB is not defined.
|
|
||||||
return 1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int parse_batch(string const &, string const &, string &)
|
int parse_batch(string const &, string const &, string &)
|
||||||
{
|
{
|
||||||
use_gui = false;
|
use_gui = false;
|
||||||
@ -1433,7 +1417,6 @@ void LyX::easyParse(int & argc, char * argv[])
|
|||||||
cmdmap["--export-to"] = parse_export_to;
|
cmdmap["--export-to"] = parse_export_to;
|
||||||
cmdmap["-i"] = parse_import;
|
cmdmap["-i"] = parse_import;
|
||||||
cmdmap["--import"] = parse_import;
|
cmdmap["--import"] = parse_import;
|
||||||
cmdmap["-geometry"] = parse_geometry;
|
|
||||||
cmdmap["-batch"] = parse_batch;
|
cmdmap["-batch"] = parse_batch;
|
||||||
cmdmap["-f"] = parse_force;
|
cmdmap["-f"] = parse_force;
|
||||||
cmdmap["--force-overwrite"] = parse_force;
|
cmdmap["--force-overwrite"] = parse_force;
|
||||||
@ -1446,6 +1429,10 @@ void LyX::easyParse(int & argc, char * argv[])
|
|||||||
cmdmap["--ignore-error-message"] = parse_ignore_error_message;
|
cmdmap["--ignore-error-message"] = parse_ignore_error_message;
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
|
// Let Qt handle -geometry even when not on X11.
|
||||||
|
if (from_utf8(argv[i]) == "-geometry")
|
||||||
|
argv[i] = const_cast<char *>("-qwindowgeometry");
|
||||||
|
|
||||||
map<string, cmd_helper>::const_iterator it
|
map<string, cmd_helper>::const_iterator it
|
||||||
= cmdmap.find(argv[i]);
|
= cmdmap.find(argv[i]);
|
||||||
|
|
||||||
|
@ -172,20 +172,6 @@ namespace lyx {
|
|||||||
|
|
||||||
frontend::Application * createApplication(int & argc, char * argv[])
|
frontend::Application * createApplication(int & argc, char * argv[])
|
||||||
{
|
{
|
||||||
#if !defined(QPA_XCB)
|
|
||||||
// prune -geometry argument(s) by shifting
|
|
||||||
// the following ones 2 places down.
|
|
||||||
for (int i = 0 ; i < argc ; ++i) {
|
|
||||||
if (strcmp(argv[i], "-geometry") == 0) {
|
|
||||||
int const remove = (i+1) < argc ? 2 : 1;
|
|
||||||
argc -= remove;
|
|
||||||
for (int j = i; j < argc; ++j)
|
|
||||||
argv[j] = argv[j + remove];
|
|
||||||
--i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|
||||||
// On Windows, allow bringing the LyX window to top
|
// On Windows, allow bringing the LyX window to top
|
||||||
AllowSetForegroundWindow(ASFW_ANY);
|
AllowSetForegroundWindow(ASFW_ANY);
|
||||||
|
@ -57,6 +57,8 @@ What's new
|
|||||||
- Speedup interactive use by avoiding expensive math macros bookkeeping
|
- Speedup interactive use by avoiding expensive math macros bookkeeping
|
||||||
when possible.
|
when possible.
|
||||||
|
|
||||||
|
- Make -geometry command-line option work on all platforms.
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user