[PATCH v2] xfree86: after VT switching back, only enable previously enabled devices

Chase Douglas chase.douglas at canonical.com
Thu Apr 12 17:36:14 PDT 2012


On 04/12/2012 04:52 PM, Peter Hutterer wrote:
> If a device was enabled before the VT switch, re-enabled it. Otherwise leave
> it as is, there was probably a reason why it was disabled.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Changes: 
> - set a flag in the pInfo struct instead of using a static array
> 
>  hw/xfree86/common/xf86Events.c |    8 ++++++--
>  hw/xfree86/common/xf86Xinput.h |    3 +++
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
> index 058057e..5896f22 100644
> --- a/hw/xfree86/common/xf86Events.c
> +++ b/hw/xfree86/common/xf86Events.c
> @@ -449,6 +449,8 @@ xf86VTSwitch(void)
>              xf86DisableInputHandler(ih);
>          for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
>              if (pInfo->dev) {
> +                if (!pInfo->dev->enabled)
> +                    pInfo->flags |= XI86_DEVICE_DISABLED;
>                  xf86ReleaseKeys(pInfo->dev);
>                  ProcessInputEvents();
>                  DisableDevice(pInfo->dev, TRUE);
> @@ -482,8 +484,9 @@ xf86VTSwitch(void)
>  
>              pInfo = xf86InputDevs;
>              while (pInfo) {
> -                if (pInfo->dev)
> +                if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
>                      EnableDevice(pInfo->dev, TRUE);
> +                pInfo->flags &= ~XI86_DEVICE_DISABLED;
>                  pInfo = pInfo->next;
>              }
>              for (ih = InputHandlers; ih; ih = ih->next)
> @@ -537,8 +540,9 @@ xf86VTSwitch(void)
>  
>          pInfo = xf86InputDevs;
>          while (pInfo) {
> -            if (pInfo->dev)
> +            if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
>                  EnableDevice(pInfo->dev, TRUE);
> +            pInfo->flags &= ~XI86_DEVICE_DISABLED;
>              pInfo = pInfo->next;
>          }

Why set the flags here instead of when the device is actually
enabled/disabled?

-- Chase


More information about the xorg-devel mailing list