bug-ncurses
[Top][All Lists]
Advanced

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

export _mouse_fd for select(2)


From: sgerwk
Subject: export _mouse_fd for select(2)
Date: Tue, 25 Jun 2019 08:34:33 +0000 (UTC)

Currently, one can include STDIN_FILENO in a select(2), and then call getch() if input is available on stdin. This allows for a main loop that also wait on other file descriptors, signals and a timeout. Unfortunataly, the mouse cannot be included in this select because the _mouse_fd field of the SCREEN structure is private. 

A workaroud is to have a thread call getch() in blocking mode and then serve the result on a pipe whose other end goes in the select. But this solution seems awkward to me, especially considering that STDIN_FILENO is instead always available to the application, and compared with having a function like getmousefd() that returns _mouse_fd. 

This function would be similar to ConnectionNumber(Display *) in XWindow: it returns a file descriptor to be used in a select, so that the application may then call XNextEvent() or similar if something can be read there. I believe it is not supposed to be used in any other way. 


reply via email to

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