hotkey.patch revision 1124
1124N/Adiff --git a/Xi/exevents.c b/Xi/exevents.c
1124N/Aindex 327873e..717f275 100644
1124N/A--- a/Xi/exevents.c
1124N/A+++ b/Xi/exevents.c
1124N/A@@ -187,7 +187,16 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
1088N/A {
851N/A KeyClassPtr mk = master->key;
1088N/A
764N/A+#ifdef SUNSOFT
764N/A+ DeviceIntPtr mdev = dixLookupPrivate(&master->devPrivates,
764N/A+ HotkeyMapDevicePrivateKey);
764N/A+#endif
1088N/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;
1124N/Adiff --git a/Xi/extinit.c b/Xi/extinit.c
1124N/Aindex 82df7eb..6b99fae 100644
1124N/A--- a/Xi/extinit.c
1124N/A+++ b/Xi/extinit.c
1088N/A@@ -371,6 +371,10 @@ extern XExtensionVersion XIVersion;
1088N/A
1088N/A Mask PropagateMask[MAXDEVICES];
1088N/A
1088N/A+#ifdef SUNSOFT
1088N/A+DevPrivateKeyRec HotkeyMapDevicePrivateKeyRec;
1088N/A+#endif
1088N/A+
1088N/A /*****************************************************************
1088N/A *
1088N/A * Versioning support
1088N/A@@ -1255,6 +1259,11 @@ XInputExtensionInit(void)
1088N/A if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
1088N/A FatalError("Cannot request private for XI.\n");
1088N/A
1088N/A+#ifdef SUNSOFT
1088N/A+ if (!dixRegisterPrivateKey(&HotkeyMapDevicePrivateKeyRec, PRIVATE_DEVICE, 0))
1088N/A+ FatalError("Cannot request private for hotkey.\n");
1088N/A+#endif
1088N/A+
1088N/A if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
1088N/A FatalError("Failed to add callback to XI.\n");
1088N/A
1124N/Adiff --git a/config/hal.c b/config/hal.c
1124N/Aindex 297520a..44c1582 100644
1124N/A--- a/config/hal.c
1124N/A+++ b/config/hal.c
1124N/A@@ -123,6 +123,63 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
1088N/A return ret;
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;
1088N/A+ InputAttributes attrs = {0};
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);
1088N/A+ if (NewInputDeviceRequest(options, &attrs, &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 {
1124N/A@@ -134,6 +191,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
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;
1124N/A@@ -377,6 +437,16 @@ device_added(LibHalContext *hal_ctx, const char *udi)
764N/A add_option(&options, "xkb_options", xkb_opts.options);
1124N/A add_option(&options, "config_info", config_info);
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);
1088N/A if ((rc = NewInputDeviceRequest(options, &attrs, &dev)) != Success) {
1124N/Adiff --git a/config/x11-input.fdi b/config/x11-input.fdi
1124N/Aindex b263f36..425aec2 100644
1124N/A--- a/config/x11-input.fdi
1124N/A+++ b/config/x11-input.fdi
1124N/A@@ -71,6 +71,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">
1124N/Adiff --git a/include/inputstr.h b/include/inputstr.h
1124N/Aindex b74ee04..808f36f 100644
1124N/A--- a/include/inputstr.h
1124N/A+++ b/include/inputstr.h
1088N/A@@ -57,6 +57,11 @@ SOFTWARE.
851N/A #include "geext.h"
851N/A #include "privates.h"
764N/A
764N/A+#ifdef SUNSOFT
1088N/A+extern _X_EXPORT DevPrivateKeyRec HotkeyMapDevicePrivateKeyRec;
1088N/A+#define HotkeyMapDevicePrivateKey (&HotkeyMapDevicePrivateKeyRec)
764N/A+#endif
851N/A+
1088N/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)))