From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#50424: 27.2; Tab bar button mouse face not clearing entirely Date: Tue, 07 Sep 2021 13:41:38 +0300 Message-ID: <83ilzcpt0d.fsf@gnu.org> References: <87eea2cebb.fsf.ref@yahoo.com> <87eea2cebb.fsf@yahoo.com> <83eea2rn8z.fsf@gnu.org> <87h7exc2dk.fsf@yahoo.com> <83lf49r4bc.fsf@gnu.org> <87czplb51o.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11783"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50424@debbugs.gnu.org To: Po Lu , Juri Linkov , Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 07 12:42:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNYYO-0002qj-OZ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Sep 2021 12:42:12 +0200 Original-Received: from localhost ([::1]:39456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNYYM-0006EF-PP for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Sep 2021 06:42:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNYYE-0006E7-7Y for bug-gnu-emacs@gnu.org; Tue, 07 Sep 2021 06:42:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43916) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mNYYD-0002sv-Vk for bug-gnu-emacs@gnu.org; Tue, 07 Sep 2021 06:42:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mNYYD-0005IE-Mp for bug-gnu-emacs@gnu.org; Tue, 07 Sep 2021 06:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Sep 2021 10:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50424 X-GNU-PR-Package: emacs Original-Received: via spool by 50424-submit@debbugs.gnu.org id=B50424.163101130220319 (code B ref 50424); Tue, 07 Sep 2021 10:42:01 +0000 Original-Received: (at 50424) by debbugs.gnu.org; 7 Sep 2021 10:41:42 +0000 Original-Received: from localhost ([127.0.0.1]:55462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNYXt-0005Hc-NY for submit@debbugs.gnu.org; Tue, 07 Sep 2021 06:41:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNYXr-0005HP-4n for 50424@debbugs.gnu.org; Tue, 07 Sep 2021 06:41:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43970) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNYXk-0002M0-8S; Tue, 07 Sep 2021 06:41:32 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4551 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNYXj-0007wP-Pa; Tue, 07 Sep 2021 06:41:32 -0400 In-Reply-To: <87czplb51o.fsf@yahoo.com> (message from Po Lu on Tue, 07 Sep 2021 08:30:43 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:213677 Archived-At: > From: Po Lu > Cc: 50424@debbugs.gnu.org > Date: Tue, 07 Sep 2021 08:30:43 +0800 > > >> I have attached two images detailing the difference, and additionally, > >> an image of the bug on X. > > > > Thanks, but which one is which, and which one(s) show the bug? > > Are the descriptions not visible for you? What descriptions? I only see the file names. > If so, the following should help: > > "Screenshot from 2021-09-06 20-27-24" depicts the relief drawn on > MS-Windows. (Which does not exhibit the bug) > > "Screenshot from 2021-09-06 20-28-53" depicts the relief drawn on > X-windows. > > "Screenshot from 2021-09-06 20-30-11" depicts the bug on X-windows. Thanks. I think I understand what is going on there: the definitions of the button margins and relief are incorrect. I show below the code which sets up the tool-bar buttons to display correctly both when the mouse is over a button and when the mouse moves off the button. As you see, there's a subtle dance with the computed values of the image margins and relief, depending on whether the button is selected or not and whether auto-raise-tool-bar-buttons is on or off. The computed values of the margin and the relief are then injected into the image spec of the button. By contrast, the corresponding spec of the tab-bar buttons specifies a fixed margin, and specifies no relief at all: (add-text-properties 0 (length tab-bar-new-button) `(display (image :type xpm :file "tabs/new.xpm" :margin (2 . 0) :ascent center)) Moreover, the value of :margin here is inconsistent with the value of tab-bar-button-margin. And there's no code there which attempts to do the same job for tab-bar buttons' margins and relief as xdisp.c does for tool-bar buttons (see below). I've fixed tab-bar.el to request the same margin as specified by tab-bar-button-margin, and I also fixed the code in w32term.c and xterm.c which used the corresponding tool-bar values when tab-bar values should have been used. This improved the situation to some extent, but we still leave behind an artifact when the mouse moves off the tab-bar button: a 1-pixel vertical line. I think that's because there's no relief definition in the image, but the value of tab-bar-button-relief is non-zero (and xterm.c/w32term.c use that non-zero value when they redraw the buttons). 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. Here's the code which sets up margins and relief on tool-bar buttons: /* Display the tool-bar button pressed, or depressed. */ plist = Fcopy_sequence (XCDR (image)); /* Compute margin and relief to draw. */ relief = (tool_bar_button_relief >= 0 ? min (tool_bar_button_relief, min (INT_MAX, MOST_POSITIVE_FIXNUM)) : DEFAULT_TOOL_BAR_BUTTON_RELIEF); hmargin = vmargin = relief; if (RANGED_FIXNUMP (1, Vtool_bar_button_margin, INT_MAX - max (hmargin, vmargin))) { hmargin += XFIXNAT (Vtool_bar_button_margin); vmargin += XFIXNAT (Vtool_bar_button_margin); } else if (CONSP (Vtool_bar_button_margin)) { if (RANGED_FIXNUMP (1, XCAR (Vtool_bar_button_margin), INT_MAX - hmargin)) hmargin += XFIXNAT (XCAR (Vtool_bar_button_margin)); if (RANGED_FIXNUMP (1, XCDR (Vtool_bar_button_margin), INT_MAX - vmargin)) vmargin += XFIXNAT (XCDR (Vtool_bar_button_margin)); } if (auto_raise_tool_bar_buttons_p) { /* Add a `:relief' property to the image spec if the item is selected. */ if (selected_p) { plist = Fplist_put (plist, QCrelief, make_fixnum (-relief)); hmargin -= relief; vmargin -= relief; } } else { /* If image is selected, display it pressed, i.e. with a negative relief. If it's not selected, display it with a raised relief. */ plist = Fplist_put (plist, QCrelief, (selected_p ? make_fixnum (-relief) : make_fixnum (relief))); hmargin -= relief; vmargin -= relief; } /* Put a margin around the image. */ if (hmargin || vmargin) { if (hmargin == vmargin) plist = Fplist_put (plist, QCmargin, make_fixnum (hmargin)); else plist = Fplist_put (plist, QCmargin, Fcons (make_fixnum (hmargin), make_fixnum (vmargin))); }