[fpc-pascal] Timer in X11
Henry Vermaak
henry.vermaak at gmail.com
Wed Dec 21 13:41:49 CET 2011
On 21/12/11 11:53, Henry Vermaak wrote:
> On 21/12/11 11:06, Felipe Monteiro de Carvalho wrote:
>> Hello,
>>
>> Does anyone know what would be the solution for implementing timer
>> support in a X11 toolkit? I already have TTimer support implemented
>> for LCL-CustomDrawn-Windows, Cocoa and Android (but Android is the
>> best tested of them), but it looks like X11 has no support for timers,
>> so I wonder what the best approach would be to solve this.
>
> Roll your own event loop by calling select() on the XConnectionNumber
> (which is a file descriptor). You can then use the select() timeout, or
> use timerfd* functions under linux. Google around to find examples.
Also note that when doing this, you'll have to make sure you check for
all the internal connections that X opens/closes. You can do this with
XAddConnectionWatch(). The callback will give you a file descriptor
that you can add/remove to/from the set of file descriptors you a
monitoring with select().
Henry
More information about the fpc-pascal
mailing list