Skip to content

Commit

Permalink
Fall back to weston.ini keymap if no mapping is found (#144)
Browse files Browse the repository at this point in the history
* rdp backend: do not force us layout

Do not force "us" layout when no xkb mapping is found. Weston will this
way fallback to the keymap defined in compositor xkb_names which falls
back to "us" if no layout is defined in weston.ini.

* rdp backend: reset default keymap if mapping fails

Reload default global compositor keymap when no xkb mapping is found for
current keyboard layout. This will default to the keymap in weston.ini
or to "us" if no keymap is defined there. Should allow to use custom KLC
layouts for keymaps that exist in Linux but have no correspondence in
Windows (e.g. altgr-intl). This should also partially fix #173. Still
need a way to export weston.ini to the user.
  • Loading branch information
fargiolas authored May 2, 2023
1 parent f784b4a commit b5e22ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 0 additions & 5 deletions libweston/backend-rdp/rdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,11 +1007,6 @@ convert_rdp_keyboard_to_xkb_rule_names(
xkbRuleNames->layout = "us";
xkbRuleNames->variant = 0;
}
/* when no layout, default to "us" */
if (!xkbRuleNames->layout) {
xkbRuleNames->layout = "us";
xkbRuleNames->variant = 0;
}

weston_log("%s: matching model=%s layout=%s variant=%s options=%s\n", __FUNCTION__,
xkbRuleNames->model, xkbRuleNames->layout, xkbRuleNames->variant, xkbRuleNames->options);
Expand Down
8 changes: 8 additions & 0 deletions libweston/backend-rdp/rdprail.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,14 @@ rail_client_LanguageImeInfo_callback(bool freeOnly, void *arg)
__func__, new_keyboard_layout,
settings->KeyboardType,
settings->KeyboardSubType);

rdp_debug_error(b, "%s: Resetting default keymap\n", __func__);
keymap = xkb_keymap_new_from_names(peer_ctx->item.seat->compositor->xkb_context,
&peer_ctx->item.seat->compositor->xkb_names,
0);
weston_seat_update_keymap(peer_ctx->item.seat, keymap);
xkb_keymap_unref(keymap);
settings->KeyboardLayout = new_keyboard_layout;
}
}
}
Expand Down

0 comments on commit b5e22ba

Please sign in to comment.