From 5903b4c749c1136d0f3e91d5e6321b08c31da4bf Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 2 Jun 2008 11:04:41 +0930 Subject: [PATCH 01/10] kdrive: don't post motion event if there was no motion. #16179 Based on the patch by Tomas Janousek. Backported from master to server-1.4. X.Org Bug 16179 (cherry picked from commit 26e7e69ab893d1f2b35213250ada40ec90944f62) --- hw/kdrive/src/kinput.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 6c247c185..d53a0d99a 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -2066,7 +2066,7 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry, int (*matrix)[3] = kdPointerMatrix.matrix; unsigned long button; int n; - int dixflags; + int dixflags = 0; if (!pi) return; @@ -2097,11 +2097,15 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry, z = rz; if (flags & KD_MOUSE_DELTA) - dixflags = POINTER_RELATIVE & POINTER_ACCELERATE; - else - dixflags = POINTER_ABSOLUTE; + { + if (x || y || z) + dixflags = POINTER_RELATIVE | POINTER_ACCELERATE; + } else if ((pi->dixdev->valuator) && (x != pi->dixdev->valuator->lastx || + y != pi->dixdev->valuator->lasty)) + dixflags = POINTER_ABSOLUTE; - _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE); + if (dixflags) + _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE); buttons = flags; From 7cdef0d6fc3ec6705a61014b741a4c24dc60973b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sun, 1 Jun 2008 15:20:42 +0930 Subject: [PATCH 02/10] xkb: delete default rules when devices are closed. We only have one set of default rules options in xkb. When the second keyboard is brought up with Xkb options specified, these new options overwrite the old. In future server generations, the rules used for the VCK are a mixture of the default ones and ones previously specified for other keyboards. Simply resetting the xkb default rules to NULL avoids this issue. Reproducable by setting XkbLayout "de" and XkbVariant "nodeadkeys". In the second server generation, the VCK has "us(nodeadkeys)". This again produces a SIGABRT when the first key is hit. I could not figure out why the SIGABRT happens. This patch is avoiding the issue rather than fixing it. (cherry picked from commit 5a3d06b8f42473cea3741dc722a775deaa2b73f6) --- dix/devices.c | 3 +++ include/xkbsrv.h | 4 ++++ xkb/xkbInit.c | 15 +++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/dix/devices.c b/dix/devices.c index f6f3c8ece..c02b7ae55 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -634,6 +634,9 @@ CloseDownDevices(void) inputInfo.off_devices = NULL; inputInfo.keyboard = NULL; inputInfo.pointer = NULL; +#ifdef XKB + XkbDeleteRulesDflts(); +#endif } /** diff --git a/include/xkbsrv.h b/include/xkbsrv.h index acf3bb0a3..b52eb6520 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -895,6 +895,10 @@ extern void XkbSetRulesDflts( char * /* options */ ); +extern void XkbDeleteRulesDflts( + void +); + extern void XkbInitDevice( DeviceIntPtr /* pXDev */ ); diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index c0867adf0..87ee0720e 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -278,6 +278,21 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, return; } +void +XkbDeleteRulesDflts() +{ + _XkbFree(XkbRulesFile); + XkbRulesFile = NULL; + _XkbFree(XkbModelDflt); + XkbModelDflt = NULL; + _XkbFree(XkbLayoutDflt); + XkbLayoutDflt = NULL; + _XkbFree(XkbVariantDflt); + XkbVariantDflt = NULL; + _XkbFree(XkbOptionsDflt); + XkbOptionsDflt = NULL; +} + /***====================================================================***/ #if defined(luna) From 9b62355847ce7df1ca144b4ebc9ff5c7286b573d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 4 Jun 2008 11:10:11 +0930 Subject: [PATCH 03/10] xkb: reset xkb_cached_map on CloseDownDevices. Could lead to some invalid pointers in the second server generation. (cherry picked from commit ff3adf3e564d94fea18e48f966de40a7ded1279e) --- xkb/xkbInit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 87ee0720e..7723c749f 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -291,6 +291,9 @@ XkbDeleteRulesDflts() XkbVariantDflt = NULL; _XkbFree(XkbOptionsDflt); XkbOptionsDflt = NULL; + + XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, True); + xkb_cached_map = NULL; } /***====================================================================***/ From 153c6d48c655b3eca9a33b7487b238b42a4a3f8e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 3 Jul 2008 15:05:14 +0930 Subject: [PATCH 04/10] xfree86: AllowEmptyInput is now enabled by default if hotplugging is enabled. Remove AEI check from configImpliedLayout as the setting isn't actually parsed at this point anyway (written by Sasha Hlusiak). Resurrect checkInput() and check for devices there if AEI is false (this also creates the default devices if required). Set AllowEmptyInput to enabled by default if hotplugging is enabled. (cherry picked from commit bea743f3d629bafdc301f40e9c0bc11382dfe8bc) Conflicts: hw/xfree86/common/xf86Config.c hw/xfree86/doc/man/xorg.conf.man.pre --- hw/xfree86/common/xf86Config.c | 10 ++++------ hw/xfree86/doc/man/xorg.conf.man.pre | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 3c29497e3..2916402f9 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -1081,9 +1081,9 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Info.aiglxFrom = X_CONFIG; } - xf86Info.allowEmptyInput = FALSE; - if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value)) - xf86Info.allowEmptyInput = TRUE; + /* AllowEmptyInput is automatically true if we're hotplugging */ + xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices); + xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput); xf86Info.useDefaultFontPath = TRUE; xf86Info.useDefaultFontPathFrom = X_DEFAULT; @@ -1841,9 +1841,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) indp = xnfalloc(sizeof(IDevPtr)); *indp = NULL; servlayoutp->inputs = indp; - if (!xf86Info.allowEmptyInput && !checkCoreInputDevices(servlayoutp, TRUE)) - return FALSE; - + return TRUE; } diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 3ff5776f4..94baf132f 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -672,6 +672,21 @@ default. .BI "Option \*qIgnoreABI\*q \*q" boolean \*q Allow modules built for a different, potentially incompatible version of the X server to load. Disabled by default. +.TP 7 +.BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q +If enabled, don't add the standard keyboard and mouse drivers, if there are no +input devices in the config file. Enabled by default if AutoAddDevices and +AutoEnableDevices is enabled, otherwise disabled. +.TP 7 +.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q +If this option is disabled, then no devices will be added from HAL events. +Enabled by default. +.TP 7 +.BI "Option \*qAutoEnableDevices\*q \*q" boolean \*q +If this option is disabled, then the devices will be added (and the +DevicePresenceNotify event sent), but not enabled, thus leaving policy up +to the client. +Enabled by default. .SH "MODULE SECTION" The .B Module From 48a9996192613ab259549cdb7c8735d2fb31ed78 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 29 Jul 2008 10:00:01 +0930 Subject: [PATCH 05/10] Xi: ChangeDeviceControl presence events should set the appropriate devchange. Requires inputproto 1.4.4 or higher. (cherry picked from commit 591ef3c047ab3597fef9d687205e99c254ff2040) Modified to use the numeric value of DeviceControlChanged instead of the define, just so we don't bork out if someone rebuilds without updating inputproto. This is a released server, after all. --- Xi/chgdctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index 9676fb747..38793c9cc 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -261,7 +261,7 @@ out: if (ret == Success) { dpn.type = DevicePresenceNotify; dpn.time = currentTime.milliseconds; - dpn.devchange = 1; + dpn.devchange = 5; /* DeviceControlChanged */ dpn.deviceid = dev->id; dpn.control = stuff->control; SendEventToAllWindows(dev, DevicePresenceNotifyMask, From b50932d998f9fe81d01a8cd22d9613aaf9136985 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 29 Jul 2008 13:14:02 +0930 Subject: [PATCH 06/10] Revert "xfree86: AllowEmptyInput is now enabled by default if hotplugging is enabled." This reverts commit 153c6d48c655b3eca9a33b7487b238b42a4a3f8e. How did this one end up on the branch? Sure as hell wasn't supposed to be pushed. --- hw/xfree86/common/xf86Config.c | 10 ++++++---- hw/xfree86/doc/man/xorg.conf.man.pre | 15 --------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 2916402f9..3c29497e3 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -1081,9 +1081,9 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Info.aiglxFrom = X_CONFIG; } - /* AllowEmptyInput is automatically true if we're hotplugging */ - xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices); - xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput); + xf86Info.allowEmptyInput = FALSE; + if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value)) + xf86Info.allowEmptyInput = TRUE; xf86Info.useDefaultFontPath = TRUE; xf86Info.useDefaultFontPathFrom = X_DEFAULT; @@ -1841,7 +1841,9 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) indp = xnfalloc(sizeof(IDevPtr)); *indp = NULL; servlayoutp->inputs = indp; - + if (!xf86Info.allowEmptyInput && !checkCoreInputDevices(servlayoutp, TRUE)) + return FALSE; + return TRUE; } diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 94baf132f..3ff5776f4 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -672,21 +672,6 @@ default. .BI "Option \*qIgnoreABI\*q \*q" boolean \*q Allow modules built for a different, potentially incompatible version of the X server to load. Disabled by default. -.TP 7 -.BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q -If enabled, don't add the standard keyboard and mouse drivers, if there are no -input devices in the config file. Enabled by default if AutoAddDevices and -AutoEnableDevices is enabled, otherwise disabled. -.TP 7 -.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q -If this option is disabled, then no devices will be added from HAL events. -Enabled by default. -.TP 7 -.BI "Option \*qAutoEnableDevices\*q \*q" boolean \*q -If this option is disabled, then the devices will be added (and the -DevicePresenceNotify event sent), but not enabled, thus leaving policy up -to the client. -Enabled by default. .SH "MODULE SECTION" The .B Module From f0f3a11acd48dd233e8808101dcc8a22591fd00c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 29 Jul 2008 13:15:34 +0930 Subject: [PATCH 07/10] Revert "xkb: reset xkb_cached_map on CloseDownDevices." This reverts commit 9b62355847ce7df1ca144b4ebc9ff5c7286b573d. This wasn't supposed to be pushed either. --- xkb/xkbInit.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 7723c749f..87ee0720e 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -291,9 +291,6 @@ XkbDeleteRulesDflts() XkbVariantDflt = NULL; _XkbFree(XkbOptionsDflt); XkbOptionsDflt = NULL; - - XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, True); - xkb_cached_map = NULL; } /***====================================================================***/ From a49d811065701c5f3abb25b9e4945ce7547d0b53 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 29 Jul 2008 13:15:50 +0930 Subject: [PATCH 08/10] Revert "xkb: delete default rules when devices are closed." This reverts commit 7cdef0d6fc3ec6705a61014b741a4c24dc60973b. Nor was this one. --- dix/devices.c | 3 --- include/xkbsrv.h | 4 ---- xkb/xkbInit.c | 15 --------------- 3 files changed, 22 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index c02b7ae55..f6f3c8ece 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -634,9 +634,6 @@ CloseDownDevices(void) inputInfo.off_devices = NULL; inputInfo.keyboard = NULL; inputInfo.pointer = NULL; -#ifdef XKB - XkbDeleteRulesDflts(); -#endif } /** diff --git a/include/xkbsrv.h b/include/xkbsrv.h index b52eb6520..acf3bb0a3 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -895,10 +895,6 @@ extern void XkbSetRulesDflts( char * /* options */ ); -extern void XkbDeleteRulesDflts( - void -); - extern void XkbInitDevice( DeviceIntPtr /* pXDev */ ); diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 87ee0720e..c0867adf0 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -278,21 +278,6 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, return; } -void -XkbDeleteRulesDflts() -{ - _XkbFree(XkbRulesFile); - XkbRulesFile = NULL; - _XkbFree(XkbModelDflt); - XkbModelDflt = NULL; - _XkbFree(XkbLayoutDflt); - XkbLayoutDflt = NULL; - _XkbFree(XkbVariantDflt); - XkbVariantDflt = NULL; - _XkbFree(XkbOptionsDflt); - XkbOptionsDflt = NULL; -} - /***====================================================================***/ #if defined(luna) From 969f1db96b03afa51dacce466320d311e5c9ce72 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 29 Jul 2008 13:17:27 +0930 Subject: [PATCH 09/10] Revert "kdrive: don't post motion event if there was no motion. #16179" This reverts commit 5903b4c749c1136d0f3e91d5e6321b08c31da4bf. And this one wasn't supposed to be pushed too. --- hw/kdrive/src/kinput.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index d53a0d99a..6c247c185 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -2066,7 +2066,7 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry, int (*matrix)[3] = kdPointerMatrix.matrix; unsigned long button; int n; - int dixflags = 0; + int dixflags; if (!pi) return; @@ -2097,15 +2097,11 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry, z = rz; if (flags & KD_MOUSE_DELTA) - { - if (x || y || z) - dixflags = POINTER_RELATIVE | POINTER_ACCELERATE; - } else if ((pi->dixdev->valuator) && (x != pi->dixdev->valuator->lastx || - y != pi->dixdev->valuator->lasty)) - dixflags = POINTER_ABSOLUTE; + dixflags = POINTER_RELATIVE & POINTER_ACCELERATE; + else + dixflags = POINTER_ABSOLUTE; - if (dixflags) - _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE); + _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE); buttons = flags; From ff49f5944d06b17fb904c4f64b8660aab60d8d0d Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 3 Jan 2008 22:53:36 -0500 Subject: [PATCH 10/10] Fix potential crasher in xf86CrtcRotate() xf86CrtcRotate() is called by randr 1.2 drivers via xf86CrtcSetMode() or xf86SetDesiredModes() during ScreenInit() at which point pScrn->pScreen is not set. If a user specifies a rotation in their config file pScrn->pScreen is dereferenced and boom. --- hw/xfree86/modes/xf86Rotate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index dd0e6598e..e2d6295b9 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -494,7 +494,8 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) { ScrnInfoPtr pScrn = crtc->scrn; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - ScreenPtr pScreen = pScrn->pScreen; + /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */ + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; PictTransform crtc_to_fb, fb_to_crtc; PictureTransformIdentity (&crtc_to_fb);