unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 5743b74d4b 1/2: Improve mouse dragging
@ 2022-05-12  7:31 Eli Zaretskii
  2022-05-12 12:03 ` Po Lu
  0 siblings, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-12  7:31 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> branch: master
> commit 5743b74d4b2e06ace233d6b170f193a72633f218
> Author: Po Lu <luangruo@yahoo.com>
> Commit: Po Lu <luangruo@yahoo.com>
> 
>     Improve mouse dragging
>     
>     * lisp/mouse.el (mouse-drag-and-drop-region-display-tooltip):
>     Respect foreground and background parameters.
>     (mouse-drag-and-drop-region): Enable fine grained tracking.
> ---
>  lisp/mouse.el | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/lisp/mouse.el b/lisp/mouse.el
> index 0446bc6dd8..4b5f6ed223 100644
> --- a/lisp/mouse.el
> +++ b/lisp/mouse.el
> @@ -3017,7 +3017,15 @@ highlight the original region when
>    "Display TOOLTIP, a tooltip string, using `x-show-tip'.
>  Call `tooltip-show-help-non-mode' instead on non-graphical displays."
>    (if (display-graphic-p)
> -      (x-show-tip tooltip)
> +      (let ((params (copy-sequence tooltip-frame-parameters))
> +	    (fg (face-attribute 'tooltip :foreground))
> +	    (bg (face-attribute 'tooltip :background)))
> +	(when (stringp fg)
> +	  (setf (alist-get 'foreground-color params) fg)
> +	  (setf (alist-get 'border-color params) fg))
> +	(when (stringp bg)
> +	  (setf (alist-get 'background-color params) bg))
> +        (x-show-tip tooltip nil params))
>      (tooltip-show-help-non-mode tooltip)))

Maybe I'm missing something here, but this seems to force the faces of
the tooltip frames to follow the attributes of faces of the frame that
is the selected frame when the tooltip is shown.  Since faces are
per-frame, why is this a good idea, and what problems does the above
change attempt to solve?  (And why do we force the border color to be
the same as the tooltip-frame's foreground color?)



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12  7:31 master 5743b74d4b 1/2: Improve mouse dragging Eli Zaretskii
@ 2022-05-12 12:03 ` Po Lu
  2022-05-12 12:47   ` Eli Zaretskii
  0 siblings, 1 reply; 27+ messages in thread
From: Po Lu @ 2022-05-12 12:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Maybe I'm missing something here, but this seems to force the faces of
> the tooltip frames to follow the attributes of faces of the frame that
> is the selected frame when the tooltip is shown.  Since faces are
> per-frame, why is this a good idea, and what problems does the above
> change attempt to solve?  (And why do we force the border color to be
> the same as the tooltip-frame's foreground color?)

The code is similar to that in `tooltip-show' (which the mouse dragging
code used to use), and without it the colors in the `tooltip' face are
not respected when creating the tooltip frame.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 12:03 ` Po Lu
@ 2022-05-12 12:47   ` Eli Zaretskii
  2022-05-12 13:02     ` Po Lu
  0 siblings, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-12 12:47 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Thu, 12 May 2022 20:03:23 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Maybe I'm missing something here, but this seems to force the faces of
