diff options
| author | Richard M. Stallman | 1994-02-12 02:37:17 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-02-12 02:37:17 +0000 |
| commit | 808c0f209ff22c8723c75e6e95467d80079ed315 (patch) | |
| tree | 90b7c75ab57d337e55a585c154f975802fae49f0 /src | |
| parent | 26757b4b031111f8e8ae9f1912b457cd17daba9a (diff) | |
| download | emacs-808c0f209ff22c8723c75e6e95467d80079ed315.tar.gz emacs-808c0f209ff22c8723c75e6e95467d80079ed315.zip | |
(Fset_frame_height, Fset_frame_width, Fset_frame_size):
Pass CHANGE_GRAVITY arg to x_set_window_size.
(other_visible_frames): New function; code taken from Fdelete_frame.
(Fdelete_frame): Use it.
(Fmake_frame_invisible): Use it. New arg FORCE.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.c | 92 |
1 files changed, 56 insertions, 36 deletions
diff --git a/src/frame.c b/src/frame.c index 654c9e5c3bd..461afb3166a 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -618,34 +618,17 @@ If MINIFRAME is non-nil and not a window, include all frames.") | |||
| 618 | return prev_frame (frame, miniframe); | 618 | return prev_frame (frame, miniframe); |
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 2, "", | 621 | /* Return 1 if it is ok to delete frame F; |
| 622 | "Delete FRAME, permanently eliminating it from use.\n\ | 622 | 0 if all frames aside from F are invisible. |
| 623 | If omitted, FRAME defaults to the selected frame.\n\ | 623 | (Exception: if F is the terminal frame, and we are using X, return 1.) */ |
| 624 | A frame may not be deleted if its minibuffer is used by other frames.\n\ | ||
| 625 | Normally, you may not delete a frame if all other frames are invisible,\n\ | ||
| 626 | but if the second optional argument FORCE is non-nil, you may do so.") | ||
| 627 | (frame, force) | ||
| 628 | Lisp_Object frame, force; | ||
| 629 | { | ||
| 630 | struct frame *f; | ||
| 631 | 624 | ||
| 632 | if (EQ (frame, Qnil)) | 625 | static int |
| 633 | { | 626 | other_visible_frames (f) |
| 634 | f = selected_frame; | 627 | FRAME_PTR f; |
| 635 | XSET (frame, Lisp_Frame, f); | 628 | { |
| 636 | } | 629 | /* We know the selected frame is visible, |
| 637 | else | 630 | so if F is some other frame, it can't be the sole visible one. */ |
| 638 | { | 631 | if (f == selected_frame) |
| 639 | CHECK_FRAME (frame, 0); | ||
| 640 | f = XFRAME (frame); | ||
| 641 | } | ||
| 642 | |||
| 643 | if (! FRAME_LIVE_P (f)) | ||
| 644 | return Qnil; | ||
| 645 | |||
| 646 | /* If all other frames are invisible, refuse to delete. | ||
| 647 | (Exception: allow deleting the terminal frame when using X.) */ | ||
| 648 | if (f == selected_frame && NILP (force)) | ||
| 649 | { | 632 | { |
| 650 | Lisp_Object frames; | 633 | Lisp_Object frames; |
| 651 | int count = 0; | 634 | int count = 0; |
| @@ -656,6 +639,9 @@ but if the second optional argument FORCE is non-nil, you may do so.") | |||
| 656 | { | 639 | { |
| 657 | Lisp_Object this = XCONS (frames)->car; | 640 | Lisp_Object this = XCONS (frames)->car; |
| 658 | 641 | ||
| 642 | /* Verify that the frame's window still exists | ||
| 643 | and we can still talk to it. And note any recent change | ||
| 644 | in visibility. */ | ||
| 659 | #ifdef HAVE_X_WINDOWS | 645 | #ifdef HAVE_X_WINDOWS |
| 660 | if (FRAME_X_P (XFRAME (this))) | 646 | if (FRAME_X_P (XFRAME (this))) |
| 661 | { | 647 | { |
| @@ -671,9 +657,38 @@ but if the second optional argument FORCE is non-nil, you may do so.") | |||
| 671 | || (FRAME_X_P (XFRAME (this)) && !FRAME_X_P (f))) | 657 | || (FRAME_X_P (XFRAME (this)) && !FRAME_X_P (f))) |
| 672 | count++; | 658 | count++; |
| 673 | } | 659 | } |
| 674 | if (count == 1) | 660 | return count > 1; |
| 675 | error ("Attempt to delete the only frame"); | ||
| 676 | } | 661 | } |
| 662 | return 1; | ||
| 663 | } | ||
| 664 | |||
| 665 | DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 2, "", | ||
| 666 | "Delete FRAME, permanently eliminating it from use.\n\ | ||
| 667 | If omitted, FRAME defaults to the selected frame.\n\ | ||
| 668 | A frame may not be deleted if its minibuffer is used by other frames.\n\ | ||
| 669 | Normally, you may not delete a frame if all other frames are invisible,\n\ | ||
| 670 | but if the second optional argument FORCE is non-nil, you may do so.") | ||
| 671 | (frame, force) | ||
| 672 | Lisp_Object frame, force; | ||
| 673 | { | ||
| 674 | struct frame *f; | ||
| 675 | |||
| 676 | if (EQ (frame, Qnil)) | ||
| 677 | { | ||
| 678 | f = selected_frame; | ||
| 679 | XSET (frame, Lisp_Frame, f); | ||
| 680 | } | ||
| 681 | else | ||
| 682 | { | ||
| 683 | CHECK_FRAME (frame, 0); | ||
| 684 | f = XFRAME (frame); | ||
| 685 | } | ||
| 686 | |||
| 687 | if (! FRAME_LIVE_P (f)) | ||
| 688 | return Qnil; | ||
| 689 | |||
| 690 | if (NILP (force) && !other_visible_frames (f)) | ||
| 691 | error ("Attempt to delete the sole visible or iconified frame"); | ||
| 677 | 692 | ||
| 678 | /* Does this frame have a minibuffer, and is it the surrogate | 693 | /* Does this frame have a minibuffer, and is it the surrogate |
| 679 | minibuffer for any other frame? */ | 694 | minibuffer for any other frame? */ |
| @@ -871,17 +886,22 @@ If omitted, FRAME defaults to the currently selected frame.") | |||
| 871 | } | 886 | } |
| 872 | 887 | ||
| 873 | DEFUN ("make-frame-invisible", Fmake_frame_invisible, Smake_frame_invisible, | 888 | DEFUN ("make-frame-invisible", Fmake_frame_invisible, Smake_frame_invisible, |
| 874 | 0, 1, "", | 889 | 0, 2, "", |
| 875 | "Make the frame FRAME invisible (assuming it is an X-window).\n\ | 890 | "Make the frame FRAME invisible (assuming it is an X-window).\n\ |
| 876 | If omitted, FRAME defaults to the currently selected frame.") | 891 | If omitted, FRAME defaults to the currently selected frame.\n\ |
| 877 | (frame) | 892 | Normally you may not make FRAME invisible if all other frames are invisible,\n\ |
| 878 | Lisp_Object frame; | 893 | but if the second optional argument FORCE is non-nil, you may do so.") |
| 894 | (frame, force) | ||
| 895 | Lisp_Object frame, force; | ||
| 879 | { | 896 | { |
| 880 | if (NILP (frame)) | 897 | if (NILP (frame)) |
| 881 | XSET (frame, Lisp_Frame, selected_frame); | 898 | XSET (frame, Lisp_Frame, selected_frame); |
| 882 | 899 | ||
| 883 | CHECK_LIVE_FRAME (frame, 0); | 900 | CHECK_LIVE_FRAME (frame, 0); |
| 884 | 901 | ||
| 902 | if (NILP (force) && !other_visible_frames (XFRAME (frame))) | ||
| 903 | error ("Attempt to make invisible the sole visible or iconified frame"); | ||
| 904 | |||
| 885 | /* Don't let the frame remain selected. */ | 905 | /* Don't let the frame remain selected. */ |
| 886 | if (XFRAME (frame) == selected_frame) | 906 | if (XFRAME (frame) == selected_frame) |
| 887 | Fhandle_switch_frame (next_frame (frame, Qt), Qnil); | 907 | Fhandle_switch_frame (next_frame (frame, Qt), Qnil); |
| @@ -1345,7 +1365,7 @@ but that the idea of the actual height of the frame should not be changed.") | |||
| 1345 | if (FRAME_X_P (f)) | 1365 | if (FRAME_X_P (f)) |
| 1346 | { | 1366 | { |
| 1347 | if (XINT (rows) != f->width) | 1367 | if (XINT (rows) != f->width) |
| 1348 | x_set_window_size (f, f->width, XINT (rows)); | 1368 | x_set_window_size (f, 1, f->width, XINT (rows)); |
| 1349 | } | 1369 | } |
| 1350 | else | 1370 | else |
| 1351 | #endif | 1371 | #endif |
| @@ -1375,7 +1395,7 @@ but that the idea of the actual width of the frame should not be changed.") | |||
| 1375 | if (FRAME_X_P (f)) | 1395 | if (FRAME_X_P (f)) |
| 1376 | { | 1396 | { |
| 1377 | if (XINT (cols) != f->width) | 1397 | if (XINT (cols) != f->width) |
| 1378 | x_set_window_size (f, XINT (cols), f->height); | 1398 | x_set_window_size (f, 1, XINT (cols), f->height); |
| 1379 | } | 1399 | } |
| 1380 | else | 1400 | else |
| 1381 | #endif | 1401 | #endif |
| @@ -1401,7 +1421,7 @@ DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0, | |||
| 1401 | if (FRAME_X_P (f)) | 1421 | if (FRAME_X_P (f)) |
| 1402 | { | 1422 | { |
| 1403 | if (XINT (rows) != f->height || XINT (cols) != f->width) | 1423 | if (XINT (rows) != f->height || XINT (cols) != f->width) |
| 1404 | x_set_window_size (f, XINT (cols), XINT (rows)); | 1424 | x_set_window_size (f, 1, XINT (cols), XINT (rows)); |
| 1405 | } | 1425 | } |
| 1406 | else | 1426 | else |
| 1407 | #endif | 1427 | #endif |