diff options
| author | Eli Zaretskii | 1997-11-20 15:50:59 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 1997-11-20 15:50:59 +0000 |
| commit | e5317d612688c235216e798521a3a199b315817b (patch) | |
| tree | 10bfb8ca0eba3f6607c894be3476465f0daa819f | |
| parent | ccd19b9f49b88df9eb4c994e6db33e97f1c612c0 (diff) | |
| download | emacs-e5317d612688c235216e798521a3a199b315817b.tar.gz emacs-e5317d612688c235216e798521a3a199b315817b.zip | |
(frame_name_fnn_p, set_term_frame_name): New functions.
(store_frame_param): When the property name is "name", set the
name of the frame to its value.
| -rw-r--r-- | src/frame.c | 69 |
1 files changed, 67 insertions, 2 deletions
diff --git a/src/frame.c b/src/frame.c index 7f2cf16eeba..ceb7951f7ab 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -21,6 +21,9 @@ Boston, MA 02111-1307, USA. */ | |||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | 22 | ||
| 23 | #include <stdio.h> | 23 | #include <stdio.h> |
| 24 | #ifdef HAVE_STDLIB_H | ||
| 25 | #include <stdlib.h> | ||
| 26 | #endif | ||
| 24 | #include "lisp.h" | 27 | #include "lisp.h" |
| 25 | #include "charset.h" | 28 | #include "charset.h" |
| 26 | #ifdef HAVE_WINDOW_SYSTEM | 29 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -1757,6 +1760,64 @@ store_in_alist (alistptr, prop, val) | |||
| 1757 | Fsetcdr (tem, val); | 1760 | Fsetcdr (tem, val); |
| 1758 | } | 1761 | } |
| 1759 | 1762 | ||
| 1763 | static int | ||
| 1764 | frame_name_fnn_p (str, len) | ||
| 1765 | char *str; | ||
| 1766 | int len; | ||
| 1767 | { | ||
| 1768 | if (len > 1 && str[0] == 'F') | ||
| 1769 | { | ||
| 1770 | char *end_ptr; | ||
| 1771 | long num = strtol (str + 1, &end_ptr, 10); | ||
| 1772 | |||
| 1773 | if (end_ptr == str + len) | ||
| 1774 | return 1; | ||
| 1775 | } | ||
| 1776 | return 0; | ||
| 1777 | } | ||
| 1778 | |||
| 1779 | /* Set the name of the terminal frame. Also used by MSDOS frames. | ||
| 1780 | Modeled after x_set_name which is used for WINDOW frames. */ | ||
| 1781 | |||
| 1782 | void | ||
| 1783 | set_term_frame_name (f, name) | ||
| 1784 | struct frame *f; | ||
| 1785 | Lisp_Object name; | ||
| 1786 | { | ||
| 1787 | f->explicit_name = ! NILP (name); | ||
| 1788 | |||
| 1789 | /* If NAME is nil, set the name to F<num>. */ | ||
| 1790 | if (NILP (name)) | ||
| 1791 | { | ||
| 1792 | char namebuf[20]; | ||
| 1793 | |||
| 1794 | /* Check for no change needed in this very common case | ||
| 1795 | before we do any consing. */ | ||
| 1796 | if (frame_name_fnn_p (XSTRING (f->name)->data, XSTRING (f->name)->size)) | ||
| 1797 | return; | ||
| 1798 | |||
| 1799 | terminal_frame_count++; | ||
| 1800 | sprintf (namebuf, "F%d", terminal_frame_count); | ||
| 1801 | name = build_string (namebuf); | ||
| 1802 | } | ||
| 1803 | else | ||
| 1804 | { | ||
| 1805 | CHECK_STRING (name, 0); | ||
| 1806 | |||
| 1807 | /* Don't change the name if it's already NAME. */ | ||
| 1808 | if (! NILP (Fstring_equal (name, f->name))) | ||
| 1809 | return; | ||
| 1810 | |||
| 1811 | /* Don't allow the user to set the frame name to F<num>, so it | ||
| 1812 | doesn't clash with the names we generate for terminal frames. */ | ||
| 1813 | if (frame_name_fnn_p (XSTRING (name)->data, XSTRING (name)->size)) | ||
| 1814 | error ("Frame names of the form F<num> are usurped by Emacs"); | ||
| 1815 | } | ||
| 1816 | |||
| 1817 | f->name = name; | ||
| 1818 | update_mode_lines = 1; | ||
| 1819 | } | ||
| 1820 | |||
| 1760 | void | 1821 | void |
| 1761 | store_frame_param (f, prop, val) | 1822 | store_frame_param (f, prop, val) |
| 1762 | struct frame *f; | 1823 | struct frame *f; |
| @@ -1780,8 +1841,12 @@ store_frame_param (f, prop, val) | |||
| 1780 | f->buffer_predicate = val; | 1841 | f->buffer_predicate = val; |
| 1781 | 1842 | ||
| 1782 | if (! FRAME_WINDOW_P (f)) | 1843 | if (! FRAME_WINDOW_P (f)) |
| 1783 | if (EQ (prop, Qmenu_bar_lines)) | 1844 | { |
| 1784 | set_menu_bar_lines (f, val, make_number (FRAME_MENU_BAR_LINES (f))); | 1845 | if (EQ (prop, Qmenu_bar_lines)) |
| 1846 | set_menu_bar_lines (f, val, make_number (FRAME_MENU_BAR_LINES (f))); | ||
| 1847 | else if (EQ (prop, Qname)) | ||
| 1848 | set_term_frame_name (f, val); | ||
| 1849 | } | ||
| 1785 | 1850 | ||
| 1786 | if (EQ (prop, Qminibuffer) && WINDOWP (val)) | 1851 | if (EQ (prop, Qminibuffer) && WINDOWP (val)) |
| 1787 | { | 1852 | { |