> > the tooltip frames to follow the attributes of faces of the frame that
> > is the selected frame when the tooltip is shown.  Since faces are
> > per-frame, why is this a good idea, and what problems does the above
> > change attempt to solve?  (And why do we force the border color to be
> > the same as the tooltip-frame's foreground color?)
> 
> The code is similar to that in `tooltip-show' (which the mouse dragging
> code used to use), and without it the colors in the `tooltip' face are
> not respected when creating the tooltip frame.

Why are they not respected?  I see the correct colors in the tooltips
in Emacs 28, so it does seem to work.  What am I missing?



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 12:47   ` Eli Zaretskii
@ 2022-05-12 13:02     ` Po Lu
  2022-05-12 13:12       ` Eli Zaretskii
  2022-05-12 15:49       ` [External] : " Drew Adams
  0 siblings, 2 replies; 27+ messages in thread
From: Po Lu @ 2022-05-12 13:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Why are they not respected?  I see the correct colors in the tooltips
> in Emacs 28, so it does seem to work.  What am I missing?

We used to use `tooltip-show' directly in Emacs 28, but that function
modifies the text properties of `text-tooltip', which caused mouse
dragging to drag along some undesirable text properties.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 13:02     ` Po Lu
@ 2022-05-12 13:12       ` Eli Zaretskii
  2022-05-12 13:20         ` Eli Zaretskii
  2022-05-12 13:23         ` Po Lu
  2022-05-12 15:49       ` [External] : " Drew Adams
  1 sibling, 2 replies; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-12 13:12 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Thu, 12 May 2022 21:02:10 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Why are they not respected?  I see the correct colors in the tooltips
> > in Emacs 28, so it does seem to work.  What am I missing?
> 
> We used to use `tooltip-show' directly in Emacs 28, but that function
> modifies the text properties of `text-tooltip', which caused mouse
> dragging to drag along some undesirable text properties.

"Used to use"?  And now we don't?  But your changes are in
tooltip-show, so if we don't use it anymore, why the changes?

Could you possibly post a more detailed response, one which would
explain that change starting from how this stuff behaves in Emacs 28
and why we needed to change it in Emacs 29, without omitting any
crucial details?



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 13:12       ` Eli Zaretskii
@ 2022-05-12 13:20         ` Eli Zaretskii
  2022-05-12 13:25           ` Po Lu
  2022-05-12 13:23         ` Po Lu
  1 sibling, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-12 13:20 UTC (permalink / raw)
  To: luangruo; +Cc: emacs-devel

> Date: Thu, 12 May 2022 16:12:10 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> your changes are in tooltip-show

This part was due to a confusion on my part, sorry.

But all the rest still stands.  In particular:

  . what do you mean by "causes mouse dragging to drag along some
    undesirable text properties"?
  . why the code you copied from tooltip.el to mouse.el doesn't call
    add-face-text-property like tooltip does?



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 13:12       ` Eli Zaretskii
  2022-05-12 13:20         ` Eli Zaretskii
@ 2022-05-12 13:23         ` Po Lu
  2022-05-12 13:51           ` Eli Zaretskii
  1 sibling, 1 reply; 27+ messages in thread
From: Po Lu @ 2022-05-12 13:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> "Used to use"?  And now we don't?  But your changes are in
> tooltip-show, so if we don't use it anymore, why the changes?

My changes are in `mouse-drag-and-drop-region-display-tooltip', which is
used by the `mouse-drag-and-drop-region' feature to display a tooltip
that follows the mouse.  I didn't touch `tooltip-show' at all.

> Could you possibly post a more detailed response, one which would
> explain that change starting from how this stuff behaves in Emacs 28
> and why we needed to change it in Emacs 29, without omitting any
> crucial details?

The behavior in Emacs 28 is a serious bug (and a regression from Emacs
27) caused by the code that lets Emacs 28 display variable-width fonts
in tooltips, but apparently nobody was using that particular feature
during the entire development process of Emacs 28, so it wasn't found in
time for the release.

That code would add text properties to the `text' argument to
`x-show-tip', which is bad, because `mouse-drag-and-drop-region'
reinserts the string passed as `text' into the buffer the mouse was
dropped on top of afterwards, which causes the inserted text to be
propertized with the wrong face.

I fixed that bug in `mouse-drag-and-drop-region' this March by making it
use `x-show-tip' directly instead of `tooltip-show' (it is safe because
we don't do anything `tooltip-show' would not.)  But it turns out that
`tooltip-show' does some processing on the frame parameters to make them
reflect the background and foreground colors of the tooltip face before
passing them to `x-show-tip', the absence of which caused tooltip colors
set by some themes to not take effect in tooltips shown while dragging
text, which is what this change fixes.  That was fixed by this change.

