Advertisement

XInput no (relative) mouse movement events at the border of the desktop

Started by August 30, 2009 05:17 AM
0 comments, last by Null and Void 15 years, 2 months ago
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]
The most common hack is to move the mouse pointer to the center of the screen after each motion event. Someone was working on a true relative motion extension, but I haven't heard anything about it in a while.

This topic is closed to new replies.

Advertisement