From 2a14f83bbdb59565f3e4bffa8e583270e10cf92c Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 13 Nov 2012 10:11:40 +0400 Subject: [PATCH] Omit glyphs initialization at startup. * dispnew.c (glyphs_initialized_initially_p): Remove. (adjust_frame_glyphs_initially): Likewise. Adjust users. (Fredraw_frame): Move actual code from here... (redraw_here): ...to here. Add eassert. Adjust comment. (Fredraw_display): Use redraw_frame. * xdisp.c (clear_garbaged_frames): Likewise. --- src/ChangeLog | 10 +++++++ src/dispnew.c | 82 ++++++++------------------------------------------- src/xdisp.c | 2 +- 3 files changed, 24 insertions(+), 70 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 88352c201b6..bdddcc11cdb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2012-11-13 Dmitry Antipov + + Omit glyphs initialization at startup. + * dispnew.c (glyphs_initialized_initially_p): Remove. + (adjust_frame_glyphs_initially): Likewise. Adjust users. + (Fredraw_frame): Move actual code from here... + (redraw_here): ...to here. Add eassert. Adjust comment. + (Fredraw_display): Use redraw_frame. + * xdisp.c (clear_garbaged_frames): Likewise. + 2012-11-13 Eli Zaretskii * xdisp.c (decode_mode_spec): Limit the value of WIDTH argument diff --git a/src/dispnew.c b/src/dispnew.c index 4758f4ad76f..675c06c22e9 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -141,10 +141,6 @@ struct frame *last_nonminibuf_frame; static bool delayed_size_change; -/* 1 means glyph initialization has been completed at startup. */ - -static bool glyphs_initialized_initially_p; - /* Updated window if != 0. Set by update_window. */ struct window *updated_window; @@ -1850,43 +1846,6 @@ adjust_glyphs (struct frame *f) unblock_input (); } - -/* Adjust frame glyphs when Emacs is initialized. - - To be called from init_display. - - We need a glyph matrix because redraw will happen soon. - Unfortunately, window sizes on selected_frame are not yet set to - meaningful values. I believe we can assume that there are only two - windows on the frame---the mini-buffer and the root window. Frame - height and width seem to be correct so far. So, set the sizes of - windows to estimated values. */ - -static void -adjust_frame_glyphs_initially (void) -{ - struct frame *sf = SELECTED_FRAME (); - struct window *root = XWINDOW (sf->root_window); - struct window *mini = XWINDOW (root->next); - int frame_lines = FRAME_LINES (sf); - int frame_cols = FRAME_COLS (sf); - int top_margin = FRAME_TOP_MARGIN (sf); - - /* Do it for the root window. */ - wset_top_line (root, make_number (top_margin)); - wset_total_lines (root, make_number (frame_lines - 1 - top_margin)); - wset_total_cols (root, make_number (frame_cols)); - - /* Do it for the mini-buffer window. */ - wset_top_line (mini, make_number (frame_lines - 1)); - wset_total_lines (mini, make_number (1)); - wset_total_cols (mini, make_number (frame_cols)); - - adjust_frame_glyphs (sf); - glyphs_initialized_initially_p = 1; -} - - /* Allocate/reallocate glyph matrices of a single frame F. */ static void @@ -3071,19 +3030,13 @@ window_to_frame_hpos (struct window *w, int hpos) Redrawing Frames **********************************************************************/ -DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 0, 1, 0, - doc: /* Clear frame FRAME and output again what is supposed to appear on it. -If FRAME is omitted or nil, the selected frame is used. */) - (Lisp_Object frame) -{ - struct frame *f = decode_live_frame (frame); - - /* Ignore redraw requests, if frame has no glyphs yet. - (Implementation note: It still has to be checked why we are - called so early here). */ - if (!glyphs_initialized_initially_p) - return Qnil; +/* Redraw frame F. */ +void +redraw_frame (struct frame *f) +{ + /* Error if F has no glyphs. */ + eassert (f->glyphs_initialized_p); update_begin (f); #ifdef MSDOS if (FRAME_MSDOS_P (f)) @@ -3100,22 +3053,17 @@ If FRAME is omitted or nil, the selected frame is used. */) mark_window_display_accurate (FRAME_ROOT_WINDOW (f), 0); set_window_update_flags (XWINDOW (FRAME_ROOT_WINDOW (f)), 1); f->garbaged = 0; - return Qnil; } - -/* Redraw frame F. This is nothing more than a call to the Lisp - function redraw-frame. */ - -void -redraw_frame (struct frame *f) +DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 0, 1, 0, + doc: /* Clear frame FRAME and output again what is supposed to appear on it. +If FRAME is omitted or nil, the selected frame is used. */) + (Lisp_Object frame) { - Lisp_Object frame; - XSETFRAME (frame, f); - Fredraw_frame (frame); + redraw_frame (decode_live_frame (frame)); + return Qnil; } - DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "", doc: /* Clear and redisplay all visible frames. */) (void) @@ -3124,7 +3072,7 @@ DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "", FOR_EACH_FRAME (tail, frame) if (FRAME_VISIBLE_P (XFRAME (frame))) - Fredraw_frame (frame); + redraw_frame (XFRAME (frame)); return Qnil; } @@ -6208,7 +6156,6 @@ init_display (void) So call tgetent. */ { char b[2044]; tgetent (b, "xterm");} #endif - adjust_frame_glyphs_initially (); return; } #endif /* HAVE_X_WINDOWS */ @@ -6218,7 +6165,6 @@ init_display (void) { Vinitial_window_system = Qw32; Vwindow_system_version = make_number (1); - adjust_frame_glyphs_initially (); return; } #endif /* HAVE_NTGUI */ @@ -6232,7 +6178,6 @@ init_display (void) { Vinitial_window_system = Qns; Vwindow_system_version = make_number (10); - adjust_frame_glyphs_initially (); return; } #endif @@ -6322,7 +6267,6 @@ init_display (void) fatal ("screen size %dx%d too big", width, height); } - adjust_frame_glyphs_initially (); calculate_costs (XFRAME (selected_frame)); /* Set up faces of the initial terminal frame of a dumped Emacs. */ diff --git a/src/xdisp.c b/src/xdisp.c index 12d7b89291c..a74628db392 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10769,7 +10769,7 @@ clear_garbaged_frames (void) { if (f->resized_p) { - Fredraw_frame (frame); + redraw_frame (f); f->force_flush_display_p = 1; } clear_current_matrices (f); -- 2.39.2