aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorEli Zaretskii2014-10-14 21:10:37 +0300
committerEli Zaretskii2014-10-14 21:10:37 +0300
commite3060a0c4d2f418ac786775109d71e5843ccf42e (patch)
tree347b37fc39d0db9cd23b3e9f79ee81b4bbc40f08 /src/window.c
parent1a3eca0656bdb764200e10a4f264138e94b1f3ce (diff)
parent980d78b3587560c13a46aef352ed8d5ed744acf6 (diff)
downloademacs-e3060a0c4d2f418ac786775109d71e5843ccf42e.tar.gz
emacs-e3060a0c4d2f418ac786775109d71e5843ccf42e.zip
Merge from trunk and resolve conflicts.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c464
1 files changed, 28 insertions, 436 deletions
diff --git a/src/window.c b/src/window.c
index ac685f6867f..0b0f2140a58 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4163,7 +4163,6 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise)
4163 new_pixel_size = max (horflag 4163 new_pixel_size = max (horflag
4164 ? size 4164 ? size
4165 : (size 4165 : (size
4166/** - FRAME_TOP_MARGIN_HEIGHT (f) **/
4167 - ((FRAME_HAS_MINIBUF_P (f) 4166 - ((FRAME_HAS_MINIBUF_P (f)
4168 && !FRAME_MINIBUF_ONLY_P (f)) 4167 && !FRAME_MINIBUF_ONLY_P (f))
4169 ? FRAME_LINE_HEIGHT (f) : 0)), 4168 ? FRAME_LINE_HEIGHT (f) : 0)),
@@ -4175,7 +4174,6 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise)
4175 new_size = max (horflag 4174 new_size = max (horflag
4176 ? size 4175 ? size
4177 : (size 4176 : (size
4178/** - FRAME_TOP_MARGIN (f) **/
4179 - ((FRAME_HAS_MINIBUF_P (f) 4177 - ((FRAME_HAS_MINIBUF_P (f)
4180 && !FRAME_MINIBUF_ONLY_P (f)) 4178 && !FRAME_MINIBUF_ONLY_P (f))
4181 ? 1 : 0)), 4179 ? 1 : 0)),
@@ -4796,10 +4794,10 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4796 block_input (); 4794 block_input ();
4797 window_resize_apply (r, 0); 4795 window_resize_apply (r, 0);
4798 4796
4799 w->total_lines = XFASTINT (w->new_total);
4800 w->top_line = r->top_line + r->total_lines;
4801 w->pixel_height = XFASTINT (w->new_pixel); 4797 w->pixel_height = XFASTINT (w->new_pixel);
4798 w->total_lines = w->pixel_height / FRAME_LINE_HEIGHT (f);
4802 w->pixel_top = r->pixel_top + r->pixel_height; 4799 w->pixel_top = r->pixel_top + r->pixel_height;
4800 w->top_line = r->top_line + r->total_lines;
4803 4801
4804 fset_redisplay (f); 4802 fset_redisplay (f);
4805 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4803 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
@@ -5916,6 +5914,8 @@ and redisplay normally--don't erase and redraw the frame. */)
5916 w->start_at_line_beg = (bytepos == BEGV_BYTE 5914 w->start_at_line_beg = (bytepos == BEGV_BYTE
5917 || FETCH_BYTE (bytepos - 1) == '\n'); 5915 || FETCH_BYTE (bytepos - 1) == '\n');
5918 5916
5917 wset_redisplay (w);
5918
5919 return Qnil; 5919 return Qnil;
5920} 5920}
5921 5921
@@ -6124,6 +6124,7 @@ the return value is nil. Otherwise the value is t. */)
6124 Lisp_Object frame; 6124 Lisp_Object frame;
6125 struct frame *f; 6125 struct frame *f;
6126 ptrdiff_t old_point = -1; 6126 ptrdiff_t old_point = -1;
6127 USE_SAFE_ALLOCA;
6127 6128
6128 CHECK_WINDOW_CONFIGURATION (configuration); 6129 CHECK_WINDOW_CONFIGURATION (configuration);
6129 6130
@@ -6231,8 +6232,8 @@ the return value is nil. Otherwise the value is t. */)
6231 really like to do is to free only those matrices not reused 6232 really like to do is to free only those matrices not reused
6232 below. */ 6233 below. */
6233 root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); 6234 root_window = XWINDOW (FRAME_ROOT_WINDOW (f));
6234 leaf_windows = alloca (count_windows (root_window) 6235 int nwindows = count_windows (root_window);
6235 * sizeof *leaf_windows); 6236 SAFE_NALLOCA (leaf_windows, 1, nwindows);
6236 n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0); 6237 n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0);
6237 6238
6238 /* Kludge Alert! 6239 /* Kludge Alert!
@@ -6456,424 +6457,11 @@ the return value is nil. Otherwise the value is t. */)
6456 Vminibuf_scroll_window = data->minibuf_scroll_window; 6457 Vminibuf_scroll_window = data->minibuf_scroll_window;
6457 minibuf_selected_window = data->minibuf_selected_window; 6458 minibuf_selected_window = data->minibuf_selected_window;
6458 6459
6460 SAFE_FREE ();
6459 return (FRAME_LIVE_P (f) ? Qt : Qnil); 6461 return (FRAME_LIVE_P (f) ? Qt : Qnil);
6460} 6462}
6461 6463
6462 6464
6463#if 0
6464DEFUN ("set-window-configuration", Fset_window_configuration,
6465 Sset_window_configuration, 1, 1, 0,
6466 doc: /* Set the configuration of windows and buffers as specified by CONFIGURATION.
6467CONFIGURATION must be a value previously returned
6468by `current-window-configuration' (which see).
6469If CONFIGURATION was made from a frame that is now deleted,
6470only frame-independent values can be restored. In this case,
6471the return value is nil. Otherwise the value is t. */)
6472 (Lisp_Object configuration)
6473{
6474 register struct save_window_data *data;
6475 struct Lisp_Vector *saved_windows;
6476 Lisp_Object new_current_buffer;
6477 Lisp_Object frame;
6478 struct frame *f;
6479 ptrdiff_t old_point = -1;
6480
6481 CHECK_WINDOW_CONFIGURATION (configuration);
6482
6483 data = (struct save_window_data *) XVECTOR (configuration);
6484 saved_windows = XVECTOR (data->saved_windows);
6485
6486 new_current_buffer = data->current_buffer;
6487 if (!BUFFER_LIVE_P (XBUFFER (new_current_buffer)))
6488 new_current_buffer = Qnil;
6489 else
6490 {
6491 if (XBUFFER (new_current_buffer) == current_buffer)
6492 /* The code further down "preserves point" by saving here PT in
6493 old_point and then setting it later back into PT. When the
6494 current-selected-window and the final-selected-window both show
6495 the current buffer, this suffers from the problem that the
6496 current PT is the window-point of the current-selected-window,
6497 while the final PT is the point of the final-selected-window, so
6498 this copy from one PT to the other would end up moving the
6499 window-point of the final-selected-window to the window-point of
6500 the current-selected-window. So we have to be careful which
6501 point of the current-buffer we copy into old_point. */
6502 if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer)
6503 && WINDOWP (selected_window)
6504 && EQ (XWINDOW (selected_window)->contents, new_current_buffer)
6505 && !EQ (selected_window, data->current_window))
6506 old_point = marker_position (XWINDOW (data->current_window)->pointm);
6507 else
6508 old_point = PT;
6509 else
6510 /* BUF_PT (XBUFFER (new_current_buffer)) gives us the position of
6511 point in new_current_buffer as of the last time this buffer was
6512 used. This can be non-deterministic since it can be changed by
6513 things like jit-lock by mere temporary selection of some random
6514 window that happens to show this buffer.
6515 So if possible we want this arbitrary choice of "which point" to
6516 be the one from the to-be-selected-window so as to prevent this
6517 window's cursor from being copied from another window. */
6518 if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer)
6519 /* If current_window = selected_window, its point is in BUF_PT. */
6520 && !EQ (selected_window, data->current_window))
6521 old_point = marker_position (XWINDOW (data->current_window)->pointm);
6522 else
6523 old_point = BUF_PT (XBUFFER (new_current_buffer));
6524 }
6525
6526 frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
6527 f = XFRAME (frame);
6528
6529 /* If f is a dead frame, don't bother rebuilding its window tree.
6530 However, there is other stuff we should still try to do below. */
6531 if (FRAME_LIVE_P (f))
6532 {
6533 Lisp_Object window;
6534 Lisp_Object dead_windows = Qnil;
6535 register Lisp_Object tem, par, pers;
6536 register struct window *w;
6537 register struct saved_window *p;
6538 struct window *root_window;
6539 struct window **leaf_windows;
6540 int n_leaf_windows;
6541 ptrdiff_t k;
6542 int i, n;
6543 ptrdiff_t count = SPECPDL_INDEX ();
6544 /* If the frame has been resized since this window configuration was
6545 made, we change the frame to the size specified in the
6546 configuration, restore the configuration, and then resize it
6547 back. We keep track of the prevailing height in these variables. */
6548 int previous_frame_text_height = FRAME_TEXT_HEIGHT (f);
6549 int previous_frame_text_width = FRAME_TEXT_WIDTH (f);
6550 /* int previous_frame_menu_bar_height = FRAME_MENU_BAR_HEIGHT (f); */
6551 /* int previous_frame_tool_bar_height = FRAME_TOOL_BAR_HEIGHT (f); */
6552 /* int previous_frame_lines = FRAME_LINES (f); */
6553 /* int previous_frame_cols = FRAME_COLS (f); */
6554 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
6555 int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f);
6556
6557 /* Don't do this within the main loop below: This may call Lisp
6558 code and is thus potentially unsafe while input is blocked. */
6559 for (k = 0; k < saved_windows->header.size; k++)
6560 {
6561 p = SAVED_WINDOW_N (saved_windows, k);
6562 window = p->window;
6563 w = XWINDOW (window);
6564 if (BUFFERP (w->contents)
6565 && !EQ (w->contents, p->buffer)
6566 && BUFFER_LIVE_P (XBUFFER (p->buffer)))
6567 /* If a window we restore gets another buffer, record the
6568 window's old buffer. */
6569 call1 (Qrecord_window_buffer, window);
6570 }
6571
6572 /* Consider frame unofficial, temporarily. */
6573 f->official = false;
6574 /* The mouse highlighting code could get screwed up
6575 if it runs during this. */
6576 block_input ();
6577
6578 if (data->frame_text_width != previous_frame_text_width
6579 || data->frame_text_height != previous_frame_text_height)
6580 /* Make frame size fit the one in data, so window sizes restored
6581 from data match those of the frame. */
6582 adjust_frame_size (f, data->frame_text_width,
6583 data->frame_text_height, 5, 0);
6584
6585 if (data->frame_menu_bar_lines != previous_frame_menu_bar_lines)
6586 {
6587#ifdef HAVE_WINDOW_SYSTEM
6588 if (FRAME_WINDOW_P (f))
6589 x_set_menu_bar_lines (f, make_number (data->frame_menu_bar_lines),
6590 make_number (0));
6591 else /* TTY or MSDOS */
6592#endif
6593 set_menu_bar_lines (f, make_number (data->frame_menu_bar_lines),
6594 make_number (0));
6595 }
6596#ifdef HAVE_WINDOW_SYSTEM
6597 if (data->frame_tool_bar_lines != previous_frame_tool_bar_lines)
6598 x_set_tool_bar_lines (f, make_number (data->frame_tool_bar_lines),
6599 make_number (0));
6600#endif
6601
6602 /* "Swap out" point from the selected window's buffer
6603 into the window itself. (Normally the pointm of the selected
6604 window holds garbage.) We do this now, before
6605 restoring the window contents, and prevent it from
6606 being done later on when we select a new window. */
6607 if (! NILP (XWINDOW (selected_window)->contents))
6608 {
6609 w = XWINDOW (selected_window);
6610 set_marker_both (w->pointm,
6611 w->contents,
6612 BUF_PT (XBUFFER (w->contents)),
6613 BUF_PT_BYTE (XBUFFER (w->contents)));
6614 }
6615
6616 fset_redisplay (f);
6617 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
6618
6619 /* Problem: Freeing all matrices and later allocating them again
6620 is a serious redisplay flickering problem. What we would
6621 really like to do is to free only those matrices not reused
6622 below. */
6623 root_window = XWINDOW (FRAME_ROOT_WINDOW (f));
6624 leaf_windows = alloca (count_windows (root_window)
6625 * sizeof *leaf_windows);
6626 n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0);
6627
6628 /* Kludge Alert!
6629 Mark all windows now on frame as "deleted".
6630 Restoring the new configuration "undeletes" any that are in it.
6631
6632 Save their current buffers in their height fields, since we may
6633 need it later, if a buffer saved in the configuration is now
6634 dead. */
6635 delete_all_child_windows (FRAME_ROOT_WINDOW (f));
6636
6637 for (k = 0; k < saved_windows->header.size; k++)
6638 {
6639 p = SAVED_WINDOW_N (saved_windows, k);
6640 window = p->window;
6641 w = XWINDOW (window);
6642 wset_next (w, Qnil);
6643
6644 if (!NILP (p->parent))
6645 wset_parent
6646 (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window);
6647 else
6648 wset_parent (w, Qnil);
6649
6650 if (!NILP (p->prev))
6651 {
6652 wset_prev
6653 (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window);
6654 wset_next (XWINDOW (w->prev), p->window);
6655 }
6656 else
6657 {
6658 wset_prev (w, Qnil);
6659 if (!NILP (w->parent))
6660 wset_combination (XWINDOW (w->parent),
6661 (XINT (p->total_cols)
6662 != XWINDOW (w->parent)->total_cols),
6663 p->window);
6664 }
6665
6666 /* If we squirreled away the buffer, restore it now. */
6667 if (BUFFERP (w->combination_limit))
6668 wset_buffer (w, w->combination_limit);
6669 w->pixel_left = XFASTINT (p->pixel_left);
6670 w->pixel_top = XFASTINT (p->pixel_top);
6671 w->pixel_width = XFASTINT (p->pixel_width);
6672 w->pixel_height = XFASTINT (p->pixel_height);
6673 w->left_col = XFASTINT (p->left_col);
6674 w->top_line = XFASTINT (p->top_line);
6675 w->total_cols = XFASTINT (p->total_cols);
6676 w->total_lines = XFASTINT (p->total_lines);
6677 wset_normal_cols (w, p->normal_cols);
6678 wset_normal_lines (w, p->normal_lines);
6679 w->hscroll = XFASTINT (p->hscroll);
6680 w->suspend_auto_hscroll = !NILP (p->suspend_auto_hscroll);
6681 w->min_hscroll = XFASTINT (p->min_hscroll);
6682 w->hscroll_whole = XFASTINT (p->hscroll_whole);
6683 wset_display_table (w, p->display_table);
6684 w->left_margin_cols = XINT (p->left_margin_cols);
6685 w->right_margin_cols = XINT (p->right_margin_cols);
6686 w->left_fringe_width = XINT (p->left_fringe_width);
6687 w->right_fringe_width = XINT (p->right_fringe_width);
6688 w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
6689 w->scroll_bar_width = XINT (p->scroll_bar_width);
6690 w->scroll_bar_height = XINT (p->scroll_bar_height);
6691 wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type);
6692 wset_horizontal_scroll_bar_type (w, p->horizontal_scroll_bar_type);
6693 wset_dedicated (w, p->dedicated);
6694 wset_combination_limit (w, p->combination_limit);
6695 /* Restore any window parameters that have been saved.
6696 Parameters that have not been saved are left alone. */
6697 for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem))
6698 {
6699 pers = XCAR (tem);
6700 if (CONSP (pers))
6701 {
6702 if (NILP (XCDR (pers)))
6703 {
6704 par = Fassq (XCAR (pers), w->window_parameters);
6705 if (CONSP (par) && !NILP (XCDR (par)))
6706 /* Reset a parameter to nil if and only if it
6707 has a non-nil association. Don't make new
6708 associations. */
6709 Fsetcdr (par, Qnil);
6710 }
6711 else
6712 /* Always restore a non-nil value. */
6713 Fset_window_parameter (window, XCAR (pers), XCDR (pers));
6714 }
6715 }
6716
6717 if (BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer)))
6718 /* If saved buffer is alive, install it. */
6719 {
6720 wset_buffer (w, p->buffer);
6721 w->start_at_line_beg = !NILP (p->start_at_line_beg);
6722 set_marker_restricted (w->start, p->start, w->contents);
6723 set_marker_restricted (w->pointm, p->pointm, w->contents);
6724 set_marker_restricted (w->old_pointm, p->old_pointm, w->contents);
6725 /* As documented in Fcurrent_window_configuration, don't
6726 restore the location of point in the buffer which was
6727 current when the window configuration was recorded. */
6728 if (!EQ (p->buffer, new_current_buffer)
6729 && XBUFFER (p->buffer) == current_buffer)
6730 Fgoto_char (w->pointm);
6731 }
6732 else if (BUFFERP (w->contents) && BUFFER_LIVE_P (XBUFFER (w->contents)))
6733 /* Keep window's old buffer; make sure the markers are real. */
6734 {
6735 /* Set window markers at start of visible range. */
6736 if (XMARKER (w->start)->buffer == 0)
6737 set_marker_restricted_both (w->start, w->contents, 0, 0);
6738 if (XMARKER (w->pointm)->buffer == 0)
6739 set_marker_restricted_both
6740 (w->pointm, w->contents,
6741 BUF_PT (XBUFFER (w->contents)),
6742 BUF_PT_BYTE (XBUFFER (w->contents)));
6743 if (XMARKER (w->old_pointm)->buffer == 0)
6744 set_marker_restricted_both
6745 (w->old_pointm, w->contents,
6746 BUF_PT (XBUFFER (w->contents)),
6747 BUF_PT_BYTE (XBUFFER (w->contents)));
6748 w->start_at_line_beg = 1;
6749 }
6750 else if (!NILP (w->start))
6751 /* Leaf window has no live buffer, get one. */
6752 {
6753 /* Get the buffer via other_buffer_safely in order to
6754 avoid showing an unimportant buffer and, if necessary, to
6755 recreate *scratch* in the course (part of Juanma's bs-show
6756 scenario from March 2011). */
6757 wset_buffer (w, other_buffer_safely (Fcurrent_buffer ()));
6758 /* This will set the markers to beginning of visible
6759 range. */
6760 set_marker_restricted_both (w->start, w->contents, 0, 0);
6761 set_marker_restricted_both (w->pointm, w->contents, 0, 0);
6762 set_marker_restricted_both (w->old_pointm, w->contents, 0, 0);
6763 w->start_at_line_beg = 1;
6764 if (!NILP (w->dedicated))
6765 /* Record this window as dead. */
6766 dead_windows = Fcons (window, dead_windows);
6767 /* Make sure window is no more dedicated. */
6768 wset_dedicated (w, Qnil);
6769 }
6770 }
6771
6772 fset_root_window (f, data->root_window);
6773 /* Arrange *not* to restore point in the buffer that was
6774 current when the window configuration was saved. */
6775 if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer))
6776 set_marker_restricted (XWINDOW (data->current_window)->pointm,
6777 make_number (old_point),
6778 XWINDOW (data->current_window)->contents);
6779
6780 /* In the following call to `select-window', prevent "swapping out
6781 point" in the old selected window using the buffer that has
6782 been restored into it. We already swapped out that point from
6783 that window's old buffer.
6784
6785 Do not record the buffer here. We do that in a separate call
6786 to select_window below. See also Bug#16207. */
6787 select_window (data->current_window, Qt, 1);
6788 BVAR (XBUFFER (XWINDOW (selected_window)->contents),
6789 last_selected_window)
6790 = selected_window;
6791
6792 if (NILP (data->focus_frame)
6793 || (FRAMEP (data->focus_frame)
6794 && FRAME_LIVE_P (XFRAME (data->focus_frame))))
6795 Fredirect_frame_focus (frame, data->focus_frame);
6796
6797 /* Set the frame size to the value it had before this function. */
6798 if (previous_frame_text_width != FRAME_TEXT_WIDTH (f)
6799 || previous_frame_text_height != FRAME_TEXT_HEIGHT (f))
6800 adjust_frame_size (f, previous_frame_text_width,
6801 previous_frame_text_height, 5, 0);
6802
6803 if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f))
6804 {
6805#ifdef HAVE_WINDOW_SYSTEM
6806 if (FRAME_WINDOW_P (f))
6807 x_set_menu_bar_lines (f,
6808 make_number (previous_frame_menu_bar_lines),
6809 make_number (0));
6810 else /* TTY or MSDOS */
6811#endif
6812 set_menu_bar_lines (f, make_number (previous_frame_menu_bar_lines),
6813 make_number (0));
6814 }
6815#ifdef HAVE_WINDOW_SYSTEM
6816 if (previous_frame_tool_bar_lines != FRAME_TOOL_BAR_LINES (f))
6817 x_set_tool_bar_lines (f, make_number (previous_frame_tool_bar_lines),
6818 make_number (0));
6819#endif
6820
6821 /* Now, free glyph matrices in windows that were not reused. */
6822 for (i = n = 0; i < n_leaf_windows; ++i)
6823 {
6824 if (NILP (leaf_windows[i]->contents))
6825 free_window_matrices (leaf_windows[i]);
6826 else if (EQ (leaf_windows[i]->contents, new_current_buffer))
6827 ++n;
6828 }
6829
6830 /* Make frame official again and apply frame size changes if
6831 needed. */
6832 f->official = true;
6833 adjust_frame_size (f, -1, -1, 1, 0);
6834
6835 adjust_frame_glyphs (f);
6836 unblock_input ();
6837
6838 /* Scan dead buffer windows. */
6839 for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows))
6840 {
6841 window = XCAR (dead_windows);
6842 if (WINDOW_LIVE_P (window) && !EQ (window, FRAME_ROOT_WINDOW (f)))
6843 delete_deletable_window (window);
6844 }
6845
6846 /* Record the selected window's buffer here. The window should
6847 already be the selected one from the call above. */
6848 select_window (data->current_window, Qnil, 0);
6849
6850 /* Fselect_window will have made f the selected frame, so we
6851 reselect the proper frame here. Fhandle_switch_frame will change the
6852 selected window too, but that doesn't make the call to
6853 Fselect_window above totally superfluous; it still sets f's
6854 selected window. */
6855 if (FRAME_LIVE_P (XFRAME (data->selected_frame)))
6856 do_switch_frame (data->selected_frame, 0, 0, Qnil);
6857
6858 run_window_configuration_change_hook (f);
6859 }
6860
6861 if (!NILP (new_current_buffer))
6862 {
6863 Fset_buffer (new_current_buffer);
6864 /* If the new current buffer doesn't appear in the selected
6865 window, go to its old point (see bug#12208). */
6866 if (!EQ (XWINDOW (data->current_window)->contents, new_current_buffer))
6867 Fgoto_char (make_number (old_point));
6868 }
6869
6870 Vminibuf_scroll_window = data->minibuf_scroll_window;
6871 minibuf_selected_window = data->minibuf_selected_window;
6872
6873 return (FRAME_LIVE_P (f) ? Qt : Qnil);
6874}
6875#endif
6876
6877void 6465void
6878restore_window_configuration (Lisp_Object configuration) 6466restore_window_configuration (Lisp_Object configuration)
6879{ 6467{
@@ -7374,9 +6962,7 @@ set_window_scroll_bars (struct window *w, Lisp_Object width,
7374 } 6962 }
7375 } 6963 }
7376 6964
7377#if (defined (HAVE_WINDOW_SYSTEM) \ 6965#if USE_HORIZONTAL_SCROLL_BARS
7378 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
7379 || defined (HAVE_NTGUI)))
7380 { 6966 {
7381 int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height))); 6967 int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height)));
7382 6968
@@ -7416,16 +7002,17 @@ DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars,
7416 doc: /* Set width and type of scroll bars of window WINDOW. 7002 doc: /* Set width and type of scroll bars of window WINDOW.
7417WINDOW must be a live window and defaults to the selected one. 7003WINDOW must be a live window and defaults to the selected one.
7418 7004
7419Second parameter WIDTH specifies the pixel width for the scroll bar. 7005Second parameter WIDTH specifies the pixel width for the vertical scroll
7006bar. If WIDTH is nil, use the scroll-bar width of WINDOW's frame.
7420Third parameter VERTICAL-TYPE specifies the type of the vertical scroll 7007Third parameter VERTICAL-TYPE specifies the type of the vertical scroll
7421bar: left, right, or nil. If WIDTH is nil, use the frame's scroll-bar 7008bar: left, right, or nil. If VERTICAL-TYPE is t, this means use the
7422width. If VERTICAL-TYPE is t, use the frame's scroll-bar type. 7009frame's scroll-bar type.
7423 7010
7424Fourth parameter HEIGHT specifies the pixel height for the scroll bar. 7011Fourth parameter HEIGHT specifies the pixel height for the horizontal
7425Fifth parameter HORIZONTAL-TYPE specifies the type of the vertical 7012scroll bar. If HEIGHT is nil, use the scroll-bar height of WINDOW's
7426scroll bar: nil, bottom, or t. If HEIGHT is nil, use the frame's 7013frame. Fifth parameter HORIZONTAL-TYPE specifies the type of the
7427scroll-bar height. If HORIZONTAL-TYPE is t, use the frame's scroll-bar 7014horizontal scroll bar: nil, bottom, or t. If HORIZONTAL-TYPE is t, this
7428type. 7015means to use the frame's horizontal scroll-bar type.
7429 7016
7430Return t if scroll bars were actually changed and nil otherwise. */) 7017Return t if scroll bars were actually changed and nil otherwise. */)
7431 (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, 7018 (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type,
@@ -7443,17 +7030,22 @@ DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars,
7443 doc: /* Get width and type of scroll bars of window WINDOW. 7030 doc: /* Get width and type of scroll bars of window WINDOW.
7444WINDOW must be a live window and defaults to the selected one. 7031WINDOW must be a live window and defaults to the selected one.
7445 7032
7446Value is a list of the form (WIDTH COLS VERTICAL-TYPE HEIGHT LINES 7033Value is a list of the form (WIDTH COLUMNS VERTICAL-TYPE HEIGHT LINES
7447HORIZONTAL-TYPE). If WIDTH or HEIGHT is nil or TYPE is t, the window is 7034HORIZONTAL-TYPE). If WIDTH or HEIGHT is nil or VERTICAL-TYPE or
7448using the frame's corresponding value. */) 7035HORIZONTAL-TYPE is t, the window is using the frame's corresponding
7036value. */)
7449 (Lisp_Object window) 7037 (Lisp_Object window)
7450{ 7038{
7451 struct window *w = decode_live_window (window); 7039 struct window *w = decode_live_window (window);
7452 7040
7453 return Fcons (make_number (WINDOW_SCROLL_BAR_AREA_WIDTH (w)), 7041 return Fcons (((w->scroll_bar_width >= 0)
7042 ? make_number (w->scroll_bar_width)
7043 : Qnil),
7454 list5 (make_number (WINDOW_SCROLL_BAR_COLS (w)), 7044 list5 (make_number (WINDOW_SCROLL_BAR_COLS (w)),
7455 w->vertical_scroll_bar_type, 7045 w->vertical_scroll_bar_type,
7456 make_number (WINDOW_SCROLL_BAR_AREA_HEIGHT (w)), 7046 ((w->scroll_bar_height >= 0)
7047 ? make_number (w->scroll_bar_height)
7048 : Qnil),
7457 make_number (WINDOW_SCROLL_BAR_LINES (w)), 7049 make_number (WINDOW_SCROLL_BAR_LINES (w)),
7458 w->horizontal_scroll_bar_type)); 7050 w->horizontal_scroll_bar_type));
7459} 7051}