Fix SEGV for X servers without XKB extension.

This commit is contained in:
David Sundstrom 2011-12-19 17:17:04 -06:00
parent 3ad37ad461
commit 50dcc1138a
4 changed files with 11 additions and 5 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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)