[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111999: 2013-03-10 Daniel Colascione
From: |
Daniel Colascione |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111999: 2013-03-10 Daniel Colascione <address@hidden> |
Date: |
Sun, 10 Mar 2013 14:55:25 -0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111999
committer: Daniel Colascione <address@hidden>
branch nick: trunk
timestamp: Sun 2013-03-10 14:55:25 -0800
message:
2013-03-10 Daniel Colascione <address@hidden>
* 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.
modified:
src/ChangeLog
src/coding.c
src/coding.h
src/w32fns.c
src/w32term.c
src/w32term.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-03-10 21:52:01 +0000
+++ b/src/ChangeLog 2013-03-10 22:55:25 +0000
@@ -1,3 +1,28 @@
+2013-03-10 Daniel Colascione <address@hidden>
+
+ * 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 <address@hidden>
* lread.c: Minor cleanup.
=== modified file 'src/coding.c'
--- a/src/coding.c 2013-03-10 15:06:04 +0000
+++ b/src/coding.c 2013-03-10 22:55:25 +0000
@@ -286,6 +286,10 @@
#include <config.h>
#include <stdio.h>
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif /* HAVE_WCHAR_H */
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
@@ -8003,6 +8007,16 @@
return code_convert_string_norecord (str, Qutf_16le, 0);
}
+Lisp_Object
+from_unicode_buffer (const wchar_t* wstr)
+{
+ return from_unicode (
+ make_unibyte_string (
+ (char*) wstr,
+ /* we get one of the two final 0 bytes for free. */
+ 1 + sizeof (wchar_t) * wcslen (wstr)));
+}
+
wchar_t *
to_unicode (Lisp_Object str, Lisp_Object *buf)
{
=== modified file 'src/coding.h'
--- a/src/coding.h 2013-03-06 11:26:30 +0000
+++ b/src/coding.h 2013-03-10 22:55:25 +0000
@@ -715,6 +715,9 @@
failure modes. STR itself is not modified. */
extern Lisp_Object from_unicode (Lisp_Object str);
+/* Convert WSTR to an Emacs string. */
+extern Lisp_Object from_unicode_buffer (const wchar_t* wstr);
+
#endif /* WINDOWSNT || CYGWIN */
/* Macros for backward compatibility. */
=== modified file 'src/w32fns.c'
--- a/src/w32fns.c 2013-03-10 17:28:04 +0000
+++ b/src/w32fns.c 2013-03-10 22:55:25 +0000
@@ -1721,11 +1721,9 @@
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 ();
}
}
@@ -1767,11 +1765,9 @@
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 ();
}
}
@@ -6006,14 +6002,6 @@
#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
@@ -6230,11 +6218,7 @@
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);
}
@@ -6243,11 +6227,7 @@
{
/* 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));
@@ -6421,20 +6401,29 @@
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);
+ parameters = GUI_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))
+ 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);
@@ -6803,6 +6792,7 @@
}
+#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
@@ -6898,6 +6888,8 @@
return value;
}
+#endif /* WINDOWSNT */
+
DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
0, 0, 0, doc: /* Return the name of Windows default printer device. */)
@@ -7624,7 +7616,10 @@
defsubr (&Sw32_window_exists_p);
defsubr (&Sw32_battery_status);
+#ifdef WINDOWSNT
defsubr (&Sfile_system_info);
+#endif
+
defsubr (&Sdefault_printer_name);
defsubr (&Sset_message_beep);
@@ -7805,3 +7800,15 @@
}
}
}
+
+#ifdef NTGUI_UNICODE
+
+Lisp_Object
+ntgui_encode_system (Lisp_Object str)
+{
+ Lisp_Object encoded;
+ to_unicode (str, &encoded);
+ return encoded;
+}
+
+#endif /* NTGUI_UNICODE */
=== modified file 'src/w32term.c'
--- a/src/w32term.c 2013-02-16 13:59:37 +0000
+++ b/src/w32term.c 2013-03-10 22:55:25 +0000
@@ -3161,7 +3161,7 @@
HDROP hdrop;
POINT p;
WORD num_files;
- char *name;
+ guichar_t *name;
int i, len;
result->kind = DRAG_N_DROP_EVENT;
@@ -3186,12 +3186,17 @@
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);
=== modified file 'src/w32term.h'
--- a/src/w32term.h 2013-01-02 16:13:04 +0000
+++ b/src/w32term.h 2013-03-10 22:55:25 +0000
@@ -761,6 +761,23 @@
w32_name_of_message (UINT msg);
#endif /* EMACSDEBUG */
+#ifdef NTGUI_UNICODE
+extern Lisp_Object ntgui_encode_system (Lisp_Object str);
+#define GUISTR(x) (L ## x)
+#define GUI_ENCODE_FILE GUI_ENCODE_SYSTEM
+#define GUI_ENCODE_SYSTEM(x) ntgui_encode_system (x)
+#define GUI_FN(fn) fn ## W
+typedef wchar_t guichar_t;
+#else /* !NTGUI_UNICODE */
+#define GUISTR(x) x
+#define GUI_ENCODE_FILE ENCODE_FILE
+#define GUI_ENCODE_SYSTEM ENCODE_SYSTEM
+#define GUI_FN(fn) fn
+typedef char guichar_t;
+#endif /* NTGUI_UNICODE */
+
+#define GUI_SDATA(x) ((guichar_t*) SDATA (x))
+
extern void syms_of_w32term (void);
extern void syms_of_w32menu (void);
extern void syms_of_w32fns (void);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111999: 2013-03-10 Daniel Colascione <address@hidden>,
Daniel Colascione <=