comparison src/window.c @ 25676:70c6d3f2f3b9

(Fminibuffer_window): Change for Lisp_Object selected_frame. (Fwindow_at, Fprevious_window, window_loop, select_window_1, display_buffer_1, Fdisplay_buffer, temp_output_buffer_show, Fcurrent_window_configuration, init_window_once): Ditto.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 13 Sep 1999 11:13:55 +0000
parents d58d733a75d6
children a4321ad412ba
comparison
equal deleted inserted replaced
25675:992d0d097e54 25676:70c6d3f2f3b9
246 used by that frame.") 246 used by that frame.")
247 (frame) 247 (frame)
248 Lisp_Object frame; 248 Lisp_Object frame;
249 { 249 {
250 if (NILP (frame)) 250 if (NILP (frame))
251 XSETFRAME (frame, selected_frame); 251 frame = selected_frame;
252 else 252 CHECK_LIVE_FRAME (frame, 0);
253 CHECK_LIVE_FRAME (frame, 0);
254
255 return FRAME_MINIBUF_WINDOW (XFRAME (frame)); 253 return FRAME_MINIBUF_WINDOW (XFRAME (frame));
256 } 254 }
257 255
258 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, 256 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0,
259 "Returns non-nil if WINDOW is a minibuffer window.") 257 "Returns non-nil if WINDOW is a minibuffer window.")
632 { 630 {
633 int part; 631 int part;
634 struct frame *f; 632 struct frame *f;
635 633
636 if (NILP (frame)) 634 if (NILP (frame))
637 XSETFRAME (frame, selected_frame); 635 frame = selected_frame;
638 else 636 CHECK_LIVE_FRAME (frame, 2);
639 CHECK_LIVE_FRAME (frame, 2);
640 f = XFRAME (frame); 637 f = XFRAME (frame);
641 638
642 /* Check that arguments are integers or floats. */ 639 /* Check that arguments are integers or floats. */
643 CHECK_NUMBER_OR_FLOAT (x, 0); 640 CHECK_NUMBER_OR_FLOAT (x, 0);
644 CHECK_NUMBER_OR_FLOAT (y, 1); 641 CHECK_NUMBER_OR_FLOAT (y, 1);
1211 and we include its frame as well as the selected one, 1208 and we include its frame as well as the selected one,
1212 next_frame may get stuck in that frame. 1209 next_frame may get stuck in that frame.
1213 If that happens, go back to the selected frame 1210 If that happens, go back to the selected frame
1214 so we can complete the cycle. */ 1211 so we can complete the cycle. */
1215 if (EQ (tem, tem1)) 1212 if (EQ (tem, tem1))
1216 XSETFRAME (tem, selected_frame); 1213 tem = selected_frame;
1217 } 1214 }
1218 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); 1215 tem = FRAME_ROOT_WINDOW (XFRAME (tem));
1219 1216
1220 break; 1217 break;
1221 } 1218 }
1363 and we include its frame as well as the selected one, 1360 and we include its frame as well as the selected one,
1364 next_frame may get stuck in that frame. 1361 next_frame may get stuck in that frame.
1365 If that happens, go back to the selected frame 1362 If that happens, go back to the selected frame
1366 so we can complete the cycle. */ 1363 so we can complete the cycle. */
1367 if (EQ (tem, tem1)) 1364 if (EQ (tem, tem1))
1368 XSETFRAME (tem, selected_frame); 1365 tem = selected_frame;
1369 } 1366 }
1370 /* If this frame has a minibuffer, find that window first, 1367 /* If this frame has a minibuffer, find that window first,
1371 because it is conceptually the last window in that frame. */ 1368 because it is conceptually the last window in that frame. */
1372 if (FRAME_HAS_MINIBUF_P (XFRAME (tem))) 1369 if (FRAME_HAS_MINIBUF_P (XFRAME (tem)))
1373 tem = FRAME_MINIBUF_WINDOW (XFRAME (tem)); 1370 tem = FRAME_MINIBUF_WINDOW (XFRAME (tem));
1474 frame points to that frame. If we're looping through windows 1471 frame points to that frame. If we're looping through windows
1475 on all frames, frame is 0. */ 1472 on all frames, frame is 0. */
1476 if (FRAMEP (frames)) 1473 if (FRAMEP (frames))
1477 frame = XFRAME (frames); 1474 frame = XFRAME (frames);
1478 else if (NILP (frames)) 1475 else if (NILP (frames))
1479 frame = selected_frame; 1476 frame = SELECTED_FRAME ();
1480 else 1477 else
1481 frame = 0; 1478 frame = 0;
1482 if (frame) 1479 if (frame)
1483 frame_arg = Qlambda; 1480 frame_arg = Qlambda;
1484 else if (XFASTINT (frames) == 0) 1481 else if (XFASTINT (frames) == 0)
1494 if (WINDOWP (obj)) 1491 if (WINDOWP (obj))
1495 w = obj; 1492 w = obj;
1496 else if (frame) 1493 else if (frame)
1497 w = FRAME_SELECTED_WINDOW (frame); 1494 w = FRAME_SELECTED_WINDOW (frame);
1498 else 1495 else
1499 w = FRAME_SELECTED_WINDOW (selected_frame); 1496 w = FRAME_SELECTED_WINDOW (SELECTED_FRAME ());
1500 1497
1501 /* Figure out the last window we're going to mess with. Since 1498 /* Figure out the last window we're going to mess with. Since
1502 Fnext_window, given the same options, is guaranteed to go in a 1499 Fnext_window, given the same options, is guaranteed to go in a
1503 ring, we can just use Fprevious_window to find the last one. 1500 ring, we can just use Fprevious_window to find the last one.
1504 1501
2448 register Lisp_Object window; 2445 register Lisp_Object window;
2449 int recordflag; 2446 int recordflag;
2450 { 2447 {
2451 register struct window *w; 2448 register struct window *w;
2452 register struct window *ow = XWINDOW (selected_window); 2449 register struct window *ow = XWINDOW (selected_window);
2450 struct frame *sf;
2453 2451
2454 CHECK_LIVE_WINDOW (window, 0); 2452 CHECK_LIVE_WINDOW (window, 0);
2455 2453
2456 w = XWINDOW (window); 2454 w = XWINDOW (window);
2457 2455
2466 set_marker_both (ow->pointm, ow->buffer, 2464 set_marker_both (ow->pointm, ow->buffer,
2467 BUF_PT (XBUFFER (ow->buffer)), 2465 BUF_PT (XBUFFER (ow->buffer)),
2468 BUF_PT_BYTE (XBUFFER (ow->buffer))); 2466 BUF_PT_BYTE (XBUFFER (ow->buffer)));
2469 2467
2470 selected_window = window; 2468 selected_window = window;
2471 if (XFRAME (WINDOW_FRAME (w)) != selected_frame) 2469 sf = SELECTED_FRAME ();
2470 if (XFRAME (WINDOW_FRAME (w)) != sf)
2472 { 2471 {
2473 XFRAME (WINDOW_FRAME (w))->selected_window = window; 2472 XFRAME (WINDOW_FRAME (w))->selected_window = window;
2474 /* Use this rather than Fhandle_switch_frame 2473 /* Use this rather than Fhandle_switch_frame
2475 so that FRAME_FOCUS_FRAME is moved appropriately as we 2474 so that FRAME_FOCUS_FRAME is moved appropriately as we
2476 move around in the state where a minibuffer in a separate 2475 move around in the state where a minibuffer in a separate
2477 frame is active. */ 2476 frame is active. */
2478 Fselect_frame (WINDOW_FRAME (w), Qnil); 2477 Fselect_frame (WINDOW_FRAME (w), Qnil);
2479 } 2478 }
2480 else 2479 else
2481 selected_frame->selected_window = window; 2480 sf->selected_window = window;
2482 2481
2483 if (recordflag) 2482 if (recordflag)
2484 record_buffer (w->buffer); 2483 record_buffer (w->buffer);
2485 Fset_buffer (w->buffer); 2484 Fset_buffer (w->buffer);
2486 2485
2517 2516
2518 static Lisp_Object 2517 static Lisp_Object
2519 display_buffer_1 (window) 2518 display_buffer_1 (window)
2520 Lisp_Object window; 2519 Lisp_Object window;
2521 { 2520 {
2522 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (window))); 2521 Lisp_Object frame = XWINDOW (window)->frame;
2522 FRAME_PTR f = XFRAME (frame);
2523
2523 FRAME_SAMPLE_VISIBILITY (f); 2524 FRAME_SAMPLE_VISIBILITY (f);
2524 if (f != selected_frame) 2525
2526 if (!EQ (frame, selected_frame))
2525 { 2527 {
2526 if (FRAME_ICONIFIED_P (f)) 2528 if (FRAME_ICONIFIED_P (f))
2527 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); 2529 Fmake_frame_visible (frame);
2528 else if (FRAME_VISIBLE_P (f)) 2530 else if (FRAME_VISIBLE_P (f))
2529 Fraise_frame (WINDOW_FRAME (XWINDOW (window))); 2531 Fraise_frame (frame);
2530 } 2532 }
2533
2531 return window; 2534 return window;
2532 } 2535 }
2533 2536
2534 DEFUN ("special-display-p", Fspecial_display_p, Sspecial_display_p, 1, 1, 0, 2537 DEFUN ("special-display-p", Fspecial_display_p, Sspecial_display_p, 1, 1, 0,
2535 "Returns non-nil if a buffer named BUFFER-NAME would be created specially.\n\ 2538 "Returns non-nil if a buffer named BUFFER-NAME would be created specially.\n\
2622 which means search visible and iconified frames.") 2625 which means search visible and iconified frames.")
2623 (buffer, not_this_window, frame) 2626 (buffer, not_this_window, frame)
2624 register Lisp_Object buffer, not_this_window, frame; 2627 register Lisp_Object buffer, not_this_window, frame;
2625 { 2628 {
2626 register Lisp_Object window, tem, swp; 2629 register Lisp_Object window, tem, swp;
2630 struct frame *f;
2627 2631
2628 swp = Qnil; 2632 swp = Qnil;
2629 buffer = Fget_buffer (buffer); 2633 buffer = Fget_buffer (buffer);
2630 CHECK_BUFFER (buffer, 0); 2634 CHECK_BUFFER (buffer, 0);
2631 2635
2681 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); 2685 window = Fframe_selected_window (call0 (Vpop_up_frame_function));
2682 Fset_window_buffer (window, buffer); 2686 Fset_window_buffer (window, buffer);
2683 return display_buffer_1 (window); 2687 return display_buffer_1 (window);
2684 } 2688 }
2685 2689
2690 f = SELECTED_FRAME ();
2686 if (pop_up_windows 2691 if (pop_up_windows
2687 || FRAME_MINIBUF_ONLY_P (selected_frame) 2692 || FRAME_MINIBUF_ONLY_P (f)
2688 /* If the current frame is a special display frame, 2693 /* If the current frame is a special display frame,
2689 don't try to reuse its windows. */ 2694 don't try to reuse its windows. */
2690 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->dedicated) 2695 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (f))->dedicated))
2691 )
2692 { 2696 {
2693 Lisp_Object frames; 2697 Lisp_Object frames;
2694 2698
2695 frames = Qnil; 2699 frames = Qnil;
2696 if (FRAME_MINIBUF_ONLY_P (selected_frame)) 2700 if (FRAME_MINIBUF_ONLY_P (f))
2697 XSETFRAME (frames, last_nonminibuf_frame); 2701 XSETFRAME (frames, last_nonminibuf_frame);
2698 /* Don't try to create a window if would get an error */ 2702 /* Don't try to create a window if would get an error */
2699 if (split_height_threshold < window_min_height << 1) 2703 if (split_height_threshold < window_min_height << 1)
2700 split_height_threshold = window_min_height << 1; 2704 split_height_threshold = window_min_height << 1;
2701 2705
2703 ignore minibuffers and dedicated windows. 2707 ignore minibuffers and dedicated windows.
2704 This means they can return nil. */ 2708 This means they can return nil. */
2705 2709
2706 /* If the frame we would try to split cannot be split, 2710 /* If the frame we would try to split cannot be split,
2707 try other frames. */ 2711 try other frames. */
2708 if (FRAME_NO_SPLIT_P (NILP (frames) ? selected_frame 2712 if (FRAME_NO_SPLIT_P (NILP (frames) ? f : last_nonminibuf_frame))
2709 : last_nonminibuf_frame))
2710 { 2713 {
2711 /* Try visible frames first. */ 2714 /* Try visible frames first. */
2712 window = Fget_largest_window (Qvisible); 2715 window = Fget_largest_window (Qvisible);
2713 /* If that didn't work, try iconified frames. */ 2716 /* If that didn't work, try iconified frames. */
2714 if (NILP (window)) 2717 if (NILP (window))
2814 call1 (Vtemp_buffer_show_function, buf); 2817 call1 (Vtemp_buffer_show_function, buf);
2815 else 2818 else
2816 { 2819 {
2817 window = Fdisplay_buffer (buf, Qnil, Qnil); 2820 window = Fdisplay_buffer (buf, Qnil, Qnil);
2818 2821
2819 if (XFRAME (XWINDOW (window)->frame) != selected_frame) 2822 if (!EQ (XWINDOW (window)->frame, selected_frame))
2820 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); 2823 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
2821 Vminibuf_scroll_window = window; 2824 Vminibuf_scroll_window = window;
2822 w = XWINDOW (window); 2825 w = XWINDOW (window);
2823 XSETFASTINT (w->hscroll, 0); 2826 XSETFASTINT (w->hscroll, 0);
2824 set_marker_restricted_both (w->start, buf, 1, 1); 2827 set_marker_restricted_both (w->start, buf, 1, 1);
4509 register struct Lisp_Vector *vec; 4512 register struct Lisp_Vector *vec;
4510 register int i; 4513 register int i;
4511 FRAME_PTR f; 4514 FRAME_PTR f;
4512 4515
4513 if (NILP (frame)) 4516 if (NILP (frame))
4514 f = selected_frame; 4517 frame = selected_frame;
4515 else 4518 CHECK_LIVE_FRAME (frame, 0);
4516 { 4519 f = XFRAME (frame);
4517 CHECK_LIVE_FRAME (frame, 0);
4518 f = XFRAME (frame);
4519 }
4520 4520
4521 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); 4521 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
4522 vec = allocate_vectorlike (VECSIZE (struct save_window_data)); 4522 vec = allocate_vectorlike (VECSIZE (struct save_window_data));
4523 for (i = 0; i < VECSIZE (struct save_window_data); i++) 4523 for (i = 0; i < VECSIZE (struct save_window_data); i++)
4524 vec->contents[i] = Qnil; 4524 vec->contents[i] = Qnil;
4527 4527
4528 XSETFASTINT (data->frame_width, FRAME_WIDTH (f)); 4528 XSETFASTINT (data->frame_width, FRAME_WIDTH (f));
4529 XSETFASTINT (data->frame_height, FRAME_HEIGHT (f)); 4529 XSETFASTINT (data->frame_height, FRAME_HEIGHT (f));
4530 XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f)); 4530 XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f));
4531 XSETFASTINT (data->frame_tool_bar_lines, FRAME_TOOL_BAR_LINES (f)); 4531 XSETFASTINT (data->frame_tool_bar_lines, FRAME_TOOL_BAR_LINES (f));
4532 XSETFRAME (data->selected_frame, selected_frame); 4532 data->selected_frame = selected_frame;
4533 data->current_window = FRAME_SELECTED_WINDOW (f); 4533 data->current_window = FRAME_SELECTED_WINDOW (f);
4534 XSETBUFFER (data->current_buffer, current_buffer); 4534 XSETBUFFER (data->current_buffer, current_buffer);
4535 data->minibuf_scroll_window = Vminibuf_scroll_window; 4535 data->minibuf_scroll_window = Vminibuf_scroll_window;
4536 data->root_window = FRAME_ROOT_WINDOW (f); 4536 data->root_window = FRAME_ROOT_WINDOW (f);
4537 data->focus_frame = FRAME_FOCUS_FRAME (f); 4537 data->focus_frame = FRAME_FOCUS_FRAME (f);
4888 } 4888 }
4889 4889
4890 void 4890 void
4891 init_window_once () 4891 init_window_once ()
4892 { 4892 {
4893 selected_frame = make_terminal_frame (); 4893 struct frame *f = make_terminal_frame ();
4894 XSETFRAME (Vterminal_frame, selected_frame); 4894 XSETFRAME (selected_frame, f);
4895 minibuf_window = selected_frame->minibuffer_window; 4895 Vterminal_frame = selected_frame;
4896 selected_window = selected_frame->selected_window; 4896 minibuf_window = f->minibuffer_window;
4897 last_nonminibuf_frame = selected_frame; 4897 selected_window = f->selected_window;
4898 last_nonminibuf_frame = f;
4898 4899
4899 window_initialized = 1; 4900 window_initialized = 1;
4900 } 4901 }
4901 4902
4902 void 4903 void