[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-unstable'



 Xext/shm.c                             |    2 
 Xext/xf86bigfont.c                     |    2 
 configure.ac                           |   17 ++-
 dix/getevents.c                        |  161 ++++++++++++++++++++++++---------
 exa/exa_accel.c                        |    2 
 hw/xfree86/common/xf86Xinput.c         |    2 
 hw/xfree86/loader/os.c                 |    2 
 hw/xfree86/os-support/bus/Pci.h        |    2 
 hw/xfree86/os-support/bus/freebsdPci.c |    2 
 include/xkbsrv.h                       |   16 ++-
 os/utils.c                             |   28 +++++
 xkb/ddxLoad.c                          |   69 ++++++--------
 xkb/xkbActions.c                       |    9 -
 13 files changed, 217 insertions(+), 97 deletions(-)

New commits:
commit 104048501f37b139d4113562ef1711978cc76018
Author: Daniel Stone <daniel@fooishbar.org>
Date:   Wed May 7 23:11:31 2008 +0300

    XKB: Actually explain keymap failures
    
    When something went wrong building a keymap, try to explain to the user
    what it actually was, instead of the dreaded 'Failed to load XKB keymap'
    catch-all.
    (cherry picked from commit cf20df39cc78203d17b99223908af388ecbf7d0e)
    
    Conflicts:
    	xkb/ddxLoad.c

diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index d79ae7a..ea9c3ff 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -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);
-    }
-    else {
-	if (strlen(XkbBaseDirectory)+strlen(rules_name)+8 > PATH_MAX)
-	    return False;
-        sprintf(buf,"%s/rules/%s",XkbBaseDirectory,rules_name);
+
+    if (strlen(XkbBaseDirectory) + strlen(rules_name) + 8 > PATH_MAX) {
+        LogMessage(X_ERROR, "XKB: Rules name is too long\n");
+        return False;
     }
-    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);
-    return complete;
-}
+    XkbRF_Free(rules, True);
 
+    if (!complete)
+        LogMessage(X_ERROR, "XKB: Rules returned no components\n");
 
+    return complete;
+}

commit b1145a6b428db2037c79ffb36116e7183f30829f
Author: Magnus Vigerlöf <Magnus.Vigerlof@ipbo.se>
Date:   Sat Feb 2 23:04:46 2008 +0100

    dix: Move motion history update until after screen crossing and clipping
    
    Cross screen and clip the coordinates before updating the motion history
    so that it will have the same contents as the events that are reported.
    (cherry picked from commit a56ef7aaa4b6ac13c8181f68fc7dad3ca89e6973)

diff --git a/dix/getevents.c b/dix/getevents.c
index c33371b..d0fe2db 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -665,15 +665,6 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
         }
     }
 
-    /* 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);
-
     pDev->valuator->lastx = x;
     pDev->valuator->lasty = y;
     /* Convert the dev coord back to screen coord if we're
@@ -719,6 +710,15 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
         cp->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) {
         events->u.u.type = type;

commit a68d0ef4a65bcd52c52ba54e6925082a9145fad3
Author: Magnus Vigerlöf <Magnus.Vigerlof@ipbo.se>
Date:   Sat Feb 2 23:03:51 2008 +0100

    dix: Skip call to clipAxis for relative core-events
    
    Relative events that generates both core and extention
    events will have its axis cliped and screen changed by
    miPointerSetPosition when the events are processed. For
    absolute and non core-generating relative events the
    axis must be clipped if we shouldn't end up completely
    outside the defined ranges (if any).
    (cherry picked from commit a0284d577aabea8406b72dd63773e341430ebe56)

diff --git a/dix/getevents.c b/dix/getevents.c
index e0bc326..c33371b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -607,6 +607,10 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
                     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)
@@ -645,22 +649,22 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
                 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);
-
     /* Drop x and y back into the valuators list, if they were originally
      * present. */
     if (first_valuator == 0 && num_valuators >= 1)
@@ -693,6 +697,24 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
     miPointerSetPosition(pDev, &x, &y, ms);
 
     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;
     }

commit b51ca35a7578b64190f663dc825d7fb551b92e73
Author: Magnus Vigerlöf <Magnus.Vigerlof@ipbo.se>
Date:   Sat Feb 2 22:57:32 2008 +0100

    Bug # 10324: dix: Add scaling of X and Y on the reported pointer-events
    
    Restore the rescaling code for x and y axis when generating
    motion events.
    (cherry picked from commit d9e23c4ff1607a62164b34717ef9afd352ce2b94)

