From 90022f5a3e142d08696bd4d73ac26c308aa762fd Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Sat, 24 May 2003 22:07:03 +0000 Subject: [PATCH] Make (few) trivial substitutions for renamed and new macros in dispextern.h, frame.h and window.h. --- src/indent.c | 22 ++++++++++-------- src/macmenu.c | 6 ++--- src/sysdep.c | 6 ++--- src/w32console.c | 28 +++++++++++----------- src/w32menu.c | 8 +++---- src/widget.c | 60 ++++++++++++++++++++++-------------------------- 6 files changed, 62 insertions(+), 68 deletions(-) diff --git a/src/indent.c b/src/indent.c index 22039ebca6b..10831c2c941 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1159,18 +1159,18 @@ struct position val_compute_motion; window_width - 1 - (has_vertical_scroll_bars - ? FRAME_SCROLL_BAR_COLS (XFRAME (window->frame)) - : (window_width + window_left != frame_width)) + ? WINDOW_CONFIG_SCROLL_BAR_COLS (window) + : (window_width + window_left != frame_cols)) where - window_width is XFASTINT (w->width), - window_left is XFASTINT (w->left), + window_width is XFASTINT (w->total_cols), + window_left is XFASTINT (w->left_col), has_vertical_scroll_bars is - FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (WINDOW_FRAME (window))) - and frame_width = FRAME_WIDTH (XFRAME (window->frame)) + WINDOW_HAS_VERTICAL_SCROLL_BAR (window) + and frame_cols = FRAME_COLS (XFRAME (window->frame)) - Or you can let window_internal_width do this all for you, and write: - window_internal_width (w) - 1 + Or you can let window_box_text_cols do this all for you, and write: + window_box_text_cols (w) - 1 The `-1' accounts for the continuation-line backslashes; the rest accounts for window borders if the window is split horizontally, and @@ -1366,7 +1366,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, { if (hscroll || (truncate_partial_width_windows - && width + 1 < FRAME_WIDTH (XFRAME (WINDOW_FRAME (win)))) + && width + 1 < FRAME_COLS (XFRAME (WINDOW_FRAME (win)))) || !NILP (current_buffer->truncate_lines)) { /* Truncating: skip to newline, unless we are already past @@ -1834,7 +1834,9 @@ vmotion (from, vtarget, w) register int from, vtarget; struct window *w; { - int width = window_internal_width (w) - 1; + /* We don't need to make room for continuation marks (we have fringes now), + so hould we really subtract 1 here if FRAME_WINDOW_P ? ++KFS */ + int width = window_box_text_cols (w) - 1; int hscroll = XINT (w->hscroll); struct position pos; /* vpos is cumulative vertical position, changed as from is changed */ diff --git a/src/macmenu.c b/src/macmenu.c index 3958be9668d..166ef22a6e9 100644 --- a/src/macmenu.c +++ b/src/macmenu.c @@ -732,10 +732,8 @@ cached information about equivalent key sequences. */) CHECK_LIVE_WINDOW (window); f = XFRAME (WINDOW_FRAME (XWINDOW (window))); - xpos = (FONT_WIDTH (FRAME_FONT (f)) - * XFASTINT (XWINDOW (window)->left)); - ypos = (FRAME_LINE_HEIGHT (f) - * XFASTINT (XWINDOW (window)->top)); + xpos = WINDOW_LEFT_EDGE_X (XWINDOW (window)); + ypos = WINDOW_TOP_EDGE_Y (XWINDOW (window)); } else /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME, diff --git a/src/sysdep.c b/src/sysdep.c index 1e4ed7576dd..cb03ae502bb 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1814,10 +1814,10 @@ reset_sys_modes () return; #endif sf = SELECTED_FRAME (); - cursor_to (FRAME_HEIGHT (sf) - 1, 0); - clear_end_of_line (FRAME_WIDTH (sf)); + cursor_to (FRAME_LINES (sf) - 1, 0); + clear_end_of_line (FRAME_COLS (sf)); /* clear_end_of_line may move the cursor */ - cursor_to (FRAME_HEIGHT (sf) - 1, 0); + cursor_to (FRAME_LINES (sf) - 1, 0); #if defined (IBMR2AIX) && defined (AIXHFT) { /* HFT devices normally use ^J as a LF/CR. We forced it to diff --git a/src/w32console.c b/src/w32console.c index 5a66ae4af8d..0ad9c755e25 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -121,8 +121,8 @@ clear_to_end (void) { struct frame * f = PICK_FRAME (); - clear_end_of_line (FRAME_WIDTH (f) - 1); - ins_del_lines (cursor_coords.Y, FRAME_HEIGHT (f) - cursor_coords.Y - 1); + clear_end_of_line (FRAME_COLS (f) - 1); + ins_del_lines (cursor_coords.Y, FRAME_LINES (f) - cursor_coords.Y - 1); } /* Clear the frame. */ @@ -138,7 +138,7 @@ clear_frame (void) GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info); /* Remember that the screen buffer might be wider than the window. */ - n = FRAME_HEIGHT (f) * info.dwSize.X; + n = FRAME_LINES (f) * info.dwSize.X; dest.X = dest.Y = 0; FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r); @@ -180,17 +180,17 @@ ins_del_lines (int vpos, int n) if (n < 0) { scroll.Top = vpos - n; - scroll.Bottom = FRAME_HEIGHT (f); + scroll.Bottom = FRAME_LINES (f); dest.Y = vpos; } else { scroll.Top = vpos; - scroll.Bottom = FRAME_HEIGHT (f) - n; + scroll.Bottom = FRAME_LINES (f) - n; dest.Y = vpos + n; } scroll.Left = 0; - scroll.Right = FRAME_WIDTH (f); + scroll.Right = FRAME_COLS (f); dest.X = 0; @@ -213,7 +213,7 @@ ins_del_lines (int vpos, int n) for (i = scroll.Bottom; i < dest.Y; i++) { move_cursor (i, 0); - clear_end_of_line (FRAME_WIDTH (f)); + clear_end_of_line (FRAME_COLS (f)); } } } @@ -226,7 +226,7 @@ ins_del_lines (int vpos, int n) for (i = nb; i < scroll.Top; i++) { move_cursor (i, 0); - clear_end_of_line (FRAME_WIDTH (f)); + clear_end_of_line (FRAME_COLS (f)); } } } @@ -256,12 +256,12 @@ scroll_line (int dist, int direction) if (direction == LEFT) { scroll.Left = cursor_coords.X + dist; - scroll.Right = FRAME_WIDTH (f) - 1; + scroll.Right = FRAME_COLS (f) - 1; } else { scroll.Left = cursor_coords.X; - scroll.Right = FRAME_WIDTH (f) - dist - 1; + scroll.Right = FRAME_COLS (f) - dist - 1; } dest.X = cursor_coords.X; @@ -661,16 +661,16 @@ initialize_w32_display (void) if (w32_use_full_screen_buffer) { - FRAME_HEIGHT (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */ - SET_FRAME_WIDTH (SELECTED_FRAME (), info.dwSize.X); /* characters per line */ + FRAME_LINES (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */ + SET_FRAME_COLS (SELECTED_FRAME (), info.dwSize.X); /* characters per line */ } else { /* Lines per page. Use buffer coords instead of buffer size. */ - FRAME_HEIGHT (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom - + FRAME_LINES (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom - info.srWindow.Top; /* Characters per line. Use buffer coords instead of buffer size. */ - SET_FRAME_WIDTH (SELECTED_FRAME (), 1 + info.srWindow.Right - + SET_FRAME_COLS (SELECTED_FRAME (), 1 + info.srWindow.Right - info.srWindow.Left); } diff --git a/src/w32menu.c b/src/w32menu.c index dbf14aaeeb8..872cb12e997 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -725,10 +725,8 @@ cached information about equivalent key sequences. */) CHECK_LIVE_WINDOW (window); f = XFRAME (WINDOW_FRAME (XWINDOW (window))); - xpos = (FONT_WIDTH (FRAME_FONT (f)) - * XFASTINT (XWINDOW (window)->left)); - ypos = (FRAME_LINE_HEIGHT (f) - * XFASTINT (XWINDOW (window)->top)); + xpos = WINDOW_LEFT_EDGE_X (XWINDOW (window)); + ypos = WINDOW_TOP_EDGE_Y (XWINDOW (window)); } else /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME, @@ -1601,7 +1599,7 @@ set_frame_menubar (f, first_time, deep_p) /* Force the window size to be recomputed so that the frame's text area remains the same, if menubar has just been created. */ if (old_widget == NULL) - x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); + x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); } UNBLOCK_INPUT; diff --git a/src/widget.c b/src/widget.c index afb8b700837..eaf8e66e9a9 100644 --- a/src/widget.c +++ b/src/widget.c @@ -183,8 +183,8 @@ get_default_char_pixel_size (ew, pixel_width, pixel_height) int* pixel_height; { struct frame* f = ew->emacs_frame.frame; - *pixel_width = FONT_WIDTH (f->output_data.x->font); - *pixel_height = f->output_data.x->line_height; + *pixel_width = FRAME_COLUMN_WIDTH (f); + *pixel_height = FRAME_LINE_HEIGHT (f); } static void @@ -196,8 +196,8 @@ pixel_to_char_size (ew, pixel_width, pixel_height, char_width, char_height) int* char_height; { struct frame* f = ew->emacs_frame.frame; - *char_width = PIXEL_TO_CHAR_WIDTH (f, (int) pixel_width); - *char_height = PIXEL_TO_CHAR_HEIGHT (f, (int) pixel_height); + *char_width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, (int) pixel_width); + *char_height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, (int) pixel_height); } static void @@ -209,8 +209,8 @@ char_to_pixel_size (ew, char_width, char_height, pixel_width, pixel_height) Dimension* pixel_height; { struct frame* f = ew->emacs_frame.frame; - *pixel_width = CHAR_TO_PIXEL_WIDTH (f, char_width); - *pixel_height = CHAR_TO_PIXEL_HEIGHT (f, char_height); + *pixel_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, char_width); + *pixel_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, char_height); } static void @@ -305,8 +305,8 @@ set_frame_size (ew) */ /* Hairily merged geometry */ - unsigned int w = ew->emacs_frame.frame->width; - unsigned int h = ew->emacs_frame.frame->height; + unsigned int w = FRAME_COLS (ew->emacs_frame.frame); + unsigned int h = FRAME_LINES (ew->emacs_frame.frame); Widget wmshell = get_wm_shell ((Widget) ew); /* Each Emacs shell is now independent and top-level. */ @@ -420,7 +420,7 @@ set_frame_size (ew) } #endif /* 0 */ { - struct frame* frame = ew->emacs_frame.frame; + struct frame *f = ew->emacs_frame.frame; Dimension pixel_width, pixel_height; /* Take into account the size of the scrollbar. Always use the @@ -428,18 +428,15 @@ set_frame_size (ew) might end up with a frame width that is not a multiple of the frame's character width which is bad for vertically split windows. */ - frame->output_data.x->vertical_scroll_bar_extra - = (!FRAME_HAS_VERTICAL_SCROLL_BARS (frame) - ? 0 - : (FRAME_SCROLL_BAR_COLS (frame) - * FONT_WIDTH (frame->output_data.x->font))); + f->scroll_bar_actual_width + = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f); - compute_fringe_widths (frame, 0); + compute_fringe_widths (f, 0); #if 0 /* This can run Lisp code, and it is dangerous to give out the frame to Lisp code before it officially exists. This is handled in Fx_create_frame so not needed here. */ - change_frame_size (frame, h, w, 1, 0, 0); + change_frame_size (f, h, w, 1, 0, 0); #endif char_to_pixel_size (ew, w, h, &pixel_width, &pixel_height); ew->core.width = pixel_width; @@ -645,10 +642,11 @@ static void update_various_frame_slots (ew) EmacsFrame ew; { - struct x_output *x = ew->emacs_frame.frame->output_data.x; - x->pixel_height = ew->core.height + x->menubar_height; - x->pixel_width = ew->core.width; - x->internal_border_width = ew->emacs_frame.internal_border_width; + struct frame *f = ew->emacs_frame.frame; + struct x_output *x = f->output_data.x; + FRAME_PIXEL_HEIGHT (f) = ew->core.height + x->menubar_height; + FRAME_PIXEL_WIDTH (f) = ew->core.width; + f->internal_border_width = ew->emacs_frame.internal_border_width; } @@ -656,11 +654,12 @@ static void update_from_various_frame_slots (ew) EmacsFrame ew; { - struct x_output *x = ew->emacs_frame.frame->output_data.x; - ew->core.height = x->pixel_height - x->menubar_height; - ew->core.width = x->pixel_width; + struct frame *f = ew->emacs_frame.frame; + struct x_output *x = f->output_data.x; + ew->core.height = FRAME_PIXEL_HEIGHT (f) - x->menubar_height; + ew->core.width = FRAME_PIXEL_WIDTH (f); ew->core.background_pixel = x->background_pixel; - ew->emacs_frame.internal_border_width = x->internal_border_width; + ew->emacs_frame.internal_border_width = f->internal_border_width; ew->emacs_frame.font = x->font; ew->emacs_frame.foreground_pixel = x->foreground_pixel; ew->emacs_frame.cursor_color = x->cursor_pixel; @@ -717,7 +716,7 @@ EmacsFrameInitialize (request, new, dum1, dum2) } /* Update the font field in frame */ - ew->emacs_frame.frame->output_data.x->font = ew->emacs_frame.font; + FRAME_FONT (ew->emacs_frame.frame) = ew->emacs_frame.font; #endif update_from_various_frame_slots (ew); @@ -910,10 +909,8 @@ EmacsFrameSetCharSize (widget, columns, rows) if (columns < 3) columns = 3; /* no way buddy */ check_frame_size (f, &rows, &columns); - f->output_data.x->vertical_scroll_bar_extra - = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) - ? 0 - : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); + f->scroll_bar_actual_width + = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f); compute_fringe_widths (f, 0); @@ -923,7 +920,7 @@ EmacsFrameSetCharSize (widget, columns, rows) /* Something is really strange here wrt to the border width: Apparently, XtNwidth and XtNheight include the border, so we have to add it here. But the XtNborderWidth set for the widgets has - no similarity to what f->output_data.x->border_width is set to. */ + no similarity to what f->border_width is set to. */ XtVaGetValues (widget, XtNborderWidth, &border_width, NULL); pixel_height += 2 * border_width; pixel_width += 2 * border_width; @@ -1017,6 +1014,5 @@ widget_store_internal_border (widget) EmacsFrame ew = (EmacsFrame) widget; FRAME_PTR f = ew->emacs_frame.frame; - ew->emacs_frame.internal_border_width - = f->output_data.x->internal_border_width; + ew->emacs_frame.internal_border_width = f->internal_border_width; } -- 2.39.2