aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuuki Harano2021-05-06 21:47:23 +0900
committerYuuki Harano2021-05-06 21:47:23 +0900
commitff3d7190bbaebf196c0ac7f84d4869fa9362276f (patch)
treee00d8dd9815703e4081abb7d5a3efae52d1a6eb0 /src
parent5b97b98daa7f61311c3662beecbeca7037505992 (diff)
parent896384b542cabdc000eafb80c9082830f692bbb2 (diff)
downloademacs-ff3d7190bbaebf196c0ac7f84d4869fa9362276f.tar.gz
emacs-ff3d7190bbaebf196c0ac7f84d4869fa9362276f.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'src')
-rw-r--r--src/comp.c2
-rw-r--r--src/frame.c71
-rw-r--r--src/minibuf.c18
3 files changed, 29 insertions, 62 deletions
diff --git a/src/comp.c b/src/comp.c
index a4dba435b4a..89667b2febc 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -5403,7 +5403,7 @@ For internal use. */);
5403 doc: /* When non-nil assume the file being compiled to 5403 doc: /* When non-nil assume the file being compiled to
5404be preloaded. */); 5404be preloaded. */);
5405 5405
5406 Fprovide (intern_c_string ("nativecomp"), Qnil); 5406 Fprovide (intern_c_string ("native-compile"), Qnil);
5407#endif /* #ifdef HAVE_NATIVE_COMP */ 5407#endif /* #ifdef HAVE_NATIVE_COMP */
5408 5408
5409 defsubr (&Snative_comp_available_p); 5409 defsubr (&Snative_comp_available_p);
diff --git a/src/frame.c b/src/frame.c
index 177022f6ebc..eb5aed82f7d 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1931,52 +1931,6 @@ other_frames (struct frame *f, bool invisible, bool force)
1931 return false; 1931 return false;
1932} 1932}
1933 1933
1934/* Make sure that minibuf_window doesn't refer to FRAME's minibuffer
1935 window. Preferably use the selected frame's minibuffer window
1936 instead. If the selected frame doesn't have one, get some other
1937 frame's minibuffer window. SELECT non-zero means select the new
1938 minibuffer window. */
1939static void
1940check_minibuf_window (Lisp_Object frame, int select)
1941{
1942 struct frame *f = decode_live_frame (frame);
1943
1944 XSETFRAME (frame, f);
1945
1946 if (WINDOWP (minibuf_window) && EQ (f->minibuffer_window, minibuf_window))
1947 {
1948 Lisp_Object frames, this, window = make_fixnum (0);
1949
1950 if (!EQ (frame, selected_frame)
1951 && FRAME_HAS_MINIBUF_P (XFRAME (selected_frame)))
1952 window = FRAME_MINIBUF_WINDOW (XFRAME (selected_frame));
1953 else
1954 FOR_EACH_FRAME (frames, this)
1955 {
1956 if (!EQ (this, frame) && FRAME_HAS_MINIBUF_P (XFRAME (this)))
1957 {
1958 window = FRAME_MINIBUF_WINDOW (XFRAME (this));
1959 break;
1960 }
1961 }
1962
1963 /* Don't abort if no window was found (Bug#15247). */
1964 if (WINDOWP (window))
1965 {
1966 /* Use set_window_buffer instead of Fset_window_buffer (see
1967 discussion of bug#11984, bug#12025, bug#12026). */
1968 set_window_buffer (window, XWINDOW (minibuf_window)->contents, 0, 0);
1969 minibuf_window = window;
1970
1971 /* SELECT non-zero usually means that FRAME's minibuffer
1972 window was selected; select the new one. */
1973 if (select)
1974 Fselect_window (minibuf_window, Qnil);
1975 }
1976 }
1977}
1978
1979
1980/** 1934/**
1981 * delete_frame: 1935 * delete_frame:
1982 * 1936 *
@@ -1991,7 +1945,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1991 struct frame *sf; 1945 struct frame *sf;
1992 struct kboard *kb; 1946 struct kboard *kb;
1993 Lisp_Object frames, frame1; 1947 Lisp_Object frames, frame1;
1994 int minibuffer_selected, is_tooltip_frame; 1948 int is_tooltip_frame;
1995 bool nochild = !FRAME_PARENT_FRAME (f); 1949 bool nochild = !FRAME_PARENT_FRAME (f);
1996 Lisp_Object minibuffer_child_frame = Qnil; 1950 Lisp_Object minibuffer_child_frame = Qnil;
1997 1951
@@ -2099,7 +2053,6 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
2099 2053
2100 /* At this point, we are committed to deleting the frame. 2054 /* At this point, we are committed to deleting the frame.
2101 There is no more chance for errors to prevent it. */ 2055 There is no more chance for errors to prevent it. */
2102 minibuffer_selected = EQ (minibuf_window, selected_window);
2103 sf = SELECTED_FRAME (); 2056 sf = SELECTED_FRAME ();
2104 /* Don't let the frame remain selected. */ 2057 /* Don't let the frame remain selected. */
2105 if (f == sf) 2058 if (f == sf)
@@ -2157,9 +2110,10 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
2157 do_switch_frame (frame1, 0, 1, Qnil); 2110 do_switch_frame (frame1, 0, 1, Qnil);
2158 sf = SELECTED_FRAME (); 2111 sf = SELECTED_FRAME ();
2159 } 2112 }
2160 2113 else
2161 /* Don't allow minibuf_window to remain on a deleted frame. */ 2114 /* Ensure any minibuffers on FRAME are moved onto the selected
2162 check_minibuf_window (frame, minibuffer_selected); 2115 frame. */
2116 move_minibuffers_onto_frame (f, true);
2163 2117
2164 /* Don't let echo_area_window to remain on a deleted frame. */ 2118 /* Don't let echo_area_window to remain on a deleted frame. */
2165 if (EQ (f->minibuffer_window, echo_area_window)) 2119 if (EQ (f->minibuffer_window, echo_area_window))
@@ -2791,9 +2745,6 @@ displayed in the terminal. */)
2791 if (NILP (force) && !other_frames (f, true, false)) 2745 if (NILP (force) && !other_frames (f, true, false))
2792 error ("Attempt to make invisible the sole visible or iconified frame"); 2746 error ("Attempt to make invisible the sole visible or iconified frame");
2793 2747
2794 /* Don't allow minibuf_window to remain on an invisible frame. */
2795 check_minibuf_window (frame, EQ (minibuf_window, selected_window));
2796
2797 if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->frame_visible_invisible_hook) 2748 if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->frame_visible_invisible_hook)
2798 FRAME_TERMINAL (f)->frame_visible_invisible_hook (f, false); 2749 FRAME_TERMINAL (f)->frame_visible_invisible_hook (f, false);
2799 2750
@@ -2836,9 +2787,6 @@ for how to proceed. */)
2836 } 2787 }
2837#endif /* HAVE_WINDOW_SYSTEM */ 2788#endif /* HAVE_WINDOW_SYSTEM */
2838 2789
2839 /* Don't allow minibuf_window to remain on an iconified frame. */
2840 check_minibuf_window (frame, EQ (minibuf_window, selected_window));
2841
2842 if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->iconify_frame_hook) 2790 if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->iconify_frame_hook)
2843 FRAME_TERMINAL (f)->iconify_frame_hook (f); 2791 FRAME_TERMINAL (f)->iconify_frame_hook (f);
2844 2792
@@ -3298,12 +3246,15 @@ If FRAME is omitted or nil, return information on the currently selected frame.
3298 /* It's questionable whether here we should report the value of 3246 /* It's questionable whether here we should report the value of
3299 f->new_height (and f->new_width below) but we've done that in the 3247 f->new_height (and f->new_width below) but we've done that in the
3300 past, so let's keep it. Note that a value of -1 for either of 3248 past, so let's keep it. Note that a value of -1 for either of
3301 these means that no new size was requested. */ 3249 these means that no new size was requested.
3302 height = (f->new_height >= 0 3250
3251 But check f->new_size before to make sure that f->new_height and
3252 f->new_width are not ones requested by adjust_frame_size. */
3253 height = ((f->new_size_p && f->new_height >= 0)
3303 ? f->new_height / FRAME_LINE_HEIGHT (f) 3254 ? f->new_height / FRAME_LINE_HEIGHT (f)
3304 : FRAME_LINES (f)); 3255 : FRAME_LINES (f));
3305 store_in_alist (&alist, Qheight, make_fixnum (height)); 3256 store_in_alist (&alist, Qheight, make_fixnum (height));
3306 width = (f->new_width >= 0 3257 width = ((f->new_size_p && f->new_width >= 0)
3307 ? f->new_width / FRAME_COLUMN_WIDTH (f) 3258 ? f->new_width / FRAME_COLUMN_WIDTH (f)
3308 : FRAME_COLS(f)); 3259 : FRAME_COLS(f));
3309 store_in_alist (&alist, Qwidth, make_fixnum (width)); 3260 store_in_alist (&alist, Qwidth, make_fixnum (width));
diff --git a/src/minibuf.c b/src/minibuf.c
index c4482d7f1ee..bc7d4393985 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -212,7 +212,23 @@ DEFUN ("active-minibuffer-window", Factive_minibuffer_window,
212 doc: /* Return the currently active minibuffer window, or nil if none. */) 212 doc: /* Return the currently active minibuffer window, or nil if none. */)
213 (void) 213 (void)
214{ 214{
215 return minibuf_level ? minibuf_window : Qnil; 215 Lisp_Object frames, frame;
216 struct frame *f;
217 Lisp_Object innermost_MB;
218
219 if (!minibuf_level)
220 return Qnil;
221
222 innermost_MB = nth_minibuffer (minibuf_level);
223 FOR_EACH_FRAME (frames, frame)
224 {
225 f = XFRAME (frame);
226 if (FRAME_LIVE_P (f)
227 && WINDOW_LIVE_P (f->minibuffer_window)
228 && EQ (XWINDOW (f->minibuffer_window)->contents, innermost_MB))
229 return f->minibuffer_window;
230 }
231 return minibuf_window; /* "Can't happen." */
216} 232}
217 233
218DEFUN ("set-minibuffer-window", Fset_minibuffer_window, 234DEFUN ("set-minibuffer-window", Fset_minibuffer_window,