xserver: Branch 'server-1.4-branch' - 3 commits

Daniel Stone daniels at kemper.freedesktop.org
Sat Nov 17 13:09:08 PST 2007


 dix/getevents.c                 |   20 +++++++++++++----
 hw/xfree86/common/xf86MiscExt.c |   20 -----------------
 hw/xfree86/common/xf86VidMode.c |   46 ----------------------------------------
 3 files changed, 16 insertions(+), 70 deletions(-)

New commits:
commit f3a5d67688a0f691ef23cb44b1fdda190b5b8bef
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Sun Sep 23 12:43:31 2007 +0300

    GetKeyboardEvents: Reject out-of-range keycodes (bug #12528)
    
    We can only deal with keycodes between 8 and 255, so make sure that we never
    accept anything out of this range.
    (cherry picked from commit 0e800ca4651a947ccef239e6fe7bf64aab92257c)

diff --git a/dix/getevents.c b/dix/getevents.c
index f921a22..b70653d 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -409,6 +409,7 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
     if (!events)
         return 0;
 
+    /* DO NOT WANT */
     if (type != KeyPress && type != KeyRelease)
         return 0;
 
@@ -416,6 +417,9 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
         (pDev->coreEvents && !inputInfo.keyboard->key))
         return 0;
 
+    if (key_code < 8 || key_code > 255)
+        return 0;
+
     if (pDev->coreEvents)
         numEvents = 2;
     else
commit 35bf7c738a8286a382aeef38c0f035773b3ab96a
Author: Naoki Hamada <nao at tom-yam.or.jp>
Date:   Thu Oct 25 18:45:50 2007 +0300

    Input: Fix key down test (bug #12858)
    
    Fix the botched previous key_is_down test, which would give false positives.
    Also move key_autorepeats to a separate inline function.
    (cherry picked from commit 242f56f722243938e908d1957781ee53c2999783)

diff --git a/dix/getevents.c b/dix/getevents.c
index f92a021..f921a22 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -95,7 +95,14 @@ set_key_up(DeviceIntPtr pDev, int key_code)
 static Bool
 key_is_down(DeviceIntPtr pDev, int key_code)
 {
-    return pDev->key->postdown[key_code >> 3] >> (key_code & 7);
+    return !!(pDev->key->postdown[key_code >> 3] & (1 << (key_code & 7)));
+}
+
+static Bool
+key_autorepeats(DeviceIntPtr pDev, int key_code)
+{
+    return !!(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3] &
+              (1 << (key_code & 7)));
 }
 
 /**
@@ -440,10 +447,11 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
      * FIXME: In theory, if you're repeating with two keyboards in non-XKB,
      *        you could get unbalanced events here. */
     if (type == KeyPress && key_is_down(pDev, key_code)) {
+        /* If autorepeating is disabled either globally or just for that key,
+         * or we have a modifier, don't generate a repeat event. */
         if (!pDev->kbdfeed->ctrl.autoRepeat ||
-            pDev->key->modifierMap[key_code] ||
-            !(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3]
-                & (1 << (key_code & 7))))
+            !key_autorepeats(pDev, key_code) ||
+            pDev->key->modifierMap[key_code])
             return 0;
 
 #ifdef XKB
commit b3de1b9d375c98b72c88991ac2011e492254c61f
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Oct 26 09:12:15 2007 +0300

    XFree86 Misc/VidMode: Remove ridiculous debug ErrorFs
    
    When we're building with --enable-debug, don't emit an ErrorF every time a
    function gets called.
    (cherry picked from commit 6d59bb5709a99ab60b482bbf3393ebffda7f9407)

diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c
index 655304e..c1b9c60 100644
--- a/hw/xfree86/common/xf86MiscExt.c
+++ b/hw/xfree86/common/xf86MiscExt.c
@@ -152,8 +152,6 @@ MiscExtGetMouseSettings(pointer *mouse, char **devname)
 {
     mseParamsPtr mseptr;
 
-    DEBUG_P("MiscExtGetMouseSettings");
-
     mseptr = MiscExtCreateStruct(MISC_POINTER);
     if (!mseptr)
 	return FALSE;
@@ -184,8 +182,6 @@ MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype)
 {
     mseParamsPtr mse = mouse;
 
-    DEBUG_P("MiscExtGetMouseValue");
-
     switch (valtype) {
 	case MISC_MSE_PROTO:		return mse->type;
 	case MISC_MSE_BAUDRATE:		return mse->baudrate;
@@ -205,8 +201,6 @@ MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value)
 {
     mseParamsPtr mse = mouse;
 
-    DEBUG_P("MiscExtSetMouseValue");
-
     switch (valtype) {
 	case MISC_MSE_PROTO:
 	    mse->type = value;
@@ -251,8 +245,6 @@ MiscExtSetMouseDevice(pointer mouse, char* device)
 _X_EXPORT Bool
 MiscExtGetKbdSettings(pointer *kbd)
 {
-    DEBUG_P("MiscExtGetKbdSettings");
-
     return FALSE;
 }
 
@@ -290,8 +282,6 @@ MiscExtClientStateCallback(CallbackListPtr *callbacks,
 _X_EXPORT int
 MiscExtSetGrabKeysState(ClientPtr client, int state)
 {
-    DEBUG_P("MiscExtSetGrabKeysState");
-
     if (xf86Info.grabInfo.override == NULL ||
 	xf86Info.grabInfo.override == client) {
 	if (state == 0 && xf86Info.grabInfo.disabled == 0) {
@@ -318,8 +308,6 @@ MiscExtSetGrabKeysState(ClientPtr client, int state)
 _X_EXPORT pointer
 MiscExtCreateStruct(MiscExtStructType mse_or_kbd)
 {
-    DEBUG_P("MiscExtCreateStruct");
-    
     switch (mse_or_kbd) {
     case MISC_POINTER:
     {
@@ -348,8 +336,6 @@ MiscExtCreateStruct(MiscExtStructType mse_or_kbd)
 _X_EXPORT void
 MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd)
 {
-    DEBUG_P("MiscExtDestroyStruct");
-
     switch (mse_or_kbd) {
 	case MISC_POINTER:
 	case MISC_KEYBOARD:
@@ -410,8 +396,6 @@ MiscExtAuthorizeDevice(InputInfoPtr pInfo, char *device)
 _X_EXPORT MiscExtReturn
 MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
 {
-    DEBUG_P("MiscExtApply");
-
     if (mse_or_kbd == MISC_POINTER) {
 	Bool protoChanged = FALSE;
 	int oldflags;
@@ -551,8 +535,6 @@ _X_EXPORT Bool
 MiscExtGetFilePaths(const char **configfile, const char **modulepath,
 		    const char **logfile)
 {
-    DEBUG_P("MiscExtGetFilePaths");
-
     *configfile = xf86ConfigFile;
     *modulepath = xf86ModulePath;
     *logfile    = xf86LogFile;
@@ -566,8 +548,6 @@ MiscExtPassMessage(int scrnIndex, const char *msgtype, const char *msgval,
 {
     ScrnInfoPtr pScr = xf86Screens[scrnIndex];
 
-    DEBUG_P("MiscExtPassMessage");
-
     if (*pScr->HandleMessage == NULL)
 	    return BadImplementation;
     return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr);
diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c
index fb91513..16a4d82 100644
--- a/hw/xfree86/common/xf86VidMode.c
+++ b/hw/xfree86/common/xf86VidMode.c
@@ -68,8 +68,6 @@ VidModeExtensionInit(ScreenPtr pScreen)
 #ifdef XF86VIDMODE
     VidModePtr pVidMode;
     
-    DEBUG_P("VidModeExtensionInit");
-
     if (!xf86GetVidModeEnabled()) {
 	DEBUG_P("!xf86GetVidModeEnabled()");
 	return FALSE;
@@ -109,8 +107,6 @@ VidModeClose(int i, ScreenPtr pScreen)
 {
     VidModePtr pVidMode = VMPTR(pScreen);
 
-    DEBUG_P("VidModeClose");
-
     /* This shouldn't happen */
     if (!pVidMode)
 	return FALSE;
@@ -132,8 +128,6 @@ VidModeAvailable(int scrnIndex)
     ScrnInfoPtr pScrn;
     VidModePtr pVidMode;
 
-    DEBUG_P("VidModeAvailable");
-
     if (VidModeIndex < 0) {
 	DEBUG_P("VidModeIndex < 0");
 	return FALSE;
@@ -159,8 +153,6 @@ VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeGetCurrentModeline");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -176,8 +168,6 @@ VidModeGetDotClock(int scrnIndex, int Clock)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeGetDotClock");
-
     if (!VidModeAvailable(scrnIndex))
 	return 0;
 
@@ -193,8 +183,6 @@ VidModeGetNumOfClocks(int scrnIndex, Bool *progClock)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeGetNumOfClocks");
-
     if (!VidModeAvailable(scrnIndex))
 	return 0;
 
@@ -214,8 +202,6 @@ VidModeGetClocks(int scrnIndex, int *Clocks)
     ScrnInfoPtr pScrn;
     int i;
 
-    DEBUG_P("VidModeGetClocks");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -237,8 +223,6 @@ VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock)
     ScrnInfoPtr pScrn;
     VidModePtr pVidMode;
 
-    DEBUG_P("VidModeGetFirstModeline");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -263,8 +247,6 @@ VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock)
     VidModePtr pVidMode;
     DisplayModePtr p;
 
-    DEBUG_P("VidModeGetNextModeline");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -288,8 +270,6 @@ VidModeDeleteModeline(int scrnIndex, pointer mode)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeDeleteModeline");
-
     if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 	return FALSE;
 
@@ -303,8 +283,6 @@ VidModeZoomViewport(int scrnIndex, int zoom)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeZoomViewPort");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -318,8 +296,6 @@ VidModeSetViewPort(int scrnIndex, int x, int y)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeSetViewPort");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -341,8 +317,6 @@ VidModeGetViewPort(int scrnIndex, int *x, int *y)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeGetViewPort");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -359,8 +333,6 @@ VidModeSwitchMode(int scrnIndex, pointer mode)
     DisplayModePtr pTmpMode;
     Bool retval;
 
-    DEBUG_P("VidModeSwitchMode");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -381,8 +353,6 @@ VidModeLockZoom(int scrnIndex, Bool lock)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeLockZoom");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -400,8 +370,6 @@ VidModeGetMonitor(int scrnIndex, pointer *monitor)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeGetMonitor");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -416,8 +384,6 @@ VidModeCheckModeForMonitor(int scrnIndex, pointer mode)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeCheckModeForMonitor");
-
     if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 	return MODE_ERROR;
 
@@ -431,8 +397,6 @@ VidModeCheckModeForDriver(int scrnIndex, pointer mode)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeCheckModeForDriver");
-
     if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 	return MODE_ERROR;
 
@@ -447,8 +411,6 @@ VidModeSetCrtcForMode(int scrnIndex, pointer mode)
     ScrnInfoPtr pScrn;
     DisplayModePtr ScreenModes;
     
-    DEBUG_P("VidModeSetCrtcForMode");
-
     if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 	return;
 
@@ -467,8 +429,6 @@ VidModeAddModeline(int scrnIndex, pointer mode)
 {
     ScrnInfoPtr pScrn;
     
-    DEBUG_P("VidModeAddModeline");
-
     if ((mode == NULL) || (!VidModeAvailable(scrnIndex)))
 	return FALSE;
 
@@ -491,8 +451,6 @@ VidModeGetNumOfModes(int scrnIndex)
     pointer mode = NULL;
     int dotClock= 0, nummodes = 0;
   
-    DEBUG_P("VidModeGetNumOfModes");
-
     if (!VidModeGetFirstModeline(scrnIndex, &mode, &dotClock))
 	return nummodes;
 
@@ -509,8 +467,6 @@ VidModeSetGamma(int scrnIndex, float red, float green, float blue)
     ScrnInfoPtr pScrn;
     Gamma gamma;
 
-    DEBUG_P("VidModeSetGamma");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 
@@ -529,8 +485,6 @@ VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue)
 {
     ScrnInfoPtr pScrn;
 
-    DEBUG_P("VidModeGetGamma");
-
     if (!VidModeAvailable(scrnIndex))
 	return FALSE;
 


More information about the xorg-commit mailing list