comparison src/xfns.c @ 14482:479987ba2c8d

(x_frame_parms): Add "title" element. (x_set_title): New function. (x_set_name): Let title prop override name prop for title use. (x_set_icon_name): Use title parm before name parm, if no icon_name.
author Richard M. Stallman <rms@gnu.org>
date Sun, 04 Feb 1996 03:00:25 +0000
parents 201ccc109ce7
children 71bca5a3c22d
comparison
equal deleted inserted replaced
14481:9785f1180901 14482:479987ba2c8d
668 void x_set_autolower (); 668 void x_set_autolower ();
669 void x_set_vertical_scroll_bars (); 669 void x_set_vertical_scroll_bars ();
670 void x_set_visibility (); 670 void x_set_visibility ();
671 void x_set_menu_bar_lines (); 671 void x_set_menu_bar_lines ();
672 void x_set_scroll_bar_width (); 672 void x_set_scroll_bar_width ();
673 void x_set_title ();
673 void x_set_unsplittable (); 674 void x_set_unsplittable ();
674 675
675 static struct x_frame_parm_table x_frame_parms[] = 676 static struct x_frame_parm_table x_frame_parms[] =
676 { 677 {
677 "auto-raise", x_set_autoraise, 678 "auto-raise", x_set_autoraise,
688 "internal-border-width", x_set_internal_border_width, 689 "internal-border-width", x_set_internal_border_width,
689 "menu-bar-lines", x_set_menu_bar_lines, 690 "menu-bar-lines", x_set_menu_bar_lines,
690 "mouse-color", x_set_mouse_color, 691 "mouse-color", x_set_mouse_color,
691 "name", x_explicitly_set_name, 692 "name", x_explicitly_set_name,
692 "scroll-bar-width", x_set_scroll_bar_width, 693 "scroll-bar-width", x_set_scroll_bar_width,
694 "title", x_set_title,
693 "unsplittable", x_set_unsplittable, 695 "unsplittable", x_set_unsplittable,
694 "vertical-scroll-bars", x_set_vertical_scroll_bars, 696 "vertical-scroll-bars", x_set_vertical_scroll_bars,
695 "visibility", x_set_visibility, 697 "visibility", x_set_visibility,
696 }; 698 };
697 699
1380 x_display_cursor (f, 0); 1382 x_display_cursor (f, 0);
1381 x_display_cursor (f, 1); 1383 x_display_cursor (f, 1);
1382 } 1384 }
1383 } 1385 }
1384 } 1386 }
1385 1387
1386 /* Set the border-color of frame F to value described by ARG. 1388 /* Set the border-color of frame F to value described by ARG.
1387 ARG can be a string naming a color. 1389 ARG can be a string naming a color.
1388 The border-color is used for the border that is drawn by the X server. 1390 The border-color is used for the border that is drawn by the X server.
1389 Note that this does not fully take effect if done before 1391 Note that this does not fully take effect if done before
1390 F has an x-window; it must be redone when the window is created. 1392 F has an x-window; it must be redone when the window is created.
1459 1461
1460 /* Make sure the cursor gets redrawn. This is overkill, but how 1462 /* Make sure the cursor gets redrawn. This is overkill, but how
1461 often do people change cursor types? */ 1463 often do people change cursor types? */
1462 update_mode_lines++; 1464 update_mode_lines++;
1463 } 1465 }
1464 1466
1465 void 1467 void
1466 x_set_icon_type (f, arg, oldval) 1468 x_set_icon_type (f, arg, oldval)
1467 struct frame *f; 1469 struct frame *f;
1468 Lisp_Object arg, oldval; 1470 Lisp_Object arg, oldval;
1469 { 1471 {
1536 BLOCK_INPUT; 1538 BLOCK_INPUT;
1537 1539
1538 result = x_text_icon (f, 1540 result = x_text_icon (f,
1539 (char *) XSTRING ((!NILP (f->icon_name) 1541 (char *) XSTRING ((!NILP (f->icon_name)
1540 ? f->icon_name 1542 ? f->icon_name
1543 : !NILP (f->title)
1544 ? f->title
1541 : f->name))->data); 1545 : f->name))->data);
1542 1546
1543 if (result) 1547 if (result)
1544 { 1548 {
1545 UNBLOCK_INPUT; 1549 UNBLOCK_INPUT;
1547 } 1551 }
1548 1552
1549 XFlush (FRAME_X_DISPLAY (f)); 1553 XFlush (FRAME_X_DISPLAY (f));
1550 UNBLOCK_INPUT; 1554 UNBLOCK_INPUT;
1551 } 1555 }
1552 1556
1553 extern Lisp_Object x_new_font (); 1557 extern Lisp_Object x_new_font ();
1554 1558
1555 void 1559 void
1556 x_set_font (f, arg, oldval) 1560 x_set_font (f, arg, oldval)
1557 struct frame *f; 1561 struct frame *f;
1636 else if (EQ (value, Qicon)) 1640 else if (EQ (value, Qicon))
1637 Ficonify_frame (frame); 1641 Ficonify_frame (frame);
1638 else 1642 else
1639 Fmake_frame_visible (frame); 1643 Fmake_frame_visible (frame);
1640 } 1644 }
1641 1645
1642 static void 1646 static void
1643 x_set_menu_bar_lines_1 (window, n) 1647 x_set_menu_bar_lines_1 (window, n)
1644 Lisp_Object window; 1648 Lisp_Object window;
1645 int n; 1649 int n;
1646 { 1650 {
1701 #else /* not USE_X_TOOLKIT */ 1705 #else /* not USE_X_TOOLKIT */
1702 FRAME_MENU_BAR_LINES (f) = nlines; 1706 FRAME_MENU_BAR_LINES (f) = nlines;
1703 x_set_menu_bar_lines_1 (f->root_window, nlines - olines); 1707 x_set_menu_bar_lines_1 (f->root_window, nlines - olines);
1704 #endif /* not USE_X_TOOLKIT */ 1708 #endif /* not USE_X_TOOLKIT */
1705 } 1709 }
1706 1710
1707 /* Change the name of frame F to NAME. If NAME is nil, set F's name to 1711 /* Change the name of frame F to NAME. If NAME is nil, set F's name to
1708 x_id_name. 1712 x_id_name.
1709 1713
1710 If EXPLICIT is non-zero, that indicates that lisp code is setting the 1714 If EXPLICIT is non-zero, that indicates that lisp code is setting the
1711 name; if NAME is a string, set F's name to NAME and set 1715 name; if NAME is a string, set F's name to NAME and set
1749 CHECK_STRING (name, 0); 1753 CHECK_STRING (name, 0);
1750 1754
1751 /* Don't change the name if it's already NAME. */ 1755 /* Don't change the name if it's already NAME. */
1752 if (! NILP (Fstring_equal (name, f->name))) 1756 if (! NILP (Fstring_equal (name, f->name)))
1753 return; 1757 return;
1758
1759 f->name = name;
1760
1761 /* For setting the frame title, the title parameter should override
1762 the name parameter. */
1763 if (! NILP (f->title))
1764 name = f->title;
1754 1765
1755 if (FRAME_X_WINDOW (f)) 1766 if (FRAME_X_WINDOW (f))
1756 { 1767 {
1757 BLOCK_INPUT; 1768 BLOCK_INPUT;
1758 #ifdef HAVE_X11R4 1769 #ifdef HAVE_X11R4
1787 XStoreName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 1798 XStoreName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
1788 XSTRING (name)->data); 1799 XSTRING (name)->data);
1789 #endif /* not HAVE_X11R4 */ 1800 #endif /* not HAVE_X11R4 */
1790 UNBLOCK_INPUT; 1801 UNBLOCK_INPUT;
1791 } 1802 }
1792
1793 f->name = name;
1794 } 1803 }
1795 1804
1796 /* This function should be called when the user's lisp code has 1805 /* This function should be called when the user's lisp code has
1797 specified a name for the frame; the name will override any set by the 1806 specified a name for the frame; the name will override any set by the
1798 redisplay code. */ 1807 redisplay code. */
1812 FRAME_PTR f; 1821 FRAME_PTR f;
1813 Lisp_Object arg, oldval; 1822 Lisp_Object arg, oldval;
1814 { 1823 {
1815 x_set_name (f, arg, 0); 1824 x_set_name (f, arg, 0);
1816 } 1825 }
1817 1826
1827 /* Change the title of frame F to NAME.
1828 If NAME is nil, use the frame name as the title.
1829
1830 If EXPLICIT is non-zero, that indicates that lisp code is setting the
1831 name; if NAME is a string, set F's name to NAME and set
1832 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
1833
1834 If EXPLICIT is zero, that indicates that Emacs redisplay code is
1835 suggesting a new name, which lisp code should override; if
1836 F->explicit_name is set, ignore the new name; otherwise, set it. */
1837
1838 void
1839 x_set_title (f, name)
1840 struct frame *f;
1841 Lisp_Object name;
1842 {
1843 /* Don't change the title if it's already NAME. */
1844 if (EQ (name, f->title))
1845 return;
1846
1847 update_mode_lines = 1;
1848
1849 f->title = name;
1850
1851 if (NILP (name))
1852 name = f->name;
1853
1854 if (FRAME_X_WINDOW (f))
1855 {
1856 BLOCK_INPUT;
1857 #ifdef HAVE_X11R4
1858 {
1859 XTextProperty text, icon;
1860 Lisp_Object icon_name;
1861
1862 text.value = XSTRING (name)->data;
1863 text.encoding = XA_STRING;
1864 text.format = 8;
1865 text.nitems = XSTRING (name)->size;
1866
1867 icon_name = (!NILP (f->icon_name) ? f->icon_name : name);
1868
1869 icon.value = XSTRING (icon_name)->data;
1870 icon.encoding = XA_STRING;
1871 icon.format = 8;
1872 icon.nitems = XSTRING (icon_name)->size;
1873 #ifdef USE_X_TOOLKIT
1874 XSetWMName (FRAME_X_DISPLAY (f),
1875 XtWindow (f->output_data.x->widget), &text);
1876 XSetWMIconName (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget),
1877 &icon);
1878 #else /* not USE_X_TOOLKIT */
1879 XSetWMName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &text);
1880 XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &icon);
1881 #endif /* not USE_X_TOOLKIT */
1882 }
1883 #else /* not HAVE_X11R4 */
1884 XSetIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
1885 XSTRING (name)->data);
1886 XStoreName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
1887 XSTRING (name)->data);
1888 #endif /* not HAVE_X11R4 */
1889 UNBLOCK_INPUT;
1890 }
1891 }
1892
1818 void 1893 void
1819 x_set_autoraise (f, arg, oldval) 1894 x_set_autoraise (f, arg, oldval)
1820 struct frame *f; 1895 struct frame *f;
1821 Lisp_Object arg, oldval; 1896 Lisp_Object arg, oldval;
1822 { 1897 {