comparison src/xfns.c @ 83632:cc587bfd19ca

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 781-792) - Update from CVS - Merge from gnus--rel--5.10 - Merge from emacs--rel--22 * emacs--rel--22 (patch 33-41) * gnus--rel--5.10 (patch 226-228) - Update from CVS Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-21
author Miles Bader <miles@gnu.org>
date Mon, 11 Jun 2007 01:00:07 +0000
parents dc002877ce12 7edf1ae10375
children 9c01792a3ce8
comparison
equal deleted inserted replaced
83631:7d63b897231b 83632:cc587bfd19ca
1523 1523
1524 1524
1525 /* Encode Lisp string STRING as a text in a format appropriate for 1525 /* Encode Lisp string STRING as a text in a format appropriate for
1526 XICCC (X Inter Client Communication Conventions). 1526 XICCC (X Inter Client Communication Conventions).
1527 1527
1528 This can call Lisp code, so callers must GCPRO.
1529
1528 If STRING contains only ASCII characters, do no conversion and 1530 If STRING contains only ASCII characters, do no conversion and
1529 return the string data of STRING. Otherwise, encode the text by 1531 return the string data of STRING. Otherwise, encode the text by
1530 CODING_SYSTEM, and return a newly allocated memory area which 1532 CODING_SYSTEM, and return a newly allocated memory area which
1531 should be freed by `xfree' by a caller. 1533 should be freed by `xfree' by a caller.
1532 1534
1570 setup_coding_system (coding_system, &coding); 1572 setup_coding_system (coding_system, &coding);
1571 if (selectionp 1573 if (selectionp
1572 && SYMBOLP (coding.pre_write_conversion) 1574 && SYMBOLP (coding.pre_write_conversion)
1573 && !NILP (Ffboundp (coding.pre_write_conversion))) 1575 && !NILP (Ffboundp (coding.pre_write_conversion)))
1574 { 1576 {
1577 struct gcpro gcpro1;
1578 /* We don't need to GCPRO string. */
1579 GCPRO1 (coding_system);
1575 string = run_pre_post_conversion_on_str (string, &coding, 1); 1580 string = run_pre_post_conversion_on_str (string, &coding, 1);
1581 UNGCPRO;
1576 str = SDATA (string); 1582 str = SDATA (string);
1577 chars = SCHARS (string); 1583 chars = SCHARS (string);
1578 bytes = SBYTES (string); 1584 bytes = SBYTES (string);
1579 } 1585 }
1580 coding.src_multibyte = 1; 1586 coding.src_multibyte = 1;
1612 { 1618 {
1613 XTextProperty text, icon; 1619 XTextProperty text, icon;
1614 int bytes, stringp; 1620 int bytes, stringp;
1615 int do_free_icon_value = 0, do_free_text_value = 0; 1621 int do_free_icon_value = 0, do_free_text_value = 0;
1616 Lisp_Object coding_system; 1622 Lisp_Object coding_system;
1623 #ifdef USE_GTK
1624 Lisp_Object encoded_name;
1625 struct gcpro gcpro1;
1626
1627 /* As ENCODE_UTF_8 may cause GC and relocation of string data,
1628 we use it before x_encode_text that may return string data. */
1629 GCPRO1 (name);
1630 encoded_name = ENCODE_UTF_8 (name);
1631 UNGCPRO;
1632 #endif
1617 1633
1618 coding_system = Qcompound_text; 1634 coding_system = Qcompound_text;
1619 /* Note: Encoding strategy 1635 /* Note: Encoding strategy
1620 1636
1621 We encode NAME by compound-text and use "COMPOUND-TEXT" in 1637 We encode NAME by compound-text and use "COMPOUND-TEXT" in
1652 icon.nitems = bytes; 1668 icon.nitems = bytes;
1653 } 1669 }
1654 1670
1655 #ifdef USE_GTK 1671 #ifdef USE_GTK
1656 gtk_window_set_title (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 1672 gtk_window_set_title (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1657 (char *) SDATA (ENCODE_UTF_8 (name))); 1673 (char *) SDATA (encoded_name));
1658 #else /* not USE_GTK */ 1674 #else /* not USE_GTK */
1659 XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text); 1675 XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text);
1660 #endif /* not USE_GTK */ 1676 #endif /* not USE_GTK */
1661 1677
1662 XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &icon); 1678 XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &icon);
1838 specified. */ 1854 specified. */
1839 tem = display_x_get_resource (dpyinfo, 1855 tem = display_x_get_resource (dpyinfo,
1840 build_string (foreground_p 1856 build_string (foreground_p
1841 ? "foreground" 1857 ? "foreground"
1842 : "background"), 1858 : "background"),
1843 empty_string, 1859 empty_unibyte_string,
1844 build_string ("verticalScrollBar"), 1860 build_string ("verticalScrollBar"),
1845 empty_string); 1861 empty_unibyte_string);
1846 if (!STRINGP (tem)) 1862 if (!STRINGP (tem))
1847 { 1863 {
1848 /* If nothing has been specified, scroll bars will use a 1864 /* If nothing has been specified, scroll bars will use a
1849 toolkit-dependent default. Because these defaults are 1865 toolkit-dependent default. Because these defaults are
1850 difficult to get at without actually creating a scroll 1866 difficult to get at without actually creating a scroll