aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2007-06-01 12:14:34 +0000
committerRichard M. Stallman2007-06-01 12:14:34 +0000
commit6f1031326e60eae1a3db7dbb394fa5438f908b83 (patch)
tree823c7c1a04ae74f96f47ebe8f6e8e61d1ddb3680
parent67cae4883e8850079fa642c9b2387c8786e3140b (diff)
downloademacs-6f1031326e60eae1a3db7dbb394fa5438f908b83.tar.gz
emacs-6f1031326e60eae1a3db7dbb394fa5438f908b83.zip
(x_encode_text): Add GCPRO.
(x_set_name_internal): Separate USE_GTK and non-USE_GTK cases.
-rw-r--r--src/xfns.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 73a88dfc058..ae8ef659728 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1516,6 +1516,8 @@ x_set_scroll_bar_background (f, value, oldval)
1516/* Encode Lisp string STRING as a text in a format appropriate for 1516/* Encode Lisp string STRING as a text in a format appropriate for
1517 XICCC (X Inter Client Communication Conventions). 1517 XICCC (X Inter Client Communication Conventions).
1518 1518
1519 This can call Lisp code, so callers must GCPRO.
1520
1519 If STRING contains only ASCII characters, do no conversion and 1521 If STRING contains only ASCII characters, do no conversion and
1520 return the string data of STRING. Otherwise, encode the text by 1522 return the string data of STRING. Otherwise, encode the text by
1521 CODING_SYSTEM, and return a newly allocated memory area which 1523 CODING_SYSTEM, and return a newly allocated memory area which
@@ -1563,7 +1565,11 @@ x_encode_text (string, coding_system, selectionp, text_bytes, stringp, freep)
1563 && SYMBOLP (coding.pre_write_conversion) 1565 && SYMBOLP (coding.pre_write_conversion)
1564 && !NILP (Ffboundp (coding.pre_write_conversion))) 1566 && !NILP (Ffboundp (coding.pre_write_conversion)))
1565 { 1567 {
1568 struct gcpro gcpro1;
1569 /* We don't need to GCPRO string. */
1570 GCPRO1 (coding_system);
1566 string = run_pre_post_conversion_on_str (string, &coding, 1); 1571 string = run_pre_post_conversion_on_str (string, &coding, 1);
1572 UNGCPRO;
1567 str = SDATA (string); 1573 str = SDATA (string);
1568 chars = SCHARS (string); 1574 chars = SCHARS (string);
1569 bytes = SBYTES (string); 1575 bytes = SBYTES (string);
@@ -1601,22 +1607,20 @@ x_set_name_internal (f, name)
1601 BLOCK_INPUT; 1607 BLOCK_INPUT;
1602#ifdef HAVE_X11R4 1608#ifdef HAVE_X11R4
1603 { 1609 {
1604 XTextProperty text, icon;
1605 int bytes, stringp;
1606 int do_free_icon_value = 0, do_free_text_value = 0;
1607 Lisp_Object coding_system;
1608#ifdef USE_GTK 1610#ifdef USE_GTK
1609 Lisp_Object encoded_name; 1611 Lisp_Object encoded_name;
1610 struct gcpro gcpro1;
1611 1612
1612 /* As ENCODE_UTF_8 may cause GC and relocation of string data,
1613 we use it before x_encode_text that may return string data. */
1614 GCPRO1 (name);
1615 encoded_name = ENCODE_UTF_8 (name); 1613 encoded_name = ENCODE_UTF_8 (name);
1616 UNGCPRO;
1617#endif
1618 1614
1615 gtk_window_set_title (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1616 (char *) SDATA (encoded_name));
1617#else /* not USE_GTK */
1618 XTextProperty text, icon;
1619 int bytes, stringp;
1620 int do_free_icon_value = 0, do_free_text_value = 0;
1621 Lisp_Object coding_system;
1619 coding_system = Qcompound_text; 1622 coding_system = Qcompound_text;
1623
1620 /* Note: Encoding strategy 1624 /* Note: Encoding strategy
1621 1625
1622 We encode NAME by compound-text and use "COMPOUND-TEXT" in 1626 We encode NAME by compound-text and use "COMPOUND-TEXT" in
@@ -1653,12 +1657,7 @@ x_set_name_internal (f, name)
1653 icon.nitems = bytes; 1657 icon.nitems = bytes;
1654 } 1658 }
1655 1659
1656#ifdef USE_GTK
1657 gtk_window_set_title (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1658 (char *) SDATA (encoded_name));
1659#else /* not USE_GTK */
1660 XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text); 1660 XSetWMName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &text);
1661#endif /* not USE_GTK */
1662 1661
1663 XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &icon); 1662 XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), &icon);
1664 1663
@@ -1666,6 +1665,7 @@ x_set_name_internal (f, name)
1666 xfree (icon.value); 1665 xfree (icon.value);
1667 if (do_free_text_value) 1666 if (do_free_text_value)
1668 xfree (text.value); 1667 xfree (text.value);
1668#endif /* not USE_GTK */
1669 } 1669 }
1670#else /* not HAVE_X11R4 */ 1670#else /* not HAVE_X11R4 */
1671 XSetIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 1671 XSetIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),