/* Process support for GNU Emacs on the Microsoft Windows API.
- Copyright (C) 1992, 1995, 1999-2013 Free Software Foundation, Inc.
+
+Copyright (C) 1992, 1995, 1999-2014 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#undef kill
#include <windows.h>
-#ifdef __GNUC__
-/* This definition is missing from mingw32 headers. */
+#if defined(__GNUC__) && !defined(__MINGW64__)
+/* This definition is missing from mingw.org headers, but not MinGW64
+ headers. */
extern BOOL WINAPI IsValidLocale (LCID, DWORD);
#endif
static BOOL
create_child (char *exe, char *cmdline, char *env, int is_gui_app,
- int * pPid, child_process *cp)
+ pid_t * pPid, child_process *cp)
{
STARTUPINFO start;
SECURITY_ATTRIBUTES sec_attrs;
program = build_string (cmdname);
full = Qnil;
GCPRO1 (program);
- openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK));
+ openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK), 0);
UNGCPRO;
if (NILP (full))
{
return -1;
}
/* From here on, CMDNAME is an ANSI-encoded string. */
- cmdname = cmdname_a
+ cmdname = cmdname_a;
argv[0] = cmdname;
/* Determine whether program is a 16-bit DOS executable, or a 32-bit Windows
FD_ZERO (rfds);
nr = 0;
- /* Always wait on interrupt_handle, to detect C-g (quit). */
- wait_hnd[0] = interrupt_handle;
- fdindex[0] = -1;
+ /* If interrupt_handle is available and valid, always wait on it, to
+ detect C-g (quit). */
+ nh = 0;
+ if (interrupt_handle && interrupt_handle != INVALID_HANDLE_VALUE)
+ {
+ wait_hnd[0] = interrupt_handle;
+ fdindex[0] = -1;
+ nh++;
+ }
/* Build a list of pipe handles to wait on. */
- nh = 1;
for (i = 0; i < nfds; i++)
if (FD_ISSET (i, &orfds))
{
FD_SET (i, rfds);
return 1;
}
+ else if (noninteractive)
+ {
+ if (handle_file_notifications (NULL))
+ return 1;
+ }
}
else
{
{
if (timeout)
Sleep (timeout_ms);
+ if (noninteractive)
+ {
+ if (handle_file_notifications (NULL))
+ return 1;
+ }
return 0;
}
}
else if (active == WAIT_TIMEOUT)
{
+ if (noninteractive)
+ {
+ if (handle_file_notifications (NULL))
+ return 1;
+ }
return 0;
}
else if (active >= WAIT_OBJECT_0
break;
} while (active < nh + nc);
+ if (noninteractive)
+ {
+ if (handle_file_notifications (NULL))
+ nr++;
+ }
+
/* If no input has arrived and timeout hasn't expired, wait again. */
if (nr == 0)
{
{
while (--num_layouts >= 0)
{
- DWORD kl = (DWORD) layouts[num_layouts];
+ HKL kl = layouts[num_layouts];
- obj = Fcons (Fcons (make_number (kl & 0xffff),
- make_number ((kl >> 16) & 0xffff)),
+ obj = Fcons (Fcons (make_number (LOWORD (kl)),
+ make_number (HIWORD (kl))),
obj);
}
}
The return value is the cons of the language id and the layout id. */)
(void)
{
- DWORD kl = (DWORD) GetKeyboardLayout (dwWindowsThreadId);
+ HKL kl = GetKeyboardLayout (dwWindowsThreadId);
- return Fcons (make_number (kl & 0xffff),
- make_number ((kl >> 16) & 0xffff));
+ return Fcons (make_number (LOWORD (kl)),
+ make_number (HIWORD (kl)));
}
If successful, the new layout id is returned, otherwise nil. */)
(Lisp_Object layout)
{
- DWORD kl;
+ HKL kl;
CHECK_CONS (layout);
CHECK_NUMBER_CAR (layout);
CHECK_NUMBER_CDR (layout);
- kl = (XINT (XCAR (layout)) & 0xffff)
- | (XINT (XCDR (layout)) << 16);
+ kl = (HKL) ((XINT (XCAR (layout)) & 0xffff)
+ | (XINT (XCDR (layout)) << 16));
/* Synchronize layout with input thread. */
if (dwWindowsThreadId)
return Qnil;
}
}
- else if (!ActivateKeyboardLayout ((HKL) kl, 0))
+ else if (!ActivateKeyboardLayout (kl, 0))
return Qnil;
return Fw32_get_keyboard_layout ();