diff options
author | Po Lu <luangruo@yahoo.com> | 2022-10-16 06:19:12 +0000 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-10-16 06:19:12 +0000 |
commit | cf19743aca5cb68c65bf5c8c3730a2eae3cb21e8 (patch) | |
tree | 26fe0f22906505b97946321506ba538857ba0140 /src | |
parent | da6778d1ce55843cd52da7db66bcb518c441e46e (diff) | |
download | emacs-cf19743aca5cb68c65bf5c8c3730a2eae3cb21e8.tar.gz |
Adapt last change to Haiku port
* src/haikuterm.c (haiku_frame_up_to_date):
(haiku_clear_frame):
(haiku_update_begin):
(haiku_flush):
(haiku_flush_dirty_back_buffer_on):
(haiku_read_socket):
* src/haikuterm.h (struct haiku_output):
(FRAME_COMPLETE_P): Synchronize logic with X.
Diffstat (limited to 'src')
-rw-r--r-- | src/haikuterm.c | 32 | ||||
-rw-r--r-- | src/haikuterm.h | 5 |
2 files changed, 32 insertions, 5 deletions
diff --git a/src/haikuterm.c b/src/haikuterm.c index 838eb128fa6..4e32b747160 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -232,6 +232,9 @@ haiku_frame_up_to_date (struct frame *f) be_evict_font_cache (); up_to_date_count = 0; } + + /* Mark the frame as complete. */ + FRAME_COMPLETE_P (f) = true; unblock_input (); } @@ -265,6 +268,8 @@ haiku_clear_frame (struct frame *f) mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); + FRAME_COMPLETE_P (f) = false; + block_input (); BView_draw_lock (view, true, 0, 0, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); @@ -1436,6 +1441,9 @@ haiku_clip_to_row (struct window *w, struct glyph_row *row, static void haiku_update_begin (struct frame *f) { + /* Mark the frame as incomplete so it is not flushed upon handling + input. */ + FRAME_COMPLETE_P (f) = false; } static void @@ -2959,6 +2967,10 @@ haiku_flush (struct frame *f) if (FRAME_DIRTY_P (f) && !buffer_flipping_blocked_p ()) haiku_flip_buffers (f); + /* The frame is complete again as its contents were just + flushed. */ + FRAME_COMPLETE_P (f) = true; + if (FRAME_VISIBLE_P (f) && !FRAME_TOOLTIP_P (f)) BWindow_Flush (FRAME_HAIKU_WINDOW (f)); } @@ -3086,10 +3098,15 @@ haiku_make_fullscreen_consistent (struct frame *f) static void haiku_flush_dirty_back_buffer_on (struct frame *f) { - if (!FRAME_GARBAGED_P (f) - && !buffer_flipping_blocked_p () - && FRAME_DIRTY_P (f)) - haiku_flip_buffers (f); + if (FRAME_GARBAGED_P (f) + || buffer_flipping_blocked_p () + /* If the frame is not already up to date, do not flush buffers + on input, as that will result in flicker. */ + || !FRAME_COMPLETE_P (f) + || !FRAME_DIRTY_P (f)) + return; + + haiku_flip_buffers (f); } /* N.B. that support for TYPE must be explicitly added to @@ -3135,6 +3152,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) int button_or_motion_p, do_help; enum haiku_event_type type; struct input_event inev, inev2; + struct frame *mouse_frame; message_count = 0; button_or_motion_p = 0; @@ -3252,9 +3270,13 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) || !EQ (f->tool_bar_window, hlinfo->mouse_face_window) || !EQ (f->tab_bar_window, hlinfo->mouse_face_window))) { + mouse_frame = hlinfo->mouse_face_mouse_frame; + clear_mouse_face (hlinfo); hlinfo->mouse_face_hidden = true; - haiku_flush_dirty_back_buffer_on (f); + + if (mouse_frame) + haiku_flush_dirty_back_buffer_on (mouse_frame); } inev.code = b->keysym ? b->keysym : b->multibyte_char; diff --git a/src/haikuterm.h b/src/haikuterm.h index 86274fd42a3..70e8cf948bf 100644 --- a/src/haikuterm.h +++ b/src/haikuterm.h @@ -174,6 +174,10 @@ struct haiku_output displayed yet. */ bool_bf dirty_p : 1; + /* Whether or not the frame is complete, i.e. safe to flush on + input. */ + bool_bf complete_p : 1; + struct font *font; /* The pending position we're waiting for. */ @@ -275,6 +279,7 @@ struct scroll_bar #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec)) #define FRAME_DIRTY_P(f) (FRAME_OUTPUT_DATA (f)->dirty_p) +#define FRAME_COMPLETE_P(f) (FRAME_OUTPUT_DATA (f)->complete_p) #define MAKE_FRAME_DIRTY(f) (FRAME_DIRTY_P (f) = 1) #define FRAME_OUTPUT_DATA(f) ((f)->output_data.haiku) #define FRAME_HAIKU_WINDOW(f) (FRAME_OUTPUT_DATA (f)->window) |