read vs select on mouse events in console

Takashi Yano takashi.yano@nifty.ne.jp
Fri Dec 23 03:24:08 GMT 2022


Hi Thomas,

On Thu, 22 Dec 2022 15:55:01 +0100
Thomas Wolff wrote:
> When I added mouse notification support to the console long ago, I 
> deliberately introduced a function mouse_aware() which was common 
> between the console version of function read() and the console branch of 
> function select(), in order to make sure by design that inconsistencies 
> between them could never occur.
> Now I noticed that by some change, mouse_aware() is not used anymore in 
> select() code.
> This means that it could happen that either a mouse event would be 
> indicated by select() but then not be delivered by read(), so read() 
> could stall,
> or (possibly, not sure) the other way round, a mouse event available for 
> delivery would not be recognized by select().
> The attached test case is a rough demonstration of the issue. It uses 
> mouse mode DECSET 1000 which has a limited range of mouse coordinates.
> Run it in a maximized console, click into the upper left area, then 
> further apart toward lower right, and eventually the program will stall 
> until another key is pressed.

mouse_aware() is called from process_input_message(). Currently,
both read() and select() call process_input_message(). So,
mouse_aware() is processed in both read() and select(), I think.

Therefore, if mouse event has some problem, the cause should be
something another.

Could you please explain about your test case more detail a bit?
What are the expected behavior and the current behavior?

I tried:
1) Maximize command prompt.
2) Start \cygwin64\bin\bash -l
3) Start your test case.
4) Then, "(0)" is displayed every one second.
5) If push down mouse left button at top left corner, some message is shown.
6) Another message is shown when release mouse left button.
7) Move mouse cursor to bottom right corner.
8) Clicking mouse does not generate any message.
9) "(0)" is still displayed every one second.

Is this different from your observation? Or do you expect
different behavior?

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin-developers mailing list