unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: luangruo@yahoo.com, 50424@debbugs.gnu.org, juri@linkov.net
Subject: bug#50424: 27.2; Tab bar button mouse face not clearing entirely
Date: Wed, 8 Sep 2021 17:57:50 +0100	[thread overview]
Message-ID: <YTjrjq5jCS4DFZXh@idiocy.org> (raw)
In-Reply-To: <83mtonob41.fsf@gnu.org>

On Wed, Sep 08, 2021 at 09:05:50AM +0300, Eli Zaretskii wrote:
> > Date: Wed, 8 Sep 2021 00:13:15 +0100
> > From: Alan Third <alan@idiocy.org>
> > Cc: Po Lu <luangruo@yahoo.com>, Juri Linkov <juri@linkov.net>,
> > 	50424@debbugs.gnu.org
> > 
> > On Tue, Sep 07, 2021 at 01:41:38PM +0300, Eli Zaretskii wrote:
> > > 
> > > I hope the information here will allow Juri and people who really
> > > understand the meaning of an image margin and relief (Alan?) fix the
> > > rest of the problem.
> > 
> > AFAIK the margin and relief are entirely handled by the term code and
> > don't really have anything to do with the image itself. I expect
> > that's why this is an OS specific problem.
> 
> The code to deal with that is identical in xterm.c and w32term.c.
> 
> Can you perhaps help us understand the purpose and semantics of the
> delicate dance in the xdisp.c code I posted regarding images on the
> tool-bar buttons?  AFAIU, the xterm/w32term code was written to
> reflect that, and the tab-bar code is simply a copy of the tool-bar
> code, except that the image spec is defined entirely in Lisp, instead
> of being dynamically redefined on the fly by the C code in the display
> engine.  So we need to understand the meaning of the margins and the
> relief settings and their relation to the button being "selected" as
> well as to the value of auto-raise-tool-bar-buttons, in order to do in
> Lisp the same thing.  Because xterm/w32term rely on this logic to
> clear the area when the mouse pointer moves off the button.

I think all it's doing is ensuring the total area the image takes up
is the same whether there's a relief or not.

The total width = image + relief width + margin width, so if you
reduce the size of the relief you have to increase the size of the
margin by the same amount to make sure it takes up the same amount of
space and doesn't move.

As far as I can see, what's happening here is that the margin is
pushing the relief one pixel into the separator to the left, so I
suspect that's why it's not being cleared.

I'm somewhat surprised that it's not pushing the right hand side one
pixel too far in the other direction and causing it to not be cleared
either, but maybe that's just chance.

The change below fixes it here, but I've not made sure it does the
right thing with different sized margins and so on.

modified   src/w32term.c
@@ -2057,11 +2057,11 @@ w32_draw_image_relief (struct glyph_string *s)
 	  && FIXNUMP (XCAR (Vtab_bar_button_margin))
 	  && FIXNUMP (XCDR (Vtab_bar_button_margin)))
 	{
-	  extra_x = XFIXNUM (XCAR (Vtab_bar_button_margin));
-	  extra_y = XFIXNUM (XCDR (Vtab_bar_button_margin));
+	  extra_x = XFIXNUM (XCAR (Vtab_bar_button_margin)) - thick;
+	  extra_y = XFIXNUM (XCDR (Vtab_bar_button_margin)) - thick;
 	}
       else if (FIXNUMP (Vtab_bar_button_margin))
-	extra_x = extra_y = XFIXNUM (Vtab_bar_button_margin);
+	extra_x = extra_y = XFIXNUM (Vtab_bar_button_margin) - thick;
     }
 
   if (s->face->id == TOOL_BAR_FACE_ID)
modified   src/xterm.c
@@ -3235,11 +3235,11 @@ x_draw_image_relief (struct glyph_string *s)
 	  && FIXNUMP (XCAR (Vtab_bar_button_margin))
 	  && FIXNUMP (XCDR (Vtab_bar_button_margin)))
 	{
-	  extra_x = XFIXNUM (XCAR (Vtab_bar_button_margin));
-	  extra_y = XFIXNUM (XCDR (Vtab_bar_button_margin));
+	  extra_x = XFIXNUM (XCAR (Vtab_bar_button_margin)) - thick;
+	  extra_y = XFIXNUM (XCDR (Vtab_bar_button_margin)) - thick;
 	}
       else if (FIXNUMP (Vtab_bar_button_margin))
-	extra_x = extra_y = XFIXNUM (Vtab_bar_button_margin);
+	extra_x = extra_y = XFIXNUM (Vtab_bar_button_margin) - thick;
     }
 
   if (s->face->id == TOOL_BAR_FACE_ID)

-- 
Alan Third





  reply	other threads:[~2021-09-08 16:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87eea2cebb.fsf.ref@yahoo.com>
2021-09-06  8:12 ` bug#50424: 27.2; Tab bar button mouse face not clearing entirely Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-06 10:50   ` Eli Zaretskii
2021-09-06 11:31     ` Stephen Berman
2021-09-06 11:46       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-06 12:00     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-06 12:30     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-06 17:39       ` Eli Zaretskii
2021-09-07  0:30         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-07 10:41           ` Eli Zaretskii
2021-09-07 13:02             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-07 13:12               ` Eli Zaretskii
2021-09-07 23:13             ` Alan Third
2021-09-08  6:05               ` Eli Zaretskii
2021-09-08 16:57                 ` Alan Third [this message]
2021-09-11 12:11                   ` Eli Zaretskii
2021-09-11 18:49                   ` Juri Linkov
2021-09-11 19:41                     ` Eli Zaretskii
2021-09-11 19:45                       ` Juri Linkov
2021-09-12  3:46                         ` Eli Zaretskii
2021-09-12  6:05                           ` Eli Zaretskii
2021-09-12  7:06                           ` Juri Linkov
2021-09-12  8:35                             ` Eli Zaretskii
2021-09-12 16:06                               ` Juri Linkov
2021-09-12 16:25                                 ` Eli Zaretskii
2021-09-13  7:59                                   ` Juri Linkov
2021-09-13 11:59                                     ` Eli Zaretskii
2021-09-11 19:43                     ` Juri Linkov
2021-09-12  3:50                       ` Eli Zaretskii

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=YTjrjq5jCS4DFZXh@idiocy.org \
    --to=alan@idiocy.org \
    --cc=50424@debbugs.gnu.org \
    --cc=eliz@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).