45 + |
45 + |
46 if (!AddCallback(&ClientStateCallback, XIClientCallback, 0)) |
46 if (!AddCallback(&ClientStateCallback, XIClientCallback, 0)) |
47 FatalError("Failed to add callback to XI.\n"); |
47 FatalError("Failed to add callback to XI.\n"); |
48 |
48 |
49 diff --git a/config/hal.c b/config/hal.c |
49 diff --git a/config/hal.c b/config/hal.c |
50 index 297520a..44c1582 100644 |
50 index 088c993..98934d3 100644 |
51 --- a/config/hal.c |
51 --- a/config/hal.c |
52 +++ b/config/hal.c |
52 +++ b/config/hal.c |
53 @@ -123,6 +123,63 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop) |
53 @@ -123,6 +123,49 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop) |
54 return ret; |
54 return ret; |
55 } |
55 } |
56 |
56 |
57 +#ifdef SUNSOFT |
57 +#ifdef SUNSOFT |
58 +static void |
58 +static void |
59 +add_extra_device(char *driver) |
59 +add_extra_device(char *driver) |
60 +{ |
60 +{ |
61 + DeviceIntPtr dev; |
61 + DeviceIntPtr dev; |
62 + char *config_info = NULL; |
62 + char *config_info = NULL; |
63 + InputOption *options = NULL, *tmpo = NULL; |
63 + InputOption *input_options = NULL; |
64 + InputAttributes attrs = {0}; |
64 + InputAttributes attrs = {0}; |
65 + |
65 + |
66 + options = xcalloc(sizeof(*options), 1); |
66 + input_options = input_option_new(NULL, "_source", "server/hal"); |
67 + if (!options){ |
67 + if (!input_options){ |
68 + LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n"); |
|
69 + goto unwind; |
|
70 + } |
|
71 + |
|
72 + options->key = xstrdup("_source"); |
|
73 + options->value = xstrdup("server/hal"); |
|
74 + if (!options->key || !options->value) { |
|
75 + LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n"); |
68 + LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n"); |
76 + goto unwind; |
69 + goto unwind; |
77 + } |
70 + } |
78 + |
71 + |
79 + add_option(&options, "driver", driver); |
72 + input_options = input_option_new(input_options, "driver", driver); |
80 + add_option(&options, "name", driver); |
73 + input_options = input_option_new(input_options, "name", driver); |
81 + |
74 + |
82 + config_info = xalloc(strlen(driver) + 5); /* "hal:" and NULL */ |
75 + if (!asprintf(&config_info, "hal:%s", driver) == -1) { |
83 + if (!config_info) { |
76 + config_info = NULL; |
84 + LogMessage(X_ERROR, "config/hal: couldn't allocate name\n"); |
77 + LogMessage(X_ERROR, "config/hal: couldn't allocate name\n"); |
85 + goto unwind; |
78 + goto unwind; |
86 + } |
79 + } |
87 + sprintf(config_info, "hal:%s", driver); |
|
88 + |
80 + |
89 + /* Check for duplicate devices */ |
81 + /* Check for duplicate devices */ |
90 + if (device_is_duplicate(config_info)) |
82 + if (device_is_duplicate(config_info)) |
91 + goto unwind; |
83 + goto unwind; |
92 + |
84 + |
93 + LogMessage(X_INFO, "config/hal: Adding input device %s\n", driver); |
85 + LogMessage(X_INFO, "config/hal: Adding input device %s\n", driver); |
94 + if (NewInputDeviceRequest(options, &attrs, &dev) != Success) { |
86 + if (NewInputDeviceRequest(input_options, &attrs, &dev) != Success) { |
95 + LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n"); |
87 + LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n"); |
96 + dev = NULL; |
88 + dev = NULL; |
97 + goto unwind; |
89 + goto unwind; |
98 + } |
90 + } |
99 + |
91 + |
100 + dev->config_info = xstrdup(config_info); |
92 + dev->config_info = xstrdup(config_info); |
101 + |
93 + |
102 +unwind: |
94 +unwind: |
103 + if (config_info) |
95 + xfree(config_info); |
104 + xfree(config_info); |
96 + input_option_free_list(&input_options); |
105 + while (!dev && (tmpo = options)) { |
|
106 + options = tmpo->next; |
|
107 + xfree(tmpo->key); |
|
108 + xfree(tmpo->value); |
|
109 + xfree(tmpo); |
|
110 + } |
|
111 +} |
97 +} |
112 +#endif |
98 +#endif |
113 + |
99 + |
114 static void |
100 static void |
115 device_added(LibHalContext *hal_ctx, const char *udi) |
101 device_added(LibHalContext *hal_ctx, const char *udi) |
116 { |
102 { |
117 @@ -134,6 +191,9 @@ device_added(LibHalContext *hal_ctx, const char *udi) |
103 @@ -371,6 +414,14 @@ device_added(LibHalContext *hal_ctx, const char *udi) |
118 DBusError error; |
104 input_options = input_option_new(input_options, "xkb_options", xkb_opts.options); |
119 struct xkb_options xkb_opts = {0}; |
105 input_options = input_option_new(input_options, "config_info", config_info); |
120 int rc; |
|
121 +#ifdef SUNSOFT |
|
122 + char *mdriver = NULL; |
|
123 +#endif |
|
124 |
|
125 LibHalPropertySet *set = NULL; |
|
126 LibHalPropertySetIterator set_iter; |
|
127 @@ -377,6 +437,16 @@ device_added(LibHalContext *hal_ctx, const char *udi) |
|
128 add_option(&options, "xkb_options", xkb_opts.options); |
|
129 add_option(&options, "config_info", config_info); |
|
130 |
106 |
131 +#ifdef SUNSOFT |
107 +#ifdef SUNSOFT |
132 + for (tmpo = options; tmpo; tmpo = tmpo->next) { |
108 + InputOption *md = input_option_find(input_options, "mdriver"); |
133 + if (!strcmp(tmpo->key, "mdriver") && (tmpo->value)) |
109 + if (md) { |
134 + mdriver = tmpo->value; |
110 + char *mdriver = input_option_get_key(md); |
|
111 + add_extra_device (mdriver); |
135 + } |
112 + } |
136 + |
|
137 + if (mdriver) |
|
138 + add_extra_device (mdriver); |
|
139 +#endif |
113 +#endif |
140 + |
114 + |
141 /* this isn't an error, but how else do you output something that the user can see? */ |
115 /* this isn't an error, but how else do you output something that the user can see? */ |
142 LogMessage(X_INFO, "config/hal: Adding input device %s\n", name); |
116 LogMessage(X_INFO, "config/hal: Adding input device %s\n", name); |
143 if ((rc = NewInputDeviceRequest(options, &attrs, &dev)) != Success) { |
117 if ((rc = NewInputDeviceRequest(input_options, &attrs, &dev)) != Success) { |
144 diff --git a/config/x11-input.fdi b/config/x11-input.fdi |
118 diff --git a/config/x11-input.fdi b/config/x11-input.fdi |
145 index b263f36..425aec2 100644 |
119 index b263f36..425aec2 100644 |
146 --- a/config/x11-input.fdi |
120 --- a/config/x11-input.fdi |
147 +++ b/config/x11-input.fdi |
121 +++ b/config/x11-input.fdi |
148 @@ -71,6 +71,12 @@ |
122 @@ -71,6 +71,12 @@ |
157 + </match> |
131 + </match> |
158 <merge key="input.x11_options.XkbModel" type="string">pc105</merge> |
132 <merge key="input.x11_options.XkbModel" type="string">pc105</merge> |
159 <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" |
133 <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" |
160 string="Linux"> |
134 string="Linux"> |
161 diff --git a/include/inputstr.h b/include/inputstr.h |
135 diff --git a/include/inputstr.h b/include/inputstr.h |
162 index 2ee2fd8..1c3711c 100644 |
136 index c3297db..3d7f83d 100644 |
163 --- a/include/inputstr.h |
137 --- a/include/inputstr.h |
164 +++ b/include/inputstr.h |
138 +++ b/include/inputstr.h |
165 @@ -57,6 +57,11 @@ SOFTWARE. |
139 @@ -59,6 +59,11 @@ SOFTWARE. |
166 #include "geext.h" |
140 #include "geext.h" |
167 #include "privates.h" |
141 #include "privates.h" |
168 |
142 |
169 +#ifdef SUNSOFT |
143 +#ifdef SUNSOFT |
170 +extern _X_EXPORT DevPrivateKeyRec HotkeyMapDevicePrivateKeyRec; |
144 +extern _X_EXPORT DevPrivateKeyRec HotkeyMapDevicePrivateKeyRec; |
171 +#define HotkeyMapDevicePrivateKey (&HotkeyMapDevicePrivateKeyRec) |
145 +#define HotkeyMapDevicePrivateKey (&HotkeyMapDevicePrivateKeyRec) |
172 +#endif |
146 +#endif |
173 + |
147 + |
174 #define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) |
148 #define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) |
175 #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) |
149 #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) |
176 #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7))) |
150 #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7))) |