Merge commit 'origin/server-1.4-branch' into xorg-server-1.4-apple

This commit is contained in:
Jeremy Huddleston 2008-05-08 16:56:54 -07:00
commit 91dd6c47aa
4 changed files with 192 additions and 85 deletions

View File

@ -66,18 +66,25 @@ AC_SYS_LARGEFILE
XORG_PROG_RAWCPP
dnl Check for dtrace program (needed to build Xserver dtrace probes)
dnl Also checks for <sys/sdt.h>, since some Linux distros have an
dnl ISDN trace program named dtrace
AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
[Enable dtrace probes (default: enabled if dtrace found)]),
[WDTRACE=$withval], [WDTRACE=auto])
if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
case $host_os in
darwin*) WDTRACE="no" ;;
*) AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
if test "x$DTRACE" = "xnot_found" ; then
darwin*) WDTRACE="no" ;;
*) AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
if test "x$DTRACE" = "xnot_found" ; then
if test "x$WDTRACE" = "xyes" ; then
AC_MSG_FAILURE([dtrace requested but not found])
fi
WDTRACE="no"
WDTRACE="no"
else
AC_CHECK_HEADER(sys/sdt.h, [HAS_SDT_H="yes"], [HAS_SDT_H="no"])
if test "x$WDTRACE" = "xauto" -a "x$HAS_SDT_H" = "xno" ; then
WDTRACE="no"
fi
fi ;;
esac
fi

View File