Thanks.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 13:20         ` Eli Zaretskii
@ 2022-05-12 13:25           ` Po Lu
  0 siblings, 0 replies; 27+ messages in thread
From: Po Lu @ 2022-05-12 13:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>   . why the code you copied from tooltip.el to mouse.el doesn't call
>     add-face-text-property like tooltip does?

Because that's the problem: that code was added in Emacs 28, and it adds
text properties to the tooltip text that interferes with
`mouse-drag-and-drop-region', causing a regression from Emacs 27 that
was fixed in an earlier change.  (Which indirectly led to the bug that
this change fixes.)



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 13:23         ` Po Lu
@ 2022-05-12 13:51           ` Eli Zaretskii
  2022-05-13  0:27             ` Po Lu
  0 siblings, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-12 13:51 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Thu, 12 May 2022 21:23:19 +0800
> 
> That code would add text properties to the `text' argument to
> `x-show-tip', which is bad, because `mouse-drag-and-drop-region'
> reinserts the string passed as `text' into the buffer the mouse was
> dropped on top of afterwards, which causes the inserted text to be
> propertized with the wrong face.

I see no argument named 'text' in that function, so I'm not sure I
understand what you are alluding to.

In any case, if the problem is that some text was modified that later
has to be inserted, a simple copy-sequence should have solved that,
no?



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

* RE: [External] : Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 13:02     ` Po Lu
  2022-05-12 13:12       ` Eli Zaretskii
@ 2022-05-12 15:49       ` Drew Adams
  2022-05-13  0:28         ` Po Lu
  1 sibling, 1 reply; 27+ messages in thread
From: Drew Adams @ 2022-05-12 15:49 UTC (permalink / raw)
  To: Po Lu, Eli Zaretskii; +Cc: emacs-devel@gnu.org

> We used to use `tooltip-show' directly in Emacs 28, but that function
> modifies the text properties of `text-tooltip', which caused mouse
> dragging to drag along some undesirable text properties.

Use `x-show-tip'.  Specify whatever you like.

