1 diff --git a/Xi/exevents.c b/Xi/exevents.c
2 index 106da3a..dd7e3a2 100644
5 @@ -225,7 +225,16 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
7 KeyClassPtr mk = master->key;
10 + DeviceIntPtr mdev = dixLookupPrivate(&master->devPrivates,
11 + HotkeyMapDevicePrivateKey);
15 + if ((device == master) || (device == mdev))
21 mk->sourceid = device->id;
22 diff --git a/config/hal.c b/config/hal.c
23 index 2ead556..9de9dfc 100644
26 @@ -123,6 +123,49 @@ get_prop_string_array(LibHalContext * hal_ctx, const char *udi,
32 +add_extra_device(char *driver)
35 + char *config_info = NULL;
36 + InputOption *input_options = NULL;
37 + InputAttributes attrs = {0};
39 + input_options = input_option_new(NULL, "_source", "server/hal");
40 + if (!input_options){
41 + LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
45 + input_options = input_option_new(input_options, "driver", driver);
46 + input_options = input_option_new(input_options, "name", driver);
48 + if (!asprintf(&config_info, "hal:%s", driver) == -1) {
50 + LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
54 + /* Check for duplicate devices */
55 + if (device_is_duplicate(config_info))
58 + LogMessage(X_INFO, "config/hal: Adding input device %s\n", driver);
59 + if (NewInputDeviceRequest(input_options, &attrs, &dev) != Success) {
60 + LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n");
65 + dev->config_info = xstrdup(config_info);
69 + input_option_free_list(&input_options);
74 device_added(LibHalContext * hal_ctx, const char *udi)
76 @@ -382,6 +425,14 @@ device_added(LibHalContext * hal_ctx, const char *udi)
77 input_option_new(input_options, "xkb_options", xkb_opts.options);
78 input_options = input_option_new(input_options, "config_info", config_info);
81 + InputOption *md = input_option_find(input_options, "mdriver");
83 + char *mdriver = input_option_get_value(md);
84 + add_extra_device (mdriver);
88 /* this isn't an error, but how else do you output something that the user can see? */
89 LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
90 if ((rc = NewInputDeviceRequest(input_options, &attrs, &dev)) != Success) {
91 diff --git a/config/x11-input.fdi b/config/x11-input.fdi
92 index b263f36..425aec2 100644
93 --- a/config/x11-input.fdi
94 +++ b/config/x11-input.fdi
96 <!-- If we're using Linux, we use evdev by default (falling back to
98 <merge key="input.x11_driver" type="string">kbd</merge>
99 + <match key="/org/freedesktop/Hal/devices/computer:system.formfactor" string="laptop">
100 + <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
102 + <merge key="input.x11_options.mdriver" type="string">hotkey</merge>
105 <merge key="input.x11_options.XkbModel" type="string">pc105</merge>
106 <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
108 diff --git a/include/inputstr.h b/include/inputstr.h
109 index 5a38924..263b1b1 100644
110 --- a/include/inputstr.h
111 +++ b/include/inputstr.h
112 @@ -57,6 +57,11 @@ SOFTWARE.
114 #include "privates.h"
117 +extern _X_EXPORT DevPrivateKeyRec HotkeyMapDevicePrivateKeyRec;
118 +#define HotkeyMapDevicePrivateKey (&HotkeyMapDevicePrivateKeyRec)
121 #define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
122 #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
123 #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
124 --- xorg-server-1.19.5/Xi/extinit.c.orig Mon Oct 23 14:46:01 2017
125 +++ xorg-server-1.19.5/Xi/extinit.c Mon Oct 23 14:46:10 2017
128 DevPrivateKeyRec XIClientPrivateKeyRec;
131 +DevPrivateKeyRec HotkeyMapDevicePrivateKeyRec;
134 /*****************************************************************
136 * Declarations of local routines.
137 @@ -1290,6 +1290,11 @@
138 (&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
139 FatalError("Cannot request private for XI.\n");
142 + if (!dixRegisterPrivateKey(&HotkeyMapDevicePrivateKeyRec, PRIVATE_DEVICE, 0))
143 + FatalError("Cannot request private for hotkey.\n");
146 if (!XIBarrierInit())
147 FatalError("Could not initialize barriers.\n");