keymap: support combining shift & capslock with altgr
Add support for combining shift & caps lock keys with altgr so that capital national characters can be written. There was some support for shift+altgr in xrdp-keygen but it was never actually used.
This commit is contained in:
parent
2f919932cb
commit
20a962b640
@ -45,8 +45,8 @@ int main(int argc, char **argv)
|
||||
char text[256];
|
||||
char *displayname = NULL;
|
||||
char *outfname;
|
||||
char *sections[6] = {"noshift", "shift", "altgr", "shiftaltgr", "capslock", "shiftcapslock"};
|
||||
int states[6] = {0, 1, 0x80, 0x81, 2, 3};
|
||||
char *sections[8] = {"noshift", "shift", "altgr", "shiftaltgr", "capslock", "capslockaltgr", "shiftcapslock", "shiftcapslockaltgr"};
|
||||
int states[8] = {0, 1, 0x80, 0x81, 2, 0x82, 3, 0x83};
|
||||
int i;
|
||||
int idx;
|
||||
int char_count;
|
||||
@ -94,7 +94,7 @@ int main(int argc, char **argv)
|
||||
e.display = dpy;
|
||||
e.same_screen = True;
|
||||
|
||||
for (idx = 0; idx < 6; idx++) /* Sections and states */
|
||||
for (idx = 0; idx < 8; idx++) /* Sections and states */
|
||||
{
|
||||
fprintf(outf, "[%s]\n", sections[idx]);
|
||||
e.state = states[idx];
|
||||
@ -115,7 +115,7 @@ int main(int argc, char **argv)
|
||||
fprintf(outf, "Key%d=%d:%d\n", i, (int) ks, unicode);
|
||||
}
|
||||
|
||||
if (idx != 4)
|
||||
if (idx != 7)
|
||||
{
|
||||
fprintf(outf, "\n");
|
||||
}
|
||||
|
@ -7,9 +7,10 @@ km-xxxx.ini
|
||||
|
||||
where the xxxx is replaced by the hex number of the layout of interest.
|
||||
|
||||
The files have 6 sections;
|
||||
The files have 8 sections;
|
||||
|
||||
[noshift], [shift], [altgr], [shiftaltgr], [capslock], [shiftcapslock]
|
||||
[noshift], [shift], [altgr], [shiftaltgr], [capslock], [capslockaltgr],
|
||||
[shiftcapslock], [shiftcapslockaltgr]
|
||||
|
||||
In each section there are multiple lines for each key.
|
||||
|
||||
|
15
xrdp/lang.c
15
xrdp/lang.c
@ -90,14 +90,26 @@ get_key_info_from_scan_code(int device_flags, int scan_code, int *keys,
|
||||
rv = &(keymap->keys_noshift[index]);
|
||||
}
|
||||
}
|
||||
else if (shift && caps_lock && altgr)
|
||||
{
|
||||
rv = &(keymap->keys_shiftcapslockaltgr[index]);
|
||||
}
|
||||
else if (shift && caps_lock)
|
||||
{
|
||||
rv = &(keymap->keys_shiftcapslock[index]);
|
||||
}
|
||||
else if (shift && altgr)
|
||||
{
|
||||
rv = &(keymap->keys_shiftaltgr[index]);
|
||||
}
|
||||
else if (shift)
|
||||
{
|
||||
rv = &(keymap->keys_shift[index]);
|
||||
}
|
||||
else if (caps_lock && altgr)
|
||||
{
|
||||
rv = &(keymap->keys_capslockaltgr[index]);
|
||||
}
|
||||
else if (caps_lock)
|
||||
{
|
||||
rv = &(keymap->keys_capslock[index]);
|
||||
@ -242,8 +254,11 @@ get_keymaps(int keylayout, struct xrdp_keymap *keymap)
|
||||
km_read_section(fd, "noshift", keymap->keys_noshift);
|
||||
km_read_section(fd, "shift", keymap->keys_shift);
|
||||
km_read_section(fd, "altgr", keymap->keys_altgr);
|
||||
km_read_section(fd, "shiftaltgr", keymap->keys_shiftaltgr);
|
||||
km_read_section(fd, "capslock", keymap->keys_capslock);
|
||||
km_read_section(fd, "capslockaltgr", keymap->keys_capslockaltgr);
|
||||
km_read_section(fd, "shiftcapslock", keymap->keys_shiftcapslock);
|
||||
km_read_section(fd, "shiftcapslockaltgr", keymap->keys_shiftcapslockaltgr);
|
||||
|
||||
if (g_memcmp(lkeymap, keymap, sizeof(struct xrdp_keymap)) != 0)
|
||||
{
|
||||
|
@ -318,8 +318,11 @@ struct xrdp_keymap
|
||||
struct xrdp_key_info keys_noshift[256];
|
||||
struct xrdp_key_info keys_shift[256];
|
||||
struct xrdp_key_info keys_altgr[256];
|
||||
struct xrdp_key_info keys_shiftaltgr[256];
|
||||
struct xrdp_key_info keys_capslock[256];
|
||||
struct xrdp_key_info keys_capslockaltgr[256];
|
||||
struct xrdp_key_info keys_shiftcapslock[256];
|
||||
struct xrdp_key_info keys_shiftcapslockaltgr[256];
|
||||
};
|
||||
|
||||
/* the window manager */
|
||||
|
Loading…
Reference in New Issue
Block a user