From ddbf2e8ab79ddc4464cc5bda6b28ff80867a3582 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sun, 24 Apr 2022 02:55:19 +0000 Subject: [PATCH] Fix disabling double buffering on Haiku * src/haikufns.c (haiku_set_inhibit_double_buffering): Garbage frame correctly after changing double buffering. * src/haikuterm.c (haiku_calculate_relief_colors) (haiku_draw_relief_rect, haiku_draw_underwave): Clean up coding style. --- src/haikufns.c | 9 +++------ src/haikuterm.c | 26 ++++++++++++-------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/haikufns.c b/src/haikufns.c index 14644be22bd..979a47d7668 100644 --- a/src/haikufns.c +++ b/src/haikufns.c @@ -1749,17 +1749,14 @@ haiku_set_inhibit_double_buffering (struct frame *f, { #ifndef USE_BE_CAIRO if (NILP (new_value)) - { #endif - EmacsView_set_up_double_buffering (FRAME_HAIKU_VIEW (f)); - - if (!NILP (old_value)) - expose_frame (f, 0, 0, 0, 0); + EmacsView_set_up_double_buffering (FRAME_HAIKU_VIEW (f)); #ifndef USE_BE_CAIRO - } else EmacsView_disable_double_buffering (FRAME_HAIKU_VIEW (f)); #endif + + SET_FRAME_GARBAGED (f); } unblock_input (); } diff --git a/src/haikuterm.c b/src/haikuterm.c index 4f671cddd0c..12db1a6f4f4 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -621,18 +621,17 @@ haiku_calculate_relief_colors (struct glyph_string *s, uint32_t *rgbout_w, uint32_t *rgbout_b) { struct face *face = s->face; + double h, cs, l; + uint32_t rgbin; prepare_face_for_display (s->f, s->face); - - uint32_t rgbin = face->use_box_color_for_shadows_p - ? face->box_color : face->background; + rgbin = (face->use_box_color_for_shadows_p + ? face->box_color : face->background); if (s->hl == DRAW_CURSOR) rgbin = FRAME_CURSOR_COLOR (s->f).pixel; - double h, cs, l; rgb_color_hsl (rgbin, &h, &cs, &l); - hsl_color_rgb (h, cs, fmin (1.0, fmax (0.2, l) * 0.6), rgbout_b); hsl_color_rgb (h, cs, fmin (1.0, fmax (0.2, l) * 1.2), rgbout_w); } @@ -640,16 +639,16 @@ haiku_calculate_relief_colors (struct glyph_string *s, uint32_t *rgbout_w, static void haiku_draw_relief_rect (struct glyph_string *s, int left_x, int top_y, int right_x, int bottom_y, - int hwidth, int vwidth, bool raised_p, bool top_p, bool bot_p, - bool left_p, bool right_p, + int hwidth, int vwidth, bool raised_p, bool top_p, + bool bot_p, bool left_p, bool right_p, struct haiku_rect *clip_rect, bool fancy_p) { - uint32_t color_white; - uint32_t color_black; + uint32_t color_white, color_black; + void *view; haiku_calculate_relief_colors (s, &color_white, &color_black); - void *view = FRAME_HAIKU_VIEW (s->f); + view = FRAME_HAIKU_VIEW (s->f); BView_SetHighColor (view, raised_p ? color_white : color_black); if (clip_rect) { @@ -726,15 +725,14 @@ haiku_draw_underwave (struct glyph_string *s, int width, int x) { int wave_height = 3, wave_length = 2; int y, dx, dy, odd, xmax; + float ax, ay, bx, by; + void *view = FRAME_HAIKU_VIEW (s->f); + dx = wave_length; dy = wave_height - 1; y = s->ybase - wave_height + 3; - - float ax, ay, bx, by; xmax = x + width; - void *view = FRAME_HAIKU_VIEW (s->f); - BView_StartClip (view); haiku_clip_to_string (s); BView_ClipToRect (view, x, y, width, wave_height); -- 2.39.5