xserver: Branch 'master' - 2 commits

Peter Hutterer whot at kemper.freedesktop.org
Wed Feb 4 20:34:19 PST 2009


 dix/devices.c    |   29 ++++++++++++++++++++---------
 dix/enterleave.c |    8 ++++----
 2 files changed, 24 insertions(+), 13 deletions(-)

New commits:
commit 9a1d07ecb74b7c3267a6910af66ada917a525110
Author: Tomas Carnecky <tom at dbservice.com>
Date:   Wed Feb 4 20:20:24 2009 +0100

    Fix "warning: cast from pointer to integer of different size"
    
    Signed-off-by: Tomas Carnecky <tom at dbservice.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/enterleave.c b/dix/enterleave.c
index 1a5f1b5..b8de9f0 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -1077,8 +1077,8 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
                 if (ptrwin && IsParent(root, ptrwin))
                     CoreFocusOutNotifyPointerEvents(dev, root, None, mode, TRUE);
             }
-            CoreFocusEvent(dev, FocusOut, mode, ((int)A) ? NotifyPointerRoot : NotifyDetailNone, root);
-            CoreFocusEvent(dev, FocusIn, mode, ((int)B) ? NotifyPointerRoot : NotifyDetailNone, root);
+            CoreFocusEvent(dev, FocusOut, mode, A ? NotifyPointerRoot : NotifyDetailNone, root);
+            CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root);
             if (B == PointerRootWin)
                 CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
         }
@@ -1128,7 +1128,7 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
         root = WindowTable[i];
         if (!HasFocus(root) && !FirstFocusChild(root))
         {
-            CoreFocusEvent(dev, FocusIn, mode, ((int)B) ? NotifyPointerRoot : NotifyDetailNone, root);
+            CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root);
             if (B == PointerRootWin)
                 CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
         }
@@ -1169,7 +1169,7 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
                 if (ptrwin)
                     CoreFocusOutNotifyPointerEvents(dev, root, None, mode, TRUE);
             }
-            CoreFocusEvent(dev, FocusOut, mode, ((int)A) ? NotifyPointerRoot : NotifyDetailNone, root);
+            CoreFocusEvent(dev, FocusOut, mode, A ? NotifyPointerRoot : NotifyDetailNone, root);
         }
     }
 
commit 0e15697b53c9448ce9911aa6499b2ea0bda92af6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Feb 4 10:11:13 2009 +1000

    dix: die if we can't activate or init the VCP/VCK.
    
    If we have a busted xkb setup, the XKB initialization on the core devices
    fails and leaves us with dev->key->xkbInfo == NULL. This in turn causes
    segfaults lateron.
    
    Return BadValue when the XKB configuration for a master device failed, and if
    that happens for the VCP/VCK, die semi-gracefully.
    The VCP init can only fail on OOM.
    
    Reported by Aaron Plattner.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Daniel Stone <daniel at fooishbar.org>
    Acked-by: Dan Nicholson <dbn.lists at gmail.com>
    Signed-off-by: Aaron Plattner <aplattner at nvidia.com>

diff --git a/dix/devices.c b/dix/devices.c
index 4f85c6d..934e695 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -488,8 +488,13 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
     switch (what) {
     case DEVICE_INIT:
         XkbGetRulesDflts(&rmlvo);
-        InitKeyboardDeviceStruct(pDev, &rmlvo, CoreKeyboardBell,
-                                 CoreKeyboardCtl);
+        if (!InitKeyboardDeviceStruct(pDev, &rmlvo, CoreKeyboardBell,
+                                      CoreKeyboardCtl))
+        {
+            ErrorF("Keyboard initialization failed. This could be a missing "
+                   "or incorrect setup of xkeyboard-config.\n");
+            return BadValue;
+        }
         return Success;
 
     case DEVICE_ON:
@@ -519,9 +524,14 @@ CorePointerProc(DeviceIntPtr pDev, int what)
     case DEVICE_INIT:
         for (i = 1; i <= 32; i++)
             map[i] = i;
-        InitPointerDeviceStruct((DevicePtr)pDev, map, 32,
+        if (!InitPointerDeviceStruct((DevicePtr)pDev, map, 32,
                                 (PtrCtrlProcPtr)NoopDDA,
-                                GetMotionHistorySize(), 2);
+                                GetMotionHistorySize(), 2))
+        {
+            ErrorF("Could not initialize device '%s'. Out of memory.\n",
+                   pDev->name);
+            return BadAlloc; /* IPDS only fails on allocs */
+        }
         pDev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
         pDev->last.valuators[0] = pDev->valuator->axisVal[0];
         pDev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
@@ -554,11 +564,12 @@ InitCoreDevices(void)
                           &inputInfo.keyboard) != Success)
         FatalError("Failed to allocate core devices");
 
-    ActivateDevice(inputInfo.pointer);
-    ActivateDevice(inputInfo.keyboard);
-    EnableDevice(inputInfo.pointer);
-    EnableDevice(inputInfo.keyboard);
-
+    if (ActivateDevice(inputInfo.pointer) != Success ||
+        ActivateDevice(inputInfo.keyboard) != Success)
+        FatalError("Failed to activate core devices.");
+    if (!EnableDevice(inputInfo.pointer) ||
+        !EnableDevice(inputInfo.keyboard))
+        FatalError("Failed to enable core devices.");
 }
 
 /**


More information about the xorg-commit mailing list