[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: export _mouse_fd for select(2)
From: |
Thomas Dickey |
Subject: |
Re: export _mouse_fd for select(2) |
Date: |
Sat, 29 Jun 2019 19:49:06 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Jun 25, 2019 at 08:34:33AM +0000, address@hidden wrote:
> 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.
_mouse_fd is only used for the GPM dependency, which is rarely used...
--
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net
signature.asc
Description: Digital signature