diff --git a/dix/getevents.c b/dix/getevents.c
index 8595eaf..e0bc326 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -529,6 +529,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
     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)
@@ -572,20 +573,39 @@ 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;
+            }
         }
     }
     else {
@@ -594,15 +614,35 @@ 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 {
             if (first_valuator == 0 && num_valuators >= 1)
@@ -621,11 +661,6 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
     clipAxis(pDev, 0, &x);
     clipAxis(pDev, 1, &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)
@@ -635,12 +670,32 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
 
     updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
 
+    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);
+
     if (pDev->coreEvents) {
         cp->valuator->lastx = x;
         cp->valuator->lasty = y;
     }
-    pDev->valuator->lastx = x;
-    pDev->valuator->lasty = y;
 
     /* for some reason inputInfo.pointer does not have coreEvents set */
     if (coreOnly || pDev->coreEvents) {
@@ -678,8 +733,8 @@ 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 (num_valuators) {

commit 1d79ba8193e9584370ffaaa8dffb4db604125dea
Author: Magnus Vigerlöf <Magnus.Vigerlof@ipbo.se>
Date:   Sat Feb 2 22:45:31 2008 +0100

    Bug # 10324: dix: Allow arbitrary value ranges in GetPointerEvents
    
    Don't use a possitive value as a marker for if a max-value
    is defined on the valuators. Use the existence of a valid
    value range instead. This will also make it possible to
    define arbitrary start and end-values for min and max as
    long as min < max.
    (cherry picked from commit f04c0838699f1a733735838e74cfbb1677b15dc4)

diff --git a/dix/getevents.c b/dix/getevents.c
index 36c1bcf..8595eaf 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -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;
+    }
 }
 
 /**

commit 7fa7031cfa9145f55881b87bc39f6e2c8a49ff76
Author: Magnus Vigerlöf <Magnus.Vigerlof@ipbo.se>
Date:   Sat Feb 2 22:44:31 2008 +0100

    dix: Always add valuator information if present
    
    Send valuator information for all event types, not only for
    MotionEvents and absolute button events.
    (cherry picked from commit 12e532403210c15a25200ef448bfe9701735ab20)

diff --git a/dix/getevents.c b/dix/getevents.c
index b7ba69b..36c1bcf 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -523,9 +523,6 @@ 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);
@@ -551,7 +548,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;
@@ -682,7 +679,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
         kbp->root_y = y;
 
         events++;
-        if (sendValuators) {
+        if (num_valuators) {
             kbp->deviceid |= MORE_EVENTS;
             clipValuators(pDev, first_valuator, num_valuators, valuators);
             events = getValuatorEvents(events, pDev, first_valuator,

commit b95befdfd2c9bcb6b0cd896f2b8dfaaeb129dbff
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Fri Dec 7 17:28:37 2007 -0800

    Check for <sys/sdt.h> as well when determining to enable dtrace probes
    
    Avoids auto-detecting dtrace is present on systems with the ISDN trace tool
    named dtrace installed, but not the dynamic tracing facility named dtrace

diff --git a/configure.ac b/configure.ac
index 4841d26..c73f4a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,8 @@ 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])
@@ -76,6 +78,11 @@ if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
 			AC_MSG_FAILURE([dtrace requested but not found])
 		fi
 		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
 fi
 if test "x$WDTRACE" != "xno" ; then

commit 0fab9843c7b553bb59d57e68d9c3ea2d754bf809
Author: Ben Byer <bbyer@bbyer.apple.com>
Date:   Fri Sep 21 17:07:36 2007 -0700

    So, like, checking return codes of system calls (signal, etc) is good.
    Also, only restore an old signal handler if one was actually set
    (prevents the server from dying on OS X).

diff --git a/os/utils.c b/os/utils.c
index 144098b..36c8dfe 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -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;
@@ -1745,13 +1753,18 @@ Popen(char *command, char *type)
 
     /* 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);
-	signal(SIGALRM, old_alarm);
+	if (signal(SIGALRM, old_alarm) == SIG_ERR)
+	  perror("signal");
 	return NULL;
     case 0:	/* child */
 	if (setgid(getgid()) == -1)
@@ -1927,7 +1940,10 @@ Pclose(pointer iop)
     /* allow EINTR again */
     OsReleaseSignals ();
     
-    signal(SIGALRM, old_alarm);
+    if (old_alarm && signal(SIGALRM, old_alarm) == SIG_ERR) {
+      perror("signal");
+      return -1;
+    }
 
     return pid == -1 ? -1 : pstat;
 }

