aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Innes2001-06-11 11:00:24 +0000
committerAndrew Innes2001-06-11 11:00:24 +0000
commita55a5f3c869451baf82d3b0065f90622f2b29820 (patch)
treed424a4189a6faaca1f99db59e005279f0c5b3e5e /src
parent6eb51c108cfd0eec8bf67c73b3e902f0eda666db (diff)
downloademacs-a55a5f3c869451baf82d3b0065f90622f2b29820.tar.gz
emacs-a55a5f3c869451baf82d3b0065f90622f2b29820.zip
(create_child): Add new parameter is_gui_app.
(w32_executable_type): Add new parameter is_gui_app. (sys_spawnve): Use it. (sys_kill): Fake ^C for SIGINT, and ^Break (if possible) for SIGQUIT. This matches better how the signals are interpreted by MSVC compiled programs. (syms_of_ntproc): Update docstring.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/w32proc.c35
2 files changed, 33 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6bd26813216..f775a250c5d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12001-06-11 Andrew Innes <andrewi@gnu.org>
2
3 * w32proc.c (create_child): Add new parameter is_gui_app.
4 (w32_executable_type): Add new parameter is_gui_app.
5 (sys_spawnve): Use it.
6 (sys_kill): Fake ^C for SIGINT, and ^Break (if possible) for
7 SIGQUIT. This matches better how the signals are interpreted by
8 MSVC compiled programs.
9 (syms_of_ntproc): Update docstring.
10
12001-06-02 Stefan Monnier <monnier@cs.yale.edu> 112001-06-02 Stefan Monnier <monnier@cs.yale.edu>
2 12
3 * xterm.c (clear_mouse_face): Reset dpyinfo->mouse_face_overlay as 13 * xterm.c (clear_mouse_face): Reset dpyinfo->mouse_face_overlay as
diff --git a/src/w32proc.c b/src/w32proc.c
index a2b5000b88d..8d5890b86dd 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -304,7 +304,7 @@ reader_thread (void *arg)
304static char * process_dir; 304static char * process_dir;
305 305
306static BOOL 306static BOOL
307create_child (char *exe, char *cmdline, char *env, 307create_child (char *exe, char *cmdline, char *env, int is_gui_app,
308 int * pPid, child_process *cp) 308 int * pPid, child_process *cp)
309{ 309{
310 STARTUPINFO start; 310 STARTUPINFO start;
@@ -321,7 +321,7 @@ create_child (char *exe, char *cmdline, char *env,
321 start.cb = sizeof (start); 321 start.cb = sizeof (start);
322 322
323#ifdef HAVE_NTGUI 323#ifdef HAVE_NTGUI
324 if (NILP (Vw32_start_process_show_window)) 324 if (NILP (Vw32_start_process_show_window) && !is_gui_app)
325 start.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; 325 start.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
326 else 326 else
327 start.dwFlags = STARTF_USESTDHANDLES; 327 start.dwFlags = STARTF_USESTDHANDLES;
@@ -571,7 +571,7 @@ get_result:
571} 571}
572 572
573void 573void
574w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app) 574w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app, int * is_gui_app)
575{ 575{
576 file_data executable; 576 file_data executable;
577 char * p; 577 char * p;
@@ -579,6 +579,7 @@ w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app)
579 /* Default values in case we can't tell for sure. */ 579 /* Default values in case we can't tell for sure. */
580 *is_dos_app = FALSE; 580 *is_dos_app = FALSE;
581 *is_cygnus_app = FALSE; 581 *is_cygnus_app = FALSE;
582 *is_gui_app = FALSE;
582 583
583 if (!open_input_file (&executable, filename)) 584 if (!open_input_file (&executable, filename))
584 return; 585 return;
@@ -599,7 +600,7 @@ w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app)
599 extension, which is defined in the registry. */ 600 extension, which is defined in the registry. */
600 p = egetenv ("COMSPEC"); 601 p = egetenv ("COMSPEC");
601 if (p) 602 if (p)
602 w32_executable_type (p, is_dos_app, is_cygnus_app); 603 w32_executable_type (p, is_dos_app, is_cygnus_app, is_gui_app);
603 } 604 }
604 else 605 else
605 { 606 {
@@ -651,6 +652,11 @@ w32_executable_type (char * filename, int * is_dos_app, int * is_cygnus_app)
651 break; 652 break;
652 } 653 }
653 } 654 }
655
656 /* Check whether app is marked as a console or windowed (aka
657 GUI) app. Accept Posix and OS2 subsytem apps as console
658 apps. */
659 *is_gui_app = (nt_header->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI);
654 } 660 }
655 } 661 }
656 662
@@ -714,7 +720,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
714 int arglen, numenv; 720 int arglen, numenv;
715 int pid; 721 int pid;
716 child_process *cp; 722 child_process *cp;
717 int is_dos_app, is_cygnus_app; 723 int is_dos_app, is_cygnus_app, is_gui_app;
718 int do_quoting = 0; 724 int do_quoting = 0;
719 char escape_char; 725 char escape_char;
720 /* We pass our process ID to our children by setting up an environment 726 /* We pass our process ID to our children by setting up an environment
@@ -757,8 +763,11 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
757 executable that is implicitly linked to the Cygnus dll (implying it 763 executable that is implicitly linked to the Cygnus dll (implying it
758 was compiled with the Cygnus GNU toolchain and hence relies on 764 was compiled with the Cygnus GNU toolchain and hence relies on
759 cygwin.dll to parse the command line - we use this to decide how to 765 cygwin.dll to parse the command line - we use this to decide how to
760 escape quote chars in command line args that must be quoted). */ 766 escape quote chars in command line args that must be quoted).
761 w32_executable_type (cmdname, &is_dos_app, &is_cygnus_app); 767
768 Also determine whether it is a GUI app, so that we don't hide its
769 initial window unless specifically requested. */
770 w32_executable_type (cmdname, &is_dos_app, &is_cygnus_app, &is_gui_app);
762 771
763 /* On Windows 95, if cmdname is a DOS app, we invoke a helper 772 /* On Windows 95, if cmdname is a DOS app, we invoke a helper
764 application to start it by specifying the helper app as cmdname, 773 application to start it by specifying the helper app as cmdname,
@@ -992,7 +1001,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
992 } 1001 }
993 1002
994 /* Now create the process. */ 1003 /* Now create the process. */
995 if (!create_child (cmdname, cmdline, env, &pid, cp)) 1004 if (!create_child (cmdname, cmdline, env, is_gui_app, &pid, cp))
996 { 1005 {
997 delete_child (cp); 1006 delete_child (cp);
998 errno = ENOEXEC; 1007 errno = ENOEXEC;
@@ -1383,18 +1392,19 @@ sys_kill (int pid, int sig)
1383 EnumWindows (find_child_console, (LPARAM) cp); 1392 EnumWindows (find_child_console, (LPARAM) cp);
1384 } 1393 }
1385 1394
1386 if (sig == SIGINT) 1395 if (sig == SIGINT || sig == SIGQUIT)
1387 { 1396 {
1388 if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd) 1397 if (NILP (Vw32_start_process_share_console) && cp && cp->hwnd)
1389 { 1398 {
1390 BYTE control_scan_code = (BYTE) MapVirtualKey (VK_CONTROL, 0); 1399 BYTE control_scan_code = (BYTE) MapVirtualKey (VK_CONTROL, 0);
1391 BYTE vk_break_code = VK_CANCEL; 1400 /* Fake Ctrl-C for SIGINT, and Ctrl-Break for SIGQUIT. */
1401 BYTE vk_break_code = (sig == SIGINT) ? 'C' : VK_CANCEL;
1392 BYTE break_scan_code = (BYTE) MapVirtualKey (vk_break_code, 0); 1402 BYTE break_scan_code = (BYTE) MapVirtualKey (vk_break_code, 0);
1393 HWND foreground_window; 1403 HWND foreground_window;
1394 1404
1395 if (break_scan_code == 0) 1405 if (break_scan_code == 0)
1396 { 1406 {
1397 /* Fake Ctrl-C if we can't manage Ctrl-Break. */ 1407 /* Fake Ctrl-C for SIGQUIT if we can't manage Ctrl-Break. */
1398 vk_break_code = 'C'; 1408 vk_break_code = 'C';
1399 break_scan_code = (BYTE) MapVirtualKey (vk_break_code, 0); 1409 break_scan_code = (BYTE) MapVirtualKey (vk_break_code, 0);
1400 } 1410 }
@@ -2154,7 +2164,8 @@ will be chosen based on the type of the program.");
2154 DEFVAR_LISP ("w32-start-process-show-window", 2164 DEFVAR_LISP ("w32-start-process-show-window",
2155 &Vw32_start_process_show_window, 2165 &Vw32_start_process_show_window,
2156 "When nil, new child processes hide their windows.\n\ 2166 "When nil, new child processes hide their windows.\n\
2157When non-nil, they show their window in the method of their choice."); 2167When non-nil, they show their window in the method of their choice.\n\
2168This variable doesn't affect GUI applications, which will never be hidden.");
2158 Vw32_start_process_show_window = Qnil; 2169 Vw32_start_process_show_window = Qnil;
2159 2170
2160 DEFVAR_LISP ("w32-start-process-share-console", 2171 DEFVAR_LISP ("w32-start-process-share-console",