unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: 51298@debbugs.gnu.org
Subject: bug#51298: 29.0.50; Tab bar buttons won't highlight after the mouse is released outside the tab bar
Date: Wed, 20 Oct 2021 15:59:36 +0800	[thread overview]
Message-ID: <87lf2oazyv.fsf@yahoo.com> (raw)
In-Reply-To: <87v91sb0ve.fsf@yahoo.com> (Po Lu's message of "Wed, 20 Oct 2021 15:40:05 +0800")

[-- Attachment #1: Type: text/plain, Size: 151 bytes --]


BTW, I'm attaching another patch that makes the tab bar behave closer to
other programs.  I've explained the behaviour in the commit message.

WDYT?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Display-a-tab-bar-item-as-sunken-when-appropriate.patch --]
[-- Type: text/x-patch, Size: 1601 bytes --]

From 69b4f84bdcd76bccee1e2af5b334b03ace918f9f Mon Sep 17 00:00:00 2001
From: Po Lu <luangruo@yahoo.com>
Date: Wed, 20 Oct 2021 15:55:10 +0800
Subject: [PATCH] Display a tab bar item as sunken when appropriate

When the mouse pointer is pressed on the tab bar, moved out of the tab
bar, and moved back in, it would be more appropriate to behave like
other programs by displaying the item as sunken.

* src/xdisp.c (note_tab_bar_highlight): Display item as sunken if the
mouse pointer returns to the tab bar down.
---
 src/xdisp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index c6b8ca636e..72b359789d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13866,12 +13866,17 @@ note_tab_bar_highlight (struct frame *f, int x, int y)
   clear_mouse_face (hlinfo);
 
   bool mouse_down_p = false;
-  /* Mouse is down, but on different tab-bar item?  */
+  /* Mouse is down, but on different tab-bar item?  Or alternatively,
+     the mouse might've been pressed somewhere we don't know about,
+     and then have moved onto the tab bar.  In this case,
+     last_tab_bar_item is -1, so we DTRT and behave like other
+     programs by displaying the item as sunken. */
   Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
   mouse_down_p = (gui_mouse_grabbed (dpyinfo)
 		  && f == dpyinfo->last_mouse_frame);
 
-  if (mouse_down_p && f->last_tab_bar_item != prop_idx)
+  if (mouse_down_p && f->last_tab_bar_item != prop_idx
+      && f->last_tab_bar_item != -1)
     return;
   draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED;
 
-- 
2.31.1


  reply	other threads:[~2021-10-20  7:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87h7dcecex.fsf.ref@yahoo.com>
2021-10-20  1:02 ` bug#51298: 29.0.50; Tab bar buttons won't highlight after the mouse is released outside the tab bar Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-20  6:58   ` Juri Linkov
2021-10-20  7:40     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-20  7:59       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-10-20 16:43         ` Juri Linkov
2022-04-22 15:59           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf2oazyv.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=51298@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).