aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1992-10-03 05:42:42 +0000
committerJim Blandy1992-10-03 05:42:42 +0000
commitbdc727bf41bcee3312d92c921d89ca31d2d6060c (patch)
tree2963038557340203c0e1df7cceeb74a339c8b68a /src
parentf689eb05f4f6574471687899ce02757ce386b0b2 (diff)
downloademacs-bdc727bf41bcee3312d92c921d89ca31d2d6060c.tar.gz
emacs-bdc727bf41bcee3312d92c921d89ca31d2d6060c.zip
* window.c (struct save_window_data): Save the currently selected
frame, too. (Fset_window_configuration): Restore the frame's selected window using Fselect_window, and then restore the selected frame using Fselect_frame. (Fcurrent_window_configuration): Record the currently selected frame. Update docstring to describe the information now recorded. * window.c (Fset_window_configuration): Clean up the way we save and restore the frame's size. * window.c (struct save_window_data): Add a member called focus_frame, to save and restore the screen's focus frame. (Fset_window_configuration): Redirect the frame's focus as indicated in the window configuration. (Fcurrent_window_configuration): Record the frame's current focus.
Diffstat (limited to 'src')
-rw-r--r--src/window.c72
1 files changed, 42 insertions, 30 deletions
diff --git a/src/window.c b/src/window.c
index cbf4d0f062a..71881ee4d49 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2296,10 +2296,12 @@ struct save_window_data
2296 int size_from_Lisp_Vector_struct; 2296 int size_from_Lisp_Vector_struct;
2297 struct Lisp_Vector *next_from_Lisp_Vector_struct; 2297 struct Lisp_Vector *next_from_Lisp_Vector_struct;
2298 Lisp_Object frame_width, frame_height; 2298 Lisp_Object frame_width, frame_height;
2299 Lisp_Object selected_frame;
2299 Lisp_Object current_window; 2300 Lisp_Object current_window;
2300 Lisp_Object current_buffer; 2301 Lisp_Object current_buffer;
2301 Lisp_Object minibuf_scroll_window; 2302 Lisp_Object minibuf_scroll_window;
2302 Lisp_Object root_window; 2303 Lisp_Object root_window;
2304 Lisp_Object focus_frame;
2303 /* A vector, interpreted as a struct saved_window */ 2305 /* A vector, interpreted as a struct saved_window */
2304 Lisp_Object saved_windows; 2306 Lisp_Object saved_windows;
2305 }; 2307 };
@@ -2353,10 +2355,12 @@ by `current-window-configuration' (which see).")
2353 int k; 2355 int k;
2354 FRAME_PTR f; 2356 FRAME_PTR f;
2355 2357
2356 /* Save screen height here so we can go back to it at the end. */ 2358 /* If the frame has been resized since this window configuration was
2359 made, we change the frame to the size specified in the
2360 configuration, restore the configuration, and then resize it
2361 back. We keep track of the prevailing height in these variables. */
2357 int previous_frame_height; 2362 int previous_frame_height;
2358 int previous_frame_width; 2363 int previous_frame_width;
2359 int frame_size_change;
2360 2364
2361 while (XTYPE (configuration) != Lisp_Window_Configuration) 2365 while (XTYPE (configuration) != Lisp_Window_Configuration)
2362 { 2366 {
@@ -2369,17 +2373,11 @@ by `current-window-configuration' (which see).")
2369 2373
2370 f = XFRAME (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame); 2374 f = XFRAME (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame);
2371 2375
2372 if (XFASTINT (data->frame_height) != FRAME_HEIGHT (f) 2376 previous_frame_height = FRAME_HEIGHT (f);
2373 || XFASTINT (data->frame_width) != FRAME_WIDTH (f)) 2377 previous_frame_width = FRAME_WIDTH (f);
2374 { 2378 if (XFASTINT (data->frame_height) != previous_frame_height
2375 previous_frame_height = FRAME_HEIGHT (f); 2379 || XFASTINT (data->frame_width) != previous_frame_width)
2376 previous_frame_width = FRAME_WIDTH (f); 2380 change_frame_size (f, data->frame_height, data->frame_width, 0, 0);
2377 frame_size_change = 1;
2378
2379 change_frame_size (f, data->frame_height, data->frame_width, 0, 0);
2380 }
2381 else
2382 frame_size_change = 0;
2383 2381
2384 windows_or_buffers_changed++; 2382 windows_or_buffers_changed++;
2385 new_current_buffer = data->current_buffer; 2383 new_current_buffer = data->current_buffer;
@@ -2391,7 +2389,7 @@ by `current-window-configuration' (which see).")
2391 Restoring the new configuration "undeletes" any that are in it. 2389 Restoring the new configuration "undeletes" any that are in it.
2392 2390
2393 Save their current buffers in their height fields, since we may 2391 Save their current buffers in their height fields, since we may
2394 need it later, if the buffer saved in the configuration is now 2392 need it later, if a buffer saved in the configuration is now
2395 dead. */ 2393 dead. */
2396 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f))); 2394 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f)));
2397 2395
@@ -2456,6 +2454,9 @@ by `current-window-configuration' (which see).")
2456 Fset_marker (XBUFFER (w->buffer)->mark, 2454 Fset_marker (XBUFFER (w->buffer)->mark,
2457 Fmarker_position (p->mark), w->buffer); 2455 Fmarker_position (p->mark), w->buffer);
2458 2456
2457 /* As documented in Fcurrent_window_configuration, don't
2458 save the location of point in the buffer which was current
2459 when the window configuration was recorded. */
2459 if (!EQ (p->buffer, new_current_buffer) && 2460 if (!EQ (p->buffer, new_current_buffer) &&
2460 XBUFFER (p->buffer) == current_buffer) 2461 XBUFFER (p->buffer) == current_buffer)
2461 Fgoto_char (w->pointm); 2462 Fgoto_char (w->pointm);
@@ -2486,9 +2487,26 @@ by `current-window-configuration' (which see).")
2486 } 2487 }
2487 2488
2488 FRAME_ROOT_WINDOW (f) = data->root_window; 2489 FRAME_ROOT_WINDOW (f) = data->root_window;
2489 /* We also need to restore the frame's selected window; that's taken 2490 Fselect_window (data->current_window);
2490 care of below, either by calling Fselect_window, or by explicit 2491
2491 assignment. */ 2492 /* Fselect_window will have made f the selected frame, so we
2493 reselect the proper frame here. Fselect_frame will change the
2494 selected window too, but that doesn't make the call to
2495 Fselect_window above totally superfluous; it still sets f's
2496 selected window. */
2497 Fselect_frame (d->selected_frame);
2498
2499 if (!NILP (new_current_buffer))
2500 Fset_buffer (new_current_buffer);
2501
2502#ifdef MULTI_FRAME
2503 {
2504 Lisp_Object frame;
2505
2506 XSET (frame, Lisp_Frame, f);
2507 Fredirect_frame_focus (frame, data->focus_frame);
2508 }
2509#endif
2492 2510
2493#if 0 /* I don't understand why this is needed, and it causes 2511#if 0 /* I don't understand why this is needed, and it causes
2494 problems when the frame's old selected window has been 2512 problems when the frame's old selected window has been
@@ -2500,20 +2518,10 @@ by `current-window-configuration' (which see).")
2500#endif 2518#endif
2501 2519
2502 /* Set the screen height to the value it had before this function. */ 2520 /* Set the screen height to the value it had before this function. */
2503 if (frame_size_change) 2521 if (previous_frame_height != FRAME_HEIGHT (f)
2522 || previous_frame_width != FRAME_WIDTH (f))
2504 change_frame_size (f, previous_frame_height, previous_frame_width, 0, 0); 2523 change_frame_size (f, previous_frame_height, previous_frame_width, 0, 0);
2505 2524
2506 if (f == selected_frame)
2507 {
2508 Fselect_window (data->current_window);
2509 if (!NILP (new_current_buffer))
2510 Fset_buffer (new_current_buffer);
2511 else
2512 Fset_buffer (XWINDOW (selected_window)->buffer);
2513 }
2514 else
2515 FRAME_SELECTED_WINDOW (f) = data->current_window;
2516
2517 Vminibuf_scroll_window = data->minibuf_scroll_window; 2525 Vminibuf_scroll_window = data->minibuf_scroll_window;
2518 return (Qnil); 2526 return (Qnil);
2519} 2527}
@@ -2627,7 +2635,9 @@ If FRAME is nil or omitted, use the selected frame.\n\
2627This describes the number of windows, their sizes and current buffers,\n\ 2635This describes the number of windows, their sizes and current buffers,\n\
2628and for each displayed buffer, where display starts, and the positions of\n\ 2636and for each displayed buffer, where display starts, and the positions of\n\
2629point and mark. An exception is made for point in the current buffer:\n\ 2637point and mark. An exception is made for point in the current buffer:\n\
2630its value is -not- saved.") 2638its value is -not- saved.\n\
2639This also records the currently selected frame, and FRAME's focus\n\
2640redirection (see `redirect-frame-focus').")
2631 (frame) 2641 (frame)
2632 Lisp_Object frame; 2642 Lisp_Object frame;
2633{ 2643{
@@ -2651,10 +2661,12 @@ its value is -not- saved.")
2651 Qnil)); 2661 Qnil));
2652 XFASTINT (data->frame_width) = FRAME_WIDTH (f); 2662 XFASTINT (data->frame_width) = FRAME_WIDTH (f);
2653 XFASTINT (data->frame_height) = FRAME_HEIGHT (f); 2663 XFASTINT (data->frame_height) = FRAME_HEIGHT (f);
2664 XSET (data->selected_frame, Lisp_Frame, selected_frame);
2654 data->current_window = FRAME_SELECTED_WINDOW (f); 2665 data->current_window = FRAME_SELECTED_WINDOW (f);
2655 XSET (data->current_buffer, Lisp_Buffer, current_buffer); 2666 XSET (data->current_buffer, Lisp_Buffer, current_buffer);
2656 data->minibuf_scroll_window = Vminibuf_scroll_window; 2667 data->minibuf_scroll_window = Vminibuf_scroll_window;
2657 data->root_window = FRAME_ROOT_WINDOW (f); 2668 data->root_window = FRAME_ROOT_WINDOW (f);
2669 data->focus_frame = FRAME_FOCUS_FRAME (f);
2658 tem = Fmake_vector (make_number (n_windows), Qnil); 2670 tem = Fmake_vector (make_number (n_windows), Qnil);
2659 data->saved_windows = tem; 2671 data->saved_windows = tem;
2660 for (i = 0; i < n_windows; i++) 2672 for (i = 0; i < n_windows; i++)