I want to receive relative mouse movement whether the pointer is moving or not. Is there a way to tell XInput to send XDeviceMotionEvent events even if the pointer on the desktop is not moving?
here is how i create my mouse device:
XDevice* device = XOpenDevice(display, deviceXID);
// device->classes contains ButtonClass and ValuatorClass
DeviceButtonPress(device, eventButtonDown, xEventClasses[numEventClasses]);
numEventClasses++;
DeviceButtonRelease(device, eventButtonUp, xEventClasses[numEventClasses]);
numEventClasses++;
DeviceMotionNotify(device, eventMove, EventClasses[numEventClasses]);
numEventClasses++;
XSelectExtensionEvent(display, RootWindow(display, DefaultScreen(display)), xEventClasses, numEventClasses);
and here is how a handle the events
while(run){
XNextEvent(display, &xEvent);
if(eventMove == xEvent.type){
// xEvent.xMotion type is XDeviceMotionEvent
mouse.addDx(xEvent.xMotion.axis_data[0]);
mouse.addDy(xEvent.xMotion.axis_data[1]);
mouse.addDz(xEvent.xMotion.axis_data[2]);
}
}
EDIT:
Or is there another solution to this problem? I use XInput, because I wanted high resolution data from my mouse.
How do other people handle the mouse input data to rotate a camera in a 3D
scene?
[Edited by - hechmi on August 30, 2009 8:40:50 AM]