Merge remote-tracking branch 'whot/for-keith'
This commit is contained in:
commit
15bbdc103b
|
@ -1228,6 +1228,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
*
|
*
|
||||||
* @param events The pointer to the event list to fill the events
|
* @param events The pointer to the event list to fill the events
|
||||||
* @param dev The device to generate the events for
|
* @param dev The device to generate the events for
|
||||||
|
* @param type The real type of the event
|
||||||
* @param axis The axis number to generate events for
|
* @param axis The axis number to generate events for
|
||||||
* @param mask State before this event in absolute coords
|
* @param mask State before this event in absolute coords
|
||||||
* @param[in,out] last Last scroll state posted in absolute coords (modified
|
* @param[in,out] last Last scroll state posted in absolute coords (modified
|
||||||
|
@ -1239,6 +1240,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
static int
|
static int
|
||||||
emulate_scroll_button_events(InternalEvent *events,
|
emulate_scroll_button_events(InternalEvent *events,
|
||||||
DeviceIntPtr dev,
|
DeviceIntPtr dev,
|
||||||
|
int type,
|
||||||
int axis,
|
int axis,
|
||||||
const ValuatorMask *mask,
|
const ValuatorMask *mask,
|
||||||
ValuatorMask *last,
|
ValuatorMask *last,
|
||||||
|
@ -1251,6 +1253,7 @@ emulate_scroll_button_events(InternalEvent *events,
|
||||||
int num_events = 0;
|
int num_events = 0;
|
||||||
double total;
|
double total;
|
||||||
int b;
|
int b;
|
||||||
|
int flags = 0;
|
||||||
|
|
||||||
if (dev->valuator->axes[axis].scroll.type == SCROLL_TYPE_NONE)
|
if (dev->valuator->axes[axis].scroll.type == SCROLL_TYPE_NONE)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1261,6 +1264,9 @@ emulate_scroll_button_events(InternalEvent *events,
|
||||||
ax = &dev->valuator->axes[axis];
|
ax = &dev->valuator->axes[axis];
|
||||||
incr = ax->scroll.increment;
|
incr = ax->scroll.increment;
|
||||||
|
|
||||||
|
if (type != ButtonPress && type != ButtonRelease)
|
||||||
|
flags |= POINTER_EMULATED;
|
||||||
|
|
||||||
if (!valuator_mask_isset(last, axis))
|
if (!valuator_mask_isset(last, axis))
|
||||||
valuator_mask_set_double(last, axis, 0);
|
valuator_mask_set_double(last, axis, 0);
|
||||||
|
|
||||||
|
@ -1287,17 +1293,23 @@ emulate_scroll_button_events(InternalEvent *events,
|
||||||
* for. In that case, we keep decreasing delta, but skip events.
|
* for. In that case, we keep decreasing delta, but skip events.
|
||||||
*/
|
*/
|
||||||
if (num_events + 4 < max_events)
|
if (num_events + 4 < max_events)
|
||||||
|
{
|
||||||
|
if (type != ButtonRelease)
|
||||||
{
|
{
|
||||||
nev_tmp = fill_pointer_events(events, dev, ButtonPress, b, ms,
|
nev_tmp = fill_pointer_events(events, dev, ButtonPress, b, ms,
|
||||||
POINTER_EMULATED, NULL);
|
flags, NULL);
|
||||||
events += nev_tmp;
|
events += nev_tmp;
|
||||||
num_events += nev_tmp;
|
num_events += nev_tmp;
|
||||||
|
}
|
||||||
|
if (type != ButtonPress)
|
||||||
|
{
|
||||||
nev_tmp = fill_pointer_events(events, dev, ButtonRelease, b, ms,
|
nev_tmp = fill_pointer_events(events, dev, ButtonRelease, b, ms,
|
||||||
POINTER_EMULATED, NULL);
|
flags, NULL);
|
||||||
events += nev_tmp;
|
events += nev_tmp;
|
||||||
num_events += nev_tmp;
|
num_events += nev_tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We emulated, update last.scroll */
|
/* We emulated, update last.scroll */
|
||||||
if (total != delta)
|
if (total != delta)
|
||||||
|
@ -1340,6 +1352,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
ValuatorMask mask;
|
ValuatorMask mask;
|
||||||
ValuatorMask scroll;
|
ValuatorMask scroll;
|
||||||
int i;
|
int i;
|
||||||
|
int realtype = type;
|
||||||
|
|
||||||
/* refuse events from disabled devices */
|
/* refuse events from disabled devices */
|
||||||
if (!pDev->enabled)
|
if (!pDev->enabled)
|
||||||
|
@ -1392,6 +1405,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
valuator_mask_set_double(&mask, axis, val);
|
valuator_mask_set_double(&mask, axis, val);
|
||||||
type = MotionNotify;
|
type = MotionNotify;
|
||||||
buttons = 0;
|
buttons = 0;
|
||||||
|
flags |= POINTER_EMULATED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1411,7 +1425,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
|
||||||
|
|
||||||
valuator_mask_set_double(&scroll, i, pDev->last.valuators[i]);
|
valuator_mask_set_double(&scroll, i, pDev->last.valuators[i]);
|
||||||
|
|
||||||
nev_tmp = emulate_scroll_button_events(events, pDev, i, &scroll,
|
nev_tmp = emulate_scroll_button_events(events, pDev, realtype, i, &scroll,
|
||||||
pDev->last.scroll, ms,
|
pDev->last.scroll, ms,
|
||||||
GetMaximumEventsNum() - num_events);
|
GetMaximumEventsNum() - num_events);
|
||||||
events += nev_tmp;
|
events += nev_tmp;
|
||||||
|
|
|
@ -538,6 +538,42 @@ valuator_mask_get(const ValuatorMask *mask, int valuator)
|
||||||
return trunc(valuator_mask_get_double(mask, valuator));
|
return trunc(valuator_mask_get_double(mask, valuator));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set value to the requested valuator. If the mask bit is set for this
|
||||||
|
* valuator, value contains the requested valuator value and TRUE is
|
||||||
|
* returned.
|
||||||
|
* If the mask bit is not set for this valuator, value is unchanged and
|
||||||
|
* FALSE is returned.
|
||||||
|
*/
|
||||||
|
Bool
|
||||||
|
valuator_mask_fetch_double(const ValuatorMask *mask, int valuator, double *value)
|
||||||
|
{
|
||||||
|
if (valuator_mask_isset(mask, valuator))
|
||||||
|
{
|
||||||
|
*value = valuator_mask_get_double(mask, valuator);
|
||||||
|
return TRUE;
|
||||||
|
} else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set value to the requested valuator. If the mask bit is set for this
|
||||||
|
* valuator, value contains the requested valuator value and TRUE is
|
||||||
|
* returned.
|
||||||
|
* If the mask bit is not set for this valuator, value is unchanged and
|
||||||
|
* FALSE is returned.
|
||||||
|
*/
|
||||||
|
Bool
|
||||||
|
valuator_mask_fetch(const ValuatorMask *mask, int valuator, int *value)
|
||||||
|
{
|
||||||
|
if (valuator_mask_isset(mask, valuator))
|
||||||
|
{
|
||||||
|
*value = valuator_mask_get(mask, valuator);
|
||||||
|
return TRUE;
|
||||||
|
} else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the valuator from the mask.
|
* Remove the valuator from the mask.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -601,16 +601,15 @@ xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
|
||||||
InputHandlerProc
|
InputHandlerProc
|
||||||
xf86SetConsoleHandler(InputHandlerProc proc, pointer data)
|
xf86SetConsoleHandler(InputHandlerProc proc, pointer data)
|
||||||
{
|
{
|
||||||
static InputHandlerProc handler = NULL;
|
static IHPtr handler = NULL;
|
||||||
InputHandlerProc old_handler = handler;
|
IHPtr old_handler = handler;
|
||||||
|
|
||||||
if (old_handler)
|
if (old_handler)
|
||||||
xf86RemoveGeneralHandler(old_handler);
|
xf86RemoveGeneralHandler(old_handler);
|
||||||
|
|
||||||
xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
|
handler = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
|
||||||
handler = proc;
|
|
||||||
|
|
||||||
return old_handler;
|
return (old_handler) ? old_handler->ihproc : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -45,15 +45,12 @@ static char vtname[11];
|
||||||
static struct termios tty_attr; /* tty state to restore */
|
static struct termios tty_attr; /* tty state to restore */
|
||||||
static int tty_mode; /* kbd mode to restore */
|
static int tty_mode; /* kbd mode to restore */
|
||||||
|
|
||||||
static void *console_handler;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drain_console(int fd, void *closure)
|
drain_console(int fd, void *closure)
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if (tcflush(fd, TCIOFLUSH) == -1 && errno == EIO) {
|
if (tcflush(fd, TCIOFLUSH) == -1 && errno == EIO) {
|
||||||
xf86RemoveGeneralHandler(console_handler);
|
xf86SetConsoleHandler(NULL, NULL);
|
||||||
console_handler = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,10 +254,11 @@ xf86CloseConsole(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (console_handler) {
|
/*
|
||||||
xf86RemoveGeneralHandler(console_handler);
|
* unregister the drain_console handler
|
||||||
console_handler = NULL;
|
* - what to do if someone else changed it in the meantime?
|
||||||
};
|
*/
|
||||||
|
xf86SetConsoleHandler(NULL, NULL);
|
||||||
|
|
||||||
/* Back to text mode ... */
|
/* Back to text mode ... */
|
||||||
SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
|
SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
|
||||||
|
|
|
@ -597,6 +597,10 @@ extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest,
|
||||||
extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
|
extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
|
||||||
extern _X_EXPORT double valuator_mask_get_double(const ValuatorMask *mask,
|
extern _X_EXPORT double valuator_mask_get_double(const ValuatorMask *mask,
|
||||||
int valnum);
|
int valnum);
|
||||||
|
extern _X_EXPORT Bool valuator_mask_fetch(const ValuatorMask *mask,
|
||||||
|
int valnum, int *val);
|
||||||
|
extern _X_EXPORT Bool valuator_mask_fetch_double(const ValuatorMask *mask,
|
||||||
|
int valnum, double *val);
|
||||||
|
|
||||||
/* InputOption handling interface */
|
/* InputOption handling interface */
|
||||||
extern _X_EXPORT InputOption* input_option_new(InputOption *list, const char *key, const char *value);
|
extern _X_EXPORT InputOption* input_option_new(InputOption *list, const char *key, const char *value);
|
||||||
|
|
15
test/input.c
15
test/input.c
|
@ -1199,14 +1199,19 @@ static void dix_input_valuator_masks(void)
|
||||||
assert(valuator_mask_num_valuators(mask) == num_vals);
|
assert(valuator_mask_num_valuators(mask) == num_vals);
|
||||||
for (i = 0; i < nvaluators; i++)
|
for (i = 0; i < nvaluators; i++)
|
||||||
{
|
{
|
||||||
|
double val;
|
||||||
if (i < first_val || i >= first_val + num_vals)
|
if (i < first_val || i >= first_val + num_vals)
|
||||||
|
{
|
||||||
assert(!valuator_mask_isset(mask, i));
|
assert(!valuator_mask_isset(mask, i));
|
||||||
else
|
assert(!valuator_mask_fetch_double(mask, i, &val));
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
assert(valuator_mask_isset(mask, i));
|
assert(valuator_mask_isset(mask, i));
|
||||||
assert(valuator_mask_get(mask, i) == val_ranged[i - first_val]);
|
assert(valuator_mask_get(mask, i) == val_ranged[i - first_val]);
|
||||||
assert(valuator_mask_get_double(mask, i) ==
|
assert(valuator_mask_get_double(mask, i) ==
|
||||||
val_ranged[i - first_val]);
|
val_ranged[i - first_val]);
|
||||||
|
assert(valuator_mask_fetch_double(mask, i, &val));
|
||||||
|
assert(val_ranged[i - first_val] == val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,10 +1223,18 @@ static void dix_input_valuator_masks(void)
|
||||||
|
|
||||||
for (i = 0; i < nvaluators; i++)
|
for (i = 0; i < nvaluators; i++)
|
||||||
{
|
{
|
||||||
|
double a, b;
|
||||||
assert(valuator_mask_isset(mask, i) == valuator_mask_isset(copy, i));
|
assert(valuator_mask_isset(mask, i) == valuator_mask_isset(copy, i));
|
||||||
|
|
||||||
|
if (!valuator_mask_isset(mask, i))
|
||||||
|
continue;
|
||||||
|
|
||||||
assert(valuator_mask_get(mask, i) == valuator_mask_get(copy, i));
|
assert(valuator_mask_get(mask, i) == valuator_mask_get(copy, i));
|
||||||
assert(valuator_mask_get_double(mask, i) ==
|
assert(valuator_mask_get_double(mask, i) ==
|
||||||
valuator_mask_get_double(copy, i));
|
valuator_mask_get_double(copy, i));
|
||||||
|
assert(valuator_mask_fetch_double(mask, i, &a));
|
||||||
|
assert(valuator_mask_fetch_double(copy, i, &b));
|
||||||
|
assert(a == b);
|
||||||
}
|
}
|
||||||
|
|
||||||
valuator_mask_free(&mask);
|
valuator_mask_free(&mask);
|
||||||
|
|
Loading…
Reference in New Issue