+2013-03-10 Daniel Colascione <dancol@dancol.org>
+
+ * w32term.h (GUISTR, GUI_ENCODE_FILE, GUI_ENCODE_SYSTEM, GUI_FN)
+ (GUI_SDATA, guichar_t): Macros to abstract out differences between
+ NTGUI_UNICODE and !NTGUI_UNICODE builds, some moved out of
+ w32fns.c.
+
+ * w32term.c (construct_drag_n_drop): Use the above macros to make
+ drag-and-drop work for non-ASCII filenames in cygw32 builds.
+
+ * w32fns.c (x_set_name, x_set_title): Use the above macros to
+ properly display non-ASCII frame titles in cygw32 builds.
+
+ * w32fns.c (Fw32_shell_execute): Use the above macros to properly
+ call ShellExecute in cygw32 builds.
+
+ * w32fn.c (Fx_file_dialog): Use the above macros to simplify the
+ common file dialog code.
+
+ * w32fns.c (Ffile_system_info): Remove from cygw32 builds, which
+ can just use du like other systems.
+
+ * coding.c (from_unicode_buffer): Declare.
+ * coding.c (from_unicode_buffer): Implement.
+
2013-03-10 Stefan Monnier <monnier@iro.umontreal.ca>
* lread.c: Minor cleanup.
if (FRAME_W32_WINDOW (f))
{
- if (STRING_MULTIBYTE (name))
- name = ENCODE_SYSTEM (name);
-
block_input ();
- SetWindowText (FRAME_W32_WINDOW (f), SDATA (name));
+ GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
+ GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
unblock_input ();
}
}
if (FRAME_W32_WINDOW (f))
{
- if (STRING_MULTIBYTE (name))
- name = ENCODE_SYSTEM (name);
-
block_input ();
- SetWindowText (FRAME_W32_WINDOW (f), SDATA (name));
+ GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
+ GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
unblock_input ();
}
}
#define FILE_NAME_COMBO_BOX cmb13
#define FILE_NAME_LIST lst1
-#ifdef NTGUI_UNICODE
-#define GUISTR(x) (L ## x)
-typedef wchar_t guichar_t;
-#else /* !NTGUI_UNICODE */
-#define GUISTR(x) x
-typedef char guichar_t;
-#endif /* NTGUI_UNICODE */
-
/* Callback for altering the behavior of the Open File dialog.
Makes the Filename text field contain "Current Directory" and be
read-only when "Directories" is selected in the filter. This
block_input ();
file_details->lpfnHook = file_dialog_callback;
-#ifdef NTGUI_UNICODE
- file_opened = GetOpenFileNameW (file_details);
-#else /* !NTGUI_UNICODE */
- file_opened = GetOpenFileNameA (file_details);
-#endif /* NTGUI_UNICODE */
+ file_opened = GUI_FN (GetOpenFileName) (file_details);
unblock_input ();
unbind_to (count, Qnil);
}
{
/* Get an Emacs string from the value Windows gave us. */
#ifdef NTGUI_UNICODE
- filename = from_unicode (
- make_unibyte_string (
- (char*) filename_buf,
- /* we get one of the two final 0 bytes for free. */
- 1 + sizeof (wchar_t) * wcslen (filename_buf)));
+ filename = from_unicode_buffer (filename_buf);
#else /* !NTGUI_UNICODE */
dostounix_filename (filename_buf, 0);
filename = DECODE_FILE (build_string (filename_buf));
CHECK_STRING (document);
/* Encode filename, current directory and parameters. */
- current_dir = ENCODE_FILE (BVAR (current_buffer, directory));
- document = ENCODE_FILE (document);
+ current_dir = BVAR (current_buffer, directory);
+
+#ifdef CYGWIN
+ current_dir = Fcygwin_convert_file_name_to_windows (current_dir, Qt);
+ if (STRINGP (document))
+ document = Fcygwin_convert_file_name_to_windows (document, Qt);
+#endif /* CYGWIN */
+
+ current_dir = GUI_ENCODE_FILE (current_dir);
+ if (STRINGP (document))
+ document = GUI_ENCODE_FILE (document);
if (STRINGP (parameters))
- parameters = ENCODE_SYSTEM (parameters);
-
- if ((int) ShellExecute (NULL,
- (STRINGP (operation) ?
- SDATA (operation) : NULL),
- SDATA (document),
- (STRINGP (parameters) ?
- SDATA (parameters) : NULL),
- SDATA (current_dir),
- (INTEGERP (show_flag) ?
- XINT (show_flag) : SW_SHOWDEFAULT))
+ parameters = GUI_ENCODE_SYSTEM (parameters);
+
+ if ((int) GUI_FN (ShellExecute) (NULL,
+ (STRINGP (operation) ?
+ GUI_SDATA (operation) : NULL),
+ GUI_SDATA (document),
+ (STRINGP (parameters) ?
+ GUI_SDATA (parameters) : NULL),
+ GUI_SDATA (current_dir),
+ (INTEGERP (show_flag) ?
+ XINT (show_flag) : SW_SHOWDEFAULT))
> 32)
return Qt;
errstr = w32_strerror (0);
}
\f
+#ifdef WINDOWSNT
DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0,
doc: /* Return storage information about the file system FILENAME is on.
Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total
return value;
}
+#endif /* WINDOWSNT */
+
\f
DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
0, 0, 0, doc: /* Return the name of Windows default printer device. */)
defsubr (&Sw32_window_exists_p);
defsubr (&Sw32_battery_status);
+#ifdef WINDOWSNT
defsubr (&Sfile_system_info);
+#endif
+
defsubr (&Sdefault_printer_name);
defsubr (&Sset_message_beep);
}
}
}
+
+#ifdef NTGUI_UNICODE
+
+Lisp_Object
+ntgui_encode_system (Lisp_Object str)
+{
+ Lisp_Object encoded;
+ to_unicode (str, &encoded);
+ return encoded;
+}
+
+#endif /* NTGUI_UNICODE */
HDROP hdrop;
POINT p;
WORD num_files;
- char *name;
+ guichar_t *name;
int i, len;
result->kind = DRAG_N_DROP_EVENT;
for (i = 0; i < num_files; i++)
{
- len = DragQueryFile (hdrop, i, NULL, 0);
+ len = GUI_FN (DragQueryFile) (hdrop, i, NULL, 0);
if (len <= 0)
continue;
- name = alloca (len + 1);
- DragQueryFile (hdrop, i, name, len + 1);
+
+ name = alloca ((len + 1) * sizeof (*name));
+ GUI_FN (DragQueryFile) (hdrop, i, name, len + 1);
+#ifdef NTGUI_UNICODE
+ files = Fcons (from_unicode_buffer (name), files);
+#else
files = Fcons (DECODE_FILE (build_string (name)), files);
+#endif /* NTGUI_UNICODE */
}
DragFinish (hdrop);