From: Po Lu Date: Mon, 7 Mar 2022 00:53:50 +0000 (+0800) Subject: Get rid of a loop through all frames when processing events X-Git-Tag: emacs-29.0.90~1986 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=36b31d38cd9bde7ad1ec18c136854cddba0d6bbe;p=emacs.git Get rid of a loop through all frames when processing events * src/xterm.c (handle_one_xevent): Just flip back buffer of f and any instead. (flush_dirty_back_buffer_on): New function. (flush_dirty_back_buffers): Delete function. --- diff --git a/src/xterm.c b/src/xterm.c index 8642345549c..d368c723239 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -9887,23 +9887,18 @@ x_net_wm_state (struct frame *f, Window window) store_frame_param (f, Qshaded, shaded ? Qt : Qnil); } -/* Flip back buffers on any frames with undrawn content. */ +/* Flip back buffers on FRAME if it has undrawn content. */ static void -flush_dirty_back_buffers (void) +flush_dirty_back_buffer_on (struct frame *f) { block_input (); - Lisp_Object tail, frame; - FOR_EACH_FRAME (tail, frame) - { - struct frame *f = XFRAME (frame); - if (FRAME_LIVE_P (f) && - FRAME_X_P (f) && - FRAME_X_WINDOW (f) && - !FRAME_GARBAGED_P (f) && - !buffer_flipping_blocked_p () && - FRAME_X_NEED_BUFFER_FLIP (f)) - show_back_buffer (f); - } + if (FRAME_LIVE_P (f) && + FRAME_X_P (f) && + FRAME_X_WINDOW (f) && + !FRAME_GARBAGED_P (f) && + !buffer_flipping_blocked_p () && + FRAME_X_NEED_BUFFER_FLIP (f)) + show_back_buffer (f); unblock_input (); } @@ -13490,9 +13485,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, count++; } - /* Sometimes event processing draws to the frame outside redisplay. - To ensure that these changes become visible, draw them here. */ - flush_dirty_back_buffers (); + /* Sometimes event processing draws to either F or ANY outside + redisplay. To ensure that these changes become visible, draw + them here. */ + + if (f) + flush_dirty_back_buffer_on (f); + + if (any && any != f) + flush_dirty_back_buffer_on (any); return count; }