XGetDeviceMotionEvents, XDeviceTimeCoord − get device motion history


#include <X11/extensions/XInput.h>

XDeviceTimeCoord *XGetDeviceMotionEvents( Display *display,
XDevice *device,
Time start,
Time stop,
int *nevents_return,
int *mode_return,
int *axis_count_return);

Specifies the connection to the X server.

Specifies the device whose motion history is to be

start, stop
Specify the time interval in which the events are
returned from the motionhistory buffer.You can pass a
timestamp or CurrentTime.

Returns the number of events from the motion history

Returns the mode of the device (Absolute or Relative).

Returns the count of axes being reported.


The server may retain the recent history of the device motion
and do so to a finer granularity than is reported by
DeviceMotionNotify events. The XGetDeviceMotionEvents request
makes this history available.

The XGetDeviceMotionEvents request returns all events in the
motion history buffer that fall between the specified start and
stop times, inclusive. If the start time is later than the stop
time or if the start time is in the future, no events are
returned. If the stop time is in the future, it is equivalent
to specifying CurrentTime.

The mode indicates whether the device is reporting absolute
positional data (mode = Absolute ) or relative motion data
(mode = Relative ). Some devices allow their mode to be changed
via the XSetDeviceMode request. These constants are defined in
the file XI.h. The axis_count returns the number of axes or
valuators being reported by the device.

XGetDeviceMotionEvents can generate a BadDevice, or BadMatch


The XDeviceTimeCoord structure contains:

typedef struct {
Time time;
int *data;
} XDeviceTimeCoord;

The time member is set to the time, in milliseconds. The data
member is a pointer to an array of integers. These integers are
set to the values of each valuator or axis reported by the
device. There is one element in the array per axis of motion
reported by the device. The value of the array elements depends
on the mode of the device. If the mode is Absolute, the values
are the raw values generated by the device. These may be scaled
by client programs using the maximum values that the device can
generate. The maximum value for each axis of the device is
reported in the max_val field of the XAxisInfo returned by the
XListInputDevices request. If the mode is Relative, the data
values are the relative values generated by the device.

You should use XFreeDeviceMotionEvents to free the data
returned by this request.

Errors returned by this request: BadDevice, BadMatch.


An invalid device was specified. The specified device
does not exist or has not been opened by this client via
XOpenInputDevice. This error may also occur if the
specified device is the X keyboard or X pointer device.

This error may occur if an XGetDeviceMotionEvents
request is made specifying a device that has no
valuators and reports no axes of motion.


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.

Free Software

Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.

Free Books

The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.