comparison src/frame.c @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 0293115a14e9
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */ 21 Boston, MA 02111-1307, USA. */
22 22
23 /* Synched up with: FSF 19.30. */ 23 /* Synched up with: FSF 19.30. */
24 24
25 /* This file has been Mule-ized except for the frame-title stuff. */ 25 /* This file has been Mule-ized. */
26 26
27 #include <config.h> 27 #include <config.h>
28 #include "lisp.h" 28 #include "lisp.h"
29 29
30 #include "buffer.h" /* for Vbuffer_alist */ 30 #include "buffer.h" /* for Vbuffer_alist */
52 Lisp_Object Vmouse_enter_frame_hook, Qmouse_enter_frame_hook; 52 Lisp_Object Vmouse_enter_frame_hook, Qmouse_enter_frame_hook;
53 Lisp_Object Vmouse_leave_frame_hook, Qmouse_leave_frame_hook; 53 Lisp_Object Vmouse_leave_frame_hook, Qmouse_leave_frame_hook;
54 Lisp_Object Vmap_frame_hook, Qmap_frame_hook; 54 Lisp_Object Vmap_frame_hook, Qmap_frame_hook;
55 Lisp_Object Vunmap_frame_hook, Qunmap_frame_hook; 55 Lisp_Object Vunmap_frame_hook, Qunmap_frame_hook;
56 Lisp_Object Vallow_deletion_of_last_visible_frame; 56 Lisp_Object Vallow_deletion_of_last_visible_frame;
57 #ifdef HAVE_CDE 57 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND)
58 Lisp_Object Vdrag_and_drop_functions, Qdrag_and_drop_functions; 58 Lisp_Object Vdrag_and_drop_functions, Qdrag_and_drop_functions;
59 #endif 59 #endif
60 Lisp_Object Vmouse_motion_handler; 60 Lisp_Object Vmouse_motion_handler;
61 Lisp_Object Vsynchronize_minibuffers; 61 Lisp_Object Vsynchronize_minibuffers;
62 Lisp_Object Qsynchronize_minibuffers; 62 Lisp_Object Qsynchronize_minibuffers;
93 93
94 Lisp_Object Qframep, Qframe_live_p; 94 Lisp_Object Qframep, Qframe_live_p;
95 Lisp_Object Qframe_x_p, Qframe_tty_p; 95 Lisp_Object Qframe_x_p, Qframe_tty_p;
96 Lisp_Object Qdelete_frame; 96 Lisp_Object Qdelete_frame;
97 97
98 Lisp_Object Vframe_title_format; 98 Lisp_Object Qframe_title_format, Vframe_title_format;
99 Lisp_Object Vframe_icon_title_format; 99 Lisp_Object Qframe_icon_title_format, Vframe_icon_title_format;
100 100
101 Lisp_Object Vdefault_frame_name; 101 Lisp_Object Vdefault_frame_name;
102 Lisp_Object Vdefault_frame_plist; 102 Lisp_Object Vdefault_frame_plist;
103 103
104 Lisp_Object Vframe_icon_glyph; 104 Lisp_Object Vframe_icon_glyph;
1142 of that type. If CONSOLE is 'window-system, return any frames on any 1142 of that type. If CONSOLE is 'window-system, return any frames on any
1143 window-system consoles. If CONSOLE is nil or omitted, return frames only 1143 window-system consoles. If CONSOLE is nil or omitted, return frames only
1144 on the FRAME's console. Otherwise, all frames are considered. 1144 on the FRAME's console. Otherwise, all frames are considered.
1145 */ ) 1145 */ )
1146 (frame, frametype, console) 1146 (frame, frametype, console)
1147 Lisp_Object frame, frametype, console; 1147 Lisp_Object frame, frametype, console;
1148 { 1148 {
1149 XSETFRAME (frame, decode_frame (frame)); 1149 XSETFRAME (frame, decode_frame (frame));
1150 1150
1151 return (next_frame (frame, frametype, console)); 1151 return (next_frame (frame, frametype, console));
1152 } 1152 }
1304 } 1304 }
1305 } 1305 }
1306 1306
1307 minibuffer_selected = EQ (minibuf_window, Fselected_window (Qnil)); 1307 minibuffer_selected = EQ (minibuf_window, Fselected_window (Qnil));
1308 1308
1309 /* If we were focussed on this frame, then we're not any more. 1309 /* If we were focused on this frame, then we're not any more.
1310 Assume that we lost the focus; that way, the call to 1310 Assume that we lost the focus; that way, the call to
1311 Fselect_frame() below won't end up making us explicitly 1311 Fselect_frame() below won't end up making us explicitly
1312 focus on another frame, which is generally undesirable in 1312 focus on another frame, which is generally undesirable in
1313 a point-to-type world. If our mouse ends up sitting over 1313 a point-to-type world. If our mouse ends up sitting over
1314 another frame, we will receive a FocusIn event and end up 1314 another frame, we will receive a FocusIn event and end up
1382 select the new one. */ 1382 select the new one. */
1383 if (minibuffer_selected) 1383 if (minibuffer_selected)
1384 Fselect_window (minibuf_window); 1384 Fselect_window (minibuf_window);
1385 } 1385 }
1386 1386
1387 /* Before here, we haven't made any dangerous changed (just checked for 1387 /* Before here, we haven't made any dangerous changes (just checked for
1388 error conditions). Now run the delete-frame-hook. Remember that 1388 error conditions). Now run the delete-frame-hook. Remember that
1389 user code there could do any number of dangerous things, including 1389 user code there could do any number of dangerous things, including
1390 signalling an error. 1390 signalling an error.
1391 */ 1391 */
1392 1392
1466 1466
1467 /* If we've deleted the last non-minibuf frame, then try to find 1467 /* If we've deleted the last non-minibuf frame, then try to find
1468 another one. */ 1468 another one. */
1469 if (EQ (frame, CONSOLE_LAST_NONMINIBUF_FRAME (con))) 1469 if (EQ (frame, CONSOLE_LAST_NONMINIBUF_FRAME (con)))
1470 { 1470 {
1471 Lisp_Object frmcons, devcons, concons; 1471 Lisp_Object frmcons, devcons;
1472 1472
1473 set_console_last_nonminibuf_frame (con, Qnil); 1473 set_console_last_nonminibuf_frame (con, Qnil);
1474 1474
1475 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con) 1475 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con)
1476 { 1476 {
1569 Normally, you cannot delete the last non-minibuffer-only frame (you must 1569 Normally, you cannot delete the last non-minibuffer-only frame (you must
1570 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional 1570 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional
1571 second argument FORCE is non-nil, you can delete the last frame. (This 1571 second argument FORCE is non-nil, you can delete the last frame. (This
1572 will automatically call `save-buffers-kill-emacs'.) 1572 will automatically call `save-buffers-kill-emacs'.)
1573 */ ) 1573 */ )
1574 (frame, force) 1574 (frame, force)
1575 Lisp_Object frame, force; 1575 Lisp_Object frame, force;
1576 { 1576 {
1577 /* This function can GC */ 1577 /* This function can GC */
1578 struct frame *f; 1578 struct frame *f;
1579 1579
1580 if (NILP (frame)) 1580 if (NILP (frame))
1621 w = XWINDOW (XCAR (val)); 1621 w = XWINDOW (XCAR (val));
1622 x = XINT (XCAR (XCDR (val))); 1622 x = XINT (XCAR (XCDR (val)));
1623 y = XINT (XCDR (XCDR (val))); 1623 y = XINT (XCDR (XCDR (val)));
1624 f = XFRAME (w->frame); 1624 f = XFRAME (w->frame);
1625 1625
1626 if (x >= 0 && y >= 0 && 1626 if (x >= 0 && y >= 0)
1627 pixel_to_glyph_translation (f, x, y, &x, &y, &obj_x, &obj_y, &w, 1627 {
1628 &bufpos, &closest, &modeline_closest, 1628 if (pixel_to_glyph_translation (f, x, y, &x, &y, &obj_x, &obj_y, &w,
1629 &obj1, &obj2) 1629 &bufpos, &closest, &modeline_closest,
1630 != OVER_NOTHING) 1630 &obj1, &obj2)
1631 { 1631 != OVER_NOTHING)
1632 XCAR (XCDR (val)) = make_int (x); 1632 {
1633 XCDR (XCDR (val)) = make_int (y); 1633 XCAR (XCDR (val)) = make_int (x);
1634 XCDR (XCDR (val)) = make_int (y);
1635 }
1634 } 1636 }
1635 else 1637 else
1636 { 1638 {
1637 XCAR (XCDR (val)) = Qnil; 1639 XCAR (XCDR (val)) = Qnil;
1638 XCDR (XCDR (val)) = Qnil; 1640 XCDR (XCDR (val)) = Qnil;
1674 DEVICE specifies the device on which to read the mouse position, and 1676 DEVICE specifies the device on which to read the mouse position, and
1675 defaults to the selected device. If the device is a mouseless terminal 1677 defaults to the selected device. If the device is a mouseless terminal
1676 or Emacs hasn't been programmed to read its mouse position, it returns 1678 or Emacs hasn't been programmed to read its mouse position, it returns
1677 the device's selected window for WINDOW and nil for X and Y. 1679 the device's selected window for WINDOW and nil for X and Y.
1678 */ ) 1680 */ )
1679 (device) 1681 (device)
1680 Lisp_Object device; 1682 Lisp_Object device;
1681 { 1683 {
1682 struct device *d = decode_device (device); 1684 struct device *d = decode_device (device);
1683 Lisp_Object frame; 1685 Lisp_Object frame;
1684 Lisp_Object window; 1686 Lisp_Object window;
1685 Lisp_Object x, y; 1687 Lisp_Object x, y;
1724 1726
1725 DEVICE specifies the device on which to read the mouse position, and 1727 DEVICE specifies the device on which to read the mouse position, and
1726 defaults to the selected device. If the mouse position can't be determined 1728 defaults to the selected device. If the mouse position can't be determined
1727 (e.g. DEVICE is a TTY device), nil is returned instead of an event. 1729 (e.g. DEVICE is a TTY device), nil is returned instead of an event.
1728 */ ) 1730 */ )
1729 (device) 1731 (device)
1730 Lisp_Object device; 1732 Lisp_Object device;
1731 { 1733 {
1732 struct device *d = decode_device (device); 1734 struct device *d = decode_device (device);
1733 Lisp_Object frame; 1735 Lisp_Object frame;
1734 int intx, inty; 1736 int intx, inty;
1735 1737
1753 before calling this function on it, like this. 1755 before calling this function on it, like this.
1754 (while (not (frame-visible-p frame)) (sleep-for .5)) 1756 (while (not (frame-visible-p frame)) (sleep-for .5))
1755 Note also: Warping the mouse is contrary to the ICCCM, so be very sure 1757 Note also: Warping the mouse is contrary to the ICCCM, so be very sure
1756 that the behavior won't end up being obnoxious! 1758 that the behavior won't end up being obnoxious!
1757 */ ) 1759 */ )
1758 (window, x, y) 1760 (window, x, y)
1759 Lisp_Object window, x, y; 1761 Lisp_Object window, x, y;
1760 { 1762 {
1761 struct window *w; 1763 struct window *w;
1762 int pix_x, pix_y; 1764 int pix_x, pix_y;
1763 1765
1764 CHECK_WINDOW (window); 1766 CHECK_WINDOW (window);
1780 Note, this is a no-op for an X frame that is not visible. 1782 Note, this is a no-op for an X frame that is not visible.
1781 If you have just created a frame, you must wait for it to become visible 1783 If you have just created a frame, you must wait for it to become visible
1782 before calling this function on it, like this. 1784 before calling this function on it, like this.
1783 (while (not (frame-visible-p frame)) (sleep-for .5)) 1785 (while (not (frame-visible-p frame)) (sleep-for .5))
1784 */ ) 1786 */ )
1785 (window, x, y) 1787 (window, x, y)
1786 Lisp_Object window, x, y; 1788 Lisp_Object window, x, y;
1787 { 1789 {
1788 struct window *w; 1790 struct window *w;
1789 1791
1790 CHECK_WINDOW (window); 1792 CHECK_WINDOW (window);
1791 CHECK_INT (x); 1793 CHECK_INT (x);
1802 0, 1, 0 /* 1804 0, 1, 0 /*
1803 Make the frame FRAME visible (assuming it is an X-window). 1805 Make the frame FRAME visible (assuming it is an X-window).
1804 If omitted, FRAME defaults to the currently selected frame. 1806 If omitted, FRAME defaults to the currently selected frame.
1805 Also raises the frame so that nothing obscures it. 1807 Also raises the frame so that nothing obscures it.
1806 */ ) 1808 */ )
1807 (frame) 1809 (frame)
1808 Lisp_Object frame; 1810 Lisp_Object frame;
1809 { 1811 {
1810 struct frame *f = decode_frame (frame); 1812 struct frame *f = decode_frame (frame);
1811 1813
1812 MAYBE_FRAMEMETH (f, make_frame_visible, (f)); 1814 MAYBE_FRAMEMETH (f, make_frame_visible, (f));
1813 return frame; 1815 return frame;
1853 0, 1, "" /* 1855 0, 1, "" /*
1854 Make the frame FRAME into an icon, if the window manager supports icons. 1856 Make the frame FRAME into an icon, if the window manager supports icons.
1855 If omitted, FRAME defaults to the currently selected frame. 1857 If omitted, FRAME defaults to the currently selected frame.
1856 */ ) 1858 */ )
1857 (frame) 1859 (frame)
1858 Lisp_Object frame; 1860 Lisp_Object frame;
1859 { 1861 {
1860 struct frame *f, *sel_frame; 1862 struct frame *f, *sel_frame;
1861 struct device *d; 1863 struct device *d;
1862 1864
1863 f = decode_frame (frame); 1865 f = decode_frame (frame);
1883 Under X, this is currently the same as `make-frame-visible'. 1885 Under X, this is currently the same as `make-frame-visible'.
1884 If omitted, FRAME defaults to the currently selected frame. 1886 If omitted, FRAME defaults to the currently selected frame.
1885 Also raises the frame so that nothing obscures it. 1887 Also raises the frame so that nothing obscures it.
1886 */ ) 1888 */ )
1887 (frame) 1889 (frame)
1888 Lisp_Object frame; 1890 Lisp_Object frame;
1889 { 1891 {
1890 return Fmake_frame_visible (frame); 1892 return Fmake_frame_visible (frame);
1891 } 1893 }
1892 1894
1893 /* FSF returns 'icon for iconized frames. What a crock! */ 1895 /* FSF returns 'icon for iconized frames. What a crock! */
1910 Sframe_totally_visible_p, 0, 1, 0 /* 1912 Sframe_totally_visible_p, 0, 1, 0 /*
1911 Return T if frame is not obscured by any other X windows, NIL otherwise. 1913 Return T if frame is not obscured by any other X windows, NIL otherwise.
1912 Always returns t for tty frames. 1914 Always returns t for tty frames.
1913 */ ) 1915 */ )
1914 (frame) 1916 (frame)
1915 Lisp_Object frame; 1917 Lisp_Object frame;
1916 { 1918 {
1917 struct frame *f = decode_frame (frame); 1919 struct frame *f = decode_frame (frame);
1918 return (FRAMEMETH_OR_GIVEN (f, frame_totally_visible_p, (f), f->visible) 1920 return (FRAMEMETH_OR_GIVEN (f, frame_totally_visible_p, (f), f->visible)
1919 ? Qt : Qnil); 1921 ? Qt : Qnil);
1920 } 1922 }
1941 0, 1, 0 /* 1943 0, 1, 0 /*
1942 Return a list of all frames now \"visible\" (being updated). 1944 Return a list of all frames now \"visible\" (being updated).
1943 If DEVICE is specified only frames on that device will be returned. 1945 If DEVICE is specified only frames on that device will be returned.
1944 */ ) 1946 */ )
1945 (device) 1947 (device)
1946 Lisp_Object device; 1948 Lisp_Object device;
1947 { 1949 {
1948 Lisp_Object devcons, concons; 1950 Lisp_Object devcons, concons;
1949 struct frame *f; 1951 struct frame *f;
1950 Lisp_Object value; 1952 Lisp_Object value;
1951 1953
1979 If FRAME is invisible, make it visible. 1981 If FRAME is invisible, make it visible.
1980 If Emacs is displaying on an ordinary terminal or some other device which 1982 If Emacs is displaying on an ordinary terminal or some other device which
1981 doesn't support multiple overlapping frames, this function does nothing. 1983 doesn't support multiple overlapping frames, this function does nothing.
1982 */ ) 1984 */ )
1983 (frame) 1985 (frame)
1984 Lisp_Object frame; 1986 Lisp_Object frame;
1985 { 1987 {
1986 struct frame *f = decode_frame (frame); 1988 struct frame *f = decode_frame (frame);
1987 1989
1988 /* Do like the documentation says. */ 1990 /* Do like the documentation says. */
1989 Fmake_frame_visible (frame); 1991 Fmake_frame_visible (frame);
2141 2143
2142 Frame properties can be retrieved using `frame-property' or `frame-properties'. 2144 Frame properties can be retrieved using `frame-property' or `frame-properties'.
2143 2145
2144 The following symbols etc. have predefined meanings: 2146 The following symbols etc. have predefined meanings:
2145 2147
2146 name Name of the frame, used for resourcing. Unchangeable 2148 name Name of the frame, used with X resources.
2147 after creation. 2149 Unchangeable after creation.
2148 2150
2149 height Height of the frame, in lines. 2151 height Height of the frame, in lines.
2150 2152
2151 width Width of the frame, in characters. 2153 width Width of the frame, in characters.
2152 2154
2184 [default foreground], [default background], [default font], 2186 [default foreground], [default background], [default font],
2185 [modeline foreground], [modeline background], [modeline font], 2187 [modeline foreground], [modeline background], [modeline font],
2186 etc. 2188 etc.
2187 [Giving a vector of a face and a property is equivalent 2189 [Giving a vector of a face and a property is equivalent
2188 to calling `set-face-property' on the face and property, 2190 to calling `set-face-property' on the face and property,
2189 with a local of FRAME. Giving the vector to 2191 with a locale of FRAME. Giving the vector to
2190 `frame-property' calls `face-property-instance' on the 2192 `frame-property' calls `face-property-instance' on the
2191 face and property.] 2193 face and property.]
2192 2194
2193 Finally, if a frame property symbol has the property `frame-property-alias' 2195 Finally, if a frame property symbol has the property `frame-property-alias'
2194 on it, then the value will be used in place of that symbol when looking 2196 on it, then the value will be used in place of that symbol when looking
2198 See the variables `default-x-frame-plist' and `default-tty-frame-plist' 2200 See the variables `default-x-frame-plist' and `default-tty-frame-plist'
2199 for a description of the properties recognized for particular types of 2201 for a description of the properties recognized for particular types of
2200 frames. 2202 frames.
2201 */ ) 2203 */ )
2202 (frame, plist) 2204 (frame, plist)
2203 Lisp_Object frame, plist; 2205 Lisp_Object frame, plist;
2204 { 2206 {
2205 struct frame *f = decode_frame (frame); 2207 struct frame *f = decode_frame (frame);
2206 Lisp_Object tail; 2208 Lisp_Object tail;
2207 Lisp_Object *tailp; 2209 Lisp_Object *tailp;
2208 struct gcpro gcpro1, gcpro2; 2210 struct gcpro gcpro1, gcpro2;
2217 Lisp_Object prop = Fcar (tail); 2219 Lisp_Object prop = Fcar (tail);
2218 Lisp_Object val = Fcar (Fcdr (tail)); 2220 Lisp_Object val = Fcar (Fcdr (tail));
2219 2221
2220 prop = get_property_alias (prop); 2222 prop = get_property_alias (prop);
2221 2223
2222 if (EQ (prop, Qminibuffer))
2223 store_minibuf_frame_prop (f, val);
2224 #if 0 2224 #if 0
2225 /* mly wants this, but it's not reasonable to change the name of a 2225 /* mly wants this, but it's not reasonable to change the name of a
2226 frame after it has been created, because the old name was used 2226 frame after it has been created, because the old name was used
2227 for resource lookup. */ 2227 for resource lookup. */
2228 if (EQ (prop, Qname)) 2228 if (EQ (prop, Qname))
2298 2298
2299 XSETFRAME (frame, f); 2299 XSETFRAME (frame, f);
2300 2300
2301 property = get_property_alias (property); 2301 property = get_property_alias (property);
2302 2302
2303 #define FROB(propprop, value) \ 2303 #define FROB(propprop, value) \
2304 do { \ 2304 do { \
2305 if (EQ (property, propprop)) \ 2305 if (EQ (property, propprop)) \
2306 { \ 2306 return (value); \
2307 return (value); \
2308 } \
2309 } while (0) 2307 } while (0)
2310 2308
2311 FROB (Qname, f->name); 2309 FROB (Qname, f->name);
2312 FROB (Qheight, make_int (FRAME_HEIGHT (f))); 2310 FROB (Qheight, make_int (FRAME_HEIGHT (f)));
2313 FROB (Qwidth, make_int (FRAME_WIDTH (f))); 2311 FROB (Qwidth, make_int (FRAME_WIDTH (f)));
2314 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. 2312 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P.
2315 This is over-the-top bogosity, because it's inconsistent with 2313 This is over-the-top bogosity, because it's inconsistent with
2316 the semantics of `minibuffer' when passed to `make-frame'. 2314 the semantics of `minibuffer' when passed to `make-frame'.
2317 Returning Qt makes things consistent. */ 2315 Returning Qt makes things consistent. */
2318 FROB (Qminibuffer, (! FRAME_HAS_MINIBUF_P (f) ? Qt 2316 FROB (Qminibuffer, (FRAME_HAS_MINIBUF_P (f) ? Qt :
2319 : FRAME_MINIBUF_ONLY_P (f) ? Qonly 2317 FRAME_MINIBUF_ONLY_P (f) ? Qonly :
2320 : FRAME_MINIBUF_WINDOW (f))); 2318 FRAME_MINIBUF_WINDOW (f)));
2321 FROB (Qunsplittable, FRAME_NO_SPLIT_P (f) ? Qt : Qnil); 2319 FROB (Qunsplittable, FRAME_NO_SPLIT_P (f) ? Qt : Qnil);
2322 FROB (Qbuffer_predicate, f->buffer_predicate); 2320 FROB (Qbuffer_predicate, f->buffer_predicate);
2323 2321
2324 #undef FROB 2322 #undef FROB
2325 2323
2367 Lisp_Object result = Qnil; 2365 Lisp_Object result = Qnil;
2368 struct gcpro gcpro1; 2366 struct gcpro gcpro1;
2369 2367
2370 GCPRO1 (result); 2368 GCPRO1 (result);
2371 2369
2372 #define FROB(propprop, value) \ 2370 #define FROB(propprop, value) \
2373 do { \ 2371 do { \
2374 Lisp_Object temtem = (value); \ 2372 Lisp_Object temtem = (value); \
2375 if (!NILP (temtem)) \ 2373 if (!NILP (temtem)) \
2376 /* backwards order; we reverse it below */ \ 2374 /* backwards order; we reverse it below */ \
2377 result = Fcons (temtem, Fcons (propprop, result)); \ 2375 result = Fcons (temtem, Fcons (propprop, result)); \
2378 } while (0) 2376 } while (0)
2379 2377
2380 FROB (Qname, f->name); 2378 FROB (Qname, f->name);
2381 FROB (Qheight, make_int (FRAME_HEIGHT (f))); 2379 FROB (Qheight, make_int (FRAME_HEIGHT (f)));
2382 FROB (Qwidth, make_int (FRAME_WIDTH (f))); 2380 FROB (Qwidth, make_int (FRAME_WIDTH (f)));
2383 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. 2381 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P.
2384 This is over-the-top bogosity, because it's inconsistent with 2382 This is over-the-top bogosity, because it's inconsistent with
2385 the semantics of `minibuffer' when passed to `make-frame'. 2383 the semantics of `minibuffer' when passed to `make-frame'.
2386 Returning Qt makes things consistent. */ 2384 Returning Qt makes things consistent. */
2387 FROB (Qminibuffer, (! FRAME_HAS_MINIBUF_P (f) ? Qt 2385 FROB (Qminibuffer, (FRAME_HAS_MINIBUF_P (f) ? Qt :
2388 : FRAME_MINIBUF_ONLY_P (f) ? Qonly 2386 FRAME_MINIBUF_ONLY_P (f) ? Qonly :
2389 : FRAME_MINIBUF_WINDOW (f))); 2387 FRAME_MINIBUF_WINDOW (f)));
2390 FROB (Qunsplittable, FRAME_NO_SPLIT_P (f) ? Qt : Qnil); 2388 FROB (Qunsplittable, FRAME_NO_SPLIT_P (f) ? Qt : Qnil);
2391 FROB (Qbuffer_predicate, f->buffer_predicate); 2389 FROB (Qbuffer_predicate, f->buffer_predicate);
2392 2390
2393 #undef FROB 2391 #undef FROB
2394 2392
2412 2410
2413 DEFUN ("frame-pixel-height", Fframe_pixel_height, Sframe_pixel_height, 0, 1, 0 /* 2411 DEFUN ("frame-pixel-height", Fframe_pixel_height, Sframe_pixel_height, 0, 1, 0 /*
2414 Return the height in pixels of FRAME. 2412 Return the height in pixels of FRAME.
2415 */ ) 2413 */ )
2416 (frame) 2414 (frame)
2417 Lisp_Object frame; 2415 Lisp_Object frame;
2418 { 2416 {
2419 struct frame *f = decode_frame (frame); 2417 struct frame *f = decode_frame (frame);
2420 return (make_int (f->pixheight)); 2418 return (make_int (f->pixheight));
2421 } 2419 }
2422 2420
2423 DEFUN ("frame-pixel-width", Fframe_pixel_width, Sframe_pixel_width, 0, 1, 0 /* 2421 DEFUN ("frame-pixel-width", Fframe_pixel_width, Sframe_pixel_width, 0, 1, 0 /*
2424 Return the width in pixels of FRAME. 2422 Return the width in pixels of FRAME.
2425 */ ) 2423 */ )
2426 (frame) 2424 (frame)
2427 Lisp_Object frame; 2425 Lisp_Object frame;
2428 { 2426 {
2429 struct frame *f = decode_frame (frame); 2427 struct frame *f = decode_frame (frame);
2430 return (make_int (f->pixwidth)); 2428 return (make_int (f->pixwidth));
2431 } 2429 }
2432 2430
2433 DEFUN ("frame-name", Fframe_name, Sframe_name, 0, 1, 0 /* 2431 DEFUN ("frame-name", Fframe_name, Sframe_name, 0, 1, 0 /*
2434 Return the name of FRAME (defaulting to the selected frame). 2432 Return the name of FRAME (defaulting to the selected frame).
2435 This is not the same as the `title' of the frame. 2433 This is not the same as the `title' of the frame.
2436 */ ) 2434 */ )
2437 (frame) 2435 (frame)
2438 Lisp_Object frame; 2436 Lisp_Object frame;
2439 { 2437 {
2440 return (decode_frame (frame)->name); 2438 return (decode_frame (frame)->name);
2441 } 2439 }
2442 2440
2443 DEFUN ("frame-modified-tick", Fframe_modified_tick, Sframe_modified_tick, 2441 DEFUN ("frame-modified-tick", Fframe_modified_tick, Sframe_modified_tick,
2448 `set-window-buffer' or `select-window' is called on a window in the 2446 `set-window-buffer' or `select-window' is called on a window in the
2449 frame, the window-start of a window in the frame has changed, or 2447 frame, the window-start of a window in the frame has changed, or
2450 anything else interesting has happened. It wraps around occasionally. 2448 anything else interesting has happened. It wraps around occasionally.
2451 No argument or nil as argument means use selected frame as FRAME. 2449 No argument or nil as argument means use selected frame as FRAME.
2452 */ ) 2450 */ )
2453 (frame) 2451 (frame)
2454 Lisp_Object frame; 2452 Lisp_Object frame;
2455 { 2453 {
2456 return make_int (decode_frame (frame)->modiff); 2454 return make_int (decode_frame (frame)->modiff);
2457 } 2455 }
2458 2456
2459 static void 2457 static void
2469 Specify that the frame FRAME has LINES lines. 2467 Specify that the frame FRAME has LINES lines.
2470 Optional third arg non-nil means that redisplay should use LINES lines 2468 Optional third arg non-nil means that redisplay should use LINES lines
2471 but that the idea of the actual height of the frame should not be changed. 2469 but that the idea of the actual height of the frame should not be changed.
2472 */ ) 2470 */ )
2473 (frame, rows, pretend) 2471 (frame, rows, pretend)
2474 Lisp_Object frame, rows, pretend; 2472 Lisp_Object frame, rows, pretend;
2475 { 2473 {
2476 struct frame *f = decode_frame (frame); 2474 struct frame *f = decode_frame (frame);
2477 XSETFRAME (frame, f); 2475 XSETFRAME (frame, f);
2478 CHECK_INT (rows); 2476 CHECK_INT (rows);
2479 2477
2486 Specify that the frame FRAME has COLS columns. 2484 Specify that the frame FRAME has COLS columns.
2487 Optional third arg non-nil means that redisplay should use COLS columns 2485 Optional third arg non-nil means that redisplay should use COLS columns
2488 but that the idea of the actual width of the frame should not be changed. 2486 but that the idea of the actual width of the frame should not be changed.
2489 */ ) 2487 */ )
2490 (frame, cols, pretend) 2488 (frame, cols, pretend)
2491 Lisp_Object frame, cols, pretend; 2489 Lisp_Object frame, cols, pretend;
2492 { 2490 {
2493 struct frame *f = decode_frame (frame); 2491 struct frame *f = decode_frame (frame);
2494 XSETFRAME (frame, f); 2492 XSETFRAME (frame, f);
2495 CHECK_INT (cols); 2493 CHECK_INT (cols);
2496 2494
2504 Sets size of FRAME to COLS by ROWS. 2502 Sets size of FRAME to COLS by ROWS.
2505 Optional fourth arg non-nil means that redisplay should use COLS by ROWS 2503 Optional fourth arg non-nil means that redisplay should use COLS by ROWS
2506 but that the idea of the actual size of the frame should not be changed. 2504 but that the idea of the actual size of the frame should not be changed.
2507 */ ) 2505 */ )
2508 (frame, cols, rows, pretend) 2506 (frame, cols, rows, pretend)
2509 Lisp_Object frame, cols, rows, pretend; 2507 Lisp_Object frame, cols, rows, pretend;
2510 { 2508 {
2511 struct frame *f = decode_frame (frame); 2509 struct frame *f = decode_frame (frame);
2512 XSETFRAME (frame, f); 2510 XSETFRAME (frame, f);
2513 CHECK_INT (cols); 2511 CHECK_INT (cols);
2514 CHECK_INT (rows); 2512 CHECK_INT (rows);
2523 This is actually the position of the upper left corner of the frame. 2521 This is actually the position of the upper left corner of the frame.
2524 Negative values for XOFFSET or YOFFSET are interpreted relative to 2522 Negative values for XOFFSET or YOFFSET are interpreted relative to
2525 the rightmost or bottommost possible position (that stays within the screen). 2523 the rightmost or bottommost possible position (that stays within the screen).
2526 */ ) 2524 */ )
2527 (frame, xoffset, yoffset) 2525 (frame, xoffset, yoffset)
2528 Lisp_Object frame, xoffset, yoffset; 2526 Lisp_Object frame, xoffset, yoffset;
2529 { 2527 {
2530 struct frame *f = decode_frame (frame); 2528 struct frame *f = decode_frame (frame);
2531 CHECK_INT (xoffset); 2529 CHECK_INT (xoffset);
2532 CHECK_INT (yoffset); 2530 CHECK_INT (yoffset);
2533 2531
2772 update_frame_title (struct frame *f) 2770 update_frame_title (struct frame *f)
2773 { 2771 {
2774 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); 2772 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
2775 Lisp_Object title_format; 2773 Lisp_Object title_format;
2776 Lisp_Object icon_format; 2774 Lisp_Object icon_format;
2777 char *frame_title_string = 0; 2775 Bufbyte *title;
2778 2776
2779 /* We don't change the title for the minibuffer unless the frame 2777 /* We don't change the title for the minibuffer unless the frame
2780 only has a minibuffer. */ 2778 only has a minibuffer. */
2781 if (MINI_WINDOW_P (w) && !FRAME_MINIBUF_ONLY_P (f)) 2779 if (MINI_WINDOW_P (w) && !FRAME_MINIBUF_ONLY_P (f))
2782 return; 2780 return;
2783 2781
2784 /* And we don't want dead buffers to blow up on us. */ 2782 /* And we don't want dead buffers to blow up on us. */
2785 else if (!BUFFER_LIVE_P (XBUFFER (w->buffer))) 2783 if (!BUFFER_LIVE_P (XBUFFER (w->buffer)))
2786 return; 2784 return;
2787 2785
2788 title_format = Vframe_title_format; 2786 title = NULL;
2789 icon_format = Vframe_icon_title_format; 2787 title_format = symbol_value_in_buffer (Qframe_title_format, w->buffer);
2790 2788 icon_format = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer);
2791 if (HAS_FRAMEMETH_P (f, set_title_from_char)) 2789
2792 { 2790 if (HAS_FRAMEMETH_P (f, set_title_from_bufbyte))
2793 frame_title_string = 2791 {
2794 generate_formatted_string (w, title_format, Qnil, DEFAULT_INDEX, 2792 title = generate_formatted_string (w, title_format, Qnil,
2795 CURRENT_DISP); 2793 DEFAULT_INDEX, CURRENT_DISP);
2796 FRAMEMETH (f, set_title_from_char, (f, frame_title_string)); 2794 FRAMEMETH (f, set_title_from_bufbyte, (f, title));
2797 } 2795 }
2798 2796
2799 if (HAS_FRAMEMETH_P (f, set_icon_name_from_char)) 2797 if (HAS_FRAMEMETH_P (f, set_icon_name_from_bufbyte))
2800 { 2798 {
2801 if (!EQ (icon_format, title_format) || 2799 if (!EQ (icon_format, title_format) || !title)
2802 !HAS_FRAMEMETH_P (f, set_title_from_char))
2803 { 2800 {
2804 if (frame_title_string) 2801 if (title)
2805 xfree (frame_title_string); 2802 xfree (title);
2806 2803
2807 frame_title_string = 2804 title = generate_formatted_string (w, icon_format, Qnil,
2808 generate_formatted_string (w, icon_format, Qnil, DEFAULT_INDEX, 2805 DEFAULT_INDEX, CURRENT_DISP);
2809 CURRENT_DISP);
2810 } 2806 }
2811 2807 FRAMEMETH (f, set_icon_name_from_bufbyte, (f, title));
2812 FRAMEMETH (f, set_icon_name_from_char, (f, frame_title_string)); 2808 }
2813 } 2809
2814 2810 if (title)
2815 if (frame_title_string) 2811 xfree (title);
2816 xfree (frame_title_string);
2817 } 2812 }
2818 2813
2819 2814
2820 DEFUN ("set-frame-pointer", Fset_frame_pointer, Sset_frame_pointer, 2815 DEFUN ("set-frame-pointer", Fset_frame_pointer, Sset_frame_pointer,
2821 2, 2, 0 /* 2816 2, 2, 0 /*
2877 defsymbol (&Qcreate_frame_hook, "create-frame-hook"); 2872 defsymbol (&Qcreate_frame_hook, "create-frame-hook");
2878 defsymbol (&Qmouse_enter_frame_hook, "mouse-enter-frame-hook"); 2873 defsymbol (&Qmouse_enter_frame_hook, "mouse-enter-frame-hook");
2879 defsymbol (&Qmouse_leave_frame_hook, "mouse-leave-frame-hook"); 2874 defsymbol (&Qmouse_leave_frame_hook, "mouse-leave-frame-hook");
2880 defsymbol (&Qmap_frame_hook, "map-frame-hook"); 2875 defsymbol (&Qmap_frame_hook, "map-frame-hook");
2881 defsymbol (&Qunmap_frame_hook, "unmap-frame-hook"); 2876 defsymbol (&Qunmap_frame_hook, "unmap-frame-hook");
2882 #ifdef HAVE_CDE 2877 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND)
2883 defsymbol (&Qdrag_and_drop_functions, "drag-and-drop-functions"); 2878 defsymbol (&Qdrag_and_drop_functions, "drag-and-drop-functions");
2884 #endif 2879 #endif
2885 2880
2886 defsymbol (&Qframep, "framep"); 2881 defsymbol (&Qframep, "framep");
2887 defsymbol (&Qframe_live_p, "frame-live-p"); 2882 defsymbol (&Qframe_live_p, "frame-live-p");
2890 defsymbol (&Qdelete_frame, "delete-frame"); 2885 defsymbol (&Qdelete_frame, "delete-frame");
2891 defsymbol (&Qsynchronize_minibuffers, "synchronize-minibuffers"); 2886 defsymbol (&Qsynchronize_minibuffers, "synchronize-minibuffers");
2892 defsymbol (&Qbuffer_predicate, "buffer-predicate"); 2887 defsymbol (&Qbuffer_predicate, "buffer-predicate");
2893 defsymbol (&Qframe_being_created, "frame-being-created"); 2888 defsymbol (&Qframe_being_created, "frame-being-created");
2894 defsymbol (&Qmake_initial_minibuffer_frame, "make-initial-minibuffer-frame"); 2889 defsymbol (&Qmake_initial_minibuffer_frame, "make-initial-minibuffer-frame");
2890
2891 defsymbol (&Qframe_title_format, "frame-title-format");
2892 defsymbol (&Qframe_icon_title_format, "frame-icon-title-format");
2895 2893
2896 defsymbol (&Qvisible, "visible"); 2894 defsymbol (&Qvisible, "visible");
2897 defsymbol (&Qiconic, "iconic"); 2895 defsymbol (&Qiconic, "iconic");
2898 defsymbol (&Qinvisible, "invisible"); 2896 defsymbol (&Qinvisible, "invisible");
2899 defsymbol (&Qvisible_iconic, "visible-iconic"); 2897 defsymbol (&Qvisible_iconic, "visible-iconic");
3012 Vdeselect_frame_hook = Qnil; 3010 Vdeselect_frame_hook = Qnil;
3013 3011
3014 DEFVAR_LISP ("delete-frame-hook", &Vdelete_frame_hook /* 3012 DEFVAR_LISP ("delete-frame-hook", &Vdelete_frame_hook /*
3015 Function or functions to call when a frame is deleted. 3013 Function or functions to call when a frame is deleted.
3016 One argument, the to-be-deleted frame. 3014 One argument, the to-be-deleted frame.
3015 When this hook is called, the selected frame is different from
3016 the to-be-deleted frame, and the hook should not change that.
3017 */ ); 3017 */ );
3018 Vdelete_frame_hook = Qnil; 3018 Vdelete_frame_hook = Qnil;
3019 3019
3020 DEFVAR_LISP ("create-frame-hook", &Vcreate_frame_hook /* 3020 DEFVAR_LISP ("create-frame-hook", &Vcreate_frame_hook /*
3021 Function or functions to call when a frame is created. 3021 Function or functions to call when a frame is created.
3055 &Vallow_deletion_of_last_visible_frame /* 3055 &Vallow_deletion_of_last_visible_frame /*
3056 *Non-nil means to assume the force option to delete-frame. 3056 *Non-nil means to assume the force option to delete-frame.
3057 */ ); 3057 */ );
3058 Vallow_deletion_of_last_visible_frame = Qnil; 3058 Vallow_deletion_of_last_visible_frame = Qnil;
3059 3059
3060 #ifdef HAVE_CDE 3060 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND)
3061 DEFVAR_LISP ("drag-and-drop-functions", &Vdrag_and_drop_functions /* 3061 DEFVAR_LISP ("drag-and-drop-functions", &Vdrag_and_drop_functions /*
3062 Function or functions to run when an object is dropped on a frame. 3062 Function or functions to run when an object is dropped on a frame.
3063 Each function is called with two args, a frame and a pathname. 3063 Each function is called with either two or three args. If called with
3064 two args, the args are a frame and a pathname. If with three, the
3065 args are a frame, a pathname (which is may be either a string or nil)
3066 and the textual representation of the dragged object.
3064 */ ); 3067 */ );
3065 Vdrag_and_drop_functions = Qnil; 3068 Vdrag_and_drop_functions = Qnil;
3066 #endif 3069 #endif
3067 3070
3068 DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /* 3071 DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /*