On Sun, 24 Nov 2019 at 11:12, Hiltjo Posthuma <[email protected]>
wrote:

> On Sat, Nov 23, 2019 at 08:29:39PM +0100, Harm te Hennepe wrote:
> > ST stopped sending mouse drag events after any ButtonRelease event was
> > received. For example if you were dragging and then scrolled the mouse,
> > the dragging events stopped.
> >
> > Fixed this by locking the dragging button to the first button pressed.
> > ST will keep sending drag events for that button until that button is
> > released.
> > ---
> >  x.c | 18 ++++++++++--------
> >  1 file changed, 10 insertions(+), 8 deletions(-)
> >
> > diff --git a/x.c b/x.c
> > index bc3ad5a..b53ede6 100644
> > --- a/x.c
> > +++ b/x.c
> > @@ -246,8 +246,6 @@ static char *opt_line  = NULL;
> >  static char *opt_name  = NULL;
> >  static char *opt_title = NULL;
> >
> > -static int oldbutton = 3; /* button event on startup: 3 = release */
> > -
> >  void
> >  clipcopy(const Arg *dummy)
> >  {
> > @@ -362,6 +360,7 @@ mousereport(XEvent *e)
> >           button = e->xbutton.button, state = e->xbutton.state;
> >       char buf[40];
> >       static int ox, oy;
> > +     static int dragbutton = -1; /* -1 = off */
> >
> >       /* from urxvt */
> >       if (e->xbutton.type == MotionNotify) {
> > @@ -370,10 +369,10 @@ mousereport(XEvent *e)
> >               if (!IS_SET(MODE_MOUSEMOTION) && !IS_SET(MODE_MOUSEMANY))
> >                       return;
> >               /* MOUSE_MOTION: no reporting if no button is pressed */
> > -             if (IS_SET(MODE_MOUSEMOTION) && oldbutton == 3)
> > +             if (IS_SET(MODE_MOUSEMOTION) && dragbutton == -1)
> >                       return;
> >
> > -             button = oldbutton + 32;
> > +             button = dragbutton + 32;
> >               ox = x;
> >               oy = y;
> >       } else {
> > @@ -385,11 +384,14 @@ mousereport(XEvent *e)
> >                               button += 64 - 3;
> >               }
> >               if (e->xbutton.type == ButtonPress) {
> > -                     oldbutton = button;
> > -                     ox = x;
> > -                     oy = y;
> > +                     if (dragbutton == -1) {
> > +                             dragbutton = button;
> > +                             ox = x;
> > +                             oy = y;
> > +                     }
> >               } else if (e->xbutton.type == ButtonRelease) {
> > -                     oldbutton = 3;
> > +                     if (button == dragbutton)
> > +                             dragbutton = -1;
> >                       /* MODE_MOUSEX10: no button release reporting */
> >                       if (IS_SET(MODE_MOUSEX10))
> >                               return;
> > --
> > 2.20.1
> >
> >
>
> Hi,
>
> I cannot reproduce this issue while selecting text and scrolling or when
> selecting text and pressing and releasing the right-mouse button for
> example.
>
> Also I think the patch looks good by itself, but maybe would then break
> some
> other use-case?
>
> Can you try this against the git version without any patches (and maybe
> give more
> information about the used programs)?
>
> --
> Kind regards,
> Hiltjo
>

Hi,

This patch is about applications running in a terminal requesting dragging
events, for example with '\e[?1002h' and '\e[?1006h'.

My issue is with tmux 2.8 and 'mouse on'. After selecting some text, and
then scrolling the mouse, I can't continue selecting text, because tmux
doesn't receive drag events anymore. Xterm and libvte-based terminals keeps
sending drag events after mouse scroll or after another button is
pressed/released.

Kind regards,
Harm te Hennepe

Reply via email to