hotkey.patch revision 851
851N/Adiff -urp -x '*~' -x '*.orig' Xi/exevents.c Xi/exevents.c
851N/A--- Xi/exevents.c 2009-11-22 16:35:01.000000000 -0800
851N/A+++ Xi/exevents.c 2009-12-02 18:58:25.404138833 -0800
851N/A@@ -198,8 +198,16 @@ CopyKeyClass(DeviceIntPtr device, Device
851N/A KeyClassPtr mk = master->key;
851N/A KeyClassPtr dk = device->key;
764N/A int i;
764N/A+#ifdef SUNSOFT
764N/A+ DeviceIntPtr mdev = dixLookupPrivate(&master->devPrivates,
764N/A+ HotkeyMapDevicePrivateKey);
764N/A+#endif
764N/A
764N/A+#ifdef SUNSOFT
851N/A+ if ((device == master) || (device == mdev))
764N/A+#else
851N/A if (device == master)
764N/A+#endif
851N/A return;
764N/A
851N/A mk->sourceid = device->id;
851N/Adiff -urp -x '*~' -x '*.orig' config/hal.c config/hal.c
851N/A--- config/hal.c 2009-11-22 16:35:01.000000000 -0800
851N/A+++ config/hal.c 2009-12-02 18:58:25.404450482 -0800
851N/A@@ -186,6 +186,62 @@ device_is_duplicate(char *config_info)
764N/A return FALSE;
764N/A }
764N/A
764N/A+#ifdef SUNSOFT
851N/A+static void
764N/A+add_extra_device(char *driver)
764N/A+{
764N/A+ DeviceIntPtr dev;
764N/A+ char *config_info = NULL;
764N/A+ InputOption *options = NULL, *tmpo = NULL;
764N/A+
764N/A+ options = xcalloc(sizeof(*options), 1);
764N/A+ if (!options){
764N/A+ LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n");
764N/A+ goto unwind;
764N/A+ }
764N/A+
764N/A+ options->key = xstrdup("_source");
764N/A+ options->value = xstrdup("server/hal");
764N/A+ if (!options->key || !options->value) {
764N/A+ LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
764N/A+ goto unwind;
764N/A+ }
764N/A+
764N/A+ add_option(&options, "driver", driver);
764N/A+ add_option(&options, "name", driver);
764N/A+
764N/A+ config_info = xalloc(strlen(driver) + 5); /* "hal:" and NULL */
764N/A+ if (!config_info) {
764N/A+ LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
764N/A+ goto unwind;
764N/A+ }
764N/A+ sprintf(config_info, "hal:%s", driver);
764N/A+
764N/A+ /* Check for duplicate devices */
764N/A+ if (device_is_duplicate(config_info))
764N/A+ goto unwind;
764N/A+
764N/A+ LogMessage(X_INFO, "config/hal: Adding input device %s\n", driver);
764N/A+ if (NewInputDeviceRequest(options, &dev) != Success) {
764N/A+ LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n");
764N/A+ dev = NULL;
764N/A+ goto unwind;
764N/A+ }
764N/A+
764N/A+ dev->config_info = xstrdup(config_info);
764N/A+
764N/A+unwind:
764N/A+ if (config_info)
764N/A+ xfree(config_info);
764N/A+ while (!dev && (tmpo = options)) {
764N/A+ options = tmpo->next;
764N/A+ xfree(tmpo->key);
764N/A+ xfree(tmpo->value);
764N/A+ xfree(tmpo);
764N/A+ }
764N/A+}
764N/A+#endif
764N/A+
851N/A static void
764N/A device_added(LibHalContext *hal_ctx, const char *udi)
764N/A {
851N/A@@ -195,6 +251,9 @@ device_added(LibHalContext *hal_ctx, con
764N/A DBusError error;
764N/A struct xkb_options xkb_opts = {0};
764N/A int rc;
764N/A+#ifdef SUNSOFT
764N/A+ char *mdriver = NULL;
764N/A+#endif
764N/A
764N/A LibHalPropertySet *set = NULL;
764N/A LibHalPropertySetIterator set_iter;
851N/A@@ -398,6 +457,16 @@ device_added(LibHalContext *hal_ctx, con
764N/A if (xkb_opts.options)
764N/A add_option(&options, "xkb_options", xkb_opts.options);
764N/A
764N/A+#ifdef SUNSOFT
764N/A+ for (tmpo = options; tmpo; tmpo = tmpo->next) {
764N/A+ if (!strcmp(tmpo->key, "mdriver") && (tmpo->value))
764N/A+ mdriver = tmpo->value;
764N/A+ }
764N/A+
764N/A+ if (mdriver)
764N/A+ add_extra_device (mdriver);
764N/A+#endif
764N/A+
764N/A /* this isn't an error, but how else do you output something that the user can see? */
764N/A LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
764N/A if ((rc = NewInputDeviceRequest(options, &dev)) != Success) {
851N/Adiff -urp -x '*~' -x '*.orig' config/x11-input.fdi config/x11-input.fdi
851N/A--- config/x11-input.fdi 2009-10-27 23:56:19.000000000 -0700
851N/A+++ config/x11-input.fdi 2009-12-02 18:58:25.404611476 -0800
764N/A@@ -76,6 +76,12 @@
764N/A <!-- If we're using Linux, we use evdev by default (falling back to
764N/A kbd otherwise). -->
764N/A <merge key="input.x11_driver" type="string">kbd</merge>
764N/A+ <match key="/org/freedesktop/Hal/devices/computer:system.formfactor" string="laptop">
764N/A+ <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
764N/A+ string="SunOS">
764N/A+ <merge key="input.x11_options.mdriver" type="string">hotkey</merge>
764N/A+ </match>
764N/A+ </match>
764N/A <merge key="input.x11_options.XkbModel" type="string">pc105</merge>
764N/A <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
764N/A string="Linux">
851N/Adiff -urp -x '*~' -x '*.orig' dix/devices.c dix/devices.c
851N/A--- dix/devices.c 2009-12-02 18:58:23.505610344 -0800
851N/A+++ dix/devices.c 2009-12-02 18:58:25.405167943 -0800
851N/A@@ -91,6 +91,10 @@ SOFTWARE.
764N/A
764N/A static int CoreDevicePrivateKeyIndex;
764N/A DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKeyIndex;
764N/A+#ifdef SUNSOFT
764N/A+static int HotkeyMapDevicePrivateKeyIndex;
764N/A+DevPrivateKey HotkeyMapDevicePrivateKey = &HotkeyMapDevicePrivateKeyIndex;
764N/A+#endif
851N/A /* Used to store classes currently not in use by an MD */
764N/A static int UnusedClassesPrivateKeyIndex;
764N/A DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKeyIndex;
851N/Adiff -urp -x '*~' -x '*.orig' include/inputstr.h include/inputstr.h
851N/A--- include/inputstr.h 2009-11-22 16:35:01.000000000 -0800
851N/A+++ include/inputstr.h 2009-12-02 18:58:25.405410778 -0800
851N/A@@ -56,6 +56,10 @@ SOFTWARE.
851N/A #include "geext.h"
851N/A #include "privates.h"
764N/A
764N/A+#ifdef SUNSOFT
851N/A+extern _X_EXPORT DevPrivateKey HotkeyMapDevicePrivateKey;
764N/A+#endif
851N/A+
851N/A #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
851N/A #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
851N/A #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))