bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Advice on mouse handling


From: Bryan Christ
Subject: Re: Advice on mouse handling
Date: Mon, 8 Jul 2019 09:43:26 -0500

Thomas,

Thanks for the reply.  The application on the reading end is a ncurses app.  Is there a reason that ncurses would be expecting something like a cursor key sequence?

On Sat, Jul 6, 2019 at 3:57 PM Thomas Dickey <address@hidden> wrote:
On Fri, Jul 05, 2019 at 12:47:04PM -0500, Bryan Christ wrote:
> Thomas,
>
> I've read the xterm documentation you authored and have reviewed the code
> in lib_mouse.c in order to add VT200 mouse support to my emulator.  The
> following code works well on the first mouse click, but subsequent mouse
> clicks don't seem to work at all.  After putting some debug code inside the
> conditional, I can see that each click is indeed firing and the x and y
> coords are updating.  I'm at a loss as to why writing that string to the
> underlying pty works fine once but not thereafter.  The guest application
> is built on ncurses so it would seem that if the sequence was decoded once
> correctly it should be again subsequent times.
>
> case KEY_MOUSE:
> {
>   if(has_mouse() == TRUE && vterm->mouse == VTERM_MOUSE_VT200)
>   {
>     if(getmouse(&mouse_event) == OK)
>     {
>       if(mouse_event.bstate & BUTTON1_CLICKED)
>       {
>         dynbuf = strdup_printf("\e[M%c%c%c\e[M%c%c%c",
>           (char)(32 + 0 + 0),
>           (char)(32 + mouse_event.x),
>           (char)(32 + mouse_event.y),
>           (char)(32 + 0 + 0x40),
>           (char)(32 + mouse_event.x),
>           (char)(32 + mouse_event.y));
>         }

perhaps it's not flushed, or else what's reading it expects a regular
ANSI control (like a cursor-key) which ends with a character like 'D' or '~'.

>         buffer = dynbuf;
>       }
>     }
>     break;
>
> --
> Bryan
> <><

> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-ncurses


--
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net


--
Bryan
<><

reply via email to

[Prev in Thread] Current Thread [Next in Thread]