st 27. 1. 2021 v 0:23 odesílatel Thomas Dickey <
dickey@his.com> napsal:
On Mon, Jan 25, 2021 at 06:42:36PM +0100, Pavel Stehule wrote:
> Hi
>
> I try to implement drag support for my ncurses application. I found an
> example
>
> https://gist.github.com/sylt/93d3f7b77e7f3a881603#file-ncurses_mouse_movement-c
>
> It worked almost well, with two exceptions.
Just reading the source code, I see an error: the printf's are not fflush'd.
As a result, the control sequence may be corrupted and ignored.
I have an equivalent test in ncurses (test/ncurses.c, menu A or a).
That works fairly reliable (with xterm of course).
I am testing this example, and it doesn't work like I expect. ncurses does only two events - click press and click release.
There are no "mouse - move" events. I need to get events when the user presses left click and try to move with the mouse.
Regards
Pavel
Wheel mice are a special problem, if you attempt to push button 2
(the wheel itself), that's likely to produce other buttons (6 or 7).
But I recall improving that a while back (and in my quick check,
it seems okay: just reporting position).
> When I use the mouse wheel, the mouse is in some strange state, and when I
> try to move with the mouse, then it generates events like the left button
> is pressed, but no button is pressed. After left click the behaviour is
> returned to normal.
>
> Second issue, that I can see, are a few false events. Although I did only
> mouse move, it generates the same mouse event like mouse click.
>
> Name : ncurses
> Version : 6.2
> Release : 3.20200222.fc33
> Architecture : x86_64
> Size : 608 k
> Source : ncurses-6.2-3.20200222.fc33.src.rpm
> Repository : @System
> >From repo : anaconda
> Summary : Ncurses support utilities
> URL : https://invisible-island.net/ncurses/ncurses.html
> License : MIT
>
> Is there some way to implement drag correctly?
>
> Regards
>
> Pavel Stehule
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net