From: Dmitry Antipov Date: Mon, 9 Sep 2013 12:15:45 +0000 (+0400) Subject: Cleanup frame flushing. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1662^2~68 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fd462129af606e37146cad265284ff4097051ad8;p=emacs.git Cleanup frame flushing. * dispextern.h (struct redisplay_interface): Drop flush_display_optional because flush_display is enough for X and flushing via RIF is just a no-op for others. * frame.h (flush_frame): New function. * dispnew.c (update_frame): * minibuf.c (read_minibuf): * xdisp.c (echo_area_display, redisplay_preserve_echo_area): Use it. * keyboard.c (detect_input_pending_run_timers): Do not flush all frames but selected one in redisplay_preserve_echo_area. * nsterm.m (ns_flush): Remove no-op. (ns_redisplay_interface): Adjust user. * w32term.h (x_flush): Remove no-op. (w32_redisplay_interface): Adjust user. * xterm.c (x_flush): Simplify because we do not flush all frames at once any more. Adjust comment. (x_redisplay_interface): Adjust user. --- diff --git a/src/ChangeLog b/src/ChangeLog index 7f4c3f731f4..231d9771e15 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +2013-09-09 Dmitry Antipov + + Cleanup frame flushing. + * dispextern.h (struct redisplay_interface): Drop + flush_display_optional because flush_display is enough + for X and flushing via RIF is just a no-op for others. + * frame.h (flush_frame): New function. + * dispnew.c (update_frame): + * minibuf.c (read_minibuf): + * xdisp.c (echo_area_display, redisplay_preserve_echo_area): + Use it. + * keyboard.c (detect_input_pending_run_timers): Do not flush + all frames but selected one in redisplay_preserve_echo_area. + * nsterm.m (ns_flush): Remove no-op. + (ns_redisplay_interface): Adjust user. + * w32term.h (x_flush): Remove no-op. + (w32_redisplay_interface): Adjust user. + * xterm.c (x_flush): Simplify because we do not flush all + frames at once any more. Adjust comment. + (x_redisplay_interface): Adjust user. + 2013-09-07 Paul Eggert Port --without-x --enable-gcc-warnings to Fedora 19. diff --git a/src/dispextern.h b/src/dispextern.h index f15da1e6564..67de6bffabf 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2796,11 +2796,6 @@ struct redisplay_interface /* Flush the display of frame F. For X, this is XFlush. */ void (*flush_display) (struct frame *f); - /* Flush the display of frame F if non-NULL. This is called - during redisplay, and should be NULL on systems which flush - automatically before reading input. */ - void (*flush_display_optional) (struct frame *f); - /* Clear the mouse highlight in window W, if there is any. */ void (*clear_window_mouse_face) (struct window *w); diff --git a/src/dispnew.c b/src/dispnew.c index 00abf65248c..74ecfa88bde 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3068,7 +3068,7 @@ update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p) at least the fringes are not redrawn in a timely manner. ++kfs */ if (f->force_flush_display_p) { - FRAME_RIF (f)->flush_display (f); + flush_frame (f); f->force_flush_display_p = 0; } } diff --git a/src/frame.h b/src/frame.h index 3dfbac15709..3d9457ce4d7 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1276,6 +1276,16 @@ extern void x_query_color (struct frame *f, XColor *); #endif /* HAVE_WINDOW_SYSTEM */ + +FRAME_INLINE void +flush_frame (struct frame *f) +{ + struct redisplay_interface *rif = FRAME_RIF (f); + + if (rif && rif->flush_display) + rif->flush_display (f); +} + /*********************************************************************** Multimonitor data ***********************************************************************/ diff --git a/src/keyboard.c b/src/keyboard.c index ed70e288c84..440820c57db 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -9873,20 +9873,7 @@ detect_input_pending_run_timers (bool do_display) get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW); if (old_timers_run != timers_run && do_display) - { - redisplay_preserve_echo_area (8); - /* The following fixes a bug when using lazy-lock with - lazy-lock-defer-on-the-fly set to t, i.e. when fontifying - from an idle timer function. The symptom of the bug is that - the cursor sometimes doesn't become visible until the next X - event is processed. --gerd. */ - { - Lisp_Object tail, frame; - FOR_EACH_FRAME (tail, frame) - if (FRAME_RIF (XFRAME (frame))) - FRAME_RIF (XFRAME (frame))->flush_display (XFRAME (frame)); - } - } + redisplay_preserve_echo_area (8); return input_pending; } diff --git a/src/minibuf.c b/src/minibuf.c index 7403fc6c32d..cc6f234f7da 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -672,12 +672,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, XWINDOW (minibuf_window)->cursor.x = 0; XWINDOW (minibuf_window)->must_be_updated_p = 1; update_frame (XFRAME (selected_frame), 1, 1); - { - struct frame *f = XFRAME (XWINDOW (minibuf_window)->frame); - struct redisplay_interface *rif = FRAME_RIF (f); - if (rif && rif->flush_display) - rif->flush_display (f); - } + flush_frame (XFRAME (XWINDOW (minibuf_window)->frame)); } /* Make minibuffer contents into a string. */ diff --git a/src/nsterm.m b/src/nsterm.m index 31053ca7a0d..38d76e9389c 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -801,18 +801,6 @@ ns_update_end (struct frame *f) NSTRACE (ns_update_end); } - -static void -ns_flush (struct frame *f) -/* -------------------------------------------------------------------------- - external (RIF) call - NS impl is no-op since currently we flush in ns_update_end and elsewhere - -------------------------------------------------------------------------- */ -{ - NSTRACE (ns_flush); -} - - static void ns_focus (struct frame *f, NSRect *r, int n) /* -------------------------------------------------------------------------- @@ -3963,8 +3951,7 @@ static struct redisplay_interface ns_redisplay_interface = ns_after_update_window_line, ns_update_window_begin, ns_update_window_end, - ns_flush, - 0, /* flush_display_optional */ + 0, /* flush_display */ x_clear_window_mouse_face, x_get_glyph_overhangs, x_fix_overlapping_area, diff --git a/src/w32term.c b/src/w32term.c index 532ded7cdad..681f70b5888 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -6258,11 +6258,6 @@ w32_make_rdb (char *xrm_option) return buffer; } -void -x_flush (struct frame * f) -{ /* Nothing to do */ } - - extern frame_parm_handler w32_frame_parm_handlers[]; static struct redisplay_interface w32_redisplay_interface = @@ -6276,8 +6271,7 @@ static struct redisplay_interface w32_redisplay_interface = x_after_update_window_line, x_update_window_begin, x_update_window_end, - x_flush, - 0, /* flush_display_optional */ + 0, /* flush_display */ x_clear_window_mouse_face, x_get_glyph_overhangs, x_fix_overlapping_area, diff --git a/src/xdisp.c b/src/xdisp.c index d5def065936..960ad18709b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10859,7 +10859,7 @@ echo_area_display (int update_frame_p) Can do with a display update of the echo area, unless we displayed some mode lines. */ update_single_window (w, 1); - FRAME_RIF (f)->flush_display (f); + flush_frame (f); } else update_frame (f, 1, 1); @@ -13645,9 +13645,7 @@ redisplay_preserve_echo_area (int from_where) else redisplay_internal (); - if (FRAME_RIF (SELECTED_FRAME ()) != NULL - && FRAME_RIF (SELECTED_FRAME ())->flush_display_optional) - FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (NULL); + flush_frame (SELECTED_FRAME ()); } diff --git a/src/xterm.c b/src/xterm.c index 2f3d5ca7a01..d12173297e8 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -334,29 +334,19 @@ static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t); static void x_initialize (void); -/* Flush display of frame F, or of all frames if F is null. */ +/* Flush display of frame F. */ static void x_flush (struct frame *f) { + eassert (f && FRAME_X_P (f)); /* Don't call XFlush when it is not safe to redisplay; the X connection may be broken. */ if (!NILP (Vinhibit_redisplay)) return; block_input (); - if (f) - { - eassert (FRAME_X_P (f)); - XFlush (FRAME_X_DISPLAY (f)); - } - else - { - /* Flush all displays and so all frames on them. */ - struct x_display_info *xdi; - for (xdi = x_display_list; xdi; xdi = xdi->next) - XFlush (xdi->display); - } + XFlush (FRAME_X_DISPLAY (f)); unblock_input (); } @@ -7361,9 +7351,7 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, #endif } -#ifndef XFlush XFlush (FRAME_X_DISPLAY (f)); -#endif } @@ -10384,11 +10372,6 @@ static struct redisplay_interface x_redisplay_interface = x_update_window_begin, x_update_window_end, x_flush, -#ifdef XFlush - x_flush, -#else - 0, /* flush_display_optional */ -#endif x_clear_window_mouse_face, x_get_glyph_overhangs, x_fix_overlapping_area,