[Xcb] keyboard/mouse input and graphics in separated threads?

Peter Harris pharris at opentext.com
Tue Dec 18 09:37:13 PST 2012


I've restored the xcb list CC.

On 2012-12-18 09:23, Christ-Jan Wijtmans wrote:
> does that mean that when i process xcb events in my input thread
> events will go missing in my graphics thread and vice versa?

"I am not able rightly to apprehend the kind of confusion of ideas that
could provoke such a question."

There is only one event queue. If you retrieve an event from the queue,
the event queue has no way to know which thread you want to process it
on (or even if you are running with multiple threads).

If you subsequently discard an event, then you have discarded the event.
Nothing more, nothing less. The event didn't go "missing", although it
might appear that way to other threads.

> On Mon, Dec 17, 2012 at 4:07 PM, Peter Harris <pharris at opentext.com> wrote:
>> On 2012-12-16 12:09, Christ-Jan Wijtmans wrote:
>>> Does the thread need to have a window mapped in order to catch such events?
>>> In my design i would like to handle input events separately from my
>>> graphics thread.
>>> I am still using only Xlib because i am using OpenGL for graphics.
>>> Would it work to just make a new thread  and use XCB in that and catch
>>> such events.
>>
>> XCB does not have a function to read only some types of events. You can
>> read events from any thread, but you'll get all of them.
>>
>> Also, the Xlib-vs-XCB event switch is a global one. You can mix Xlib and
>> XCB requests, but you can't mix event handlers on the same connection.
>>
>> Peter Harris
-- 
               Open Text Connectivity Solutions Group
Peter Harris                    http://connectivity.opentext.com/
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866


More information about the Xcb mailing list