Mercurial > hg > xemacs-beta
comparison src/frame.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 56c54cf7c5b6 |
children | 821dec489c24 |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
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; |
105 | 105 |
106 Lisp_Object Qhidden; | |
107 | |
108 Lisp_Object Qvisible, Qiconic, Qinvisible, Qvisible_iconic, Qinvisible_iconic; | 106 Lisp_Object Qvisible, Qiconic, Qinvisible, Qvisible_iconic, Qinvisible_iconic; |
109 Lisp_Object Qnomini, Qvisible_nomini, Qiconic_nomini, Qinvisible_nomini; | 107 Lisp_Object Qnomini, Qvisible_nomini, Qiconic_nomini, Qinvisible_nomini; |
110 Lisp_Object Qvisible_iconic_nomini, Qinvisible_iconic_nomini; | 108 Lisp_Object Qvisible_iconic_nomini, Qinvisible_iconic_nomini; |
111 | 109 |
112 Lisp_Object Qset_specifier, Qset_glyph_image, Qset_face_property; | 110 Lisp_Object Qset_specifier, Qset_glyph_image, Qset_face_property; |
460 call Lisp code, and if any of them causes a warning to be displayed | 458 call Lisp code, and if any of them causes a warning to be displayed |
461 and the *Warnings* buffer to be created, it won't get added to | 459 and the *Warnings* buffer to be created, it won't get added to |
462 the frame-specific version of the buffer-alist unless the frame | 460 the frame-specific version of the buffer-alist unless the frame |
463 is accessible from the device. */ | 461 is accessible from the device. */ |
464 | 462 |
465 #if 0 | |
466 DEVICE_FRAME_LIST (d) = nconc2 (DEVICE_FRAME_LIST (d), Fcons (frame, Qnil)); | 463 DEVICE_FRAME_LIST (d) = nconc2 (DEVICE_FRAME_LIST (d), Fcons (frame, Qnil)); |
467 #endif | |
468 DEVICE_FRAME_LIST (d) = Fcons (frame, DEVICE_FRAME_LIST (d)); | |
469 RESET_CHANGED_SET_FLAGS; | 464 RESET_CHANGED_SET_FLAGS; |
470 | 465 |
471 /* Now make sure that the initial cached values are set correctly. | 466 /* Now make sure that the initial cached values are set correctly. |
472 Do this after the init_frame method is called because that may | 467 Do this after the init_frame method is called because that may |
473 do things (e.g. create widgets) that are necessary for the | 468 do things (e.g. create widgets) that are necessary for the |
906 #endif | 901 #endif |
907 | 902 |
908 if (NILP (type)) | 903 if (NILP (type)) |
909 type = Qnomini; | 904 type = Qnomini; |
910 if (ZEROP (type)) | 905 if (ZEROP (type)) |
911 type = Qvisible_iconic; | 906 type = Qiconic; |
912 | 907 |
913 if (EQ (type, Qvisible)) | 908 if (EQ (type, Qvisible)) |
914 return FRAME_VISIBLE_P (f); | 909 return FRAME_VISIBLE_P (f); |
915 if (EQ (type, Qiconic)) | 910 if (EQ (type, Qiconic)) |
916 return FRAME_ICONIFIED_P (f); | 911 return FRAME_ICONIFIED_P (f); |
1280 signal_simple_error | 1275 signal_simple_error |
1281 ("Attempt to delete a surrogate minibuffer frame", frame); | 1276 ("Attempt to delete a surrogate minibuffer frame", frame); |
1282 } | 1277 } |
1283 } | 1278 } |
1284 } | 1279 } |
1285 /* Test for popup frames hanging around. */ | |
1286 /* Deletion of a parent frame with popups is deadly. */ | |
1287 { | |
1288 Lisp_Object frmcons, devcons, concons; | |
1289 | |
1290 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) | |
1291 { | |
1292 Lisp_Object this = XCAR (frmcons); | |
1293 | |
1294 | |
1295 if (! EQ (this, frame) | |
1296 && EQ (frame, DEVMETH_OR_GIVEN(XDEVICE(XCAR(devcons)), | |
1297 get_frame_parent, | |
1298 (XFRAME(this)), | |
1299 Qnil))) | |
1300 { | |
1301 /* We've found another frame whose minibuffer is on | |
1302 this frame. */ | |
1303 signal_simple_error | |
1304 ("Attempt to delete a frame with live popups", frame); | |
1305 } | |
1306 } | |
1307 } | |
1308 | 1280 |
1309 /* Before here, we haven't made any dangerous changes (just checked for | 1281 /* Before here, we haven't made any dangerous changes (just checked for |
1310 error conditions). Now run the delete-frame-hook. Remember that | 1282 error conditions). Now run the delete-frame-hook. Remember that |
1311 user code there could do any number of dangerous things, including | 1283 user code there could do any number of dangerous things, including |
1312 signalling an error. */ | 1284 signalling an error. */ |
1380 /* If this is a popup frame, select its parent if possible. | 1352 /* If this is a popup frame, select its parent if possible. |
1381 Otherwise, find another visible frame; if none, just take any frame. | 1353 Otherwise, find another visible frame; if none, just take any frame. |
1382 First try the same device, then the same console. */ | 1354 First try the same device, then the same console. */ |
1383 | 1355 |
1384 next = DEVMETH_OR_GIVEN (d, get_frame_parent, (f), Qnil); | 1356 next = DEVMETH_OR_GIVEN (d, get_frame_parent, (f), Qnil); |
1385 | |
1386 if (NILP (next) || EQ (next, frame) || ! FRAME_LIVE_P (XFRAME (next))) | 1357 if (NILP (next) || EQ (next, frame) || ! FRAME_LIVE_P (XFRAME (next))) |
1387 next = next_frame_internal (frame, Qvisible, device, | 1358 next = next_frame_internal (frame, Qvisible, device, |
1388 called_from_delete_device); | 1359 called_from_delete_device); |
1389 if (NILP (next) || EQ (next, frame)) | 1360 if (NILP (next) || EQ (next, frame)) |
1390 next = next_frame_internal (frame, Qvisible, console, | 1361 next = next_frame_internal (frame, Qvisible, console, |
1398 if (NILP (next) || EQ (next, frame)) | 1369 if (NILP (next) || EQ (next, frame)) |
1399 next = next_frame_internal (frame, Qt, console, | 1370 next = next_frame_internal (frame, Qt, console, |
1400 called_from_delete_device); | 1371 called_from_delete_device); |
1401 if (NILP (next) || EQ (next, frame)) | 1372 if (NILP (next) || EQ (next, frame)) |
1402 next = next_frame_internal (frame, Qt, Qt, called_from_delete_device); | 1373 next = next_frame_internal (frame, Qt, Qt, called_from_delete_device); |
1403 | |
1404 /* if we haven't found another frame at this point | |
1405 then there aren't any. */ | |
1406 if (NILP (next) || EQ (next, frame)) | 1374 if (NILP (next) || EQ (next, frame)) |
1407 ; | 1375 ; |
1376 else if (EQ (frame, Fselected_frame (Qnil))) | |
1377 Fselect_frame (next); | |
1408 else | 1378 else |
1409 { | 1379 set_device_selected_frame (d, next); |
1410 int did_select = 0; | |
1411 /* if this is the global selected frame, select another one. */ | |
1412 if (EQ (frame, Fselected_frame (Qnil))) | |
1413 { | |
1414 Fselect_frame (next); | |
1415 did_select = 1; | |
1416 } | |
1417 /* | |
1418 * If the new frame we just selected is on a different | |
1419 * device then we still need to change DEVICE_SELECTED_FRAME(d) | |
1420 * to a live frame, if there are any left on this device. | |
1421 */ | |
1422 if (!EQ (device, FRAME_DEVICE(XFRAME(next)))) | |
1423 { | |
1424 Lisp_Object next_f = | |
1425 next_frame_internal (frame, Qt, device, | |
1426 called_from_delete_device); | |
1427 if (NILP (next_f) || EQ (next_f, frame)) | |
1428 ; | |
1429 else | |
1430 set_device_selected_frame (d, next_f); | |
1431 } | |
1432 else if (! did_select) | |
1433 set_device_selected_frame (d, next); | |
1434 | |
1435 } | |
1436 } | 1380 } |
1437 | 1381 |
1438 /* Don't allow minibuf_window to remain on a deleted frame. */ | 1382 /* Don't allow minibuf_window to remain on a deleted frame. */ |
1439 if (EQ (f->minibuffer_window, minibuf_window)) | 1383 if (EQ (f->minibuffer_window, minibuf_window)) |
1440 { | 1384 { |
1894 } | 1838 } |
1895 | 1839 |
1896 /* FSF returns 'icon for iconized frames. What a crock! */ | 1840 /* FSF returns 'icon for iconized frames. What a crock! */ |
1897 | 1841 |
1898 DEFUN ("frame-visible-p", Fframe_visible_p, 0, 1, 0, /* | 1842 DEFUN ("frame-visible-p", Fframe_visible_p, 0, 1, 0, /* |
1899 Return non NIL if FRAME is now \"visible\" (actually in use for display). | 1843 Return t if FRAME is now \"visible\" (actually in use for display). |
1900 A frame that is not visible is not updated, and, if it works through a | 1844 A frame that is not visible is not updated, and, if it works through a |
1901 window system, may not show at all. | 1845 window system, may not show at all. |
1902 N.B. Under X \"visible\" means Mapped. It the window is mapped but not | |
1903 actually visible on screen then frame_visible returns 'hidden. | |
1904 */ | 1846 */ |
1905 (frame)) | 1847 (frame)) |
1906 { | 1848 { |
1907 int visible; | |
1908 | |
1909 struct frame *f = decode_frame (frame); | 1849 struct frame *f = decode_frame (frame); |
1910 visible = FRAMEMETH_OR_GIVEN (f, frame_visible_p, (f), f->visible); | 1850 return (FRAMEMETH_OR_GIVEN (f, frame_visible_p, (f), f->visible) |
1911 return ( visible ? ( visible > 0 ? Qt : Qhidden ) | 1851 ? Qt : Qnil); |
1912 : Qnil); | |
1913 } | 1852 } |
1914 | 1853 |
1915 DEFUN ("frame-totally-visible-p", Fframe_totally_visible_p, 0, 1, 0, /* | 1854 DEFUN ("frame-totally-visible-p", Fframe_totally_visible_p, 0, 1, 0, /* |
1916 Return T if frame is not obscured by any other X windows, NIL otherwise. | 1855 Return T if frame is not obscured by any other X windows, NIL otherwise. |
1917 Always returns t for tty frames. | 1856 Always returns t for tty frames. |
1940 } | 1879 } |
1941 | 1880 |
1942 DEFUN ("visible-frame-list", Fvisible_frame_list, 0, 1, 0, /* | 1881 DEFUN ("visible-frame-list", Fvisible_frame_list, 0, 1, 0, /* |
1943 Return a list of all frames now \"visible\" (being updated). | 1882 Return a list of all frames now \"visible\" (being updated). |
1944 If DEVICE is specified only frames on that device will be returned. | 1883 If DEVICE is specified only frames on that device will be returned. |
1945 Note that under virtual window managers not all these frame are necessarily | |
1946 really updated. | |
1947 */ | 1884 */ |
1948 (device)) | 1885 (device)) |
1949 { | 1886 { |
1950 Lisp_Object devcons, concons; | 1887 Lisp_Object devcons, concons; |
1951 struct frame *f; | 1888 struct frame *f; |
1963 | 1900 |
1964 DEVICE_FRAME_LOOP (frmcons, XDEVICE (XCAR (devcons))) | 1901 DEVICE_FRAME_LOOP (frmcons, XDEVICE (XCAR (devcons))) |
1965 { | 1902 { |
1966 Lisp_Object frame = XCAR (frmcons); | 1903 Lisp_Object frame = XCAR (frmcons); |
1967 f = XFRAME (frame); | 1904 f = XFRAME (frame); |
1968 if (FRAME_VISIBLE_P(f)) | 1905 if (f->visible) |
1969 value = Fcons (frame, value); | 1906 value = Fcons (frame, value); |
1970 } | 1907 } |
1971 } | 1908 } |
1972 } | 1909 } |
1973 | 1910 |
2870 defsymbol (&Qmake_initial_minibuffer_frame, "make-initial-minibuffer-frame"); | 2807 defsymbol (&Qmake_initial_minibuffer_frame, "make-initial-minibuffer-frame"); |
2871 | 2808 |
2872 defsymbol (&Qframe_title_format, "frame-title-format"); | 2809 defsymbol (&Qframe_title_format, "frame-title-format"); |
2873 defsymbol (&Qframe_icon_title_format, "frame-icon-title-format"); | 2810 defsymbol (&Qframe_icon_title_format, "frame-icon-title-format"); |
2874 | 2811 |
2875 defsymbol (&Qhidden, "hidden"); | |
2876 defsymbol (&Qvisible, "visible"); | 2812 defsymbol (&Qvisible, "visible"); |
2877 defsymbol (&Qiconic, "iconic"); | 2813 defsymbol (&Qiconic, "iconic"); |
2878 defsymbol (&Qinvisible, "invisible"); | 2814 defsymbol (&Qinvisible, "invisible"); |
2879 defsymbol (&Qvisible_iconic, "visible-iconic"); | 2815 defsymbol (&Qvisible_iconic, "visible-iconic"); |
2880 defsymbol (&Qinvisible_iconic, "invisible-iconic"); | 2816 defsymbol (&Qinvisible_iconic, "invisible-iconic"); |