]> git.pld-linux.org Git - packages/xorg-xserver-server.git/blob - xorg-xserver-server-force-SwitchCoreKeyboard-for-evdev.patch
- up to 1.6.1
[packages/xorg-xserver-server.git] / xorg-xserver-server-force-SwitchCoreKeyboard-for-evdev.patch
1 From 638cab7e1dc3711f7fb04155bcdabf4b8895cc5e Mon Sep 17 00:00:00 2001
2 From: Peter Hutterer <peter.hutterer@who-t.net>
3 Date: Mon, 4 Aug 2008 17:08:36 +0930
4 Subject: [PATCH] xfree86: force SwitchCoreKeyboard for evdev devices (updated).
5
6 If an evdev keyboard device is added through the HAL mechanism, force a
7 SwitchCoreKeyboard to load the evdev map into the VCK. This way, by the time a
8 client starts the evdev keymap is already there, leading to less pain lateron.
9
10 Works if:
11 - all keyboards are hotplugged through HAL, and/or
12 - the xorg.conf keyboard uses the kbd driver.
13
14 Has no effect (i.e. busted keymaps) if:
15 - an evdev keyboard device has been specified in the xorg.conf.
16 - we don't have a device at startup and plug a device in after starting the
17   desktop environment.
18 - if the device we use isn't the first one reported by HAL.
19
20 If HAL isn't set up, this patch is a noop.
21 ---
22  hw/xfree86/common/xf86Xinput.c |   31 +++++++++++++++++++++++++++++++
23  1 files changed, 31 insertions(+), 0 deletions(-)
24
25 diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
26 index 710e787..dacc3dc 100644
27 --- a/hw/xfree86/common/xf86Xinput.c
28 +++ b/hw/xfree86/common/xf86Xinput.c
29 @@ -423,6 +423,37 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
30          (!is_auto || xf86Info.autoEnableDevices))
31          EnableDevice(dev);
32  
33 +    /* XXX: The VCK always starts with built-in defaults for keymap. These
34 +     * defaults are different to the evdev ones. When the first key is hit on
35 +     * an extension device, the keymap is copied into the VCK's and any
36 +     * changes made at runtime to the VCK map are lost.
37 +     *
38 +     * Assumption: if we have at least one evdev keyboard device, we can
39 +     * ignore kbd devices. Force a SwitchCoreKeyboard so the VCK has the same
40 +     * keymap as we do.
41 +     *
42 +     * Next time we hit a key, we don't change the map over anymore (see
43 +     * SwitchCoreKeyboard), and live happily ever after.
44 +     * Until we have 2 physical keyboards. Or the first real keyboard isn't
45 +     * actually the one we use. Oh well.
46 +     *
47 +     */
48 +    if (dev->key)
49 +    {
50 +        InputInfoPtr info;
51 +
52 +        /* Search if there is one other keyboard that uses evdev. */
53 +        for (info = xf86InputDevs; info; info = info->next)
54 +        {
55 +            if (info != pInfo && info->dev && info->dev->key &&
56 +                (strcmp(info->drv->driverName, "evdev") == 0))
57 +                break;
58 +        }
59 +
60 +        if (!info)
61 +            SwitchCoreKeyboard(dev);
62 +    }
63 +
64      *pdev = dev;
65      return Success;
66  
67 -- 
68 1.5.5.1
69
This page took 0.027402 seconds and 3 git commands to generate.