[PATCH v2] xfree86: after VT switching back, only enable previously enabled devices
Chase Douglas
chase.douglas at canonical.com
Thu Apr 12 19:27:34 PDT 2012
On 04/12/2012 07:10 PM, Peter Hutterer wrote:
> On Thu, Apr 12, 2012 at 05:36:14PM -0700, Chase Douglas wrote:
>> 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?
>>
> Enable/DisableDevice are DIX functions that don't have access to the
> xfree86-only pInfo structs. We could shove the flags into the DeviceIntRec
> but that's another ABI break (so no backports) and this is decidedly xfree86
> functionality anyways.
>
> Renaming the flag to XI86_DEVICE_VT_DISABLED would be more appropriate,
> I guess.
Hmmm.. I'm not crazy about putting a single-function quirk inside an
external record, but I can't think of anything better.
Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
More information about the xorg-devel
mailing list