/*
* Set various parameters for keyboard controlled mouse pointer
*
*
* *mk_delay* - this field is the time in milliseconds between
* the initial key press and the first repeated motion event
* for mouse key acceleration.
*
* *mk_interval* - this field is the time in milliseconds
* between repeated motion events for mouse key acceleration.
*
* *mk_time_to_max* - this field is the number of key events
* before the pointer reaches a maximum speed for mouse key
* acceleration.
*
* *mk_max_speed* - this field is the maximum speed in pixels
* per key event the pointer can reach for mouse key
* acceleration.
*
* *mk_curve* - this field is the slope of the acceleration
* curve for mouse key acceleration.
*/
int main(int argc, char **argv)
{
Display *d;
int ev_rtrn = 0;
int err_rtrn = 0;
int major_rtrn = XkbMajorVersion;
int minor_rtrn = XkbMinorVersion;
int reason = 0;
XkbDescPtr xkb;
int delay = 0;
int interval = 0;
int time_to_max = 0;
int max_speed = 0;
int c;
while ((c = getopt(argc, argv, ":d:i:t:m:")) != -1) {
switch (c) {
case 'd':
delay = atoi(optarg);
break;
case 'i':
interval = atoi(optarg);
break;
case 't':
time_to_max = atoi(optarg);
break;
case 'm':
max_speed = atoi(optarg);
break;
case ':':
case '?':
default:
usage();
}
}
d = XkbOpenDisplay(NULL, &ev_rtrn, &err_rtrn, &major_rtrn, &minor_rtrn,
&reason);
if (! d) {
fprintf(stderr, "Error opening display\n");
exit(1);
}
xkb = XkbGetMap(d, 0, XkbUseCoreKbd);
XkbGetControls(d, XkbAllControlsMask, xkb);
if (delay)
xkb->ctrls->mk_delay = delay;
if (interval)
xkb->ctrls->mk_interval = interval;
if (time_to_max)
xkb->ctrls->mk_time_to_max = time_to_max;
if (max_speed)
xkb->ctrls->mk_max_speed = max_speed;