aboutsummaryrefslogtreecommitdiffstats
path: root/src/dispnew.c
diff options
context:
space:
mode:
authorMartin Rudalics <[email protected]>2013-11-30 10:25:31 +0100
committerMartin Rudalics <[email protected]>2013-11-30 10:25:31 +0100
commit880e615853d4074937795850b279338720618431 (patch)
tree9ff3cbd92ec5963cf80315a4fb912ed73dc89be3 /src/dispnew.c
parent3e2fb4db3f517dd051cd35c742355c492e085333 (diff)
Support resizing frames and windows pixelwise.
* dispextern.h (enum window_part): Add ON_SCROLL_BAR, ON_RIGHT_DIVIDER and ON_BOTTOM_DIVIDER. (struct glyph_matrix): Replace window_left_col and window_top_line by window_pixel_left and window_pixel_top. (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P): Minor rewrite. (enum face_id): Add WINDOW_DIVIDER_FACE_ID. (draw_window_divider, move_it_to, x_draw_right_divider) (x_draw_bottom_divider, change_frame_size): Add or fix declarations. * dispnew.c (change_frame_size_1): Change prototype. (adjust_glyph_matrix, required_matrix_width) (adjust_frame_glyphs_for_window_redisplay): Use pixel values instead of lines and columns. (marginal_area_string): Use WINDOW_FRINGES_WIDTH instead of WINDOW_TOTAL_FRINGE_WIDTH. (handle_window_change_signal, do_pending_window_change) (init_display): Adjusts calls of change_frame_size. (change_frame_size, change_frame_size_1): Handle pixelwise changes. * frame.c (Qright_divider_width, Qbottom_divider_width): New Lisp objects. (set_menu_bar_lines_1, set_menu_bar_lines, make_frame) (make_terminal_frame, Fmake_terminal_frame, Fframe_parameters) (x_set_internal_border_width, x_set_vertical_scroll_bars) (x_set_scroll_bar_width, x_figure_window_size): Handle pixel values. (set_frame_param): New function. (Fframe_text_cols, Fframe_text_lines, Fframe_total_cols) (Fframe_text_width, Fframe_text_height, Fscroll_bar_width) (Ffringe_width, Fborder_width, Fright_divider_width) (Fbottom_divider_width): New functions, defsubr them. (Fset_frame_height, Fset_frame_width, Fset_frame_size): New argument pixelwise. (struct frame_parm_table): New members Qright_divider_width and Qbottom_divider_width. (x_set_frame_parameters): Handle parameters for pixelwise sizes. (x_report_frame_params): Handle Qright_divider_width and Qbottom_divider_width. (x_set_right_divider_width, x_set_bottom_divider_width): New functions. (frame_resize_pixelwise): New option. * frame.h (struct frame): Add tool_bar_height, menu_bar_height, new_pixelwise, right_divider_width and bottom_divider_width; remove total_lines; rename text_lines, text_cols, new_text_lines and new_text_cols to text_height, text_width, new_height and new_width respectively. (FRAME_LINES, FRAME_COLS): Rename to FRAME_TEXT_HEIGHT and FRAME_TEXT_WIDTH respectively. (FRAME_MENU_BAR_HEIGHT, FRAME_TOOL_BAR_HEIGHT) (FRAME_RIGHT_DIVIDER_WIDTH, FRAME_BOTTOM_DIVIDER_WIDTH) (FRAME_TEXT_TO_PIXEL_WIDTH, FRAME_PIXEL_TO_TEXT_WIDTH): New macros. (FRAME_TOP_MARGIN_HEIGHT, FRAME_LEFT_SCROLL_BAR_AREA_WIDTH) (FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH, FRAME_SCROLL_BAR_AREA_WIDTH) (SET_FRAME_COLS, SET_FRAME_WIDTH, SET_FRAME_HEIGHT) (FRAME_TEXT_COLS_TO_PIXEL_WIDTH, FRAME_PIXEL_WIDTH_TO_TEXT_COLS) (FRAME_TEXT_COLS_TO_PIXEL_WIDTH): Rewrite macros. (FRAME_TOTAL_COLS_ARG): Remove macro. * fringe.c (draw_fringe_bitmap_1): Handle right divder. * gtkutil.c (xg_frame_resized, xg_frame_set_char_size) (x_wm_set_size_hint): Handle frame pixel sizes. * indent.c (compute_motion, Fcompute_motion): Call window_body_width instead of window_body_cols. * keyboard.c (Qright_divider, Qbottom_divider): New symbols. (make_lispy_position): Handle right and bottom dividers. (Fsuspend_emacs): Pixelize call of change_frame_size. * keyboard.h: Extern Qright_divider, Qbottom_divider. * lisp.h: Extern set_frame_param. * nsfns.m (x_set_tool_bar_lines): Pixelize call of x_set_window_size. (Fx_create_frame): Add entry for vertical_drag_cursor. Pixelize call of change_frame_size. * nsterm.h (struct ns_output): Add vertical_drag_cursor. * nsterm.m (ns_update_window_end): Optionally draw right divider. (x_set_window_size): Add argument pixelwise. Call check_frame_size and change_frame_size with pixelwise zero. (ns_draw_window_divider): New function. (ns_redisplay_interface): Add ns_draw_window_divider. (updateFrameSize:): Call change_frame_size with pixelwise zero. (x_new_font): Call x_set_window_size with pixelwise zero. * print.c (print_object): For a window print its sequence number again. * term.c (Fresume_tty): Pixelize call of change_frame_size. * w32fns.c (x_set_mouse_color): Handle vertical drag cursor. (x_set_menu_bar_lines, x_set_tool_bar_lines): Calculate pixelwise. (w32_createwindow): Use scroll bar area width. (w32_wnd_proc): Handle bottom divider width. For WM_WINDOWPOSCHANGING return zero if we resize pixelwise. (Fx_create_frame): Default divider width parameters. Caclulate sizes pixelwise. Add vertical drag cursor support. (x_create_tip_frame): Default divider widths to zero. Pixelize call to change_frame_size. (Fx_show_tip): Add handling of divider widths. Pixelize window position and sizes. (Fw32_frame_rect): New function. (frame_parm_handler w32_frame_parm_handlers): Add divider widths. (Vx_window_vertical_drag_shape): Add variable. * w32inevt.c (resize_event, maybe_generate_resize_event): Pixelize change_frame_size calls. * w32menu.c (set_frame_menubar): Pixelize x_set_window_size call. * w32term.c (w32_draw_window_divider): New function. (x_update_window_end): Handle right divider. (w32_draw_fringe_bitmap, x_scroll_run) (w32_set_vertical_scroll_bar): Pixelize scrollbar widths. (w32_read_socket): Handle SIZE_MAXIMIZED separately. Calculate new frame sizes pixelwise. (x_new_font): Pixelize call to x_set_window_size. (x_check_fullscreen): Pixelize call to change_frame_size. (x_set_window_size_1, x_set_window_size): New argument pixelwise. Calculate pixelwise. (x_wm_set_size_hint): Use scroll bar area width. (w32_redisplay_interface): Add w32_draw_window_divider. * w32term.h (struct w32_output): Add vertical drag cursor. * widget.c (set_frame_size, update_wm_hints) (EmacsFrameResize, EmacsFrameSetValues): Pixelize calls of change_frame_size. (EmacsFrameSetCharSize): Pixelize call of x_set_window_size. * window.c (sequence_number): Restore. (Fwindow_pixel_width, Fwindow_pixel_height) (Fwindow_mode_line_height, Fwindow_header_line_height) (window_pixel_to_total, Frun_window_scroll_functions) (Fset_window_new_pixel, window_resize_apply_total) (Fwindow_resize_apply_total): New functions. (window_body_height, window_body_width): Rename from window_body_lines. New argument PIXELWISE. Calculate pixelwise. (Fwindow_body_height, Fwindow_body_width): New argument PIXELWISE. (coordinates_in_window, window_relative_x_coord): Use window's pixel width instead of total width. (replace_window, recombine_windows): Initialize pixel values. (resize_root_window, resize_frame_windows, grow_mini_window) (shrink_mini_window): New argument PIXELWISE. Calculate pixelwise. (Fdelete_other_windows_internal, adjust_window_margins) (window_resize_check, window_resize_apply) (Fdelete_window_internal, Fresize_mini_window_internal) (Fwindow_text_width, Fwindow_text_height): Calculate pixelwise. (check_frame_size): Rename arguments. New argument PIXELWISE. Calculate pixelwise. (set_window_buffer): Make samebuf bool. Run configuration change hook only if buffer changed. (Fset_window_buffer): Rewrite doc-string. (make_window): Initialize new_pixel slot. (Fwindow_resize_apply): Check pixel size of root window. (Fsplit_window_internal): Call 2nd argument pixel_size. Calculate pixelwise. (Fscroll_left, Fscroll_right): Call window_body_width instead of window_body_cols. (save_window_data): New slots frame_text_width, frame_text_height, frame_menu_bar_height, frame_tool_bar_height. (saved_window): New slots pixel_left, pixel_top, pixel_height, pixel_width. (Fcurrent_window_configuration, Fset_window_configuration) (save_window_save, compare_window_configurations): Handle new slots in save_window_data and saved_window. (Fset_window_scroll_bars): Fix doc-string. (window_resize_pixelwise): New variable. (coordinates_in_window, Fcoordinates_in_window_p): Handle dividers. (make_parent_window): Adjust sequence_number. (Fwindow_right_divider_width, Fwindow_bottom_divider_width): New functions. * window.h (struct window): New members new_pixel, pixel_left, pixel_top, pixel_width, pixel_height. Restore sequence_number. (wset_new_pixel): New function. (WINDOW_PIXEL_WIDTH, WINDOW_PIXEL_HEIGHT) (MIN_SAFE_WINDOW_PIXEL_WIDTH, MIN_SAFE_WINDOW_PIXEL_HEIGHT) (WINDOW_LEFT_PIXEL_EDGE, WINDOW_RIGHT_PIXEL_EDGE) (WINDOW_TOP_PIXEL_EDGE, WINDOW_BOTTOM_PIXEL_EDGE) (WINDOW_BOTTOMMOST_P, WINDOW_BOX_LEFT_PIXEL_EDGE) (WINDOW_BOX_RIGHT_PIXEL_EDGE, WINDOW_MARGINS_COLS) (WINDOW_MARGINS_WIDTH, WINDOW_RIGHT_DIVIDER_WIDTH) (WINDOW_BOTTOM_DIVIDER_WIDTH): New macros. (WINDOW_TOTAL_FRINGE_WIDTH): Rename to WINDOW_FRINGES_WIDTH. (WINDOW_TOTAL_WIDTH, WINDOW_TOTAL_HEIGHT): Remove macros. (WINDOW_RIGHT_EDGE_X, WINDOW_LEFT_EDGE_X, WINDOW_TOP_EDGE_Y) (WINDOW_BOTTOM_EDGE_Y, WINDOW_FULL_WIDTH_P, WINDOW_LEFTMOST_P) (WINDOW_RIGHTMOST_P, WINDOW_BOX_LEFT_EDGE_X) (WINDOW_BOX_RIGHT_EDGE_X, WINDOW_FRINGE_COLS) (WINDOW_BOX_HEIGHT_NO_MODE_LINE, WINDOW_BOX_TEXT_HEIGHT): Rewrite. (resize_frame_windows, grow_mini_window, shrink_mini_window) (window_body_width, check_frame_size): Adapt external declarations. * xdisp.c (last_max_ascent): New integer. (window_text_bottom_y): Handle bottom divider. (window_box_width, window_box_height): Calculate pixelwise. (get_glyph_string_clip_rects): Handle right divider. (remember_mouse_glyph): When windows are resized pixelwise proceed with width and height set to 1. (init_iterator): Use WINDOW_PIXEL_WIDTH instead of WINDOW_TOTAL_WIDTH. (move_it_to): Calculate and return maximum x position encountered. (Fwindow_text_pixel_size): New function. (resize_mini_window, update_tool_bar): Calculate pixelwise. (tool_bar_lines_needed): Rename to tool_bar_height. Calculate pixelwise. (Ftool_bar_lines_needed): Rename to Ftool_bar_height. Calculate pixelwise. (redisplay_tool_bar): Calculate pixelwise. (redisplay_window): Calculate pixelwise. Handle dividers. (draw_glyphs, x_clear_end_of_line, note_mouse_highlight) (x_draw_vertical_border): Handle dividers. (define_frame_cursor1): Handle vertical drag cursor. (x_draw_right_divider, x_draw_bottom_divider): New functions. (expose_window): Calculate pixelwise. Handle dividers. (init_xdisp): Initialize pixel values. * xfaces.c (Qwindow_divider): New face. (realize_basic_faces): Realize it. * xfns.c (x_set_mouse_color): Handle vertical_drag_cursor. (x_set_menu_bar_lines, x_set_tool_bar_lines): Calculate pixelwise. (x_set_scroll_bar_default_width): Default actual width to 16. (Fx_create_frame): Set sizes pixelwise. (x_create_tip_frame): Default divider widths to zero. Pixelize call of change_frame_size. (Fx_show_tip): Handle divider widths. Initial pixel position and sizes. (frame_parm_handler x_frame_parm_handlers): Add divider widths. (Vx_window_vertical_drag_shape): New option. * xmenu.c (free_frame_menubar): Pixelize call of x_set_window_size. * xterm.c (x_draw_window_divider): New function. (x_update_window_end): Optionally draw right divider. (x_draw_fringe_bitmap, x_scroll_run, x_scroll_bar_create) (XTset_vertical_scroll_bar): Use scroll bar pixel width. (handle_one_xevent, x_new_font): Calculate pixelwise. (x_set_window_size_1, x_set_window_size): New argument pixelwise. Calculate pixelwise. (x_wm_set_size_hint): Pixelize call of check_frame_size. (struct x_redisplay_interface): Add x_draw_window_divider. * xterm.h (struct x_output): Add vertical_drag_cursor. * cus-start.el (frame-resize-pixelwise) (window-resize-pixelwise): New entries. * emacs-lisp/debug.el (debug): Use window-total-height instead of window-total-size. * frame.el (tool-bar-lines-needed): Defalias to tool-bar-height. * help.el (describe-bindings-internal): Call help-buffer (temp-buffer-max-width): New option. (resize-temp-buffer-window, help-window-setup) (with-help-window): Rewrite. * mouse.el (mouse-drag-line): Rewrite. Add key bindings for dragging dividers. * window.el (frame-char-size, window-min-pixel-height) (window-safe-min-pixel-height, window-safe-min-pixel-width) (window-min-pixel-width, window-safe-min-pixel-size) (window-combination-p, window-safe-min-size) (window-resizable-p, window--size-to-pixel) (window--pixel-to-size, window--resize-apply-p): New functions. (window-safe-min-height): Fix doc-string. (window-size, window-min-size, window--min-size-1) (window-sizable, window-sizable-p, window--min-delta-1) (window-min-delta, window--max-delta-1, window-max-delta) (window--resizable, window--resizable-p, window-resizable) (window-full-height-p, window-full-width-p, window-at-side-p) (window--in-direction-2, window-in-direction) (window--resize-reset-1, window--resize-mini-window) (window-resize, window-resize-no-error) (window--resize-child-windows-normal) (window--resize-child-windows, window--resize-siblings) (window--resize-this-window, window--resize-root-window) (window--resize-root-window-vertically) (adjust-window-trailing-edge, enlarge-window, shrink-window) (maximize-window, minimize-window, delete-window) (quit-restore-window, window-split-min-size, split-window) (balance-windows-2, balance-windows) (balance-windows-area-adjust, balance-windows-area) (window--state-get-1, window-state-get, window--state-put-1) (window--state-put-2, window-state-put) (display-buffer-record-window, window--display-buffer): Make functions handle pixelwise sizing of windows. (display-buffer--action-function-custom-type) (display-buffer-fallback-action): Add display-buffer-in-previous-window. (display-buffer-use-some-window): Resize window to height it had before. (fit-window-to-buffer-horizontally): New option. (fit-frame-to-buffer): Describe new values. (fit-frame-to-buffer-bottom-margin): Replace with fit-frame-to-buffer-margins. (window--sanitize-margin): New function. (fit-frame-to-buffer, fit-window-to-buffer): Rewrite completely using window-text-pixel-size.
Diffstat (limited to 'src/dispnew.c')
-rw-r--r--src/dispnew.c160
1 files changed, 100 insertions, 60 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index b68cc2e54f..9492960028 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -72,7 +72,7 @@ struct dim
static void update_frame_line (struct frame *, int);
static int required_matrix_height (struct window *);
static int required_matrix_width (struct window *);
-static void change_frame_size_1 (struct frame *, int, int, bool, bool, bool);
+static void change_frame_size_1 (struct frame *, int, int, bool, bool, bool, bool);
static void increment_row_positions (struct glyph_row *, ptrdiff_t, ptrdiff_t);
static void build_frame_matrix_from_window_tree (struct glyph_matrix *,
struct window *);
@@ -401,8 +401,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
if (!marginal_areas_changed_p
&& !XFRAME (w->frame)->fonts_changed
&& !header_line_changed_p
- && matrix->window_left_col == WINDOW_LEFT_EDGE_COL (w)
- && matrix->window_top_line == WINDOW_TOP_EDGE_LINE (w)
+ && matrix->window_pixel_left == WINDOW_LEFT_PIXEL_EDGE (w)
+ && matrix->window_pixel_top == WINDOW_TOP_PIXEL_EDGE (w)
&& matrix->window_height == window_height
&& matrix->window_vscroll == w->vscroll
&& matrix->window_width == window_width)
@@ -543,8 +543,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
&& !header_line_changed_p
&& new_rows == 0
&& dim.width == matrix->matrix_w
- && matrix->window_left_col == WINDOW_LEFT_EDGE_COL (w)
- && matrix->window_top_line == WINDOW_TOP_EDGE_LINE (w)
+ && matrix->window_pixel_left == WINDOW_LEFT_PIXEL_EDGE (w)
+ && matrix->window_pixel_top == WINDOW_TOP_PIXEL_EDGE (w)
&& matrix->window_width == window_width)
{
/* Find the last row in the window. */
@@ -591,8 +591,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
was last adjusted. This is used to optimize redisplay above. */
if (w)
{
- matrix->window_left_col = WINDOW_LEFT_EDGE_COL (w);
- matrix->window_top_line = WINDOW_TOP_EDGE_LINE (w);
+ matrix->window_pixel_left = WINDOW_LEFT_PIXEL_EDGE (w);
+ matrix->window_pixel_top = WINDOW_TOP_PIXEL_EDGE (w);
matrix->window_height = window_height;
matrix->window_width = window_width;
matrix->window_vscroll = w->vscroll;
@@ -1661,6 +1661,7 @@ required_matrix_height (struct window *w)
{
int ch_height = FRAME_SMALLEST_FONT_HEIGHT (f);
int window_pixel_height = window_box_height (w) + eabs (w->vscroll);
+
return (((window_pixel_height + ch_height - 1)
/ ch_height) * w->nrows_scale_factor
/* One partially visible line at the top and
@@ -1685,10 +1686,9 @@ required_matrix_width (struct window *w)
if (FRAME_WINDOW_P (f))
{
int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f);
- int window_pixel_width = WINDOW_TOTAL_WIDTH (w);
/* Compute number of glyphs needed in a glyph row. */
- return (((window_pixel_width + ch_width - 1)
+ return (((WINDOW_PIXEL_WIDTH (w) + ch_width - 1)
/ ch_width) * w->ncols_scale_factor
/* 2 partially visible columns in the text area. */
+ 2
@@ -1978,6 +1978,10 @@ adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
/* Size of frame matrices must equal size of frame. Note
that we are called for X frames with window widths NOT equal
to the frame width (from CHANGE_FRAME_SIZE_1). */
+ if (matrix_dim.width != FRAME_COLS (f)
+ || matrix_dim.height != FRAME_LINES (f))
+ return;
+
eassert (matrix_dim.width == FRAME_COLS (f)
&& matrix_dim.height == FRAME_LINES (f));
@@ -2047,10 +2051,14 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
/* Set window dimensions to frame dimensions and allocate or
adjust glyph matrices of W. */
- w->top_line = 0;
+ w->pixel_left = 0;
w->left_col = 0;
- w->total_lines = FRAME_MENU_BAR_LINES (f);
+ w->pixel_top = 0;
+ w->top_line = 0;
+ w->pixel_width = FRAME_PIXEL_WIDTH (f);
w->total_cols = FRAME_TOTAL_COLS (f);
+ w->pixel_height = FRAME_MENU_BAR_HEIGHT (f);
+ w->total_lines = FRAME_MENU_BAR_LINES (f);
allocate_matrices_for_window_redisplay (w);
}
#endif
@@ -2072,10 +2080,15 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
else
w = XWINDOW (f->tool_bar_window);
- w->top_line = FRAME_MENU_BAR_LINES (f);
+ w->pixel_left = 0;
w->left_col = 0;
- w->total_lines = FRAME_TOOL_BAR_LINES (f);
+ w->pixel_top = FRAME_MENU_BAR_HEIGHT (f);
+ w->top_line = FRAME_MENU_BAR_LINES (f);
+ w->pixel_width = (FRAME_PIXEL_WIDTH (f)
+ - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
w->total_cols = FRAME_TOTAL_COLS (f);
+ w->pixel_height = FRAME_TOOL_BAR_HEIGHT (f);
+ w->total_lines = FRAME_TOOL_BAR_LINES (f);
allocate_matrices_for_window_redisplay (w);
}
#endif
@@ -5275,7 +5288,7 @@ marginal_area_string (struct window *w, enum window_part part,
if (area == RIGHT_MARGIN_AREA)
x0 = ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
? WINDOW_LEFT_FRINGE_WIDTH (w)
- : WINDOW_TOTAL_FRINGE_WIDTH (w))
+ : WINDOW_FRINGES_WIDTH (w))
+ window_box_width (w, LEFT_MARGIN_AREA)
+ window_box_width (w, TEXT_AREA));
else
@@ -5367,7 +5380,7 @@ handle_window_change_signal (int sig)
/* Record the new sizes, but don't reallocate the data
structures now. Let that be done later outside of the
signal handler. */
- change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
+ change_frame_size (XFRAME (frame), width, height, 0, 1, 0, 0);
}
}
}
@@ -5401,17 +5414,21 @@ do_pending_window_change (bool safe)
{
struct frame *f = XFRAME (frame);
- if (f->new_text_lines != 0 || f->new_text_cols != 0)
- change_frame_size (f, f->new_text_lines, f->new_text_cols,
- 0, 0, safe);
+ if (f->new_height != 0 || f->new_width != 0)
+ change_frame_size (f, f->new_width, f->new_height,
+ 0, 0, safe, f->new_pixelwise);
}
}
}
-
/* Change the frame height and/or width. Values may be given as zero to
indicate no change is to take place.
+ new_height and new_width refer to the text portion of the frame. It
+ doesn't matter for new_height, since text and total portion are the
+ same in that case. But new_width must be enlarged to get the total
+ width of the frame.
+
If DELAY, assume we're being called from a signal handler, and
queue the change for later - perhaps the next redisplay.
Since this tries to resize windows, we can't call it
@@ -5421,8 +5438,8 @@ do_pending_window_change (bool safe)
safe to change frame sizes while a redisplay is in progress. */
void
-change_frame_size (struct frame *f, int newheight, int newwidth,
- bool pretend, bool delay, bool safe)
+change_frame_size (struct frame *f, int new_width, int new_height,
+ bool pretend, bool delay, bool safe, bool pixelwise)
{
Lisp_Object tail, frame;
@@ -5433,55 +5450,72 @@ change_frame_size (struct frame *f, int newheight, int newwidth,
ttys. */
FOR_EACH_FRAME (tail, frame)
if (! FRAME_WINDOW_P (XFRAME (frame)))
- change_frame_size_1 (XFRAME (frame), newheight, newwidth,
- pretend, delay, safe);
+ change_frame_size_1 (XFRAME (frame), new_width, new_height,
+ pretend, delay, safe, pixelwise);
}
else
- change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe);
+ change_frame_size_1 (f, new_width, new_height, pretend, delay, safe,
+ pixelwise);
}
static void
-change_frame_size_1 (struct frame *f, int newheight, int newwidth,
- bool pretend, bool delay, bool safe)
+change_frame_size_1 (struct frame *f, int new_width, int new_height,
+ bool pretend, bool delay, bool safe, bool pixelwise)
{
- int new_frame_total_cols;
+ int new_text_width, new_text_height, new_root_width;
+ int old_root_width = (FRAME_PIXEL_WIDTH (f)
+ - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
+ int new_cols, new_lines;
ptrdiff_t count = SPECPDL_INDEX ();
/* If we can't deal with the change now, queue it for later. */
if (delay || (redisplaying_p && !safe))
{
- f->new_text_lines = newheight;
- f->new_text_cols = newwidth;
+ f->new_width = new_width;
+ f->new_height = new_height;
+ f->new_pixelwise = pixelwise;
delayed_size_change = 1;
return;
}
/* This size-change overrides any pending one for this frame. */
- f->new_text_lines = 0;
- f->new_text_cols = 0;
+ f->new_height = 0;
+ f->new_width = 0;
+ f->new_pixelwise = 0;
/* If an argument is zero, set it to the current value. */
- if (newheight == 0)
- newheight = FRAME_LINES (f);
- if (newwidth == 0)
- newwidth = FRAME_COLS (f);
+ if (pixelwise)
+ {
+ new_text_width = (new_width == 0) ? FRAME_TEXT_WIDTH (f) : new_width;
+ new_text_height = (new_height == 0) ? FRAME_TEXT_HEIGHT (f) : new_height;
+ new_cols = new_text_width / FRAME_COLUMN_WIDTH (f);
+ new_lines = new_text_height / FRAME_LINE_HEIGHT (f);
+ }
+ else
+ {
+ new_cols = (new_width == 0) ? FRAME_COLS (f) : new_width;
+ new_lines = (new_height == 0) ? FRAME_LINES (f) : new_height;
+ new_text_width = new_cols * FRAME_COLUMN_WIDTH (f);
+ new_text_height = new_lines * FRAME_LINE_HEIGHT (f);
+ }
/* Compute width of windows in F. */
/* Round up to the smallest acceptable size. */
- check_frame_size (f, &newheight, &newwidth);
-
- /* This is the width of the frame with vertical scroll bars and fringe
- columns. Do this after rounding - see discussion of bug#9723. */
- new_frame_total_cols = FRAME_TOTAL_COLS_ARG (f, newwidth);
-
+ check_frame_size (f, &new_text_width, &new_text_height, 1);
+
+ /* This is the width of the frame without vertical scroll bars and
+ fringe columns. Do this after rounding - see discussion of
+ bug#9723. */
+ new_root_width = (new_text_width
+ /* PXM: Use the configured scrollbar width !?? */
+ + FRAME_SCROLL_BAR_AREA_WIDTH (f)
+ + FRAME_TOTAL_FRINGE_WIDTH (f));
/* If we're not changing the frame size, quit now. */
/* Frame width may be unchanged but the text portion may change, for
example, fullscreen and remove/add scroll bar. */
- if (newheight == FRAME_LINES (f)
- /* Text portion unchanged? */
- && newwidth == FRAME_COLS (f)
- /* Frame width unchanged? */
- && new_frame_total_cols == FRAME_TOTAL_COLS (f))
+ if (new_text_height == FRAME_TEXT_HEIGHT (f)
+ && new_text_width == FRAME_TEXT_WIDTH (f)
+ && new_root_width == old_root_width)
return;
block_input ();
@@ -5490,36 +5524,44 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth,
/* We only can set screen dimensions to certain values supported
by our video hardware. Try to find the smallest size greater
or equal to the requested dimensions. */
- dos_set_window_size (&newheight, &newwidth);
+ dos_set_window_size (&new_lines, &new_cols);
#endif
- if (newheight != FRAME_LINES (f))
+ if (new_text_height != FRAME_TEXT_HEIGHT (f))
{
- resize_frame_windows (f, newheight, 0);
+ resize_frame_windows (f, new_text_height, 0, 1);
/* MSDOS frames cannot PRETEND, as they change frame size by
manipulating video hardware. */
if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
- FrameRows (FRAME_TTY (f)) = newheight;
+ FrameRows (FRAME_TTY (f)) = new_height;
}
- if (new_frame_total_cols != FRAME_TOTAL_COLS (f))
+ if (new_text_width != FRAME_TEXT_WIDTH (f)
+ || new_root_width != old_root_width)
{
- resize_frame_windows (f, new_frame_total_cols, 1);
+ resize_frame_windows (f, new_root_width, 1, 1);
/* MSDOS frames cannot PRETEND, as they change frame size by
manipulating video hardware. */
if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
- FrameCols (FRAME_TTY (f)) = newwidth;
+ FrameCols (FRAME_TTY (f)) = new_cols;
#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
if (WINDOWP (f->tool_bar_window))
- XWINDOW (f->tool_bar_window)->total_cols = newwidth;
+ {
+ XWINDOW (f->tool_bar_window)->total_cols = new_cols;
+ XWINDOW (f->tool_bar_window)->pixel_width = new_root_width;
+ }
#endif
}
- FRAME_LINES (f) = newheight;
- SET_FRAME_COLS (f, newwidth);
+ SET_FRAME_COLS (f, new_cols);
+ FRAME_LINES (f) = new_lines;
+ FRAME_TEXT_WIDTH (f) = new_text_width;
+ FRAME_TEXT_HEIGHT (f) = new_text_height;
+ FRAME_PIXEL_WIDTH (f) = FRAME_TEXT_TO_PIXEL_WIDTH (f, new_text_width);
+ FRAME_PIXEL_HEIGHT (f) = FRAME_TEXT_TO_PIXEL_HEIGHT (f, new_text_height);
{
struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
@@ -5546,8 +5588,6 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth,
unbind_to (count, Qnil);
}
-
-
/***********************************************************************
Terminal Related Lisp Functions
@@ -6076,8 +6116,8 @@ init_display (void)
#endif
t->display_info.tty->top_frame = selected_frame;
change_frame_size (XFRAME (selected_frame),
- FrameRows (t->display_info.tty),
- FrameCols (t->display_info.tty), 0, 0, 1);
+ FrameCols (t->display_info.tty),
+ FrameRows (t->display_info.tty), 0, 0, 1, 0);
/* Delete the initial terminal. */
if (--initial_terminal->reference_count == 0