Fix SEGV for X servers without XKB extension.
This commit is contained in:
parent
3ad37ad461
commit
50dcc1138a
@ -54,6 +54,7 @@ rdpSettings* settings_new(void* instance)
|
||||
settings->kbd_type = 0;
|
||||
settings->kbd_subtype = 0;
|
||||
settings->kbd_fn_keys = 0;
|
||||
settings->kbd_layout = 0;
|
||||
settings->encryption = false;
|
||||
settings->port = 3389;
|
||||
settings->desktop_resize = true;
|
||||
|
@ -79,8 +79,8 @@ unsigned int detect_keyboard_layout_from_xkb(void* dpy)
|
||||
|
||||
if (dpy && XkbRF_GetNamesProp(dpy, NULL, &rules_names))
|
||||
{
|
||||
DEBUG_KBD("layouts: %s", rules_names.layout);
|
||||
DEBUG_KBD("variants: %s", rules_names.variant);
|
||||
DEBUG_KBD("layouts: %s", rules_names.layout ? rules_names.layout : "");
|
||||
DEBUG_KBD("variants: %s", rules_names.variant ? rules_names.variant : "");
|
||||
|
||||
XGetKeyboardControl(dpy, &coreKbdState);
|
||||
|
||||
@ -92,8 +92,8 @@ unsigned int detect_keyboard_layout_from_xkb(void* dpy)
|
||||
layout = comma_substring(rules_names.layout, group);
|
||||
variant = comma_substring(rules_names.variant, group);
|
||||
|
||||
DEBUG_KBD("layout: %s", layout);
|
||||
DEBUG_KBD("variant: %s", variant);
|
||||
DEBUG_KBD("layout: %s", layout ? layout : "");
|
||||
DEBUG_KBD("variant: %s", variant ? variant : "");
|
||||
|
||||
keyboard_layout = find_keyboard_layout_in_xorg_rules(layout, variant);
|
||||
|
||||
|
@ -102,7 +102,9 @@ unsigned int freerdp_kbd_init(void* dpy, unsigned int keyboard_layout_id)
|
||||
KeycodeToVkcode keycodeToVkcode;
|
||||
int keycode;
|
||||
|
||||
keyboard_layout_id = detect_keyboard(dpy, keyboard_layout_id, xkbfile, sizeof(xkbfile));
|
||||
if (keyboard_layout_id == 0)
|
||||
keyboard_layout_id = detect_keyboard(dpy, keyboard_layout_id, xkbfile, sizeof(xkbfile));
|
||||
|
||||
DEBUG_KBD("Using keyboard layout 0x%X with xkb name %s and xkbfile %s",
|
||||
keyboard_layout_id, get_layout_name(keyboard_layout_id), xkbfile);
|
||||
|
||||
|
@ -1132,6 +1132,9 @@ unsigned int detect_keyboard_type_and_layout_sunos(char* xkbfile, int length)
|
||||
|
||||
kbd = popen("kbd -t -l", "r");
|
||||
|
||||
if (kbd < 0)
|
||||
return 0;
|
||||
|
||||
while(fgets(buffer, sizeof(buffer), kbd) != NULL)
|
||||
{
|
||||
if((pch = strstr(buffer, "type=")) != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user