let module decide if alt-gr needs to be ignored
This commit is contained in:
parent
778b1489d7
commit
b295e08ad2
25
vnc/vnc.c
25
vnc/vnc.c
@ -190,7 +190,18 @@ lib_mod_event(struct vnc* v, int msg, long param1, long param2,
|
||||
v->shift_state = (msg == 15);
|
||||
break;
|
||||
case 0x0038: /* left-right alt */
|
||||
key = (param2 & 0x0100) ? 0xffea : 0xffe9;
|
||||
if (param2 & 0x0100) /* right alt */
|
||||
{
|
||||
/* only en-us keymap can send right alt(alt-gr) */
|
||||
if (v->keylayout == 0x409)
|
||||
{
|
||||
key = 0xffea;
|
||||
}
|
||||
}
|
||||
else /* left alt */
|
||||
{
|
||||
key = 0xffe9;
|
||||
}
|
||||
break;
|
||||
case 0x003b: /* F1 */
|
||||
key = 0xffbe;
|
||||
@ -1102,22 +1113,26 @@ lib_mod_end(struct vnc* v)
|
||||
int DEFAULT_CC
|
||||
lib_mod_set_param(struct vnc* v, char* name, char* value)
|
||||
{
|
||||
if (g_strncasecmp(name, "username", 8) == 0)
|
||||
if (g_strcasecmp(name, "username") == 0)
|
||||
{
|
||||
g_strncpy(v->username, value, 255);
|
||||
}
|
||||
else if (g_strncasecmp(name, "password", 8) == 0)
|
||||
else if (g_strcasecmp(name, "password") == 0)
|
||||
{
|
||||
g_strncpy(v->password, value, 255);
|
||||
}
|
||||
else if (g_strncasecmp(name, "ip", 2) == 0)
|
||||
else if (g_strcasecmp(name, "ip") == 0)
|
||||
{
|
||||
g_strncpy(v->ip, value, 255);
|
||||
}
|
||||
else if (g_strncasecmp(name, "port", 4) == 0)
|
||||
else if (g_strcasecmp(name, "port") == 0)
|
||||
{
|
||||
g_strncpy(v->port, value, 255);
|
||||
}
|
||||
else if (g_strcasecmp(name, "keylayout") == 0)
|
||||
{
|
||||
v->keylayout = g_atoi(value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -92,4 +92,5 @@ struct vnc
|
||||
char port[256];
|
||||
int sck_closed;
|
||||
int shift_state; /* 0 up, 1 down */
|
||||
int keylayout;
|
||||
};
|
||||
|
12
xrdp/lang.c
12
xrdp/lang.c
@ -431,54 +431,42 @@ get_char_from_scan_code(int device_flags, int scan_code, int* keys,
|
||||
int shift;
|
||||
int altgr;
|
||||
int ext;
|
||||
int has_altgr;
|
||||
|
||||
if (keylayout == 0x40c) /* france */
|
||||
{
|
||||
keys_noshift = fr_noshift;
|
||||
keys_shift = fr_shift;
|
||||
keys_altgr = fr_altgr;
|
||||
has_altgr = 1;
|
||||
}
|
||||
else if (keylayout == 0x809) /* en-uk or en-gb */
|
||||
{
|
||||
keys_noshift = en_uk_noshift;
|
||||
keys_shift = en_uk_shift;
|
||||
keys_altgr = en_uk_altgr;
|
||||
has_altgr = 1;
|
||||
}
|
||||
else if (keylayout == 0x407) /* german */
|
||||
{
|
||||
keys_noshift = de_noshift;
|
||||
keys_shift = de_shift;
|
||||
keys_altgr = de_altgr;
|
||||
has_altgr = 1;
|
||||
}
|
||||
else if (keylayout == 0x416) /* Portuguese (Brazil) */
|
||||
{
|
||||
keys_noshift = pt_br_noshift;
|
||||
keys_shift = pt_br_shift;
|
||||
keys_altgr = pt_br_altgr;
|
||||
has_altgr = 1;
|
||||
}
|
||||
else if (keylayout == 0x410) /* italy */
|
||||
{
|
||||
keys_noshift = it_noshift;
|
||||
keys_shift = it_shift;
|
||||
keys_altgr = it_altgr;
|
||||
has_altgr = 1;
|
||||
}
|
||||
else /* english us 0x409 */
|
||||
{
|
||||
keys_noshift = en_us_noshift;
|
||||
keys_shift = en_us_shift;
|
||||
keys_altgr = en_us_altgr;
|
||||
has_altgr = 0;
|
||||
}
|
||||
/* don't send altgr */
|
||||
if (has_altgr && (scan_code == 56) && (device_flags & 0x100))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
/*g_writeln("%d %d %x", scan_code, device_flags, keylayout);*/
|
||||
shift = keys[42] || keys[54];
|
||||
|
@ -1171,13 +1171,7 @@ xrdp_wm_key(struct xrdp_wm* self, int device_flags, int scan_code)
|
||||
self->num_lock,
|
||||
self->scroll_lock,
|
||||
self->session->client_info->keylayout);
|
||||
/* this means don't send anything */
|
||||
/* used to qvoid sending alt to xserver eg altgr */
|
||||
/* if alt state is down, the xserver avoids the keystroke */
|
||||
if (c == 1)
|
||||
{
|
||||
}
|
||||
else if (c != 0)
|
||||
if (c != 0)
|
||||
{
|
||||
self->mod->mod_event(self->mod, msg, (unsigned char)c, 0xffff,
|
||||
scan_code, device_flags);
|
||||
|
Loading…
Reference in New Issue
Block a user