[Xcb] Catch events from external window

Peter Harris pharris at opentext.com
Thu Nov 25 12:43:12 PST 2010


On 2010-11-25 15:25, Borys Igor Polevoj wrote:
> Hi guys,
> I want to write an application which finds a current focus window and 
> counts
> mouse and keyboard clicks for it.
> I retrieve focus window id with xcb_get_input_focus function.
> How can I catch/signalize my application about events for the given id?
> I used XSelectInput from XLib but this function turned out to be 
> insufficient
> since I couldn't catch mouse button up/down events with it.
> Is there something eqivalent to XSelectInput in XCB,

XSelectInput does an XChangeWindowAttributes. So
xcb_change_window_attributes is the function you need to change the
event mask of an arbitrary window. And, yes, it doesn't work for buttons
if the app in question has already selected for button events.

I heartily recommend Appendix G of ISBN 1-56592-083-X to anybody porting
Xlib apps.

> or maybe there is
> any alternative way to achive my goal? Any trick? Utility module 
> (documentation is very laconic) ?

Take a look at the xevie extension.

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