TrackMouseEvent_Proc track_mouse_event_fn = NULL;
ClipboardSequence_Proc clipboard_sequence_fn = NULL;
+extern AppendMenuW_Proc unicode_append_menu;
/* W95 mousewheel handler */
unsigned int msh_mousewheel = 0;
pMis->itemHeight = GetSystemMetrics (SM_CYMENUSIZE);
if (title)
{
- GetTextExtentPoint32 (hdc, title, strlen (title), &size);
+ if (unicode_append_menu)
+ GetTextExtentPoint32W (hdc, (WCHAR *) title,
+ wcslen ((WCHAR *) title),
+ &size);
+ else
+ GetTextExtentPoint32 (hdc, title, strlen (title), &size);
+
pMis->itemWidth = size.cx;
if (pMis->itemHeight < size.cy)
pMis->itemHeight = size.cy;
menu_font = CreateFontIndirect (&menu_logfont);
old_font = SelectObject (hdc, menu_font);
- /* Always draw title as if not selected. */
- ExtTextOut (hdc,
- pDis->rcItem.left
- + GetSystemMetrics (SM_CXMENUCHECK),
- pDis->rcItem.top,
- ETO_OPAQUE, &pDis->rcItem,
- title, strlen (title), NULL);
+ /* Always draw title as if not selected. */
+ if (unicode_append_menu)
+ ExtTextOutW (hdc,
+ pDis->rcItem.left
+ + GetSystemMetrics (SM_CXMENUCHECK),
+ pDis->rcItem.top,
+ ETO_OPAQUE, &pDis->rcItem,
+ (WCHAR *) title,
+ wcslen ((WCHAR *) title), NULL);
+ else
+ ExtTextOut (hdc,
+ pDis->rcItem.left
+ + GetSystemMetrics (SM_CXMENUCHECK),
+ pDis->rcItem.top,
+ ETO_OPAQUE, &pDis->rcItem,
+ title, strlen (title), NULL);
SelectObject (hdc, old_font);
DeleteObject (menu_font);
{
Lisp_Object bdf_fonts;
struct font_info *retval = NULL;
+ struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
bdf_fonts = w32_list_bdf_fonts (build_string (fontname), 1);
{
char *bdf_name, *bdf_file;
Lisp_Object bdf_pair;
+ int i;
bdf_name = SDATA (XCAR (bdf_fonts));
bdf_pair = Fassoc (XCAR (bdf_fonts), Vw32_bdf_filename_alist);
bdf_file = SDATA (XCDR (bdf_pair));
+ // If the font is already loaded, do not load it again.
+ for (i = 0; i < dpyinfo->n_fonts; i++)
+ {
+ if ((dpyinfo->font_table[i].name
+ && !strcmp (dpyinfo->font_table[i].name, bdf_name))
+ || (dpyinfo->font_table[i].full_name
+ && !strcmp (dpyinfo->font_table[i].full_name, bdf_name)))
+ return dpyinfo->font_table + i;
+ }
+
retval = w32_load_bdf_font (f, bdf_name, size, bdf_file);
bdf_fonts = XCDR (bdf_fonts);
setup_coding_system
(Fcheck_coding_system (Vlocale_coding_system), &coding);
coding.src_multibyte = 1;
- coding.dst_multibyte = 1;
+ coding.dst_multibyte = 0;
/* Need to set COMPOSITION_DISABLED, otherwise Emacs crashes in
encode_coding_iso2022 trying to dereference a null pointer. */
coding.composing = COMPOSITION_DISABLED;
char * fontname;
char * pattern;
{
- char *regex = alloca (strlen (pattern) * 2 + 3);
- char *font_name_copy = alloca (strlen (fontname) + 1);
char *ptr;
+ char *font_name_copy;
+ char *regex = alloca (strlen (pattern) * 2 + 3);
- /* Copy fontname so we can modify it during comparison. */
+ font_name_copy = alloca (strlen (fontname) + 1);
strcpy (font_name_copy, fontname);
ptr = regex;
return FALSE;
}
- return (fast_c_string_match_ignore_case (build_string (regex),
- font_name_copy) >= 0);
+ return (fast_string_match_ignore_case (build_string (regex),
+ build_string(font_name_copy)) >= 0);
}
/* Callback functions, and a structure holding info they need, for
}
DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
- doc: /* Returns the vendor ID string of the W32 system (Microsoft).
+ doc: /* Returns the "vendor ID" string of the W32 system (Microsoft).
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
doc: /* Returns the version numbers of the server of DISPLAY.
The value is a list of three integers: the major and minor
-version numbers, and the vendor-specific release
+version numbers of the X Protocol in use, and the distributor-specific release
number. See also the function `x-server-vendor'.
The optional argument DISPLAY specifies which display to ask about.
return 0;
}
-DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0,
+DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
doc: /* Read file name, prompting with PROMPT in directory DIR.
Use a file selection dialog.
Select DEFAULT-FILENAME in the dialog's file selection box, if
-specified. Ensure that file exists if MUSTMATCH is non-nil. */)
- (prompt, dir, default_filename, mustmatch)
- Lisp_Object prompt, dir, default_filename, mustmatch;
+specified. Ensure that file exists if MUSTMATCH is non-nil.
+If ONLY-DIR-P is non-nil, the user can only select directories. */)
+ (prompt, dir, default_filename, mustmatch, only_dir_p)
+ Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
{
struct frame *f = SELECTED_FRAME ();
Lisp_Object file = Qnil;
int count = SPECPDL_INDEX ();
- struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
+ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
char filename[MAX_PATH + 1];
char init_dir[MAX_PATH + 1];
int default_filter_index = 1; /* 1: All Files, 2: Directories only */
- GCPRO5 (prompt, dir, default_filename, mustmatch, file);
+ GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
CHECK_STRING (prompt);
CHECK_STRING (dir);
/* Create the dialog with PROMPT as title, using DIR as initial
directory and using "*" as pattern. */
dir = Fexpand_file_name (dir, Qnil);
- strncpy (init_dir, SDATA (dir), MAX_PATH);
+ strncpy (init_dir, SDATA (ENCODE_FILE (dir)), MAX_PATH);
init_dir[MAX_PATH] = '\0';
unixtodos_filename (init_dir);
if (STRINGP (default_filename))
{
char *file_name_only;
- char *full_path_name = SDATA (default_filename);
+ char *full_path_name = SDATA (ENCODE_FILE (default_filename));
unixtodos_filename (full_path_name);
file_details.lpstrInitialDir = init_dir;
file_details.lpstrTitle = SDATA (prompt);
- /* If prompt starts with Dired, default to directories only. */
- /* A bit hacky, but there doesn't seem to be a better way to
- DTRT for dired. */
- if (strncmp (file_details.lpstrTitle, "Dired", 5) == 0)
+ if (! NILP (only_dir_p))
default_filter_index = 2;
file_details.nFilterIndex = default_filter_index;