commit a02b989c68864a7388553fb96e4fbaf91f941c4a
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Sep 12 13:23:13 2007 +0000

    Fix build on FreeBSD after Popen changes.

diff --git a/os/utils.c b/os/utils.c
index afcaae4..144098b 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1720,7 +1720,7 @@ static struct pid {
     int pid;
 } *pidlist;
 
-static sighandler_t old_alarm = NULL; /* XXX horrible awful hack */
+void (*old_alarm)(int) = NULL; /* XXX horrible awful hack */
 
 pointer
 Popen(char *command, char *type)

commit 6a5066c2e9e872d4ef85ec70745c34d93580177e
Author: Adam Jackson <ajax@benzedrine.nwnk.net>
Date:   Tue Sep 11 11:37:06 2007 -0400

    Ignore - not just block - SIGALRM around Popen()/Pclose().
    
    Because our "popen" implementation uses stdio, and because nobody's stdio
    library is capable of surviving signals, we need to make absolutely sure
    that we hide the SIGALRM from the smart scheduler.  Otherwise, when you
    open a menu in openoffice, and it recompiles XKB to deal with the
    accelerators, and you popen xkbcomp because we suck, then the scheduler
    will tell you you're taking forever doing something stupid, and the
    wait() code will get confused, and input will hang and your CPU usage
    slams to 100%.  Down, not across.

diff --git a/os/utils.c b/os/utils.c
index 3bb7dbe..afcaae4 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1720,6 +1720,8 @@ static struct pid {
     int pid;
 } *pidlist;
 
+static sighandler_t old_alarm = NULL; /* XXX horrible awful hack */
+
 pointer
 Popen(char *command, char *type)
 {
@@ -1741,11 +1743,15 @@ Popen(char *command, char *type)
 	return NULL;
     }
 
+    /* Ignore the smart scheduler while this is going on */
+    old_alarm = signal(SIGALRM, SIG_IGN);
+
     switch (pid = fork()) {
     case -1: 	/* error */
 	close(pdes[0]);
 	close(pdes[1]);
 	xfree(cur);
+	signal(SIGALRM, old_alarm);
 	return NULL;
     case 0:	/* child */
 	if (setgid(getgid()) == -1)
@@ -1921,6 +1927,8 @@ Pclose(pointer iop)
     /* allow EINTR again */
     OsReleaseSignals ();
     
+    signal(SIGALRM, old_alarm);
+
     return pid == -1 ? -1 : pstat;
 }
 