@ -306,10 +306,13 @@ clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
{
AxisInfoPtr axes = pDev->valuator->axes + axisNum;
if (*val < axes->min_value)
*val = axes->min_value;
if (axes->max_value >= 0 && *val > axes->max_value)
*val = axes->max_value;
/* No clipping if the value-range <= 0 */
if(axes->min_value < axes->min_value) {
if (*val < axes->min_value)
*val = axes->min_value;
if (*val > axes->max_value)
*val = axes->max_value;
}
}
/**
@ -526,12 +529,10 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
int num_events = 0, final_valuator = 0;
CARD32 ms = 0;
deviceKeyButtonPointer *kbp = NULL;
/* Thanks to a broken lib, we _always_ have to chase DeviceMotionNotifies
* with DeviceValuators. */
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
DeviceIntPtr cp = inputInfo.pointer;
int x = 0, y = 0;
Bool coreOnly = (pDev == inputInfo.pointer);
ScreenPtr scr = miPointerGetScreen(pDev);
/* Sanity checks. */
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
@ -557,7 +558,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
return 0;
/* Do we need to send a DeviceValuator event? */
if (!coreOnly && sendValuators) {
if (!coreOnly && num_valuators) {
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS * 6;
num_events += ((num_valuators - 1) / 6) + 1;
@ -578,21 +579,44 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
x = valuators[0];
}
else {
if (pDev->coreEvents)
x = cp->valuator->lastx;
else
x = pDev->valuator->lastx;
/* If we're sending core events but didn't provide a value,
* translate the core value (but use the device coord if
* it translates to the same coord to preserve sub-pixel
* coord information). If we're not sending core events use
* whatever value we have */
x = pDev->valuator->lastx;
if(pDev->coreEvents) {
int min = pDev->valuator->axes[0].min_value;
int max = pDev->valuator->axes[0].max_value;
if(min < max) {
if((int)((float)(x-min)*scr->width/(max-min+1)) != cp->valuator->lastx)
x = (int)((float)(cp->valuator->lastx)*(max-min+1)/scr->width)+min;
}
else
x = cp->valuator->lastx;
}
}
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
y = valuators[1 - first_valuator];
}
else {
if (pDev->coreEvents)
y = cp->valuator->lasty;
else
y = pDev->valuator->lasty;
y = pDev->valuator->lasty;
if(pDev->coreEvents) {
int min = pDev->valuator->axes[1].min_value;
int max = pDev->valuator->axes[1].max_value;
if(min < max) {
if((int)((float)(y-min)*scr->height/(max-min+1)) != cp->valuator->lasty)
y = (int)((float)(cp->valuator->lasty)*(max-min+1)/scr->height)+min;
}
else
y = cp->valuator->lasty;
}
}
/* Clip both x and y to the defined limits (usually co-ord space limit). */
clipAxis(pDev, 0, &x);
clipAxis(pDev, 1, &y);
}
else {
if (flags & POINTER_ACCELERATE)
@ -600,53 +624,106 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
valuators);
if (pDev->coreEvents) {
if (first_valuator == 0 && num_valuators >= 1)
x = cp->valuator->lastx + valuators[0];
/* Get and convert the core pointer coordinate space into
* device coordinates. Use the device coords if it translates
* into the same position as the core to preserve relative sub-
* pixel movements from the device. */
int min = pDev->valuator->axes[0].min_value;
int max = pDev->valuator->axes[0].max_value;
if(min < max) {
x = pDev->valuator->lastx;
if((int)((float)(x-min)*scr->width/(max-min+1)) != cp->valuator->lastx)
x = (int)((float)(cp->valuator->lastx)*(max-min+1)/scr->width)+min;
}
else
x = cp->valuator->lastx;
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
y = cp->valuator->lasty + valuators[1 - first_valuator];
min = pDev->valuator->axes[1].min_value;
max = pDev->valuator->axes[1].max_value;
if(min < max) {
y = pDev->valuator->lasty;
if((int)((float)(y-min)*scr->height/(max-min+1)) != cp->valuator->lasty)
y = (int)((float)(cp->valuator->lasty)*(max-min+1)/scr->height)+min;
}
else
y = cp->valuator->lasty;
/* Add relative movement */
if (first_valuator == 0 && num_valuators >= 1)
x += valuators[0];
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
y += valuators[1 - first_valuator];
}
else {
x = pDev->valuator->lastx;
y = pDev->valuator->lasty;
if (first_valuator == 0 && num_valuators >= 1)
x = pDev->valuator->lastx + valuators[0];
else
x = pDev->valuator->lastx;
x += valuators[0];
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
y = pDev->valuator->lasty + valuators[1 - first_valuator];
else
y = pDev->valuator->lasty;
y += valuators[1 - first_valuator];
if(!coreOnly) {
/* Since we're not sending core-events we must clip both x and y
* to the defined limits so we don't run outside the box. */
clipAxis(pDev, 0, &x);
clipAxis(pDev, 1, &y);
}
}
}
/* Clip both x and y to the defined limits (usually co-ord space limit). */
clipAxis(pDev, 0, &x);
clipAxis(pDev, 1, &y);
pDev->valuator->lastx = x;
pDev->valuator->lasty = y;
/* Convert the dev coord back to screen coord if we're
* sending core events */
if (pDev->coreEvents) {
int min = pDev->valuator->axes[0].min_value;
int max = pDev->valuator->axes[0].max_value;
if(min < max)
x = (int)((float)(x-min)*scr->width/(max-min+1));
cp->valuator->lastx = x;
min = pDev->valuator->axes[1].min_value;
max = pDev->valuator->axes[1].max_value;
if(min < max)
y = (int)((float)(y-min)*scr->height/(max-min+1));
cp->valuator->lasty = y;
}
/* This takes care of crossing screens for us, as well as clipping
* to the current screen. Right now, we only have one history buffer,
* so we don't set this for both the device and core.*/
miPointerSetPosition(pDev, &x, &y, ms);
/* Drop x and y back into the valuators list, if they were originally
* present. */
if (first_valuator == 0 && num_valuators >= 1)
valuators[0] = x;
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
valuators[1 - first_valuator] = y;
updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
if (pDev->coreEvents) {
/* miPointerSetPosition may have changed screen */
scr = miPointerGetScreen(pDev);
if(x != cp->valuator->lastx) {
int min = pDev->valuator->axes[0].min_value;
int max = pDev->valuator->axes[0].max_value;
cp->valuator->lastx = pDev->valuator->lastx = x;
if(min < max)
pDev->valuator->lastx = (int)((float)(x)*(max-min+1)/scr->width)+min;
}
if(y != cp->valuator->lasty) {
int min = pDev->valuator->axes[1].min_value;
int max = pDev->valuator->axes[1].max_value;
cp->valuator->lasty = pDev->valuator->lasty = y;
if(min < max)
pDev->valuator->lasty = (int)((float)(y)*(max-min+1)/scr->height)+min;
}
}
else if (coreOnly) {
cp->valuator->lastx = x;
cp->valuator->lasty = y;
}
pDev->valuator->lastx = x;
pDev->valuator->lasty = y;
/* Drop x and y back into the valuators list, if they were originally
* present. */
if (first_valuator == 0 && num_valuators >= 1)
valuators[0] = pDev->valuator->lastx;
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
valuators[1 - first_valuator] = pDev->valuator->lasty;
updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
/* for some reason inputInfo.pointer does not have coreEvents set */
if (coreOnly || pDev->coreEvents) {
@ -684,11 +761,11 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
kbp->detail = pDev->button->map[buttons];
}
kbp->root_x = x;
kbp->root_y = y;
kbp->root_x = pDev->valuator->lastx;
kbp->root_y = pDev->valuator->lasty;
events++;
if (sendValuators) {
if (num_valuators) {
kbp->deviceid |= MORE_EVENTS;
clipValuators(pDev, first_valuator, num_valuators, valuators);
events = getValuatorEvents(events, pDev, first_valuator,

View File

@ -285,7 +285,8 @@ OsSignal(sig, handler)
sigaddset(&act.sa_mask, sig);
act.sa_flags = 0;
act.sa_handler = handler;
sigaction(sig, &act, &oact);
if (sigaction(sig, &act, &oact))
perror("sigaction");
return oact.sa_handler;
#endif
}
@ -1684,6 +1685,10 @@ System(char *command)
#ifdef SIGCHLD
csig = signal(SIGCHLD, SIG_DFL);
if (csig == SIG_ERR) {
perror("signal");
return -1;
}
#endif
#ifdef DEBUG
@ -1708,7 +1713,10 @@ System(char *command)
}
#ifdef SIGCHLD
signal(SIGCHLD, csig);
if (signal(SIGCHLD, csig) == SIG_ERR) {
perror("signal");
return -1;
}
#endif
return p == -1 ? -1 : status;
@ -1720,6 +1728,8 @@ static struct pid {
int pid;
} *pidlist;
void (*old_alarm)(int) = NULL; /* XXX horrible awful hack */
pointer
Popen(char *command, char *type)
{
@ -1741,11 +1751,20 @@ Popen(char *command, char *type)
return NULL;
}
/* Ignore the smart scheduler while this is going on */
old_alarm = signal(SIGALRM, SIG_IGN);
if (old_alarm == SIG_ERR) {
perror("signal");
return NULL;
}
switch (pid = fork()) {
case -1: /* error */
close(pdes[0]);
close(pdes[1]);
xfree(cur);
if (signal(SIGALRM, old_alarm) == SIG_ERR)
perror("signal");
return NULL;
case 0: /* child */
if (setgid(getgid()) == -1)
@ -1921,6 +1940,11 @@ Pclose(pointer iop)
/* allow EINTR again */
OsReleaseSignals ();
if (old_alarm && signal(SIGALRM, old_alarm) == SIG_ERR) {
perror("signal");
return -1;
}
return pid == -1 ? -1 : pstat;
}

View File

@ -385,24 +385,20 @@ char tmpname[PATH_MAX];
xfree (buf);
return True;
}
#ifdef DEBUG
else
ErrorF("Error compiling keymap (%s)\n",keymap);
#endif
LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
#ifdef WIN32
/* remove the temporary file */
unlink(tmpname);
#endif
}
#ifdef DEBUG
else {
#ifndef WIN32
ErrorF("Could not invoke keymap compiler\n");
LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
#else
ErrorF("Could not open file %s\n", tmpname);
LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
#endif
}
#endif
if (nameRtrn)
nameRtrn[0]= '\0';
if (buf != NULL)
@ -477,17 +473,14 @@ unsigned missing;
return 0;
}
else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) {
#ifdef NOISY
ErrorF("Couldn't compile keymap file\n");
#endif
LogMessage(X_ERROR, "Couldn't compile keymap file %s\n",
names->keymap);
return 0;
}
}
else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
nameRtrn,nameRtrnLen)){
#ifdef NOISY
ErrorF("Couldn't compile keymap file\n");
#endif
nameRtrn,nameRtrnLen)){
LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
return 0;
}
file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX);
@ -502,11 +495,9 @@ unsigned missing;
(void) unlink (fileName);
return 0;
}
#ifdef DEBUG
else if (xkbDebugFlags) {
ErrorF("Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined);
else {
DebugF("XKB: Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined);
}
#endif
fclose(file);
(void) unlink (fileName);
return (need|want)&(~missing);
@ -525,32 +516,40 @@ XkbRF_RulesPtr rules;
if (!rules_name)
return False;
if (XkbBaseDirectory==NULL) {
if (strlen(rules_name)+7 > PATH_MAX)
return False;
sprintf(buf,"rules/%s",rules_name);
if (strlen(XkbBaseDirectory) + strlen(rules_name) + 8 > PATH_MAX) {
LogMessage(X_ERROR, "XKB: Rules name is too long\n");
return False;
}
else {
if (strlen(XkbBaseDirectory)+strlen(rules_name)+8 > PATH_MAX)
return False;
sprintf(buf,"%s/rules/%s",XkbBaseDirectory,rules_name);
}
if ((file= fopen(buf,"r"))==NULL)
sprintf(buf,"%s/rules/%s", XkbBaseDirectory, rules_name);
file = fopen(buf, "r");
if (!file) {
LogMessage(X_ERROR, "XKB: Couldn't open rules file %s\n", file);
return False;
if ((rules= XkbRF_Create(0,0))==NULL) {
}
rules = XkbRF_Create(0, 0);
if (!rules) {
LogMessage(X_ERROR, "XKB: Couldn't create rules struct\n");
fclose(file);
return False;
}
if (!XkbRF_LoadRules(file,rules)) {
if (!XkbRF_LoadRules(file, rules)) {
LogMessage(X_ERROR, "XKB: Couldn't parse rules file %s\n", rules_name);
fclose(file);
XkbRF_Free(rules,True);
return False;
}
bzero((char *)names,sizeof(XkbComponentNamesRec));
complete= XkbRF_GetComponents(rules,defs,names);
memset(names, 0, sizeof(*names));
complete = XkbRF_GetComponents(rules,defs,names);
fclose(file);
XkbRF_Free(rules,True);
XkbRF_Free(rules, True);
if (!complete)
LogMessage(X_ERROR, "XKB: Rules returned no components\n");
return complete;
}