E.g.:
(x-show-tip (propertize STRING 'face FACE-YOU-WANT)
            nil
            nil
            TIMEOUT-YOU-WANT)

Or bind the relevant variable(s) around a call to
`tooltip-show', if you like to jump through hoops
and you really don't want to call `x-show-tip'.




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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 13:51           ` Eli Zaretskii
@ 2022-05-13  0:27             ` Po Lu
  2022-05-13  6:00               ` Eli Zaretskii
  0 siblings, 1 reply; 27+ messages in thread
From: Po Lu @ 2022-05-13  0:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> I see no argument named 'text' in that function, so I'm not sure I
> understand what you are alluding to.

I meant the `string' argument, sorry.

> In any case, if the problem is that some text was modified that later
> has to be inserted, a simple copy-sequence should have solved that,
> no?

That wasn't the only problem, apparently the modifications also
interfered with the display of the tooltip.



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

* Re: [External] : Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-12 15:49       ` [External] : " Drew Adams
@ 2022-05-13  0:28         ` Po Lu
  2022-05-13  1:49           ` Drew Adams
  0 siblings, 1 reply; 27+ messages in thread
From: Po Lu @ 2022-05-13  0:28 UTC (permalink / raw)
  To: Drew Adams; +Cc: Eli Zaretskii, emacs-devel@gnu.org

Drew Adams <drew.adams@oracle.com> writes:

> Use `x-show-tip'.  Specify whatever you like.
>
> E.g.:
> (x-show-tip (propertize STRING 'face FACE-YOU-WANT)
>             nil
>             nil
>             TIMEOUT-YOU-WANT)

Setting params to nil will cause various bugs, including the user's
tooltip color customizations not being respected.



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

* RE: [External] : Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13  0:28         ` Po Lu
@ 2022-05-13  1:49           ` Drew Adams
  2022-05-13  3:42             ` Po Lu
  0 siblings, 1 reply; 27+ messages in thread
From: Drew Adams @ 2022-05-13  1:49 UTC (permalink / raw)
  To: Po Lu; +Cc: Eli Zaretskii, emacs-devel@gnu.org

> > Use `x-show-tip'.  Specify whatever you like.
> > E.g.:
> > (x-show-tip (propertize STRING 'face FACE-YOU-WANT)
> >             nil
> >             nil
> >             TIMEOUT-YOU-WANT)
> 
> Setting params to nil will cause various bugs,
> including the user's tooltip color customizations
> not being respected.

Really?

Setting an arg to nil _"causes"_ bugs?
And this though nil is a documented
valid value for optional arg PARMS?
Good golly!

And what do you mean by "the user's
tooltip color customizations"?  There's
nothing in that call that makes any use
or mention of anything user-defined.

With such a call no user should expect
anything related to anything they've
customized (unless it's FACE-YOU-WANT
that they've customized - and a face
customization is surely respected).

I wonder, did you actually try what I
suggested?

Anyway I don't see any such sky-falling.
I use such code with no problem.

But then, I don't use the latest and
greatest development of Emacs.

Perhaps some innovative regressions have
been introduced in Emacs 28, or later.
On n'arrete pas le progres...



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

* Re: [External] : Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13  1:49           ` Drew Adams
@ 2022-05-13  3:42             ` Po Lu
  2022-05-13 15:30               ` Drew Adams
  0 siblings, 1 reply; 27+ messages in thread
From: Po Lu @ 2022-05-13  3:42 UTC (permalink / raw)
  To: Drew Adams; +Cc: Eli Zaretskii, emacs-devel@gnu.org

Drew Adams <drew.adams@oracle.com> writes:

> Setting an arg to nil _"causes"_ bugs?
> And this though nil is a documented
> valid value for optional arg PARMS?
> Good golly!
>
> And what do you mean by "the user's
> tooltip color customizations"?  There's
> nothing in that call that makes any use
> or mention of anything user-defined.

The `tooltip' face will not affect the background and border colors of
the created tooltip frame, and nor will `tooltip-frame-parameters'.

Which is a bug in `mouse-drag-and-drop-region', and arguably a bug
everywhere else as well.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13  0:27             ` Po Lu
@ 2022-05-13  6:00               ` Eli Zaretskii
  2022-05-13  7:05                 ` Po Lu
  0 siblings, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-13  6:00 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 13 May 2022 08:27:08 +0800
> 
> > In any case, if the problem is that some text was modified that later
> > has to be inserted, a simple copy-sequence should have solved that,
> > no?
> 
> That wasn't the only problem, apparently the modifications also
> interfered with the display of the tooltip.

I'm not sure I understand.  Do you remember the details of tis
interference?  If not, can you reimplement this using tooltip-show and
string copying, and tell what problems that yields?  I really don't
want to have the tricky code that sets up colors in tooltip-show to be
in more than one place, it's a maintenance problem waiting to happen.

Thanks.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13  6:00               ` Eli Zaretskii
@ 2022-05-13  7:05                 ` Po Lu
  2022-05-13  7:36                   ` Eli Zaretskii
  0 siblings, 1 reply; 27+ messages in thread
From: Po Lu @ 2022-05-13  7:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> I'm not sure I understand.  Do you remember the details of tis
> interference?  If not, can you reimplement this using tooltip-show and
> string copying, and tell what problems that yields?  I really don't
> want to have the tricky code that sets up colors in tooltip-show to be
> in more than one place, it's a maintenance problem waiting to happen.

The immediate problem is that the tooltip contents get displayed in a
proportional font, which makes no sense when dragging monospace text.

IIRC there was also a problem involving `tooltip-hide-delay' and
help-echo events, but I don't remember the details of that well enough
to reproduce it.

Thanks.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13  7:05                 ` Po Lu
@ 2022-05-13  7:36                   ` Eli Zaretskii
  2022-05-13  7:49                     ` Po Lu
  0 siblings, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-13  7:36 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 13 May 2022 15:05:39 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I'm not sure I understand.  Do you remember the details of tis
> > interference?  If not, can you reimplement this using tooltip-show and
> > string copying, and tell what problems that yields?  I really don't
> > want to have the tricky code that sets up colors in tooltip-show to be
> > in more than one place, it's a maintenance problem waiting to happen.
> 
> The immediate problem is that the tooltip contents get displayed in a
> proportional font, which makes no sense when dragging monospace text.

This can be countermanded by using a variant of tooltip-face that
doesn't specify the variable-pitch inheritance.

In general, though, the text should have the same typeface as the
region you are dragging, right?  IOW, if the region you are dragging
uses variable-pitch, the tooltip should use that as well.

I would suggest refactoring tooltip-show and possibly the 'tooltip'
face as well, so that use of the variable-pitch attribute could be
controlled by the caller if the tooltips are used for something other
than their original goal.  As currently implemented, tooltip-show is
really unsuitable for being called in any other context, so our
recommendation to use it, and not x-show-tip, effectively stands on
the proverbial feet of clay.

> IIRC there was also a problem involving `tooltip-hide-delay' and
> help-echo events, but I don't remember the details of that well enough
> to reproduce it.

That is unfortunate.  I'd really prefer that we could call
tooltip-show in mouse.el, not x-show-tip.  So if you can afford that,
please try reproducing the problems, and let's convert mouse.el to
using tooltip-show.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13  7:36                   ` Eli Zaretskii
@ 2022-05-13  7:49                     ` Po Lu
  2022-05-13 10:32                       ` Eli Zaretskii
  0 siblings, 1 reply; 27+ messages in thread
From: Po Lu @ 2022-05-13  7:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> This can be countermanded by using a variant of tooltip-face that
> doesn't specify the variable-pitch inheritance.
>
> In general, though, the text should have the same typeface as the
> region you are dragging, right?  IOW, if the region you are dragging
> uses variable-pitch, the tooltip should use that as well.

Yes.  But in most cases the user will be dragging text, which in Emacs
is typically fixed-pitch.

> I would suggest refactoring tooltip-show and possibly the 'tooltip'
> face as well, so that use of the variable-pitch attribute could be
> controlled by the caller if the tooltips are used for something other
> than their original goal.

I will look into that.  Adding a FACE argument to `tooltip-show' that
specifies the face to use for the tooltip text and colors instead of
hard-coding `tooltip' could work neatly, I think.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13  7:49                     ` Po Lu
@ 2022-05-13 10:32                       ` Eli Zaretskii
  2022-05-13 11:10                         ` Po Lu
  0 siblings, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-13 10:32 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 13 May 2022 15:49:27 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > This can be countermanded by using a variant of tooltip-face that
> > doesn't specify the variable-pitch inheritance.
> >
> > In general, though, the text should have the same typeface as the
> > region you are dragging, right?  IOW, if the region you are dragging
> > uses variable-pitch, the tooltip should use that as well.
> 
> Yes.  But in most cases the user will be dragging text, which in Emacs
> is typically fixed-pitch.

That is in no way a given.  For example, text displayed by EWW is not
fixed-pitch at all.

> > I would suggest refactoring tooltip-show and possibly the 'tooltip'
> > face as well, so that use of the variable-pitch attribute could be
> > controlled by the caller if the tooltips are used for something other
> > than their original goal.
> 
> I will look into that.  Adding a FACE argument to `tooltip-show' that
> specifies the face to use for the tooltip text and colors instead of
> hard-coding `tooltip' could work neatly, I think.

Yes, I think so.  Thanks.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13 10:32                       ` Eli Zaretskii
@ 2022-05-13 11:10                         ` Po Lu
  2022-05-13 12:08                           ` Eli Zaretskii
  2022-05-13 12:16                           ` Eli Zaretskii
  0 siblings, 2 replies; 27+ messages in thread
From: Po Lu @ 2022-05-13 11:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> That is in no way a given.  For example, text displayed by EWW is not
> fixed-pitch at all.

Which will be respected now, but not in Emacs 28, where any text will be
displayed in a variable-pitch face.

Thanks.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13 11:10                         ` Po Lu
@ 2022-05-13 12:08                           ` Eli Zaretskii
  2022-05-13 12:45                             ` Po Lu
  2022-05-13 12:16                           ` Eli Zaretskii
  1 sibling, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-13 12:08 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 13 May 2022 19:10:37 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > That is in no way a given.  For example, text displayed by EWW is not
> > fixed-pitch at all.
> 
> Which will be respected now, but not in Emacs 28, where any text will be
> displayed in a variable-pitch face.

If we come up with a safe enough fix, we could consider backporting it
to the release branch.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13 11:10                         ` Po Lu
  2022-05-13 12:08                           ` Eli Zaretskii
@ 2022-05-13 12:16                           ` Eli Zaretskii
  2022-05-13 12:46                             ` Po Lu
  1 sibling, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-13 12:16 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 13 May 2022 19:10:37 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > That is in no way a given.  For example, text displayed by EWW is not
> > fixed-pitch at all.
> 
> Which will be respected now, but not in Emacs 28, where any text will be
> displayed in a variable-pitch face.

In the change you installed (thanks!), I would suggest to rename
FRAME-FACE to DEFAULT-FACE.

Also "Emacs is built with support for system tooltips" is too vague;
suggest to mention GTK and whatever other configurations for which
this is relevant.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13 12:08                           ` Eli Zaretskii
@ 2022-05-13 12:45                             ` Po Lu
  2022-05-13 12:48                               ` Eli Zaretskii
  0 siblings, 1 reply; 27+ messages in thread
From: Po Lu @ 2022-05-13 12:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> If we come up with a safe enough fix, we could consider backporting it
> to the release branch.

I think the display issue is not serious enough to backport (and
probably can't be fixed safely).

But the tooltip face overwriting the text completely prevents any
meaningful use of `mouse-drag-and-drop-region'.  This is enough to fix
that bug alone:

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 1b9542b9b8..e5ea5475f4 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -3049,7 +3049,7 @@ mouse-drag-and-drop-region
 
           ;; Show a tooltip.
           (if mouse-drag-and-drop-region-show-tooltip
-              (tooltip-show text-tooltip)
+              (tooltip-show (copy-sequence text-tooltip))
             (tooltip-hide))
 
           ;; Show cursor and highlight the original region.

WDYT?



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13 12:16                           ` Eli Zaretskii
@ 2022-05-13 12:46                             ` Po Lu
  0 siblings, 0 replies; 27+ messages in thread
From: Po Lu @ 2022-05-13 12:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> In the change you installed (thanks!), I would suggest to rename
> FRAME-FACE to DEFAULT-FACE.
>
> Also "Emacs is built with support for system tooltips" is too vague;
> suggest to mention GTK and whatever other configurations for which
> this is relevant.

Sure, I'll do both.  Thanks.



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

* Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13 12:45                             ` Po Lu
@ 2022-05-13 12:48                               ` Eli Zaretskii
  0 siblings, 0 replies; 27+ messages in thread
From: Eli Zaretskii @ 2022-05-13 12:48 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 13 May 2022 20:45:23 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > If we come up with a safe enough fix, we could consider backporting it
> > to the release branch.
> 
> I think the display issue is not serious enough to backport (and
> probably can't be fixed safely).
> 
> But the tooltip face overwriting the text completely prevents any
> meaningful use of `mouse-drag-and-drop-region'.  This is enough to fix
> that bug alone:
> 
> diff --git a/lisp/mouse.el b/lisp/mouse.el
> index 1b9542b9b8..e5ea5475f4 100644
> --- a/lisp/mouse.el
> +++ b/lisp/mouse.el
> @@ -3049,7 +3049,7 @@ mouse-drag-and-drop-region
>  
>            ;; Show a tooltip.
>            (if mouse-drag-and-drop-region-show-tooltip
> -              (tooltip-show text-tooltip)
> +              (tooltip-show (copy-sequence text-tooltip))
>              (tooltip-hide))
>  
>            ;; Show cursor and highlight the original region.
> 
> WDYT?

This is okay for the release branch, thanks.



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

* RE: [External] : Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13  3:42             ` Po Lu
@ 2022-05-13 15:30               ` Drew Adams
  2022-05-14  0:56                 ` Po Lu
  0 siblings, 1 reply; 27+ messages in thread
From: Drew Adams @ 2022-05-13 15:30 UTC (permalink / raw)
  To: Po Lu; +Cc: Eli Zaretskii, emacs-devel@gnu.org

> > Setting an arg to nil _"causes"_ bugs?
> > And this though nil is a documented
> > valid value for optional arg PARMS?
> > Good golly!
> >
> > And what do you mean by "the user's
> > tooltip color customizations"?  There's
> > nothing in that call that makes any use
> > or mention of anything user-defined.
> 
> The `tooltip' face will not affect the background and border colors of
> the created tooltip frame, and nor will `tooltip-frame-parameters'.

Why should they?  What does this have to do
with `tooltip-*' anything?  Not everything
having to do with showing tooltips is under
the sway of `tooltip-*' functions (thank
goodness).

> Which is a bug in `mouse-drag-and-drop-region',
> and arguably a bug everywhere else as well.

I don't see that you've shown that.



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

* Re: [External] : Re: master 5743b74d4b 1/2: Improve mouse dragging
  2022-05-13 15:30               ` Drew Adams
@ 2022-05-14  0:56                 ` Po Lu
  0 siblings, 0 replies; 27+ messages in thread
From: Po Lu @ 2022-05-14  0:56 UTC (permalink / raw)
  To: Drew Adams; +Cc: Eli Zaretskii, emacs-devel@gnu.org

Drew Adams <drew.adams@oracle.com> writes:

>> Which is a bug in `mouse-drag-and-drop-region',
>> and arguably a bug everywhere else as well.
>
> I don't see that you've shown that.

It's not your or my call.  The author of that feature wrote it in a way
that respected those parameters, and after a while it didn't anymore, so
which was a bug.



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

end of thread, other threads:[~2022-05-14  0:56 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  7:31 master 5743b74d4b 1/2: Improve mouse dragging Eli Zaretskii
2022-05-12 12:03 ` Po Lu
2022-05-12 12:47   ` Eli Zaretskii
2022-05-12 13:02     ` Po Lu
2022-05-12 13:12       ` Eli Zaretskii
2022-05-12 13:20         ` Eli Zaretskii
2022-05-12 13:25           ` Po Lu
2022-05-12 13:23         ` Po Lu
2022-05-12 13:51           ` Eli Zaretskii
2022-05-13  0:27             ` Po Lu
2022-05-13  6:00               ` Eli Zaretskii
2022-05-13  7:05                 ` Po Lu
2022-05-13  7:36                   ` Eli Zaretskii
2022-05-13  7:49                     ` Po Lu
2022-05-13 10:32                       ` Eli Zaretskii
2022-05-13 11:10                         ` Po Lu
2022-05-13 12:08                           ` Eli Zaretskii
2022-05-13 12:45                             ` Po Lu
2022-05-13 12:48                               ` Eli Zaretskii
2022-05-13 12:16                           ` Eli Zaretskii
2022-05-13 12:46                             ` Po Lu
2022-05-12 15:49       ` [External] : " Drew Adams
2022-05-13  0:28         ` Po Lu
2022-05-13  1:49           ` Drew Adams
2022-05-13  3:42             ` Po Lu
2022-05-13 15:30               ` Drew Adams
2022-05-14  0:56                 ` Po Lu

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