On Wed, Aug 28, 2024 at 04:48:16PM +0200, Jean-Marc Lasgouttes wrote:
Le 28/08/2024 à 15:54, Jean-Marc Lasgouttes a écrit :
In createAppplication, we have:

#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


Archaeology tells me that it came from win32 code, where the goal was likely to accept and ignore -geometry parameter on non-x11 binaries.

Can I get rid of it? The current platform is known only after creating the QGuiApplication object, and this requires (argv,argc) as argument.

Removing silently these arguments seems a bit silly to me anyway.

Forget about it for now, I have found the code in LyX.cpp, which is redundant with the code in createApplication, if I understand correctly.

I am not sure I understand your concern. That makes the -geometry option work also on Windows. Maybe those lines can be transferred in the following guard, i.e.,

|#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)
|       // On Windows, allow bringing the LyX window to top
|       AllowSetForegroundWindow(ASFW_ANY);
|#endif

might become

|#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
|       // 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;
|               }
|       }
|
|       // On Windows, allow bringing the LyX window to top
|       AllowSetForegroundWindow(ASFW_ANY);
|#endif

so that we can get rid of QPA_XCB?

--
Enrico
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to