From db74a93659d8a94b6f3db88ba1402ccf5edb32d3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 7 Sep 2021 13:24:01 +0300 Subject: [PATCH] Fix display of tab-bar buttons * src/xterm.c (x_draw_image_relief): * src/w32term.c (w32_draw_image_relief): Fix calculation of relief thickness for tab-bar buttons. * lisp/tab-bar.el (tab-bar--load-buttons) (tab-bar-history-mode): Fix the :margin specification for tab-bar buttons. (Bug#50424) --- lisp/tab-bar.el | 8 ++++---- src/w32term.c | 13 ++++++++----- src/xterm.c | 13 ++++++++----- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 7f6afd7d533..cde9a32076f 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -161,7 +161,7 @@ Possible modifier keys are `control', `meta', `shift', `hyper', `super' and (add-text-properties 0 (length tab-bar-new-button) `(display (image :type xpm :file "tabs/new.xpm" - :margin (2 . 0) + :margin ,tab-bar-button-margin :ascent center)) tab-bar-new-button)) @@ -171,7 +171,7 @@ Possible modifier keys are `control', `meta', `shift', `hyper', `super' and (add-text-properties 0 (length tab-bar-close-button) `(display (image :type xpm :file "tabs/close.xpm" - :margin (2 . 0) + :margin ,tab-bar-button-margin :ascent center)) tab-bar-close-button))) @@ -1597,7 +1597,7 @@ and can restore them." (add-text-properties 0 (length tab-bar-back-button) `(display (image :type xpm :file "tabs/left-arrow.xpm" - :margin (2 . 0) + :margin ,tab-bar-button-margin :ascent center)) tab-bar-back-button)) (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-forward-button))) @@ -1605,7 +1605,7 @@ and can restore them." (add-text-properties 0 (length tab-bar-forward-button) `(display (image :type xpm :file "tabs/right-arrow.xpm" - :margin (2 . 0) + :margin ,tab-bar-button-margin :ascent center)) tab-bar-forward-button)) diff --git a/src/w32term.c b/src/w32term.c index ad4d1a32829..ebd672361bf 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2031,11 +2031,14 @@ w32_draw_image_relief (struct glyph_string *s) if (s->hl == DRAW_IMAGE_SUNKEN || s->hl == DRAW_IMAGE_RAISED) { - thick = (tab_bar_button_relief < 0 - ? DEFAULT_TAB_BAR_BUTTON_RELIEF - : (tool_bar_button_relief < 0 - ? DEFAULT_TOOL_BAR_BUTTON_RELIEF - : min (tool_bar_button_relief, 1000000))); + if (s->face->id == TAB_BAR_FACE_ID) + thick = (tab_bar_button_relief < 0 + ? DEFAULT_TAB_BAR_BUTTON_RELIEF + : min (tab_bar_button_relief, 1000000)); + else + thick = (tool_bar_button_relief < 0 + ? DEFAULT_TOOL_BAR_BUTTON_RELIEF + : min (tool_bar_button_relief, 1000000)); raised_p = s->hl == DRAW_IMAGE_RAISED; } else diff --git a/src/xterm.c b/src/xterm.c index 1887c3255d4..b478eff2906 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3209,11 +3209,14 @@ x_draw_image_relief (struct glyph_string *s) if (s->hl == DRAW_IMAGE_SUNKEN || s->hl == DRAW_IMAGE_RAISED) { - thick = (tab_bar_button_relief < 0 - ? DEFAULT_TAB_BAR_BUTTON_RELIEF - : (tool_bar_button_relief < 0 - ? DEFAULT_TOOL_BAR_BUTTON_RELIEF - : min (tool_bar_button_relief, 1000000))); + if (s->face->id == TAB_BAR_FACE_ID) + thick = (tab_bar_button_relief < 0 + ? DEFAULT_TAB_BAR_BUTTON_RELIEF + : min (tab_bar_button_relief, 1000000)); + else + thick = (tool_bar_button_relief < 0 + ? DEFAULT_TOOL_BAR_BUTTON_RELIEF + : min (tool_bar_button_relief, 1000000)); raised_p = s->hl == DRAW_IMAGE_RAISED; } else -- 2.39.2