unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51298: 29.0.50; Tab bar buttons won't highlight after the mouse is released outside the tab bar
       [not found] <87h7dcecex.fsf.ref@yahoo.com>
@ 2021-10-20  1:02 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-10-20  6:58   ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-10-20  1:02 UTC (permalink / raw)
  To: 51298


When moving the mouse pointer over the Tab Bar "new tab" button, the
button appears to have a raised relief highlight.  But after clicking
down on the button and moving the pointer outside the button before
depressing the mouse button to cancel the tab creation, the new tab
button will no longer highlight unless it's clicked again.

In GNU Emacs 29.0.50 (build 643, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
 of 2021-10-20 built on limity
Repository revision: b611da8cd3cf5501ef58a34688029f525c5ad69b
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101002
System Description: Fedora 34 (Workstation Edition)

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM
GTK3 ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils seq gv
byte-opt bytecomp byte-compile cconv time-date subr-x cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 53275 9464)
 (symbols 48 6639 1)
 (strings 32 20246 1640)
 (string-bytes 1 670408)
 (vectors 16 13791)
 (vector-slots 8 185757 12718)
 (floats 8 24 38)
 (intervals 56 224 1)
 (buffers 992 10))





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#51298: 29.0.50; Tab bar buttons won't highlight after the mouse is released outside the tab bar
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2021-10-20  6:58 UTC (permalink / raw)
  To: Po Lu; +Cc: 51298

> When moving the mouse pointer over the Tab Bar "new tab" button, the
> button appears to have a raised relief highlight.  But after clicking
> down on the button and moving the pointer outside the button before
> depressing the mouse button to cancel the tab creation, the new tab
> button will no longer highlight unless it's clicked again.

The same problem exists when clicking down the tab close button "x".
Patches welcome.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#51298: 29.0.50; Tab bar buttons won't highlight after the mouse is released outside the tab bar
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-10-20  7:40 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 51298

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

Juri Linkov <juri@linkov.net> writes:

> Patches welcome.

Thanks, please test.  The issue was because f->last_tab_bar_item
wouldn't be cleared when the mouse click was dropped outside the tab
bar.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-tab-bar-item-highlight-when-a-mouse-click-is-dro.patch --]
[-- Type: text/x-patch, Size: 998 bytes --]

From 0b56777754cc5112c35c04d1da2a1154eed6e0bd Mon Sep 17 00:00:00 2001
From: Po Lu <luangruo@yahoo.com>
Date: Wed, 20 Oct 2021 15:36:59 +0800
Subject: [PATCH] Fix tab bar item highlight when a mouse click is dropped

* src/xdisp.c (note_mouse_highlight): Clear last_tab_bar_item if the
movement wasn't made on top of the tab bar.
---
 src/xdisp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/xdisp.c b/src/xdisp.c
index 1a65066ef9..888bf2d88d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -33786,6 +33786,14 @@ note_mouse_highlight (struct frame *f, int x, int y)
       else
 	return;
     }
+  else
+    {
+      /* The mouse might have pressed into the tab bar, but might
+	 also have been released outside the tab bar, so
+	 f->last_tab_bar_item must be reset, in order to make sure the
+	 item can be still highlighted again in the future.  */
+      f->last_tab_bar_item = -1;
+    }
 #endif
 
 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#51298: 29.0.50; Tab bar buttons won't highlight after the mouse is released outside the tab bar
  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
  2021-10-20 16:43         ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-10-20  7:59 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 51298

[-- 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#51298: 29.0.50; Tab bar buttons won't highlight after the mouse is released outside the tab bar
  2021-10-20  7:59       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-10-20 16:43         ` Juri Linkov
  2022-04-22 15:59           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2021-10-20 16:43 UTC (permalink / raw)
  To: Po Lu; +Cc: 51298

tags 51298 fixed
thanks

> 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?

Thank you for the patches, everything works as it should,
so I pushed both patches.  The second patch didn't apply
cleanly (the difference was in #ifndef HAVE_NS),
so I have to add it manually, but this is not a problem.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#51298: 29.0.50; Tab bar buttons won't highlight after the mouse is released outside the tab bar
  2021-10-20 16:43         ` Juri Linkov
@ 2022-04-22 15:59           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-22 15:59 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Po Lu, 51298

Juri Linkov <juri@linkov.net> writes:

> Thank you for the patches, everything works as it should,
> so I pushed both patches.  The second patch didn't apply
> cleanly (the difference was in #ifndef HAVE_NS),
> so I have to add it manually, but this is not a problem.

This bug report was marked as fixed, but wasn't closed, so I'm doing
that now.  (Skimming the thread, it seems like all issues raised were
addressed.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-22 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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
2021-10-20 16:43         ` Juri Linkov
2022-04-22 15:59           ` Lars Ingebrigtsen

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).