Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107009876
D38388.id116518.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D38388.id116518.diff
View Options
diff --git a/sys/sys/kbio.h b/sys/sys/kbio.h
--- a/sys/sys/kbio.h
+++ b/sys/sys/kbio.h
@@ -199,8 +199,8 @@
#define ACC(x) ((x)+F_ACC)
struct acc_t {
- u_char accchar;
- u_char map[NUM_ACCENTCHARS][2];
+ u_int accchar;
+ u_int map[NUM_ACCENTCHARS][2];
};
struct accentmap {
@@ -209,6 +209,19 @@
};
typedef struct accentmap accentmap_t;
+//#ifdef _KERNEL
+struct oacc_t {
+ u_char accchar;
+ u_char map[NUM_ACCENTCHARS][2];
+};
+
+struct oaccentmap {
+ u_short n_accs;
+ struct oacc_t acc[NUM_DEADKEYS];
+};
+typedef struct oaccentmap oaccentmap_t;
+//#endif /* _KERNEL */
+
struct keyarg {
u_short keynum;
struct keyent_t key;
@@ -241,8 +254,13 @@
#define OGIO_KEYMAP _IOR('k', 6, okeymap_t)
#define OPIO_KEYMAP _IOW('k', 7, okeymap_t)
#endif /* _KERNEL */
-#define GIO_DEADKEYMAP _IOR('k', 8, accentmap_t)
-#define PIO_DEADKEYMAP _IOW('k', 9, accentmap_t)
+/* XXX: Should have accentmap_t as an argument, but that's too big for ioctl()! */
+#define GIO_DEADKEYMAP _IO('k', 8)
+#define PIO_DEADKEYMAP _IO('k', 9)
+//#ifdef _KERNEL
+#define OGIO_DEADKEYMAP _IOR('k', 8, oaccentmap_t)
+#define OPIO_DEADKEYMAP _IOW('k', 9, oaccentmap_t)
+//#endif /* _KERNEL */
#define GIO_KEYMAPENT _IOWR('k', 10, keyarg_t)
#define PIO_KEYMAPENT _IOW('k', 11, keyarg_t)
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c
--- a/usr.sbin/kbdcontrol/kbdcontrol.c
+++ b/usr.sbin/kbdcontrol/kbdcontrol.c
@@ -818,11 +818,27 @@
STAILQ_INSERT_TAIL(&pathlist, pe, next);
}
+static void
+to_old_accentmap(accentmap_t *from, oaccentmap_t *to)
+{
+ int i, j;
+
+ to->n_accs = from->n_accs;
+ for (i = 0; i < NUM_DEADKEYS; i++) {
+ for (j = 0; j < NUM_ACCENTCHARS; j++) {
+ to->acc[i].map[j][0] = from->acc[i].map[j][0];
+ to->acc[i].map[j][1] = from->acc[i].map[j][1];
+ to->acc[i].accchar = from->acc[i].accchar;
+ }
+ }
+}
+
static void
load_keymap(char *opt, int dumponly)
{
keymap_t keymap;
accentmap_t accentmap;
+ oaccentmap_t oaccentmap;
struct pathent *pe;
FILE *file;
int j;
@@ -882,9 +898,27 @@
}
if ((accentmap.n_accs > 0)
&& (ioctl(0, PIO_DEADKEYMAP, &accentmap) < 0)) {
- warn("setting accentmap");
- fclose(file);
- return;
+ to_old_accentmap(&accentmap, &oaccentmap);
+ if (ioctl(0, OPIO_DEADKEYMAP, &oaccentmap) < 0) {
+ warn("setting accentmap");
+ fclose(file);
+ return;
+ }
+ }
+}
+
+static void
+to_new_accentmap(oaccentmap_t *from, accentmap_t *to)
+{
+ int i, j;
+
+ to->n_accs = from->n_accs;
+ for (i = 0; i < NUM_DEADKEYS; i++) {
+ for (j = 0; j < NUM_ACCENTCHARS; j++) {
+ to->acc[i].map[j][0] = from->acc[i].map[j][0];
+ to->acc[i].map[j][1] = from->acc[i].map[j][1];
+ to->acc[i].accchar = from->acc[i].accchar;
+ }
}
}
@@ -893,12 +927,17 @@
{
keymap_t keymap;
accentmap_t accentmap;
+ oaccentmap_t oaccentmap;
int i;
if (ioctl(0, GIO_KEYMAP, &keymap) < 0)
err(1, "getting keymap");
- if (ioctl(0, GIO_DEADKEYMAP, &accentmap) < 0)
- memset(&accentmap, 0, sizeof(accentmap));
+ if (ioctl(0, GIO_DEADKEYMAP, &accentmap) < 0) {
+ if (ioctl(0, OGIO_DEADKEYMAP, &oaccentmap) == 0)
+ to_new_accentmap(&oaccentmap, &accentmap);
+ else
+ memset(&accentmap, 0, sizeof(accentmap));
+ }
printf(
"# alt\n"
"# scan cntrl alt alt cntrl lock\n"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 9, 10:17 PM (21 m, 15 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15736614
Default Alt Text
D38388.id116518.diff (3 KB)
Attached To
Mode
D38388: Add backwards API compatibility to kbdcontrol with Unicode support for dead keys
Attached
Detach File
Event Timeline
Log In to Comment