commit ff4006bd5a71d39cc5655679447c5c47a99a2751
Author: Peter Hutterer <peter@cs.unisa.edu.au>
Date:   Tue Jan 29 10:01:37 2008 +1030

    xfree86: fix AlwaysCore handling. (Bug #14256)
    
    Assume AlwaysCore being set by default, just like the other options.
    
    X.Org Bug 14256 <http://bugs.freedesktop.org/show_bug.cgi?id=14256>
    (cherry picked from commit 5b8641a5fdc112c19e78ca2954878712e328d403)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index b939fb7..ca2be5c 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -116,7 +116,7 @@ _X_EXPORT void
 xf86ProcessCommonOptions(LocalDevicePtr local,
                          pointer	list)
 {
-    if (xf86SetBoolOption(list, "AlwaysCore", 0) ||
+    if (!xf86SetBoolOption(list, "AlwaysCore", 1) ||
         !xf86SetBoolOption(list, "SendCoreEvents", 1) ||
         !xf86SetBoolOption(list, "CorePointer", 1) ||
         !xf86SetBoolOption(list, "CoreKeyboard", 1)) {

commit fdfb57d342da0ace14eed635804ebc31441240c5
Author: Thomas Jaeger <thjaeger@gmail.com>
Date:   Tue Apr 1 15:27:06 2008 +0300

    XKB: Fix processInputProc wrapping
    
    If input processing is frozen, only wrap realInputProc: don't smash
    processInputProc as well.  When input processing is thawed, pIP will be
    rewrapped correctly.
    
    This supersedes the previous workaround in 50e80c9.
    
    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    (cherry picked from commit 37b1258f0a288a79ce6a3eef3559e17a67c4dd96)

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 9174eb6..acf3bb0 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -241,6 +241,14 @@ typedef struct	_XkbSrvLedInfo {
 typedef struct
 {
     ProcessInputProc processInputProc;
+    /* If processInputProc is set to something different than realInputProc,
+     * UNWRAP and COND_WRAP will not touch processInputProc and update only
+     * realInputProc.  This ensures that
+     *   processInputProc == (frozen ? EnqueueEvent : realInputProc)
+     *
+     * WRAP_PROCESS_INPUT_PROC should only be called during initialization,
+     * since it may destroy this invariant.
+     */
     ProcessInputProc realInputProc;
     DeviceUnwrapProc unwrapProc;
 } xkbDeviceInfoRec, *xkbDeviceInfoPtr;
@@ -258,14 +266,14 @@ typedef struct
 	    device->public.processInputProc = proc; \
 	oldprocs->processInputProc = \
 	oldprocs->realInputProc = device->public.realInputProc; \
-	if (proc != device->public.enqueueInputProc) \
-		device->public.realInputProc = proc; \
+	device->public.realInputProc = proc; \
 	oldprocs->unwrapProc = device->unwrapProc; \
 	device->unwrapProc = unwrapproc;
 
 #define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs, backupproc) \
-        backupproc = device->public.processInputProc; \
-	device->public.processInputProc = oldprocs->processInputProc; \
+        backupproc = device->public.realInputProc; \
+	if (device->public.processInputProc == device->public.realInputProc)\
+	    device->public.processInputProc = oldprocs->realInputProc; \
 	device->public.realInputProc = oldprocs->realInputProc; \
 	device->unwrapProc = oldprocs->unwrapProc;
 
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 6edac29..59d34c5 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -50,15 +50,14 @@ xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
                    pointer data)
 {
     xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device);
-    ProcessInputProc tmp = device->public.processInputProc;
-    ProcessInputProc dummy; /* unused, but neede for macro */
+    ProcessInputProc backupproc;
     if(xkbPrivPtr->unwrapProc)
 	xkbPrivPtr->unwrapProc = NULL;
 
-    UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, dummy);
+    UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, backupproc);
     proc(device,data);
-    WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr,
-			    tmp,xkbUnwrapProc);
+    COND_WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr,
+				 backupproc,xkbUnwrapProc);
 }
 
 

commit 6afcf996cade0c9464d6af9b04b177b1de138cfd
Author: Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
Date:   Tue Oct 23 16:45:13 2007 +0200

    EXA: Fix off-by-one in polyline drawing.
    (cherry picked from commit d502521c3669f3f22b94c39a64ab63bfd92c6a97)

diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index aed4e42..e8444c6 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -535,7 +535,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
     x1 = ppt[0].x;
     y1 = ppt[0].y;
     /* If we have any non-horizontal/vertical, fall back. */
-    for (i = 0; i < npt; i++) {
+    for (i = 0; i < npt - 1; i++) {
 	if (mode == CoordModePrevious) {
 	    x2 = x1 + ppt[i + 1].x;
 	    y2 = y1 + ppt[i + 1].y;

commit 9e9eeca2b094fa9edb9c20002d42aeafb14ad1e4
Author: Tilman Sauerbeck <tilman@code-monkey.de>
Date:   Thu Apr 10 21:36:19 2008 +0200

    Fixed configure.ac for autoconf 2.62.
    (cherry picked from commit 3c337e18b933881e22b0d03312511f1d23a8640b)

diff --git a/configure.ac b/configure.ac
index dfb2950..4841d26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1964,7 +1964,9 @@ DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
 
 AC_SUBST([DIX_CFLAGS])
 
-AC_SUBST([libdir exec_prefix prefix])
+AC_SUBST([libdir])
+AC_SUBST([exec_prefix])
+AC_SUBST([prefix])
 
 # Man page sections - used in config utils & generating man pages
 XORG_MANPAGE_SECTIONS

commit dd6b0de38d649617600a8357e576955c9b831328
Author: Hasso Tepper <hasso@estpak.ee>
Date:   Mon Apr 7 14:09:04 2008 +0300

    configure.ac: DragonFly BSD support
    
    Add support for DragonFly BSD, which is just the same as FreeBSD for all
    of these cases.
    (cherry picked from commit 0f87b41a432a6472a15ec0c9dee997e3bddbd0f2)

diff --git a/configure.ac b/configure.ac
index 72d9819..dfb2950 100644
--- a/configure.ac
+++ b/configure.ac
@@ -291,6 +291,7 @@ case $host_cpu in
 	        darwin*)	use_x86_asm="no" ;;
 		*linux*)	DEFAULT_INT10=vm86 ;;
 		*freebsd*)	AC_DEFINE(USE_DEV_IO) ;;
