xserver: Branch 'master' - 6 commits

Peter Hutterer whot at kemper.freedesktop.org
Tue Aug 4 22:30:46 PDT 2009


 Xi/xichangehierarchy.c |    8 +++++++-
 configure.ac           |    2 +-
 dix/devices.c          |   21 ++++++++++++++-------
 dix/inpututils.c       |    6 ++----
 hw/xnest/Init.c        |   15 ++++++++++-----
 hw/xnest/Keyboard.c    |   21 +++++----------------
 hw/xnest/Pointer.c     |    1 +
 include/input.h        |    2 ++
 8 files changed, 42 insertions(+), 34 deletions(-)

New commits:
commit 95b678e6dc41f2524ada4eb11289687fafce7588
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Mon Aug 3 23:49:56 2009 -0700

    Correct modifier map built when ProcSetModifierMapping is called
    
    Fixes xmodmap changes to modifiers to stop corrupting modifier maps
    
    Previous code had two bugs:
     - the code to increment mod was after the code to continue if no
       modifier was set, so mod wouldn't be incremented for modifiers
       with no keys mapped to them (such as if you called
       xmodmap -e 'clear Lock')
     - the value it set in the modifier map was the raw modifier number,
       not the bitmask value for that modifier
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/inpututils.c b/dix/inpututils.c
index 378deb0..66936c9 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -227,7 +227,7 @@ do_modmap_change(ClientPtr client, DeviceIntPtr dev, CARD8 *modmap)
 static int build_modmap_from_modkeymap(CARD8 *modmap, KeyCode *modkeymap,
                                        int max_keys_per_mod)
 {
-    int i, mod = 0, len = max_keys_per_mod * 8;
+    int i, len = max_keys_per_mod * 8;
 
     memset(modmap, 0, MAP_LENGTH);
 
@@ -241,9 +241,7 @@ static int build_modmap_from_modkeymap(CARD8 *modmap, KeyCode *modkeymap,
         if (modmap[modkeymap[i]])
             return BadValue;
 
-        if (!(i % max_keys_per_mod))
-            mod++;
-        modmap[modkeymap[i]] = mod;
+        modmap[modkeymap[i]] = 1 << (i / max_keys_per_mod);
     }
 
     return Success;
commit 4ca305956e5ea6f606b22ef62aa462186a7b95f0
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Aug 5 09:40:56 2009 +1000

    Re-enable Xnest by default.
    
    Xnest was disabled in 82fc102568b3d6b0daeb6c5f5b3a1310a7f14fcd due do build
    errors. These errors have since been fixed.
    
    Re-enable Xnest by default to increase coverage by default builds.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index 1e3438e..f19b6fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -595,7 +595,7 @@ dnl DDXes.
 AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
 AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
 AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
-AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: no)]), [XNEST=$enableval], [XNEST=no])
+AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: no)]), [XNEST=$enableval], [XNEST=yes])
 AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
 AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
 AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
commit 5904ef2ccd6056b187ca76f104c21e2d686bfc1d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Aug 5 10:40:20 2009 +1000

    xnest: restore xnestUpdateModifierState
    
    The meat of xnestUpdateModifierState was ifdef'd out in
    6ef46c40e62def4841a4cff4e0b443516a2ed782. This resulted in stuck modifiers
    when a modifier key release event wasn't sent to Xnest (e.g. Alt-Tab away).
    
    See X.Org Bug 3664 <https://bugs.freedesktop.org/show_bug.cgi?id=3664> for
    the original bug report.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 191bec7..1835c70 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -206,29 +206,19 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev)
 void
 xnestUpdateModifierState(unsigned int state)
 {
-#if 0
   DeviceIntPtr pDev = xnestKeyboardDevice;
   KeyClassPtr keyc = pDev->key;
   int i;
   CARD8 mask;
+  int xkb_state;
 
   if (!pDev)
       return;
 
-/* This is pretty broken.
- *
- * What should happen is that focus out should do as a VT switch does in
- * traditional servers: fake releases for all keys (and buttons too, come
- * to think of it) currently down.  Then, on focus in, get the state from
- * the host, and fake keypresses for everything currently down.
- *
- * So I'm leaving this broken for a little while.  Sorry, folks.
- *
- * -daniels
- */
+  xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state);
   state = state & 0xff;
 
