#include <fcntl.h>
#include <unistd.h>
+#include <c-ctype.h>
+
#include "lisp.h"
#include "w32term.h"
#include "frame.h"
typedef LONG (WINAPI * ImmGetCompositionString_Proc)
(IN HIMC context, IN DWORD index, OUT LPVOID buffer, IN DWORD bufLen);
typedef HIMC (WINAPI * ImmGetContext_Proc) (IN HWND window);
-typedef HWND (WINAPI * ImmReleaseContext_Proc) (IN HWND wnd, IN HIMC context);
-typedef HWND (WINAPI * ImmSetCompositionWindow_Proc) (IN HIMC context,
+typedef BOOL (WINAPI * ImmReleaseContext_Proc) (IN HWND wnd, IN HIMC context);
+typedef BOOL (WINAPI * ImmSetCompositionWindow_Proc) (IN HIMC context,
IN COMPOSITIONFORM *form);
typedef HMONITOR (WINAPI * MonitorFromPoint_Proc) (IN POINT pt, IN DWORD flags);
typedef BOOL (WINAPI * GetMonitorInfo_Proc)
set_ime_composition_window_fn (context, &form);
release_ime_context_fn (hwnd, context);
}
- /* Pass WM_IME_STARTCOMPOSITION to DefWindowProc, so that the
- composition window will actually be displayed. */
- goto dflt;
+ /* We should "goto dflt" here to pass WM_IME_STARTCOMPOSITION to
+ DefWindowProc, so that the composition window will actually
+ be displayed. But doing so causes trouble with displaying
+ dialog boxes, such as the file selection dialog or font
+ selection dialog. So something else is needed to fix the
+ former without breaking the latter. See bug#11732. */
+ break;
case WM_IME_ENDCOMPOSITION:
ignore_ime_char = 0;
#else /* !CYGWIN */
- current_dir = ENCODE_FILE (current_dir);
+ const char file_url_str[] = "file:///";
+ const int file_url_len = sizeof (file_url_str) - 1;
+ if (strncmp (SSDATA (document), file_url_str, file_url_len) == 0)
+ {
+ /* Passing "file:///" URLs to ShellExecute causes shlwapi.dll to
+ start a thread in some rare system configurations, for
+ unknown reasons. That thread is started in the context of
+ the Emacs process, but out of control of our code, and seems
+ to never exit afterwards. Each such thread reserves 8MB of
+ stack space (because that's the value recorded in the Emacs
+ executable at link time: Emacs needs a large stack). So a
+ large enough number of invocations of w32-shell-execute can
+ potentially cause the Emacs process to run out of available
+ address space, which is nasty. To work around this, we
+ convert such URLs to local file names, which seems to prevent
+ those threads from starting. See bug #20220. */
+ char *p = SSDATA (document) + file_url_len;
+
+ if (c_isalpha (*p) && p[1] == ':' && IS_DIRECTORY_SEP (p[2]))
+ document = Fsubstring_no_properties (document,
+ make_number (file_url_len), Qnil);
+ }
/* We have a situation here. If DOCUMENT is a relative file name,
but its name includes leading directories, i.e. it lives not in
CURRENT_DIR, but in its subdirectory, then ShellExecute below
else
document = ENCODE_FILE (document);
UNGCPRO;
+
+ current_dir = ENCODE_FILE (current_dir);
if (use_unicode)
{
wchar_t document_w[MAX_PATH], current_dir_w[MAX_PATH];
- `title-bar-height' is the height of the title bar of FRAME.
-- `menu-bar-external' if `t' means the menu bar is by default external
+- `menu-bar-external' if t means the menu bar is by default external
(not included in the inner size of FRAME).
- `menu-bar-size' is a cons of the width and height of the menu bar of
FRAME.
-- `tool-bar-external' if `t' means the tool bar is by default external
+- `tool-bar-external' if t means the tool bar is by default external
(not included in the inner size of FRAME).
- `tool-bar-side' tells tells on which side the tool bar on FRAME is by
MessageBeep (sound_type);
}
+DEFUN ("w32--menu-bar-in-use", Fw32__menu_bar_in_use, Sw32__menu_bar_in_use,
+ 0, 0, 0,
+ doc: /* Return non-nil when a menu-bar menu is being used.
+Internal use only. */)
+ (void)
+{
+ return menubar_in_use ? Qt : Qnil;
+}
+
\f
/***********************************************************************
Initialization
DEFSYM (Qworkarea, "workarea");
DEFSYM (Qmm_size, "mm-size");
DEFSYM (Qframes, "frames");
+ DEFSYM (Qtip_frame, "tip-frame");
+ DEFSYM (Qunicode_sip, "unicode-sip");
+
+ /* Symbols used elsewhere, but only in MS-Windows-specific code. */
+ DEFSYM (Qgnutls_dll, "gnutls");
+ DEFSYM (Qlibxml2_dll, "libxml2");
+ DEFSYM (Qserif, "serif");
+ DEFSYM (Qzlib_dll, "zlib");
Fput (Qundefined_color, Qerror_conditions,
listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror));
defsubr (&Sw32_frame_rect);
defsubr (&Sw32_frame_menu_bar_size);
defsubr (&Sw32_battery_status);
+ defsubr (&Sw32__menu_bar_in_use);
#ifdef WINDOWSNT
defsubr (&Sfile_system_info);