aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2015-01-28 01:03:45 -0300
committerFabián Ezequiel Gallina2015-01-28 01:03:45 -0300
commit4d0108a132788e0c3903eb4d5875321ed6e8eef1 (patch)
treed079bc14c90021591629403d42370ab9ceb453a6 /src
parent32a2c91658bd02c4e761030f93eb5f0415524104 (diff)
parenta3505cb3ef00ad3c9f886e2eb7f245845eb4c1ee (diff)
downloademacs-4d0108a132788e0c3903eb4d5875321ed6e8eef1.tar.gz
emacs-4d0108a132788e0c3903eb4d5875321ed6e8eef1.zip
Merge from origin/emacs-24
a3505cb doc/lispref/variables.texi (Creating Buffer-Local): Improve indexing (Bug#19608) d132c7b erc-backend.el: Give hook-name a default value of nil and add-to-list unconditionally. Fixes debbugs:19363 61cc7bf Fix support of non-ASCII frame titles on MS-Windows (Bug#19590) 1e5902a * filenotify.el (file-notify--descriptor): Do not cons for remote files. b1ea160 Handle watching of several files in the same directory for inotify.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/w32fns.c60
2 files changed, 53 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 422933d22f9..4a49b8b7799 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12015-01-14 Eli Zaretskii <eliz@gnu.org>
2
3 * w32fns.c (w32_set_title_bar_text): New function, including
4 support for titles with non-ASCII characters outside of the
5 current system codepage.
6 (x_set_name, x_set_title): Use it. (Bug#19590)
7
12015-01-10 Eli Zaretskii <eliz@gnu.org> 82015-01-10 Eli Zaretskii <eliz@gnu.org>
2 9
3 * indent.c (Fvertical_motion): Return zero if we started from ZV 10 * indent.c (Fvertical_motion): Return zero if we started from ZV
diff --git a/src/w32fns.c b/src/w32fns.c
index deda2eab26d..777819edd52 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1759,6 +1759,50 @@ x_change_tool_bar_height (struct frame *f, int height)
1759 x_clear_under_internal_border (f); 1759 x_clear_under_internal_border (f);
1760} 1760}
1761 1761
1762static void
1763w32_set_title_bar_text (struct frame *f, Lisp_Object name)
1764{
1765 if (FRAME_W32_WINDOW (f))
1766 {
1767 block_input ();
1768#ifdef __CYGWIN__
1769 GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
1770 GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
1771#else
1772 /* The frame's title many times shows the name of the file
1773 visited in the selected window's buffer, so it makes sense to
1774 support non-ASCII characters outside of the current system
1775 codepage in the title. */
1776 if (w32_unicode_filenames)
1777 {
1778 Lisp_Object encoded_title = ENCODE_UTF_8 (name);
1779 wchar_t *title_w;
1780 int tlen = pMultiByteToWideChar (CP_UTF8, 0, SSDATA (encoded_title),
1781 -1, NULL, 0);
1782
1783 if (tlen > 0)
1784 {
1785 /* Windows truncates the title text beyond what fits on
1786 a single line, so we can limit the length to some
1787 reasonably large value, and use alloca. */
1788 if (tlen > 10000)
1789 tlen = 10000;
1790 title_w = alloca ((tlen + 1) * sizeof (wchar_t));
1791 pMultiByteToWideChar (CP_UTF8, 0, SSDATA (encoded_title), -1,
1792 title_w, tlen);
1793 title_w[tlen] = L'\0';
1794 SetWindowTextW (FRAME_W32_WINDOW (f), title_w);
1795 }
1796 else /* Conversion to UTF-16 failed, so we punt. */
1797 SetWindowTextA (FRAME_W32_WINDOW (f),
1798 SSDATA (ENCODE_SYSTEM (name)));
1799 }
1800 else
1801 SetWindowTextA (FRAME_W32_WINDOW (f), SSDATA (ENCODE_SYSTEM (name)));
1802#endif
1803 unblock_input ();
1804 }
1805}
1762 1806
1763/* Change the name of frame F to NAME. If NAME is nil, set F's name to 1807/* Change the name of frame F to NAME. If NAME is nil, set F's name to
1764 w32_id_name. 1808 w32_id_name.
@@ -1812,13 +1856,7 @@ x_set_name (struct frame *f, Lisp_Object name, bool explicit)
1812 if (! NILP (f->title)) 1856 if (! NILP (f->title))
1813 name = f->title; 1857 name = f->title;
1814 1858
1815 if (FRAME_W32_WINDOW (f)) 1859 w32_set_title_bar_text (f, name);
1816 {
1817 block_input ();
1818 GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
1819 GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
1820 unblock_input ();
1821 }
1822} 1860}
1823 1861
1824/* This function should be called when the user's lisp code has 1862/* This function should be called when the user's lisp code has
@@ -1856,13 +1894,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1856 if (NILP (name)) 1894 if (NILP (name))
1857 name = f->name; 1895 name = f->name;
1858 1896
1859 if (FRAME_W32_WINDOW (f)) 1897 w32_set_title_bar_text (f, name);
1860 {
1861 block_input ();
1862 GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f),
1863 GUI_SDATA (GUI_ENCODE_SYSTEM (name)));
1864 unblock_input ();
1865 }
1866} 1898}
1867 1899
1868void 1900void