-  if (keyc->state == state)
+  if (xkb_state == state)
     return;
 
   for (i = 0, mask = 1; i < 8; i++, mask <<= 1) {
@@ -236,7 +226,7 @@ xnestUpdateModifierState(unsigned int state)
 
     /* Modifier is down, but shouldn't be
      */
-    if ((keyc->state & mask) && !(state & mask)) {
+    if ((xkb_state & mask) && !(state & mask)) {
       int count = keyc->modifierKeyCount[i];
 
       for (key = 0; key < MAP_LENGTH; key++)
@@ -257,12 +247,11 @@ xnestUpdateModifierState(unsigned int state)
 
     /* Modifier shoud be down, but isn't
      */
-    if (!(keyc->state & mask) && (state & mask))
+    if (!(xkb_state & mask) && (state & mask))
       for (key = 0; key < MAP_LENGTH; key++)
 	if (keyc->xkbInfo->desc->map->modmap[key] & mask) {
 	  xnestQueueKeyEvent(KeyPress, key);
 	  break;
 	}
   }
-#endif
 }
commit 44afc7577ad3339f4555438388f6a4d8e220c991
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Aug 5 09:51:05 2009 +1000

    xnest: include exevents.h for XIGetKnownProperty.
    
    Silences compiler warning.
    Pointer.c: In function ‘xnestPointerProc’:
    Pointer.c:64: warning: implicit declaration of function ‘XIGetKnownProperty’
    Pointer.c:64: warning: nested extern declaration of ‘XIGetKnownProperty’
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c
index c5d361c..4de4673 100644
--- a/hw/xnest/Pointer.c
+++ b/hw/xnest/Pointer.c
@@ -34,6 +34,7 @@ is" without express or implied warranty.
 #include "Args.h"
 
 #include "xserver-properties.h"
+#include "exevents.h" /* For XIGetKnownProperty */
 
 DeviceIntPtr xnestPointerDevice = NULL;
 
commit 32ce5c83a504d2cafd2b19ed628b40032ef347b3
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Aug 5 09:39:47 2009 +1000

    xnest: use AllocDevicePair for  Xnest device initalization
    
    All Xnest needs is a single pointer+keyboard pair. AllocDevicePair sets them
    up nicely with the name assigned etc.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 49a52d7..0765f73 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -89,13 +89,18 @@ InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
 void
 InitInput(int argc, char *argv[])
 {
-  xnestPointerDevice = AddInputDevice(serverClient, xnestPointerProc, TRUE);
-  xnestKeyboardDevice = AddInputDevice(serverClient, xnestKeyboardProc, TRUE);
+  int rc;
+  rc = AllocDevicePair(serverClient, "Xnest",
+                       &xnestPointerDevice,
+                       &xnestKeyboardDevice,
+                       xnestPointerProc,
+                       xnestKeyboardProc,
+                       FALSE);
 
-  GetEventList(&xnestEvents);
+  if (rc != Success)
+      FatalError("Failed to init Xnest default devices.\n");
 
-  RegisterPointerDevice(xnestPointerDevice);
-  RegisterKeyboardDevice(xnestKeyboardDevice);
+  GetEventList(&xnestEvents);
 
   mieqInit();
 
commit 26b83ad4a29dc180b336a19d9e97589814e93e37
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Aug 5 09:32:50 2009 +1000

    dix: require PointerProc and KeyboardProc to be passed into AllocDevicePair.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 9f52b6d..48d25c3 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -54,6 +54,10 @@
 
 #include "xichangehierarchy.h"
 
+extern DeviceProc CorePointerProc;
+extern DeviceProc CoreKeyboardProc;
+
+
 /**
  * Send the current state of the device hierarchy to all clients.
  */
@@ -176,7 +180,9 @@ ProcXIChangeHierarchy(ClientPtr client)
                     strncpy(name, (char*)&c[1], c->name_len);
 
 
-                    rc = AllocDevicePair(client, name, &ptr, &keybd, TRUE);
+                    rc = AllocDevicePair(client, name, &ptr, &keybd,
+                                         CorePointerProc, CoreKeyboardProc,
+                                         TRUE);
                     if (rc != Success)
                     {
                         xfree(name);
diff --git a/dix/devices.c b/dix/devices.c
index 53b7e2c..e58e940 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -98,6 +98,9 @@ DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKeyIndex;
 static int XTstDevicePrivateKeyIndex;
 DevPrivateKey XTstDevicePrivateKey = &XTstDevicePrivateKeyIndex;
 
+
+int CorePointerProc(DeviceIntPtr, int);
+int CoreKeyboardProc(DeviceIntPtr, int);
 /**
  * vxtstpointer
  * is the virtual pointer for XTest. It is the first slave
@@ -531,7 +534,7 @@ CoreKeyboardCtl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
 /**
  * Device control function for the Virtual Core Keyboard.
  */
-static int
+int
 CoreKeyboardProc(DeviceIntPtr pDev, int what)
 {
 
@@ -560,7 +563,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
 /**
  * Device control function for the Virtual Core Pointer.
  */
-static int
+int
 CorePointerProc(DeviceIntPtr pDev, int what)
 {
 #define NBUTTONS 7
@@ -627,6 +630,7 @@ InitCoreDevices(void)
 {
     if (AllocDevicePair(serverClient, "Virtual core",
                         &inputInfo.pointer, &inputInfo.keyboard,
+                        CorePointerProc, CoreKeyboardProc,
                         TRUE) != Success)
         FatalError("Failed to allocate core devices");
 
@@ -2491,15 +2495,18 @@ GetMaster(DeviceIntPtr dev, int which)
  */
 int
 AllocDevicePair (ClientPtr client, char* name,
-			    DeviceIntPtr* ptr, DeviceIntPtr* keybd,
-			    Bool master)
+                 DeviceIntPtr* ptr,
+                 DeviceIntPtr* keybd,
+                 DeviceProc ptr_proc,
+                 DeviceProc keybd_proc,
+                 Bool master)
 {
     DeviceIntPtr pointer;
     DeviceIntPtr keyboard;
     ClassesPtr classes;
     *ptr = *keybd = NULL;
 
-    pointer = AddInputDevice(client, CorePointerProc, TRUE);
+    pointer = AddInputDevice(client, ptr_proc, TRUE);
     if (!pointer)
         return BadAlloc;
 
@@ -2519,7 +2526,7 @@ AllocDevicePair (ClientPtr client, char* name,
     pointer->last.slave = NULL;
     pointer->type = (master) ? MASTER_POINTER : SLAVE;
 
-    keyboard = AddInputDevice(client, CoreKeyboardProc, TRUE);
+    keyboard = AddInputDevice(client, keybd_proc, TRUE);
     if (!keyboard)
     {
         RemoveDevice(pointer, FALSE);
@@ -2587,7 +2594,7 @@ int AllocXtstDevice (ClientPtr client, char* name,
     strncpy( xtstname, name, len);
     strncat( xtstname, " Xtst", 5 );
 
-    retval = AllocDevicePair( client, xtstname, ptr, keybd, FALSE);
+    retval = AllocDevicePair( client, xtstname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
     if ( retval == Success ){
         dixSetPrivate(&((*ptr)->devPrivates), XTstDevicePrivateKey, (void *)master_ptr->id);
         dixSetPrivate(&((*keybd)->devPrivates), XTstDevicePrivateKey, (void *)master_keybd->id);
diff --git a/include/input.h b/include/input.h
index e962696..d003472 100644
--- a/include/input.h
+++ b/include/input.h
@@ -482,6 +482,8 @@ extern int AllocDevicePair(ClientPtr client,
                              char* name,
                              DeviceIntPtr* ptr,
                              DeviceIntPtr* keybd,
+                             DeviceProc ptr_proc,
+                             DeviceProc keybd_proc,
                              Bool master);
 extern void DeepCopyDeviceClasses(DeviceIntPtr from,
                                   DeviceIntPtr to,


More information about the xorg-commit mailing list