Hello,<br><br>To be clear, all I need is to listen to pointer (mouse) motion/buttons events globally. I want to be notified about every pointer move on every screen (without respect to on what window pointer was when moving and to what window has grabed it).<br>
<br>I found 3 ways to do it:<br><br>1. Poll it (like in xeyes). It is not the way I really need it. If polling interval will be long, I will not receive enough motion event to be smooth. Short polling interval just wastes CPU cycles.<br>
<br>2. Receive MotionNotify from every window (the synergy way). The idea is to select MotionNotify event for every window on every screen. We will also need to select CreateNotify event to select MotionNotify for newly created windows. The bad side of this, that if some windows grabs the pointer we will not receive any events, because they are delivered only to window that grabs the pointer.<br>
<br>3. Listen to device events (I failed to find some popular examples). We can use XListInputDevices() to get list of available devices. The we can open one of it (for example, that has type "MOUSE") using XOpenDevice() and then call XSelectExtensionEvent() to select inpu from it. It works great when we have at least on extension device in the list (also, behavior can vary between different extension devices, but it is not the problem now).<br>
<br>Lets talk about 3. We can have only 2 devices in list: "core keyboard" and "core pointer" (which are of IsXKeyboard and IsXpointer use flags in corresponding XDeviceInfo structure). As written in man, XOpenDevice() will fail for X keyboard and X pointer. I don't understand why it is designed so and what the problem was solved by this, but it is the problem for me now :)<br>
<br>So, the question can be devided on two parts:<br>1. Is there ant way to select X pointer/keyboard (core devices) events?<br>2. Maybe there is more direct/simple/right way to do what I need?<br><br>Thanks :)<br><br>