Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rdp-backend: Fall back to weston.ini keymap if no mapping is found #144

Merged
merged 2 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally "new_keyboard_layout" should reflect the default.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately that's not always possible because you may have a xkb layout in weston.ini that doesn't have a windows counter-part. E.g. us-intl with altgr dead keys is a pretty popular one for europeans using us keyboards that doesn't exist in windows unless you use MSKLC layouts.

Still you need to save the layout in settings->KeyboardLayout otherwise the if (new_keyboard_layout != settings->KeyboardLayout) a few lines above will fail and prevent you to actually change layout.

}
}
}
Expand Down