comparison src/frame.c @ 1118:a43d53261506

* frame.c (choose_minibuf_frame): abort if the selected frame has nil in its minibuffer_window slot; this shouldn't happen any more.
author Jim Blandy <jimb@redhat.com>
date Sun, 13 Sep 1992 12:29:01 +0000
parents a13ee72d74a2
children 4e556fda7a4d
comparison
equal deleted inserted replaced
1117:878afcdce84e 1118:a43d53261506
399 } 399 }
400 400
401 #ifdef MULTI_FRAME 401 #ifdef MULTI_FRAME
402 402
403 /* Return the next frame in the frame list after FRAME. 403 /* Return the next frame in the frame list after FRAME.
404 If MINIBUF is non-nil, include all frames.
405 If MINIBUF is nil, exclude minibuffer-only frames. 404 If MINIBUF is nil, exclude minibuffer-only frames.
406 If MINIBUF is a window, include only frames using that window for 405 If MINIBUF is a window, include only frames using that window for
407 their minibuffer. */ 406 their minibuffer.
407 If MINIBUF is non-nil, and not a window, include all frames. */
408 Lisp_Object 408 Lisp_Object
409 next_frame (frame, minibuf) 409 next_frame (frame, minibuf)
410 Lisp_Object frame; 410 Lisp_Object frame;
411 Lisp_Object minibuf; 411 Lisp_Object minibuf;
412 { 412 {
418 abort (); 418 abort ();
419 419
420 while (1) 420 while (1)
421 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) 421 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
422 { 422 {
423 Lisp_Object f = XCONS (tail)->car;
424
423 if (passed) 425 if (passed)
424 { 426 {
425 Lisp_Object f = XCONS (tail)->car; 427 /* Decide whether this frame is eligible to be returned. */
426 428
427 /* Decide whether this frame is eligible to be returned, 429 /* If we've looped all the way around without finding any
428 according to minibuf. */ 430 eligible frames, return the original frame. */
429 if ((NILP (minibuf) && ! FRAME_MINIBUF_ONLY_P (XFRAME (f))) 431 if (EQ (f, frame))
430 || XTYPE (minibuf) != Lisp_Window 432 return f;
431 || EQ (FRAME_MINIBUF_WINDOW (XFRAME (f)), minibuf) 433
432 || EQ (f, frame)) 434 /* Let minibuf decide if this frame is acceptable. */
435 if (NILP (minibuf))
436 {
437 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f)))
438 return f;
439 }
440 else if (XTYPE (minibuf) == Lisp_Window)
441 {
442 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f)), minibuf))
443 return f;
444 }
445 else
433 return f; 446 return f;
434 } 447 }
435 448
436 if (EQ (frame, XCONS (tail)->car)) 449 if (EQ (frame, f))
437 passed++; 450 passed++;
438 } 451 }
439 } 452 }
440 453
454 #if 0
455 /* Nobody seems to be using this code right now. */
456
441 /* Return the previous frame in the frame list before FRAME. 457 /* Return the previous frame in the frame list before FRAME.
442 If MINIBUF is non-nil, include all frames.
443 If MINIBUF is nil, exclude minibuffer-only frames. 458 If MINIBUF is nil, exclude minibuffer-only frames.
444 If MINIBUF is a window, include only frames using that window for 459 If MINIBUF is a window, include only frames using that window for
445 their minibuffer. */ 460 their minibuffer.
461 If MINIBUF is non-nil and not a window, include all frames. */
446 Lisp_Object 462 Lisp_Object
447 prev_frame (frame, minibuf) 463 prev_frame (frame, minibuf)
448 Lisp_Object frame; 464 Lisp_Object frame;
449 Lisp_Object minibuf; 465 Lisp_Object minibuf;
450 { 466 {
454 /* There must always be at least one frame in Vframe_list. */ 470 /* There must always be at least one frame in Vframe_list. */
455 if (! CONSP (Vframe_list)) 471 if (! CONSP (Vframe_list))
456 abort (); 472 abort ();
457 473
458 prev = Qnil; 474 prev = Qnil;
459 while (1) 475 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
460 { 476 {
461 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) 477 Lisp_Object f = XCONS (tail)->car;
478
479 if (XTYPE (f) != Lisp_Frame)
480 abort ();
481
482 if (EQ (frame, f) && !NILP (prev))
483 return prev;
484
485 /* Decide whether this frame is eligible to be returned,
486 according to minibuf. */
487 if (NILP (minibuf))
462 { 488 {
463 Lisp_Object scr = XCONS (tail)->car; 489 if (! FRAME_MINIBUF_ONLY_P (XFRAME (f)))
464 490 prev = f;
465 if (XTYPE (scr) != Lisp_Frame)
466 abort ();
467
468 if (EQ (frame, scr) && !NILP (prev))
469 return prev;
470
471 /* Decide whether this frame is eligible to be returned,
472 according to minibuf. */
473 if ((NILP (minibuf) && ! FRAME_MINIBUF_ONLY_P (XFRAME (scr)))
474 || XTYPE (minibuf) != Lisp_Window
475 || EQ (FRAME_MINIBUF_WINDOW (XFRAME (scr)), minibuf))
476 prev = scr;
477 } 491 }
478 492 else if (XTYPE (minibuf) == Lisp_Window)
479 if (NILP (prev)) 493 {
480 /* We went through the whole frame list without finding a single 494 if (EQ (FRAME_MINIBUF_WINDOW (XFRAME (f)), minibuf))
481 acceptable frame. Return the original frame. */ 495 prev = f;
482 prev = frame; 496 }
483 } 497 else
484 498 prev = f;
485 } 499 }
500
501 /* We've scanned the entire list. */
502 if (NILP (prev))
503 /* We went through the whole frame list without finding a single
504 acceptable frame. Return the original frame. */
505 return frame;
506 else
507 /* There were no acceptable frames in the list before FRAME; otherwise,
508 we would have returned directly from the loop. Since PREV is the last
509 acceptable frame in the list, return it. */
510 return prev;
511 }
512 #endif
486 513
487 DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0, 514 DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0,
488 "Return the next frame in the frame list after FRAME.\n\ 515 "Return the next frame in the frame list after FRAME.\n\
489 If optional argument MINIBUF is non-nil, include all frames. If\n\ 516 If omitted, FRAME defaults to the selected frame.\n\
490 MINIBUF is nil or omitted, exclude minibuffer-only frames. If\n\ 517 If optional argument MINIBUF is nil or omitted, exclude minibuffer-only frames.\n\
491 MINIBUF is a window, include only frames using that window for their\n\ 518 If MINIBUF is a window, include only frames using that window for their\n\
492 minibuffer.") 519 minibuffer.\n\
520 If MINIBUF is non-nil and not a window, include all frames.")
493 (frame, miniframe) 521 (frame, miniframe)
494 Lisp_Object frame, miniframe; 522 Lisp_Object frame, miniframe;
495 { 523 {
496 Lisp_Object tail; 524 Lisp_Object tail;
497 525
1211 1239
1212 choose_minibuf_frame () 1240 choose_minibuf_frame ()
1213 { 1241 {
1214 /* For lowest-level minibuf, put it on currently selected frame 1242 /* For lowest-level minibuf, put it on currently selected frame
1215 if frame has a minibuffer. */ 1243 if frame has a minibuffer. */
1244
1216 if (minibuf_level == 0 1245 if (minibuf_level == 0
1217 && selected_frame != 0 1246 && selected_frame != 0
1218 && !EQ (minibuf_window, selected_frame->minibuffer_window) 1247 && !EQ (minibuf_window, selected_frame->minibuffer_window))
1219 && !EQ (Qnil, selected_frame->minibuffer_window)) 1248 {
1220 { 1249 /* I don't think that any frames may validly have a null minibuffer
1250 window anymore. */
1251 if (NILP (selected_frame->minibuffer_window))
1252 abort ();
1253
1221 Fset_window_buffer (selected_frame->minibuffer_window, 1254 Fset_window_buffer (selected_frame->minibuffer_window,
1222 XWINDOW (minibuf_window)->buffer); 1255 XWINDOW (minibuf_window)->buffer);
1223 minibuf_window = selected_frame->minibuffer_window; 1256 minibuf_window = selected_frame->minibuffer_window;
1224 } 1257 }
1225 } 1258 }
1323 #ifndef HAVE_X11 1356 #ifndef HAVE_X11
1324 defsubr (&Srubber_band_rectangle); 1357 defsubr (&Srubber_band_rectangle);
1325 #endif /* HAVE_X11 */ 1358 #endif /* HAVE_X11 */
1326 } 1359 }
1327 1360
1328 #else /* not MULTI_SCREEN */ 1361 #else /* not MULTI_FRAME */
1329 1362
1330 /* If we're not using multi-frame stuff, we still need to provide some 1363 /* If we're not using multi-frame stuff, we still need to provide some
1331 support functions. */ 1364 support functions. */
1332 1365
1333 /* Unless this function is defined, providing set-frame-height and 1366 /* Unless this function is defined, providing set-frame-height and