Merge remote-tracking branch 'whot/for-keith'
This commit is contained in:
commit
132545ff57
|
@ -985,6 +985,8 @@ CloseDownDevices(void)
|
|||
{
|
||||
DeviceIntPtr dev;
|
||||
|
||||
OsBlockSignals();
|
||||
|
||||
/* Float all SDs before closing them. Note that at this point resources
|
||||
* (e.g. cursors) have been freed already, so we can't just call
|
||||
* AttachDevice(NULL, dev, NULL). Instead, we have to forcibly set master
|
||||
|
@ -1007,6 +1009,8 @@ CloseDownDevices(void)
|
|||
inputInfo.keyboard = NULL;
|
||||
inputInfo.pointer = NULL;
|
||||
XkbDeleteRulesDflts();
|
||||
|
||||
OsReleaseSignals();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -910,35 +910,38 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
|
|||
return BadAlloc;
|
||||
|
||||
nt_list_for_each_entry(option, options, list.next) {
|
||||
if (strcasecmp(input_option_get_key(option), "driver") == 0) {
|
||||
const char *key = input_option_get_key(option);
|
||||
const char *value = input_option_get_value(option);
|
||||
|
||||
if (strcasecmp(key, "driver") == 0) {
|
||||
if (pInfo->driver) {
|
||||
rval = BadRequest;
|
||||
goto unwind;
|
||||
}
|
||||
pInfo->driver = xstrdup(input_option_get_value(option));
|
||||
pInfo->driver = xstrdup(value);
|
||||
if (!pInfo->driver) {
|
||||
rval = BadAlloc;
|
||||
goto unwind;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcasecmp(input_option_get_key(option), "name") == 0 ||
|
||||
strcasecmp(input_option_get_key(option), "identifier") == 0) {
|
||||
if (strcasecmp(key, "name") == 0 ||
|
||||
strcasecmp(key, "identifier") == 0) {
|
||||
if (pInfo->name) {
|
||||
rval = BadRequest;
|
||||
goto unwind;
|
||||
}
|
||||
pInfo->name = xstrdup(input_option_get_value(option));
|
||||
pInfo->name = xstrdup(value);
|
||||
if (!pInfo->name) {
|
||||
rval = BadAlloc;
|
||||
goto unwind;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(input_option_get_key(option), "_source") == 0 &&
|
||||
(strcmp(input_option_get_value(option), "server/hal") == 0 ||
|
||||
strcmp(input_option_get_value(option), "server/udev") == 0 ||
|
||||
strcmp(input_option_get_value(option), "server/wscons") == 0)) {
|
||||
if (strcmp(key, "_source") == 0 &&
|
||||
(strcmp(value, "server/hal") == 0 ||
|
||||
strcmp(value, "server/udev") == 0 ||
|
||||
strcmp(value, "server/wscons") == 0)) {
|
||||
is_auto = 1;
|
||||
if (!xf86Info.autoAddDevices) {
|
||||
rval = BadMatch;
|
||||
|
|
|
@ -1093,7 +1093,7 @@ char *
|
|||
xf86addComment(char *cur, char *add)
|
||||
{
|
||||
char *str;
|
||||
int len, curlen, iscomment, hasnewline = 0, endnewline;
|
||||
int len, curlen, iscomment, hasnewline = 0, insnewline, endnewline;
|
||||
|
||||
if (add == NULL || add[0] == '\0')
|
||||
return cur;
|
||||
|
@ -1118,14 +1118,23 @@ xf86addComment(char *cur, char *add)
|
|||
|
||||
len = strlen(add);
|
||||
endnewline = add[len - 1] == '\n';
|
||||
len += 1 + iscomment + (!hasnewline) + (!endnewline) + eol_seen;
|
||||
|
||||
if ((str = realloc(cur, len + curlen)) == NULL)
|
||||
insnewline = eol_seen || (curlen && !hasnewline);
|
||||
if (insnewline)
|
||||
len++;
|
||||
if (!iscomment)
|
||||
len++;
|
||||
if (!endnewline)
|
||||
len++;
|
||||
|
||||
/* Allocate + 1 char for '\0' terminator. */
|
||||
str = realloc(cur, curlen + len + 1);
|
||||
if (!str)
|
||||
return cur;
|
||||
|
||||
cur = str;
|
||||
|
||||
if (eol_seen || (curlen && !hasnewline))
|
||||
if (insnewline)
|
||||
cur[curlen++] = '\n';
|
||||
if (!iscomment)
|
||||
cur[curlen++] = '#';
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86Parser.h"
|
||||
|
||||
static void
|
||||
xfree86_option_list_duplicate(void)
|
||||
|
@ -73,9 +74,34 @@ xfree86_option_list_duplicate(void)
|
|||
assert(a && b);
|
||||
}
|
||||
|
||||
static void
|
||||
xfree86_add_comment(void)
|
||||
{
|
||||
char *current = NULL, *comment;
|
||||
char compare[1024] = {0};
|
||||
|
||||
comment = "# foo";
|
||||
current = xf86addComment(current, comment);
|
||||
strcpy(compare, comment);
|
||||
strcat(compare, "\n");
|
||||
|
||||
assert(!strcmp(current, compare));
|
||||
|
||||
/* this used to overflow */
|
||||
strcpy(current, "\n");
|
||||
comment = "foobar\n";
|
||||
current = xf86addComment(current, comment);
|
||||
strcpy(compare, "\n#");
|
||||
strcat(compare, comment);
|
||||
assert(!strcmp(current, compare));
|
||||
|
||||
free(current);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
xfree86_option_list_duplicate();
|
||||
xfree86_add_comment();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ TestPointerProc(DeviceIntPtr pDev, int what)
|
|||
pDev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
|
||||
pDev->last.valuators[1] = pDev->valuator->axisVal[1];
|
||||
|
||||
/* protocol-xiquerydevice.c relies on these increment */
|
||||
SetScrollValuator(pDev, 2, SCROLL_TYPE_VERTICAL, 2.4, SCROLL_FLAG_NONE);
|
||||
SetScrollValuator(pDev, 3, SCROLL_TYPE_HORIZONTAL, 3.5, SCROLL_FLAG_PREFERRED);
|
||||
break;
|
||||
|
|
|
@ -389,9 +389,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
|
|||
{
|
||||
FP3232 vi, vo;
|
||||
|
||||
vi.integral = trunc(in->valuators.data[i]);
|
||||
vi.frac = (in->valuators.data[i] - vi.integral) * (1UL << 32);
|
||||
|
||||
vi = double_to_fp3232(in->valuators.data[i]);
|
||||
vo = *values;
|
||||
|
||||
if (swap)
|
||||
|
|
|
@ -213,9 +213,9 @@ static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void
|
|||
}
|
||||
|
||||
assert(si->increment.integral == si->number);
|
||||
/* FIXME: frac testing with float/FP issues? */
|
||||
assert(si->increment.frac > 0.3 * (1UL << 32));
|
||||
assert(si->increment.frac < 0.6 * (1UL << 32));
|
||||
/* protocol-common.c sets up increments of 2.4 and 3.5 */
|
||||
assert(si->increment.frac > 0.3 * (1ULL << 32));
|
||||
assert(si->increment.frac < 0.6 * (1ULL << 32));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user