+		*dragonfly*)	AC_DEFINE(USE_DEV_IO) ;;
 		*netbsd*)	AC_DEFINE(USE_I386_IOPL)
 				SYS_LIBS=-li386
 				;;
@@ -316,6 +317,7 @@ case $host_cpu in
 	case $host_os in
 	        darwin*)	use_x86_asm="no" ;;
 		*freebsd*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
+		*dragonfly*)	AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
 		*netbsd*)	AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
 				SYS_LIBS=-lx86_64
 				;;
@@ -337,7 +339,7 @@ DRI=no
 KDRIVE_HW=no
 dnl it would be nice to autodetect these *CONS_SUPPORTs
 case $host_os in
-  *freebsd*)
+  *freebsd* | *dragonfly*)
 	case $host_os in
 		kfreebsd*-gnu) ;;
 		*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;;
@@ -1363,7 +1365,7 @@ return 0;}
 			;;
 		esac
 		;;
-	  freebsd* | kfreebsd*-gnu)
+	  freebsd* | kfreebsd*-gnu | dragonfly*)
 	  	XORG_OS="freebsd"
 		XORG_OS_SUBDIR="bsd"
 		case $host_cpu in

commit 76b950cd6e03f0060afe463871de4570fca90213
Author: Jeremy C. Reed <reed@glacier.reedmedia.net>
Date:   Thu Aug 16 11:20:12 2007 -0500

    Add some more support for DragonFly. From Joerg Sonnenberger
    and pkgsrc.
    (cherry picked from commit 1d4bea6106d7a1c83e1dfe37fad8268589feaa0b)

diff --git a/Xext/shm.c b/Xext/shm.c
index 376f123..3c0d1ee 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -154,7 +154,7 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
 }
 
 
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
 #include <sys/signal.h>
 
 static Bool badSysCall = FALSE;
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index f50481f..c2f891a 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -104,7 +104,7 @@ static unsigned int pagesize;
 
 static Bool badSysCall = FALSE;
 
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
 
 #include <sys/signal.h>
 
diff --git a/hw/xfree86/loader/os.c b/hw/xfree86/loader/os.c
index fdddce8..12cf3d8 100644
--- a/hw/xfree86/loader/os.c
+++ b/hw/xfree86/loader/os.c
@@ -42,6 +42,8 @@
 #define OSNAME "linux"
 #elif defined(__FreeBSD__)
 #define OSNAME "freebsd"
+#elif defined(__DragonFly__)
+#define OSNAME "dragonfly"
 #elif defined(__NetBSD__)
 #define OSNAME "netbsd"
 #elif defined(__OpenBSD__)
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index f0cb916..5ebbdd5 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -235,7 +235,7 @@
 # if defined(linux)
 #  define ARCH_PCI_INIT axpPciInit
 #  define INCLUDE_XF86_MAP_PCI_MEM
-# elif defined(__FreeBSD__) || defined(__OpenBSD__)
+# elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
 #  define ARCH_PCI_INIT freebsdPciInit
 #  define INCLUDE_XF86_MAP_PCI_MEM
 #  define INCLUDE_XF86_NO_DOMAIN
diff --git a/hw/xfree86/os-support/bus/freebsdPci.c b/hw/xfree86/os-support/bus/freebsdPci.c
index 61cb405..63c00b2 100644
--- a/hw/xfree86/os-support/bus/freebsdPci.c
+++ b/hw/xfree86/os-support/bus/freebsdPci.c
@@ -83,7 +83,7 @@ static pciBusInfo_t freebsdPci0 = {
 /* bridge      */	NULL
 };
 
-#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
+#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__)
 #if X_BYTE_ORDER == X_BIG_ENDIAN
 #ifdef __sparc__
 #ifndef ASI_PL


Reply to: