implement option `-b` for `x` hot key (to open a new xschem`s process) on Windows. (Joannne)

This commit is contained in:
Stefan Frederik 2021-12-04 01:50:05 +01:00
parent e3ab569f35
commit 8832830d91
3 changed files with 16 additions and 12 deletions

View File

@ -284,11 +284,15 @@ void new_window(const char* cell, int symbol)
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
if (!cell || !cell[0]) {
if (!symbol)
my_snprintf(cmd_line, S(cmd_line), "%s -b -s", xschem_executable);
/* "detach" (-b) is not processed for Windows, so
use DETACHED_PROCESS in CreateProcessA to not create
a TCL shell
*/
if (!cell || !cell[0]) {
if (!symbol)
my_snprintf(cmd_line, S(cmd_line), "%s -b -s --tcl \"set XSCHEM_START_WINDOW {}\"", xschem_executable);
else
my_snprintf(cmd_line, S(cmd_line), "%s -b -y", xschem_executable);
my_snprintf(cmd_line, S(cmd_line), "%s -b -y --tcl \"set XSCHEM_START_WINDOW {}\"", xschem_executable);
}
else if (!symbol) {
my_snprintf(cmd_line, S(cmd_line), "%s -b -s \"%s\"", xschem_executable, cell);
@ -304,7 +308,7 @@ void new_window(const char* cell, int symbol)
NULL, /* Process handle not inheritable */
NULL, /* Thread handle not inheritable */
FALSE, /* Set handle inheritance to FALSE */
CREATE_NEW_CONSOLE, /* Opens file in a separate console */
DETACHED_PROCESS, /* Opens file in a separate console */
NULL, /* Use parent's environment block */
NULL, /* Use parent's starting directory */
&si, /* Pointer to STARTUPINFO structure */

View File

@ -86,8 +86,9 @@ int main(int argc, char **argv)
fprintf(errfp, "main(): no DISPLAY set, assuming no X available\n");
/* detach from console (fork a child and close std file descriptors) */
#ifdef __unix__
if(detach) {
#ifdef __unix__
pid_t pid = fork();
if(pid < 0) {
fprintf(errfp, "main(): fork() failed\n");
@ -106,8 +107,8 @@ int main(int argc, char **argv)
/* terminate parent */
exit(0);
}
}
#endif
}
if(has_x) Tk_Main(1, argv, Tcl_AppInit);
else Tcl_Main(1, argv, Tcl_AppInit);

View File

@ -1831,6 +1831,9 @@ int Tcl_AppInit(Tcl_Interp *inter)
char * tmp;
char filename[PATH_MAX];
tmp = (char *) tclgetvar("XSCHEM_START_WINDOW");
#ifndef __unix__
change_to_unix_fn(tmp);
#endif
dbg(1, "Tcl_AppInit(): tmp=%s\n", tmp? tmp: "NULL");
my_strncpy(filename, abs_sym_path(tmp, ""), S(filename));
/* if do_netlist=1 call load_schematic with 'reset_undo=0' avoiding call
@ -1924,11 +1927,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
/* */
if(
#ifdef __unix__
!detach &&
#endif
!no_readline) {
if(!detach && !no_readline) {
tcleval( "if {![catch {package require tclreadline}]} "
"{::tclreadline::readline builtincompleter 0;"
/* "::tclreadline::readline customcompleter completer;" */