From c94d58ddbfeb32c9b60aaa4b346eb4fe05652013 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 9 Jun 2026 18:49:32 +0300 Subject: [PATCH] Fix the tab close button appearance when clicking (bug#76394) * src/xdisp.c (handle_tab_bar_click): Use the variable 'close_p' to show mouse face as sunken/raised only when clicked on the close button. Clicking elsewhere on the tab should not change the close button's appearance using DRAW_MOUSE_FACE. --- src/xdisp.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index b3c6fb8a486..b440b8f1825 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -15321,16 +15321,24 @@ handle_tab_bar_click (struct frame *f, int x, int y, bool down_p, if (down_p) { - /* Show the clicked button in pressed state. */ + /* Show the clicked button in pressed state, but only when + the click was on the close button. Clicking elsewhere on + the tab should not change the close button's appearance, + so just keep the ordinary mouse-face highlight. */ if (!NILP (Vmouse_highlight)) - show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN, true); + show_mouse_face (hlinfo, close_p ? DRAW_IMAGE_SUNKEN : DRAW_MOUSE_FACE, + true); f->last_tab_bar_item = prop_idx; /* record the pressed tab */ } else { - /* Show item in released state. */ + /* Show item in released state. Only change the close button's + appearance when the click was on it. Elsewhere keep the + ordinary mouse-face highlight to avoid the close button + blinking on release. */ if (!NILP (Vmouse_highlight)) - show_mouse_face (hlinfo, DRAW_IMAGE_RAISED, true); + show_mouse_face (hlinfo, close_p ? DRAW_IMAGE_RAISED : DRAW_MOUSE_FACE, + true); f->last_tab_bar_item = -1; }