From 6ea80fa7c47acd7eb47d5d3453e5cd114882adca Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Fri, 7 Apr 2023 08:37:30 +0200 Subject: [PATCH] * src/xterm.c (x_scroll_bar_set_handle): Simplify scroll bar drawing. --- src/xterm.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 70bcb67d80d..f9837b3464e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -16583,9 +16583,9 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, that many pixels tall. */ end += VERTICAL_SCROLL_BAR_MIN_HANDLE; - /* Draw the empty space above the handle. Note that we can't clear - zero-height areas; that means "clear to end of window." */ - if ((inside_width > 0) && (start > 0)) + /* Clear all scroll bar area. Note that we can't clear zero-height + areas; that means "clear to end of window." */ + if ((inside_width > 0) && (inside_height > 0)) { if (f->output_data.x->scroll_bar_background_pixel != -1) XSetForeground (FRAME_X_DISPLAY (f), gc, @@ -16597,7 +16597,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, XFillRectangle (FRAME_X_DISPLAY (f), w, gc, bar->left + VERTICAL_SCROLL_BAR_LEFT_BORDER, bar->top + VERTICAL_SCROLL_BAR_TOP_BORDER, - inside_width, start); + inside_width, inside_height); XSetForeground (FRAME_X_DISPLAY (f), gc, FRAME_FOREGROUND_PIXEL (f)); @@ -16615,27 +16615,6 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, bar->top + VERTICAL_SCROLL_BAR_TOP_BORDER + start, inside_width, end - start); - - /* Draw the empty space below the handle. Note that we can't - clear zero-height areas; that means "clear to end of window." */ - if ((inside_width > 0) && (end < inside_height)) - { - if (f->output_data.x->scroll_bar_background_pixel != -1) - XSetForeground (FRAME_X_DISPLAY (f), gc, - f->output_data.x->scroll_bar_background_pixel); - else - XSetForeground (FRAME_X_DISPLAY (f), gc, - FRAME_BACKGROUND_PIXEL (f)); - - XFillRectangle (FRAME_X_DISPLAY (f), w, gc, - bar->left + VERTICAL_SCROLL_BAR_LEFT_BORDER, - bar->top + VERTICAL_SCROLL_BAR_TOP_BORDER + end, - inside_width, inside_height - end); - - XSetForeground (FRAME_X_DISPLAY (f), gc, - FRAME_FOREGROUND_PIXEL (f)); - } - /* Restore the foreground color of the GC if we changed it above. */ if (f->output_data.x->scroll_bar_foreground_pixel != -1) XSetForeground (FRAME_X_DISPLAY (f), gc, -- 2.39.2