From f7755b88186bc70a35e0d8be422c8dd2f10db0ac Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 18 Dec 2021 03:40:44 +0000 Subject: [PATCH] Flip buffers if display were modified in haiku_read_socket * src/haikuterm.c (flush_dirty_back_buffers): New function. (haiku_read_socket): Flip buffers if the display could have been modified. --- src/haikuterm.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/haikuterm.c b/src/haikuterm.c index f95a013867f..24fa44b01d0 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -2571,6 +2571,25 @@ haiku_make_fullscreen_consistent (struct frame *f) store_frame_param (f, Qfullscreen, lval); } +static void +flush_dirty_back_buffers (void) +{ + block_input (); + Lisp_Object tail, frame; + FOR_EACH_FRAME (tail, frame) + { + struct frame *f = XFRAME (frame); + if (FRAME_LIVE_P (f) && + FRAME_HAIKU_P (f) && + FRAME_HAIKU_WINDOW (f) && + !FRAME_GARBAGED_P (f) && + !buffer_flipping_blocked_p () && + FRAME_DIRTY_P (f)) + haiku_flip_buffers (f); + } + unblock_input (); +} + static int haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) { @@ -2580,6 +2599,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) ssize_t b_size; struct unhandled_event *unhandled_events = NULL; int button_or_motion_p; + int need_flush = 0; if (!buf) buf = xmalloc (200); @@ -2827,8 +2847,11 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) tab_bar_p = EQ (window, f->tab_bar_window); if (tab_bar_p) - tab_bar_arg = handle_tab_bar_click - (f, x, y, type == BUTTON_DOWN, inev.modifiers); + { + tab_bar_arg = handle_tab_bar_click + (f, x, y, type == BUTTON_DOWN, inev.modifiers); + need_flush = 1; + } } if (WINDOWP (f->tool_bar_window) @@ -2845,7 +2868,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) { handle_tool_bar_click (f, x, y, type == BUTTON_DOWN, inev.modifiers); - redisplay (); + need_flush = 1; } } @@ -3223,6 +3246,9 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) xfree (old); } + if (need_flush) + flush_dirty_back_buffers (); + unblock_input (); return message_count; } -- 2.39.5