[PATCH Weston] Load xkb map from file
Pekka Paalanen
ppaalanen at gmail.com
Thu Jan 30 15:06:28 UTC 2020
On Mon, 14 Aug 2017 16:50:43 +0300
Constantine Bytensky <kostya3 at gmail.com> wrote:
> I use my own keymap file on X.Org and I want to use it at Weston.
>
> compositor/main.c | 2 ++
> libweston/compositor.h | 1 +
> libweston/input.c | 13 ++++++++++---
> 3 files changed, 13 insertions(+), 3 deletions(-)
Hi,
sorry for the late reply, but I think this is being solved through
keymap includes and search paths. For pointers, see:
https://github.com/xkbcommon/libxkbcommon/pull/122
https://github.com/xkbcommon/libxkbcommon/pull/108
If those features do not help with your use case, you can propose this
patch again as a Gitlab merge request and explain how the existing ways
don't work.
https://gitlab.freedesktop.org/wayland/weston/blob/master/CONTRIBUTING.md
Thanks,
pq
>
> diff --git a/compositor/main.c b/compositor/main.c
> index f8a60e9..fccc741 100644
> --- a/compositor/main.c
> +++ b/compositor/main.c
> @@ -888,6 +888,8 @@ weston_compositor_init_config(struct weston_compositor *ec,
> int vt_switching;
>
> s = weston_config_get_section(config, "keyboard", NULL, NULL);
> + weston_config_section_get_string(s, "keymap_file",
> + (char **) &ec->xkb_file, NULL);
> weston_config_section_get_string(s, "keymap_rules",
> (char **) &xkb_names.rules, NULL);
> weston_config_section_get_string(s, "keymap_model",
> diff --git a/libweston/compositor.h b/libweston/compositor.h
> index 769203a..9359b00 100644
> --- a/libweston/compositor.h
> +++ b/libweston/compositor.h
> @@ -921,6 +921,7 @@ struct weston_compositor {
> uint32_t output_id_pool;
>
> struct xkb_rule_names xkb_names;
> + char *xkb_file;
> struct xkb_context *xkb_context;
> struct weston_xkb_info *xkb_info;
>
> diff --git a/libweston/input.c b/libweston/input.c
> index 81a94a9..0e93a54 100644
> --- a/libweston/input.c
> +++ b/libweston/input.c
> @@ -2778,13 +2778,20 @@ static int
> weston_compositor_build_global_keymap(struct weston_compositor *ec)
> {
> struct xkb_keymap *keymap;
> + FILE *file;
>
> if (ec->xkb_info != NULL)
> return 0;
>
> - keymap = xkb_keymap_new_from_names(ec->xkb_context,
> - &ec->xkb_names,
> - 0);
> + if (ec->xkb_file != NULL) {
> + file = fopen(ec->xkb_file, "r");
> + keymap = xkb_keymap_new_from_file(ec->xkb_context, file, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
> + fclose(file);
> + } else {
> + keymap = xkb_keymap_new_from_names(ec->xkb_context,
> + &ec->xkb_names,
> + 0);
> + }
> if (keymap == NULL) {
> weston_log("failed to compile global XKB keymap\n");
> weston_log(" tried rules %s, model %s, layout %s, variant %s, "
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20200130/7d09db6b/attachment-0001.sig>
More information about the wayland-devel
mailing list