aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeoff Voelker1995-11-07 07:35:38 +0000
committerGeoff Voelker1995-11-07 07:35:38 +0000
commit58d4e829a2c3db394349149a8b215b0bef4b18e7 (patch)
treef1237dca240be953c30aee2de6ea6d495dea2047 /src
parent6e72ba86635487989ef98deaf923d0eeb0e5d83d (diff)
downloademacs-58d4e829a2c3db394349149a8b215b0bef4b18e7.tar.gz
emacs-58d4e829a2c3db394349149a8b215b0bef4b18e7.zip
[HAVE_NTGUI] (create_child): Pass handles to children.
[HAVE_NTGUI1] (sys_select): Support alternate keyboard handling.
Diffstat (limited to 'src')
-rw-r--r--src/w32proc.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/w32proc.c b/src/w32proc.c
index 1aa5a0cc6bb..8e8d986f38c 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -226,6 +226,15 @@ create_child (char *exe, char *cmdline, char *env,
226 memset (&start, 0, sizeof (start)); 226 memset (&start, 0, sizeof (start));
227 start.cb = sizeof (start); 227 start.cb = sizeof (start);
228 228
229#ifdef HAVE_NTGUI
230 start.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
231 start.wShowWindow = SW_HIDE;
232
233 start.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
234 start.hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE);
235 start.hStdError = GetStdHandle (STD_ERROR_HANDLE);
236#endif /* HAVE_NTGUI */
237
229 /* Explicitly specify no security */ 238 /* Explicitly specify no security */
230 if (!InitializeSecurityDescriptor (&sec_desc, SECURITY_DESCRIPTOR_REVISION)) 239 if (!InitializeSecurityDescriptor (&sec_desc, SECURITY_DESCRIPTOR_REVISION))
231 goto EH_thrd; 240 goto EH_thrd;
@@ -569,8 +578,11 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
569 DWORD timeout_ms; 578 DWORD timeout_ms;
570 int i, nh, nr; 579 int i, nh, nr;
571 DWORD active; 580 DWORD active;
572 child_process *cp, *cps[MAX_CHILDREN]; 581 child_process *cp, *cps[MAX_CHILDREN + 1];
573 HANDLE wait_hnd[MAX_CHILDREN]; 582 HANDLE wait_hnd[MAX_CHILDREN + 1];
583#ifdef HAVE_NTGUI1
584 BOOL keyboardwait = FALSE ;
585#endif /* HAVE_NTGUI */
574 586
575 /* If the descriptor sets are NULL but timeout isn't, then just Sleep. */ 587 /* If the descriptor sets are NULL but timeout isn't, then just Sleep. */
576 if (rfds == NULL && wfds == NULL && efds == NULL && timeout != NULL) 588 if (rfds == NULL && wfds == NULL && efds == NULL && timeout != NULL)
@@ -601,10 +613,14 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
601 { 613 {
602 if (i == 0) 614 if (i == 0)
603 { 615 {
616#ifdef HAVE_NTGUI1
617 keyboardwait = TRUE ;
618#else
604 /* Handle stdin specially */ 619 /* Handle stdin specially */
605 wait_hnd[nh] = keyboard_handle; 620 wait_hnd[nh] = keyboard_handle;
606 cps[nh] = NULL; 621 cps[nh] = NULL;
607 nh++; 622 nh++;
623#endif /* HAVE_NTGUI */
608 624
609 /* Check for any emacs-generated input in the queue since 625 /* Check for any emacs-generated input in the queue since
610 it won't be detected in the wait */ 626 it won't be detected in the wait */
@@ -639,6 +655,9 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
639 } 655 }
640 } 656 }
641 657
658 /* Never do this in win32 since we will not get paint messages */
659
660#ifndef HAVE_NTGUI1
642 /* Nothing to look for, so we didn't find anything */ 661 /* Nothing to look for, so we didn't find anything */
643 if (nh == 0) 662 if (nh == 0)
644 { 663 {
@@ -650,6 +669,7 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
650#endif 669#endif
651 return 0; 670 return 0;
652 } 671 }
672#endif /* !HAVE_NTGUI */
653 673
654 /* Check for immediate return without waiting */ 674 /* Check for immediate return without waiting */
655 if (nr > 0) 675 if (nr > 0)
@@ -666,7 +686,11 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
666#else 686#else
667 timeout_ms = timeout ? *timeout*1000 : INFINITE; 687 timeout_ms = timeout ? *timeout*1000 : INFINITE;
668#endif 688#endif
689#ifdef HAVE_NTGUI1
690 active = MsgWaitForMultipleObjects (nh, wait_hnd, FALSE, timeout_ms,QS_ALLINPUT);
691#else
669 active = WaitForMultipleObjects (nh, wait_hnd, FALSE, timeout_ms); 692 active = WaitForMultipleObjects (nh, wait_hnd, FALSE, timeout_ms);
693#endif /* HAVE_NTGUI */
670 if (active == WAIT_FAILED) 694 if (active == WAIT_FAILED)
671 { 695 {
672 DebPrint (("select.WaitForMultipleObjects (%d, %lu) failed with %lu\n", 696 DebPrint (("select.WaitForMultipleObjects (%d, %lu) failed with %lu\n",
@@ -679,6 +703,19 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
679 { 703 {
680 return 0; 704 return 0;
681 } 705 }
706#ifdef HAVE_NTGUI1
707 else if (active == WAIT_OBJECT_0 + nh)
708 {
709 /* Keyboard input available */
710 FD_SET (0, rfds);
711
712 /* This shouldn't be necessary, but apparently just setting the input
713 fd is not good enough for emacs */
714// read_input_waiting ();
715
716 return (1) ;
717 }
718#endif /* HAVE_NTGUI */
682 else if (active >= WAIT_OBJECT_0 && 719 else if (active >= WAIT_OBJECT_0 &&
683 active < WAIT_OBJECT_0+MAXIMUM_WAIT_OBJECTS) 720 active < WAIT_OBJECT_0+MAXIMUM_WAIT_OBJECTS)
684 { 721 {