Mercurial > hg > xemacs-beta
comparison src/frame.c @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | b2472a1930f2 |
children | 7df0dd720c89 |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
123 Lisp_Object Vframe_being_created; | 123 Lisp_Object Vframe_being_created; |
124 Lisp_Object Qframe_being_created; | 124 Lisp_Object Qframe_being_created; |
125 | 125 |
126 static void store_minibuf_frame_prop (struct frame *f, Lisp_Object val); | 126 static void store_minibuf_frame_prop (struct frame *f, Lisp_Object val); |
127 | 127 |
128 MAC_DEFINE (struct frame *, MTframe_data) | 128 EXFUN (Fset_frame_properties, 2); |
129 | 129 |
130 | 130 |
131 static Lisp_Object mark_frame (Lisp_Object, void (*) (Lisp_Object)); | |
132 static void print_frame (Lisp_Object, Lisp_Object, int); | |
133 DEFINE_LRECORD_IMPLEMENTATION ("frame", frame, | |
134 mark_frame, print_frame, 0, 0, 0, | |
135 struct frame); | |
136 | |
137 static Lisp_Object | 131 static Lisp_Object |
138 mark_frame (Lisp_Object obj, void (*markobj) (Lisp_Object)) | 132 mark_frame (Lisp_Object obj, void (*markobj) (Lisp_Object)) |
139 { | 133 { |
140 struct frame *f = XFRAME (obj); | 134 struct frame *f = XFRAME (obj); |
141 | 135 |
182 print_internal (frm->name, printcharfun, 1); | 176 print_internal (frm->name, printcharfun, 1); |
183 sprintf (buf, " 0x%x>", frm->header.uid); | 177 sprintf (buf, " 0x%x>", frm->header.uid); |
184 write_c_string (buf, printcharfun); | 178 write_c_string (buf, printcharfun); |
185 } | 179 } |
186 | 180 |
181 DEFINE_LRECORD_IMPLEMENTATION ("frame", frame, | |
182 mark_frame, print_frame, 0, 0, 0, | |
183 struct frame); | |
187 | 184 |
188 static void | 185 static void |
189 nuke_all_frame_slots (struct frame *f) | 186 nuke_all_frame_slots (struct frame *f) |
190 { | 187 { |
191 #define MARKED_SLOT(x) f->x = Qnil; | 188 #define MARKED_SLOT(x) f->x = Qnil; |
216 | 213 |
217 static struct frame * | 214 static struct frame * |
218 allocate_frame_core (Lisp_Object device) | 215 allocate_frame_core (Lisp_Object device) |
219 { | 216 { |
220 /* This function can GC */ | 217 /* This function can GC */ |
221 Lisp_Object frame = Qnil; | 218 Lisp_Object frame; |
222 Lisp_Object root_window; | 219 Lisp_Object root_window; |
223 struct frame *f = alloc_lcrecord_type (struct frame, lrecord_frame); | 220 struct frame *f = alloc_lcrecord_type (struct frame, lrecord_frame); |
224 | 221 |
225 zero_lcrecord (f); | 222 zero_lcrecord (f); |
226 nuke_all_frame_slots (f); | 223 nuke_all_frame_slots (f); |
367 | 364 |
368 return foolist; | 365 return foolist; |
369 } | 366 } |
370 | 367 |
371 DEFUN ("make-frame", Fmake_frame, 0, 2, "", /* | 368 DEFUN ("make-frame", Fmake_frame, 0, 2, "", /* |
372 Create a new frame, displaying the current buffer. | 369 Create and return a new frame, displaying the current buffer. |
373 Runs the functions listed in `create-frame-hook' after frame creation. | 370 Runs the functions listed in `create-frame-hook' after frame creation. |
374 | 371 |
375 Optional argument PROPS is a property list (a list of alternating | 372 Optional argument PROPS is a property list (a list of alternating |
376 keyword-value specifications) of properties for the new frame. | 373 keyword-value specifications) of properties for the new frame. |
377 \(An alist is accepted for backward compatibility but should not | 374 \(An alist is accepted for backward compatibility but should not |
585 } | 582 } |
586 | 583 |
587 Lisp_Object | 584 Lisp_Object |
588 make_frame (struct frame *f) | 585 make_frame (struct frame *f) |
589 { | 586 { |
590 Lisp_Object frame = Qnil; | 587 Lisp_Object frame; |
591 XSETFRAME (frame, f); | 588 XSETFRAME (frame, f); |
592 return frame; | 589 return frame; |
593 } | 590 } |
594 | 591 |
595 | 592 |
817 Return the root-window of FRAME. | 814 Return the root-window of FRAME. |
818 If omitted, FRAME defaults to the currently selected frame. | 815 If omitted, FRAME defaults to the currently selected frame. |
819 */ | 816 */ |
820 (frame)) | 817 (frame)) |
821 { | 818 { |
822 return FRAME_ROOT_WINDOW (decode_frame (frame)); | 819 struct frame *f = decode_frame (frame); |
820 return FRAME_ROOT_WINDOW (f); | |
823 } | 821 } |
824 | 822 |
825 DEFUN ("frame-selected-window", Fframe_selected_window, 0, 1, 0, /* | 823 DEFUN ("frame-selected-window", Fframe_selected_window, 0, 1, 0, /* |
826 Return the selected window of frame object FRAME. | 824 Return the selected window of frame object FRAME. |
827 If omitted, FRAME defaults to the currently selected frame. | 825 If omitted, FRAME defaults to the currently selected frame. |
828 */ | 826 */ |
829 (frame)) | 827 (frame)) |
830 { | 828 { |
831 return FRAME_SELECTED_WINDOW (decode_frame (frame)); | 829 struct frame *f = decode_frame (frame); |
830 return FRAME_SELECTED_WINDOW (f); | |
832 } | 831 } |
833 | 832 |
834 void | 833 void |
835 set_frame_selected_window (struct frame *f, Lisp_Object window) | 834 set_frame_selected_window (struct frame *f, Lisp_Object window) |
836 { | 835 { |
1179 return Qnil; | 1178 return Qnil; |
1180 } | 1179 } |
1181 | 1180 |
1182 | 1181 |
1183 | 1182 |
1184 extern void free_window_mirror (struct window_mirror *mir); | 1183 /* extern void free_line_insertion_deletion_costs (struct frame *f); */ |
1185 extern void free_line_insertion_deletion_costs (struct frame *f); | |
1186 | 1184 |
1187 /* Return 1 if it is ok to delete frame F; | 1185 /* Return 1 if it is ok to delete frame F; |
1188 0 if all frames aside from F are invisible. | 1186 0 if all frames aside from F are invisible. |
1189 (Exception: if F is a stream frame, it's OK to delete if | 1187 (Exception: if F is a stream frame, it's OK to delete if |
1190 any other frames exist.) */ | 1188 any other frames exist.) */ |
1300 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) | 1298 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) |
1301 { | 1299 { |
1302 Lisp_Object this = XCAR (frmcons); | 1300 Lisp_Object this = XCAR (frmcons); |
1303 | 1301 |
1304 | 1302 |
1305 if (! EQ (this, frame) | 1303 if (! EQ (this, frame)) |
1306 && EQ (frame, DEVMETH_OR_GIVEN(XDEVICE(XCAR(devcons)), | |
1307 get_frame_parent, | |
1308 (XFRAME(this)), | |
1309 Qnil))) | |
1310 { | 1304 { |
1311 /* We've found a popup frame whose parent is this frame. */ | 1305 struct device *devcons_d = XDEVICE (XCAR (devcons)); |
1312 signal_simple_error | 1306 if (EQ (frame, DEVMETH_OR_GIVEN (devcons_d, get_frame_parent, |
1313 ("Attempt to delete a frame with live popups", frame); | 1307 (XFRAME (this)), |
1308 Qnil))) | |
1309 /* We've found a popup frame whose parent is this frame. */ | |
1310 signal_simple_error | |
1311 ("Attempt to delete a frame with live popups", frame); | |
1314 } | 1312 } |
1315 } | 1313 } |
1316 } | 1314 } |
1317 | 1315 |
1318 /* Before here, we haven't made any dangerous changes (just checked for | 1316 /* Before here, we haven't made any dangerous changes (just checked for |
1619 } | 1617 } |
1620 | 1618 |
1621 | 1619 |
1622 /* Return mouse position in character cell units. */ | 1620 /* Return mouse position in character cell units. */ |
1623 | 1621 |
1622 static int | |
1623 mouse_pixel_position_1 (struct device *d, Lisp_Object *frame, | |
1624 int *x, int *y) | |
1625 { | |
1626 switch (DEVMETH_OR_GIVEN (d, get_mouse_position, (d, frame, x, y), -1)) | |
1627 { | |
1628 case 1: | |
1629 return 1; | |
1630 | |
1631 case 0: | |
1632 *frame = Qnil; | |
1633 break; | |
1634 | |
1635 case -1: | |
1636 *frame = DEVICE_SELECTED_FRAME (d); | |
1637 break; | |
1638 | |
1639 default: | |
1640 abort (); /* method is incorrectly written */ | |
1641 } | |
1642 | |
1643 return 0; | |
1644 } | |
1645 | |
1646 DEFUN ("mouse-pixel-position", Fmouse_pixel_position, 0, 1, 0, /* | |
1647 Return a list (WINDOW X . Y) giving the current mouse window and position. | |
1648 The position is given in pixel units, where (0, 0) is the | |
1649 upper-left corner. | |
1650 | |
1651 DEVICE specifies the device on which to read the mouse position, and | |
1652 defaults to the selected device. If the device is a mouseless terminal | |
1653 or Emacs hasn't been programmed to read its mouse position, it returns | |
1654 the device's selected window for WINDOW and nil for X and Y. | |
1655 */ | |
1656 (device)) | |
1657 { | |
1658 struct device *d = decode_device (device); | |
1659 Lisp_Object frame; | |
1660 Lisp_Object window; | |
1661 Lisp_Object x = Qnil; | |
1662 Lisp_Object y = Qnil; | |
1663 int intx, inty; | |
1664 | |
1665 if (mouse_pixel_position_1 (d, &frame, &intx, &inty)) | |
1666 { | |
1667 struct window *w = | |
1668 find_window_by_pixel_pos (intx, inty, XFRAME (frame)->root_window); | |
1669 if (!w) | |
1670 window = Qnil; | |
1671 else | |
1672 { | |
1673 XSETWINDOW (window, w); | |
1674 | |
1675 /* Adjust the position to be relative to the window. */ | |
1676 intx -= w->pixel_left; | |
1677 inty -= w->pixel_top; | |
1678 XSETINT (x, intx); | |
1679 XSETINT (y, inty); | |
1680 } | |
1681 } | |
1682 else | |
1683 { | |
1684 if (FRAMEP (frame)) | |
1685 window = FRAME_SELECTED_WINDOW (XFRAME (frame)); | |
1686 else | |
1687 window = Qnil; | |
1688 } | |
1689 | |
1690 return Fcons (window, Fcons (x, y)); | |
1691 } | |
1692 | |
1624 DEFUN ("mouse-position", Fmouse_position, 0, 1, 0, /* | 1693 DEFUN ("mouse-position", Fmouse_position, 0, 1, 0, /* |
1625 Return a list (WINDOW X . Y) giving the current mouse window and position. | 1694 Return a list (WINDOW X . Y) giving the current mouse window and position. |
1626 The position is given in character cells, where (0, 0) is the | 1695 The position is given in character cells, where (0, 0) is the |
1627 upper-left corner of the window. | 1696 upper-left corner of the window. |
1628 | 1697 |
1666 } | 1735 } |
1667 | 1736 |
1668 return val; | 1737 return val; |
1669 } | 1738 } |
1670 | 1739 |
1671 static int | |
1672 mouse_pixel_position_1 (struct device *d, Lisp_Object *frame, | |
1673 int *x, int *y) | |
1674 { | |
1675 switch (DEVMETH_OR_GIVEN (d, get_mouse_position, (d, frame, x, y), -1)) | |
1676 { | |
1677 case 1: | |
1678 return 1; | |
1679 | |
1680 case 0: | |
1681 *frame = Qnil; | |
1682 break; | |
1683 | |
1684 case -1: | |
1685 *frame = DEVICE_SELECTED_FRAME (d); | |
1686 break; | |
1687 | |
1688 default: | |
1689 abort (); /* method is incorrectly written */ | |
1690 } | |
1691 | |
1692 return 0; | |
1693 } | |
1694 | |
1695 DEFUN ("mouse-pixel-position", Fmouse_pixel_position, 0, 1, 0, /* | |
1696 Return a list (WINDOW X . Y) giving the current mouse window and position. | |
1697 The position is given in pixel units, where (0, 0) is the | |
1698 upper-left corner. | |
1699 | |
1700 DEVICE specifies the device on which to read the mouse position, and | |
1701 defaults to the selected device. If the device is a mouseless terminal | |
1702 or Emacs hasn't been programmed to read its mouse position, it returns | |
1703 the device's selected window for WINDOW and nil for X and Y. | |
1704 */ | |
1705 (device)) | |
1706 { | |
1707 struct device *d = decode_device (device); | |
1708 Lisp_Object frame; | |
1709 Lisp_Object window; | |
1710 Lisp_Object x, y; | |
1711 int intx, inty; | |
1712 | |
1713 x = y = Qnil; | |
1714 | |
1715 if (mouse_pixel_position_1 (d, &frame, &intx, &inty)) | |
1716 { | |
1717 struct window *w = | |
1718 find_window_by_pixel_pos (intx, inty, XFRAME (frame)->root_window); | |
1719 if (!w) | |
1720 window = Qnil; | |
1721 else | |
1722 { | |
1723 XSETWINDOW (window, w); | |
1724 | |
1725 /* Adjust the position to be relative to the window. */ | |
1726 intx -= w->pixel_left; | |
1727 inty -= w->pixel_top; | |
1728 XSETINT (x, intx); | |
1729 XSETINT (y, inty); | |
1730 } | |
1731 } | |
1732 else | |
1733 { | |
1734 if (FRAMEP (frame)) | |
1735 window = FRAME_SELECTED_WINDOW (XFRAME (frame)); | |
1736 else | |
1737 window = Qnil; | |
1738 } | |
1739 | |
1740 return Fcons (window, Fcons (x, y)); | |
1741 } | |
1742 | |
1743 DEFUN ("mouse-position-as-motion-event", Fmouse_position_as_motion_event, 0, 1, 0, /* | 1740 DEFUN ("mouse-position-as-motion-event", Fmouse_position_as_motion_event, 0, 1, 0, /* |
1744 Return the current mouse position as a motion event. | 1741 Return the current mouse position as a motion event. |
1745 This allows you to call the standard event functions such as | 1742 This allows you to call the standard event functions such as |
1746 `event-over-toolbar-p' to determine where the mouse is. | 1743 `event-over-toolbar-p' to determine where the mouse is. |
1747 | 1744 |
1748 DEVICE specifies the device on which to read the mouse position, and | 1745 DEVICE specifies the device on which to read the mouse position, and |
1749 defaults to the selected device. If the mouse position can't be determined | 1746 defaults to the selected device. If the mouse position can't be determined |
1750 (e.g. DEVICE is a TTY device), nil is returned instead of an event. | 1747 \(e.g. DEVICE is a TTY device), nil is returned instead of an event. |
1751 */ | 1748 */ |
1752 (device)) | 1749 (device)) |
1753 { | 1750 { |
1754 struct device *d = decode_device (device); | 1751 struct device *d = decode_device (device); |
1755 Lisp_Object frame; | 1752 Lisp_Object frame; |
1916 int visible = FRAMEMETH_OR_GIVEN (f, frame_visible_p, (f), f->visible); | 1913 int visible = FRAMEMETH_OR_GIVEN (f, frame_visible_p, (f), f->visible); |
1917 return visible ? ( visible > 0 ? Qt : Qhidden ) : Qnil; | 1914 return visible ? ( visible > 0 ? Qt : Qhidden ) : Qnil; |
1918 } | 1915 } |
1919 | 1916 |
1920 DEFUN ("frame-totally-visible-p", Fframe_totally_visible_p, 0, 1, 0, /* | 1917 DEFUN ("frame-totally-visible-p", Fframe_totally_visible_p, 0, 1, 0, /* |
1921 Return T if frame is not obscured by any other X windows, NIL otherwise. | 1918 Return t if frame is not obscured by any other window system windows. |
1922 Always returns t for tty frames. | 1919 Always returns t for tty frames. |
1923 */ | 1920 */ |
1924 (frame)) | 1921 (frame)) |
1925 { | 1922 { |
1926 struct frame *f = decode_frame (frame); | 1923 struct frame *f = decode_frame (frame); |
2145 | 2142 |
2146 Frame properties can be retrieved using `frame-property' or `frame-properties'. | 2143 Frame properties can be retrieved using `frame-property' or `frame-properties'. |
2147 | 2144 |
2148 The following symbols etc. have predefined meanings: | 2145 The following symbols etc. have predefined meanings: |
2149 | 2146 |
2150 name Name of the frame, used with X resources. | 2147 name Name of the frame. Used with X resources. |
2151 Unchangeable after creation. | 2148 Unchangeable after creation. |
2152 | 2149 |
2153 height Height of the frame, in lines. | 2150 height Height of the frame, in lines. |
2154 | 2151 |
2155 width Width of the frame, in characters. | 2152 width Width of the frame, in characters. |
2295 See `set-frame-properties' for the built-in property names. | 2292 See `set-frame-properties' for the built-in property names. |
2296 */ | 2293 */ |
2297 (frame, property, default_)) | 2294 (frame, property, default_)) |
2298 { | 2295 { |
2299 struct frame *f = decode_frame (frame); | 2296 struct frame *f = decode_frame (frame); |
2300 int width, height; | 2297 Lisp_Object value; |
2301 | 2298 |
2302 XSETFRAME (frame, f); | 2299 XSETFRAME (frame, f); |
2303 | 2300 |
2304 property = get_property_alias (property); | 2301 property = get_property_alias (property); |
2305 | 2302 |
2306 #define FROB(propprop, value) \ | 2303 if (EQ (Qname, property)) return f->name; |
2307 do { \ | 2304 |
2308 if (EQ (property, propprop)) \ | 2305 if (EQ (Qheight, property) || EQ (Qwidth, property)) |
2309 return value; \ | 2306 { |
2310 } while (0) | 2307 if (window_system_pixelated_geometry (frame)) |
2311 | 2308 { |
2312 FROB (Qname, f->name); | 2309 int width, height; |
2313 | 2310 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f), |
2314 if (window_system_pixelated_geometry (frame)) | 2311 &width, &height); |
2315 { | 2312 return make_int (EQ (Qheight, property) ? height: width); |
2316 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f), | 2313 } |
2317 &width, &height); | 2314 else |
2318 } | 2315 return make_int (EQ (Qheight, property) ? |
2319 else | 2316 FRAME_HEIGHT (f) : |
2320 { | 2317 FRAME_WIDTH (f)); |
2321 height = FRAME_HEIGHT (f); | 2318 } |
2322 width = FRAME_WIDTH (f); | |
2323 } | |
2324 FROB (Qheight, make_int (height)); | |
2325 FROB (Qwidth, make_int (width)); | |
2326 | 2319 |
2327 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. | 2320 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. |
2328 This is over-the-top bogosity, because it's inconsistent with | 2321 This is over-the-top bogosity, because it's inconsistent with |
2329 the semantics of `minibuffer' when passed to `make-frame'. | 2322 the semantics of `minibuffer' when passed to `make-frame'. |
2330 Returning Qt makes things consistent. */ | 2323 Returning Qt makes things consistent. */ |
2331 FROB (Qminibuffer, (FRAME_MINIBUF_ONLY_P (f) ? Qonly : | 2324 if (EQ (Qminibuffer, property)) |
2332 FRAME_HAS_MINIBUF_P (f) ? Qt : | 2325 return (FRAME_MINIBUF_ONLY_P (f) ? Qonly : |
2333 FRAME_MINIBUF_WINDOW (f))); | 2326 FRAME_HAS_MINIBUF_P (f) ? Qt : |
2334 FROB (Qunsplittable, FRAME_NO_SPLIT_P (f) ? Qt : Qnil); | 2327 FRAME_MINIBUF_WINDOW (f)); |
2335 FROB (Qbuffer_predicate, f->buffer_predicate); | 2328 if (EQ (Qunsplittable, property)) |
2336 | 2329 return FRAME_NO_SPLIT_P (f) ? Qt : Qnil; |
2337 #undef FROB | 2330 if (EQ (Qbuffer_predicate, property)) |
2338 | 2331 return f->buffer_predicate; |
2339 if (SYMBOLP (property) && EQ (Fbuilt_in_variable_type (property), | 2332 |
2340 Qconst_specifier)) | 2333 if (SYMBOLP (property)) |
2341 return Fspecifier_instance (Fsymbol_value (property), frame, default_, Qnil); | 2334 { |
2342 if (SYMBOLP (property) && !NILP (Fget (property, Qconst_glyph_variable, | 2335 if (EQ (Fbuilt_in_variable_type (property), Qconst_specifier)) |
2343 Qnil))) | 2336 return Fspecifier_instance (Fsymbol_value (property), |
2344 { | 2337 frame, default_, Qnil); |
2345 Lisp_Object glyph = Fsymbol_value (property); | 2338 if (!NILP (Fget (property, Qconst_glyph_variable, Qnil))) |
2346 CHECK_GLYPH (glyph); | 2339 { |
2347 return Fspecifier_instance (XGLYPH_IMAGE (glyph), frame, default_, Qnil); | 2340 Lisp_Object glyph = Fsymbol_value (property); |
2348 } | 2341 CHECK_GLYPH (glyph); |
2342 return Fspecifier_instance (XGLYPH_IMAGE (glyph), | |
2343 frame, default_, Qnil); | |
2344 } | |
2345 } | |
2346 | |
2349 if (VECTORP (property) && XVECTOR_LENGTH (property) == 2) | 2347 if (VECTORP (property) && XVECTOR_LENGTH (property) == 2) |
2350 { | 2348 { |
2351 Lisp_Object face_prop = XVECTOR_DATA (property)[1]; | 2349 Lisp_Object face_prop = XVECTOR_DATA (property)[1]; |
2352 CHECK_SYMBOL (face_prop); | 2350 CHECK_SYMBOL (face_prop); |
2353 return call3 (Qface_property_instance, | 2351 return call3 (Qface_property_instance, |
2354 Fget_face (XVECTOR_DATA (property)[0]), | 2352 Fget_face (XVECTOR_DATA (property)[0]), |
2355 face_prop, frame); | 2353 face_prop, frame); |
2356 } | 2354 } |
2357 | 2355 |
2358 { | 2356 if (HAS_FRAMEMETH_P (f, frame_property)) |
2359 Lisp_Object value; | 2357 if (!UNBOUNDP (value = FRAMEMETH (f, frame_property, (f, property)))) |
2360 | |
2361 value = FRAMEMETH_OR_GIVEN (f, frame_property, (f, property), Qunbound); | |
2362 if (!UNBOUNDP (value)) | |
2363 return value; | 2358 return value; |
2364 | 2359 |
2365 value = external_plist_get (&f->plist, property, 1, ERROR_ME); | 2360 if (!UNBOUNDP (value = external_plist_get (&f->plist, property, 1, ERROR_ME))) |
2366 if (!UNBOUNDP (value)) | 2361 return value; |
2367 return value; | 2362 |
2368 return default_; | 2363 return default_; |
2369 } | |
2370 } | 2364 } |
2371 | 2365 |
2372 DEFUN ("frame-properties", Fframe_properties, 0, 1, 0, /* | 2366 DEFUN ("frame-properties", Fframe_properties, 0, 1, 0, /* |
2373 Return a property list of the properties of FRAME. | 2367 Return a property list of the properties of FRAME. |
2374 Do not modify this list; use `set-frame-property' instead. | 2368 Do not modify this list; use `set-frame-property' instead. |
2376 (frame)) | 2370 (frame)) |
2377 { | 2371 { |
2378 struct frame *f = decode_frame (frame); | 2372 struct frame *f = decode_frame (frame); |
2379 Lisp_Object result = Qnil; | 2373 Lisp_Object result = Qnil; |
2380 struct gcpro gcpro1; | 2374 struct gcpro gcpro1; |
2381 int width, height; | |
2382 | 2375 |
2383 GCPRO1 (result); | 2376 GCPRO1 (result); |
2384 | 2377 |
2385 XSETFRAME (frame, f); | 2378 XSETFRAME (frame, f); |
2386 | 2379 |
2387 #define FROB(propprop, value) \ | 2380 /* #### for the moment (since old code uses `frame-parameters'), |
2388 do { \ | 2381 we call `copy-sequence' on f->plist. That allows frame-parameters |
2389 Lisp_Object temtem = (value); \ | 2382 to destructively convert the plist into an alist, which is more |
2390 if (!NILP (temtem)) \ | 2383 efficient than doing it non-destructively. At some point we |
2391 /* backwards order; we reverse it below */ \ | 2384 should remove the call to copy-sequence. */ |
2392 result = Fcons (temtem, Fcons (propprop, result)); \ | 2385 result = Fcopy_sequence (f->plist); |
2393 } while (0) | 2386 |
2394 | 2387 /* #### should we be adding all the specifiers and glyphs? |
2395 FROB (Qname, f->name); | 2388 That would entail having a list of them all. */ |
2396 | 2389 if (HAS_FRAMEMETH_P (f, frame_properties)) |
2397 if (window_system_pixelated_geometry (frame)) | 2390 result = nconc2 (FRAMEMETH (f, frame_properties, (f)), result); |
2398 { | 2391 |
2399 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f), | 2392 if (!NILP (f->buffer_predicate)) |
2400 &width, &height); | 2393 result = cons3 (Qbuffer_predicate, f->buffer_predicate, result); |
2401 } | 2394 |
2402 else | 2395 if (FRAME_NO_SPLIT_P (f)) |
2403 { | 2396 result = cons3 (Qunsplittable, Qt, result); |
2404 height = FRAME_HEIGHT (f); | 2397 |
2405 width = FRAME_WIDTH (f); | 2398 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. |
2406 } | |
2407 FROB (Qheight, make_int (height)); | |
2408 FROB (Qwidth, make_int (width)); | |
2409 | |
2410 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. | |
2411 This is over-the-top bogosity, because it's inconsistent with | 2399 This is over-the-top bogosity, because it's inconsistent with |
2412 the semantics of `minibuffer' when passed to `make-frame'. | 2400 the semantics of `minibuffer' when passed to `make-frame'. |
2413 Returning Qt makes things consistent. */ | 2401 Returning Qt makes things consistent. */ |
2414 FROB (Qminibuffer, (FRAME_MINIBUF_ONLY_P (f) ? Qonly : | 2402 result = cons3 (Qminibuffer, |
2415 FRAME_HAS_MINIBUF_P (f) ? Qt : | 2403 (FRAME_MINIBUF_ONLY_P (f) ? Qonly : |
2416 FRAME_MINIBUF_WINDOW (f))); | 2404 FRAME_HAS_MINIBUF_P (f) ? Qt : |
2417 FROB (Qunsplittable, FRAME_NO_SPLIT_P (f) ? Qt : Qnil); | 2405 FRAME_MINIBUF_WINDOW (f)), |
2418 FROB (Qbuffer_predicate, f->buffer_predicate); | 2406 result); |
2419 | |
2420 #undef FROB | |
2421 | |
2422 /* #### should we be adding all the specifiers and glyphs? | |
2423 That would entail having a list of them all. */ | |
2424 { | 2407 { |
2425 Lisp_Object value; | 2408 int width, height; |
2426 | 2409 |
2427 value = FRAMEMETH_OR_GIVEN (f, frame_properties, (f), Qnil); | 2410 if (window_system_pixelated_geometry (frame)) |
2428 result = nconc2 (value, result); | 2411 { |
2429 /* #### for the moment (since old code uses `frame-parameters'), | 2412 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f), |
2430 we call `copy-sequence' on f->plist. That allows frame-parameters | 2413 &width, &height); |
2431 to destructively convert the plist into an alist, which is more | 2414 } |
2432 efficient than doing it non-destructively. At some point we | 2415 else |
2433 should remove the call to copy-sequence. */ | 2416 { |
2434 result = nconc2 (Fnreverse (result), Fcopy_sequence (f->plist)); | 2417 height = FRAME_HEIGHT (f); |
2435 RETURN_UNGCPRO (result); | 2418 width = FRAME_WIDTH (f); |
2419 } | |
2420 result = cons3 (Qwidth , make_int (width), result); | |
2421 result = cons3 (Qheight, make_int (height), result); | |
2436 } | 2422 } |
2423 | |
2424 result = cons3 (Qname, f->name, result); | |
2425 | |
2426 UNGCPRO; | |
2427 return result; | |
2437 } | 2428 } |
2438 | 2429 |
2439 | 2430 |
2440 DEFUN ("frame-pixel-height", Fframe_pixel_height, 0, 1, 0, /* | 2431 DEFUN ("frame-pixel-height", Fframe_pixel_height, 0, 1, 0, /* |
2441 Return the height in pixels of FRAME. | 2432 Return the height in pixels of FRAME. |
2442 */ | 2433 */ |
2443 (frame)) | 2434 (frame)) |
2444 { | 2435 { |
2445 struct frame *f = decode_frame (frame); | 2436 return make_int (decode_frame (frame)->pixheight); |
2446 return make_int (f->pixheight); | |
2447 } | 2437 } |
2448 | 2438 |
2449 DEFUN ("frame-pixel-width", Fframe_pixel_width, 0, 1, 0, /* | 2439 DEFUN ("frame-pixel-width", Fframe_pixel_width, 0, 1, 0, /* |
2450 Return the width in pixels of FRAME. | 2440 Return the width in pixels of FRAME. |
2451 */ | 2441 */ |
2452 (frame)) | 2442 (frame)) |
2453 { | 2443 { |
2454 struct frame *f = decode_frame (frame); | 2444 return make_int (decode_frame (frame)->pixwidth); |
2455 return make_int (f->pixwidth); | |
2456 } | 2445 } |
2457 | 2446 |
2458 DEFUN ("frame-name", Fframe_name, 0, 1, 0, /* | 2447 DEFUN ("frame-name", Fframe_name, 0, 1, 0, /* |
2459 Return the name of FRAME (defaulting to the selected frame). | 2448 Return the name of FRAME (defaulting to the selected frame). |
2460 This is not the same as the `title' of the frame. | 2449 This is not the same as the `title' of the frame. |
2540 internal_set_frame_size (f, width, height, !NILP (pretend)); | 2529 internal_set_frame_size (f, width, height, !NILP (pretend)); |
2541 return frame; | 2530 return frame; |
2542 } | 2531 } |
2543 | 2532 |
2544 DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /* | 2533 DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /* |
2545 Sets size of FRAME to COLS by ROWS. | 2534 Set the size of FRAME to COLS by ROWS. |
2546 Optional fourth arg non-nil means that redisplay should use COLS by ROWS | 2535 Optional fourth arg non-nil means that redisplay should use COLS by ROWS |
2547 but that the idea of the actual size of the frame should not be changed. | 2536 but that the idea of the actual size of the frame should not be changed. |
2548 */ | 2537 */ |
2549 (frame, cols, rows, pretend)) | 2538 (frame, cols, rows, pretend)) |
2550 { | 2539 { |
2565 internal_set_frame_size (f, width, height, !NILP (pretend)); | 2554 internal_set_frame_size (f, width, height, !NILP (pretend)); |
2566 return frame; | 2555 return frame; |
2567 } | 2556 } |
2568 | 2557 |
2569 DEFUN ("set-frame-position", Fset_frame_position, 3, 3, 0, /* | 2558 DEFUN ("set-frame-position", Fset_frame_position, 3, 3, 0, /* |
2570 Sets position of FRAME in pixels to XOFFSET by YOFFSET. | 2559 Set position of FRAME in pixels to XOFFSET by YOFFSET. |
2571 This is actually the position of the upper left corner of the frame. | 2560 This is actually the position of the upper left corner of the frame. |
2572 Negative values for XOFFSET or YOFFSET are interpreted relative to | 2561 Negative values for XOFFSET or YOFFSET are interpreted relative to |
2573 the rightmost or bottommost possible position (that stays within the screen). | 2562 the rightmost or bottommost possible position (that stays within the screen). |
2574 */ | 2563 */ |
2575 (frame, xoffset, yoffset)) | 2564 (frame, xoffset, yoffset)) |
2951 void | 2940 void |
2952 update_frame_icon (struct frame *f) | 2941 update_frame_icon (struct frame *f) |
2953 { | 2942 { |
2954 if (f->icon_changed || f->windows_changed) | 2943 if (f->icon_changed || f->windows_changed) |
2955 { | 2944 { |
2956 Lisp_Object frame = Qnil; | 2945 Lisp_Object frame; |
2957 Lisp_Object new_icon; | 2946 Lisp_Object new_icon; |
2958 | 2947 |
2959 XSETFRAME (frame, f); | 2948 XSETFRAME (frame, f); |
2960 new_icon = glyph_image_instance (Vframe_icon_glyph, frame, | 2949 new_icon = glyph_image_instance (Vframe_icon_glyph, frame, |
2961 ERROR_ME_WARN, 0); | 2950 ERROR_ME_WARN, 0); |
3219 DEFVAR_LISP ("default-frame-name", &Vdefault_frame_name /* | 3208 DEFVAR_LISP ("default-frame-name", &Vdefault_frame_name /* |
3220 The default name to assign to newly-created frames. | 3209 The default name to assign to newly-created frames. |
3221 This can be overridden by arguments to `make-frame'. | 3210 This can be overridden by arguments to `make-frame'. |
3222 This must be a string. | 3211 This must be a string. |
3223 */ ); | 3212 */ ); |
3213 #ifndef INFODOCK | |
3224 Vdefault_frame_name = Fpurecopy (build_string ("emacs")); | 3214 Vdefault_frame_name = Fpurecopy (build_string ("emacs")); |
3215 #else | |
3216 Vdefault_frame_name = Fpurecopy (build_string ("InfoDock")); | |
3217 #endif | |
3225 | 3218 |
3226 DEFVAR_LISP ("default-frame-plist", &Vdefault_frame_plist /* | 3219 DEFVAR_LISP ("default-frame-plist", &Vdefault_frame_plist /* |
3227 Plist of default values for frame creation, other than the first one. | 3220 Plist of default values for frame creation, other than the first one. |
3228 These may be set in your init file, like this: | 3221 These may be set in your init file, like this: |
3229 | 3222 |