# HG changeset patch # User Markus Mützel # Date 1689697732 -7200 # Node ID 2117b017e466498c1154d22983418f216f8a06a9 # Parent 52802f7d049fc4defd54062397648f825570b1d1# Parent ecb84ac8b3171ceb9b3e8fa94f7f6e8e20ce3dc1 maint: Merge release to default. diff -r 52802f7d049f -r 2117b017e466 binary-dist-rules.mk --- a/binary-dist-rules.mk Mon Jul 17 12:06:12 2023 -0400 +++ b/binary-dist-rules.mk Tue Jul 18 18:28:52 2023 +0200 @@ -105,7 +105,7 @@ ## FIXME: We aren't using VPATH? installer-files/octave-launch.exe: $(TOP_DIR)/installer-files/octave-launch.c installer-files/octave-launch.res | installer-files/.dirstamp - $(MXE_CC) $< -o $@ installer-files/octave-launch.res -Wl,--subsystem,windows -lshlwapi -municode -DUNICODE -D_UNICODE $(OCTAVE_LAUNCH_NO_SHORT_CPPFLAGS) + $(MXE_CC) $< -o $@ installer-files/octave-launch.res -lshlwapi -municode -DUNICODE -D_UNICODE $(OCTAVE_LAUNCH_NO_SHORT_CPPFLAGS) .PHONY: octave-launch-firsttime octave-launch-firsttime: installer-files/octave-launch-firsttime.exe diff -r 52802f7d049f -r 2117b017e466 installer-files/octave-launch.c --- a/installer-files/octave-launch.c Mon Jul 17 12:06:12 2023 -0400 +++ b/installer-files/octave-launch.c Tue Jul 18 18:28:52 2023 +0200 @@ -1,7 +1,7 @@ /* - * Wrapper application to set octave env variables and then run octave + * Windows wrapper application to set Octave env variables and then run Octave. * - * Copyright (C) 2020-2021 John Donoghue + * Copyright (C) 2020-2023 John Donoghue * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software @@ -87,11 +87,11 @@ { PROCESS_INFORMATION pi; - // FIXME: There are currently have no checks to ensure that the - // following fixed-size buffers are sufficiently large. MAX_PATH is - // 260 on Winndows by default. But a user might have increased that - // limit to 32767 characters by manually changing policy settings. - // Maybe it would be better if we used C++ and std::string objects? + // FIXME: There are currently no checks to ensure that the following + // fixed-size buffers are sufficiently large. MAX_PATH is 260 on + // Windows by default. But a user might have increased that limit to + // 32767 characters by manually changing policy settings. Maybe it + // would be better if we used C++ and std::string objects? // Note that the use of sizeof(path)-1 will fail if we switch to // using // @@ -125,7 +125,7 @@ #else /* transform to short paths to work around issues with spaces in paths */ - /* FIXME: This won't help on systems with de-activated short paths */ + /* FIXME: This won't help on systems with de-activated short paths. */ nSize = GetShortPathNameW (path, rootpath, PATH_SZ-1); if (nSize == 0) StringCchCopyW (rootpath, PATH_SZ, path); @@ -177,7 +177,7 @@ } } - /* binpath is to the octave bin dir so get the parent */ + /* binpath is to the Octave bin dir so get the parent */ StringCchCopyW (path, PATH_SZ, binpath); ParentDir (path); @@ -352,13 +352,16 @@ StringCchCopyW (argbuffer, ARGBUF_SZ, L"octave.exe "); StringCchCatW (path, PATH_SZ, L"\\octave.exe"); - /* If parent process has a console, attach to it. - Let the function fail silently, when parent has no console - (e.g., when program has been started from link in start menu). - No console will be shown in this case. */ - AttachConsole (ATTACH_PARENT_PROCESS); - - if (! (no_gui_libs || no_gui_arg_found)) + DWORD no_window = 0; + if (no_gui_libs || no_gui_arg_found) + { + /* If parent process has a console, attach to it. + Let the function fail silently, when parent has no console + (e.g., when program has been started from link in start menu). + No console will be shown in this case. */ + AttachConsole (ATTACH_PARENT_PROCESS); + } + else { /* Unless --no-gui or --no-gui-libs is specified, we will use a GUI window. */ si.dwFlags = STARTF_USESHOWWINDOW; @@ -369,6 +372,12 @@ if (! gui_arg_found) StringCchCatW (argbuffer, ARGBUF_SZ, L"--gui "); + + /* Detach from the console to allow hiding it. */ + FreeConsole (); + + /* Suppress creating a new console when starting the GUI. */ + no_window = CREATE_NO_WINDOW; } /* quote and append each arg */ @@ -385,7 +394,7 @@ NULL, // Process handle not inheritable NULL, // Thread handle not inheritable FALSE, // Set handle inheritance to FALSE - 0, // No creation flags + no_window | CREATE_UNICODE_ENVIRONMENT, // Creation flags NULL, // Use parent's environment block NULL, // Use parent's starting directory &si, // Pointer to STARTUPINFO