hotkey.patch revision 1265
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 6b2db4b..16ae210 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -230,7 +230,16 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
{
KeyClassPtr mk = master->key;
+#ifdef SUNSOFT
+ DeviceIntPtr mdev = dixLookupPrivate(&master->devPrivates,
+ HotkeyMapDevicePrivateKey);
+#endif
+
+#ifdef SUNSOFT
+ if ((device == master) || (device == mdev))
+#else
if (device == master)
+#endif
return;
mk->sourceid = device->id;
diff --git a/Xi/extinit.c b/Xi/extinit.c
index a81c8f1..2171d82 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -370,6 +370,10 @@ extern XExtensionVersion XIVersion;
Mask PropagateMask[MAXDEVICES];
+#ifdef SUNSOFT
+DevPrivateKeyRec HotkeyMapDevicePrivateKeyRec;
+#endif
+
/*****************************************************************
*
* Versioning support
@@ -1258,6 +1262,11 @@ XInputExtensionInit(void)
if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
FatalError("Cannot request private for XI.\n");
+#ifdef SUNSOFT
+ if (!dixRegisterPrivateKey(&HotkeyMapDevicePrivateKeyRec, PRIVATE_DEVICE, 0))
+ FatalError("Cannot request private for hotkey.\n");
+#endif
+
if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
FatalError("Failed to add callback to XI.\n");
diff --git a/config/hal.c b/config/hal.c
index 088c993..98934d3 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -123,6 +123,49 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
return ret;
}
+#ifdef SUNSOFT
+static void
+add_extra_device(char *driver)
+{
+ DeviceIntPtr dev;
+ char *config_info = NULL;
+ InputOption *input_options = NULL;
+ InputAttributes attrs = {0};
+
+ input_options = input_option_new(NULL, "_source", "server/hal");
+ if (!input_options){
+ LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
+ goto unwind;
+ }
+
+ input_options = input_option_new(input_options, "driver", driver);
+ input_options = input_option_new(input_options, "name", driver);
+
+ if (!asprintf(&config_info, "hal:%s", driver) == -1) {
+ config_info = NULL;
+ LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
+ goto unwind;
+ }
+
+ /* Check for duplicate devices */
+ if (device_is_duplicate(config_info))
+ goto unwind;
+
+ LogMessage(X_INFO, "config/hal: Adding input device %s\n", driver);
+ if (NewInputDeviceRequest(input_options, &attrs, &dev) != Success) {
+ LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n");
+ dev = NULL;
+ goto unwind;
+ }
+
+ dev->config_info = xstrdup(config_info);
+
+unwind:
+ xfree(config_info);
+ input_option_free_list(&input_options);
+}
+#endif
+
static void
device_added(LibHalContext *hal_ctx, const char *udi)
{
@@ -371,6 +414,14 @@ device_added(LibHalContext *hal_ctx, const char *udi)
input_options = input_option_new(input_options, "xkb_options", xkb_opts.options);
input_options = input_option_new(input_options, "config_info", config_info);
+#ifdef SUNSOFT
+ InputOption *md = input_option_find(input_options, "mdriver");
+ if (md) {
+ char *mdriver = input_option_get_key(md);
+ add_extra_device (mdriver);
+ }
+#endif
+
/* this isn't an error, but how else do you output something that the user can see? */
LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
if ((rc = NewInputDeviceRequest(input_options, &attrs, &dev)) != Success) {
diff --git a/config/x11-input.fdi b/config/x11-input.fdi
index b263f36..425aec2 100644
@@ -71,6 +71,12 @@
<!-- If we're using Linux, we use evdev by default (falling back to
kbd otherwise). -->
<merge key="input.x11_driver" type="string">kbd</merge>
+ <match key="/org/freedesktop/Hal/devices/computer:system.formfactor" string="laptop">
+ <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
+ string="SunOS">
+ <merge key="input.x11_options.mdriver" type="string">hotkey</merge>
+ </match>
+ </match>
<merge key="input.x11_options.XkbModel" type="string">pc105</merge>
<match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
string="Linux">
diff --git a/include/inputstr.h b/include/inputstr.h
index c3297db..3d7f83d 100644
@@ -59,6 +59,11 @@ SOFTWARE.
#include "geext.h"
#include "privates.h"
+#ifdef SUNSOFT
+extern _X_EXPORT DevPrivateKeyRec HotkeyMapDevicePrivateKeyRec;
+#define HotkeyMapDevicePrivateKey (&HotkeyMapDevicePrivateKeyRec)
+#endif
+
#define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))