aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-04-28 12:50:47 +0000
committerPo Lu2022-04-28 12:51:04 +0000
commit613aa1894500f4c707078e71b497662e91f3f6f3 (patch)
tree9e4eef27a615cfd4626fb5271cd040422ddcba31 /src
parent6ef295cd51855c8b2a14b6a8512e6e972c97c4c0 (diff)
downloademacs-613aa1894500f4c707078e71b497662e91f3f6f3.tar.gz
emacs-613aa1894500f4c707078e71b497662e91f3f6f3.zip
Simplify buffer flipping code on Haiku
* src/haikuterm.c (flush_dirty_back_buffers): Delete function. (haiku_flush_dirty_back_buffer_on): New function. (haiku_read_socket): Use that instead of looping over each frame at the end.
Diffstat (limited to 'src')
-rw-r--r--src/haikuterm.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/haikuterm.c b/src/haikuterm.c
index 5d5e48c3915..393d359b66e 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -2781,22 +2781,12 @@ haiku_make_fullscreen_consistent (struct frame *f)
2781} 2781}
2782 2782
2783static void 2783static void
2784flush_dirty_back_buffers (void) 2784haiku_flush_dirty_back_buffer_on (struct frame *f)
2785{ 2785{
2786 block_input (); 2786 if (!FRAME_GARBAGED_P (f)
2787 Lisp_Object tail, frame; 2787 && !buffer_flipping_blocked_p ()
2788 FOR_EACH_FRAME (tail, frame) 2788 && FRAME_DIRTY_P (f))
2789 { 2789 haiku_flip_buffers (f);
2790 struct frame *f = XFRAME (frame);
2791 if (FRAME_LIVE_P (f) &&
2792 FRAME_HAIKU_P (f) &&
2793 FRAME_HAIKU_WINDOW (f) &&
2794 !FRAME_GARBAGED_P (f) &&
2795 !buffer_flipping_blocked_p () &&
2796 FRAME_DIRTY_P (f))
2797 haiku_flip_buffers (f);
2798 }
2799 unblock_input ();
2800} 2790}
2801 2791
2802/* N.B. that support for TYPE must be explictly added to 2792/* N.B. that support for TYPE must be explictly added to
@@ -2840,12 +2830,11 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
2840 static void *buf; 2830 static void *buf;
2841 ssize_t b_size; 2831 ssize_t b_size;
2842 struct unhandled_event *unhandled_events = NULL; 2832 struct unhandled_event *unhandled_events = NULL;
2843 int button_or_motion_p, need_flush, do_help; 2833 int button_or_motion_p, do_help;
2844 enum haiku_event_type type; 2834 enum haiku_event_type type;
2845 struct input_event inev, inev2; 2835 struct input_event inev, inev2;
2846 2836
2847 message_count = 0; 2837 message_count = 0;
2848 need_flush = 0;
2849 button_or_motion_p = 0; 2838 button_or_motion_p = 0;
2850 do_help = 0; 2839 do_help = 0;
2851 buf = NULL; 2840 buf = NULL;
@@ -2954,7 +2943,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
2954 { 2943 {
2955 clear_mouse_face (hlinfo); 2944 clear_mouse_face (hlinfo);
2956 hlinfo->mouse_face_hidden = true; 2945 hlinfo->mouse_face_hidden = true;
2957 need_flush = 1; 2946 haiku_flush_dirty_back_buffer_on (f);
2958 } 2947 }
2959 2948
2960 inev.code = b->keysym ? b->keysym : b->multibyte_char; 2949 inev.code = b->keysym ? b->keysym : b->multibyte_char;
@@ -3046,7 +3035,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3046 { 3035 {
3047 hlinfo->mouse_face_hidden = false; 3036 hlinfo->mouse_face_hidden = false;
3048 clear_mouse_face (hlinfo); 3037 clear_mouse_face (hlinfo);
3049 need_flush = 1; 3038 haiku_flush_dirty_back_buffer_on (f);
3050 } 3039 }
3051 3040
3052 if (b->just_exited_p) 3041 if (b->just_exited_p)
@@ -3059,7 +3048,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3059 clear_mouse_face (hlinfo); 3048 clear_mouse_face (hlinfo);
3060 hlinfo->mouse_face_mouse_frame = 0; 3049 hlinfo->mouse_face_mouse_frame = 0;
3061 3050
3062 need_flush = 1; 3051 haiku_flush_dirty_back_buffer_on (f);
3063 } 3052 }
3064 3053
3065 if (f->auto_lower && !popup_activated_p 3054 if (f->auto_lower && !popup_activated_p
@@ -3193,7 +3182,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3193 } 3182 }
3194 3183
3195 if (FRAME_DIRTY_P (f)) 3184 if (FRAME_DIRTY_P (f))
3196 need_flush = 1; 3185 haiku_flush_dirty_back_buffer_on (f);
3197 break; 3186 break;
3198 } 3187 }
3199 case BUTTON_UP: 3188 case BUTTON_UP:
@@ -3231,7 +3220,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3231 { 3220 {
3232 tab_bar_arg = handle_tab_bar_click 3221 tab_bar_arg = handle_tab_bar_click
3233 (f, x, y, type == BUTTON_DOWN, inev.modifiers); 3222 (f, x, y, type == BUTTON_DOWN, inev.modifiers);
3234 need_flush = 1; 3223 haiku_flush_dirty_back_buffer_on (f);
3235 } 3224 }
3236 } 3225 }
3237 3226
@@ -3251,7 +3240,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3251 { 3240 {
3252 handle_tool_bar_click 3241 handle_tool_bar_click
3253 (f, x, y, type == BUTTON_DOWN, inev.modifiers); 3242 (f, x, y, type == BUTTON_DOWN, inev.modifiers);
3254 need_flush = 1; 3243 haiku_flush_dirty_back_buffer_on (f);
3255 } 3244 }
3256 } 3245 }
3257 3246
@@ -3724,9 +3713,6 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3724 } 3713 }
3725 } 3714 }
3726 3715
3727 if (need_flush)
3728 flush_dirty_back_buffers ();
3729
3730 unblock_input (); 3716 unblock_input ();
3731 3717
3732 return message_count; 3718 return message_count;