diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h index f0d1c9cdc..3d220f70c 100644 --- a/src/backends/meta-backend-private.h +++ b/src/backends/meta-backend-private.h @@ -89,7 +89,8 @@ struct _MetaBackendClass void (* set_keymap) (MetaBackend *backend, const char *layouts, const char *variants, - const char *options); + const char *options, + const char *model); gboolean (* is_lid_closed) (MetaBackend *backend); diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index 6733a294c..965f8e810 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -1546,9 +1546,10 @@ void meta_backend_set_keymap (MetaBackend *backend, const char *layouts, const char *variants, - const char *options) + const char *options, + const char *model) { - META_BACKEND_GET_CLASS (backend)->set_keymap (backend, layouts, variants, options); + META_BACKEND_GET_CLASS (backend)->set_keymap (backend, layouts, variants, options, model); } /** diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index 418af8504..d6ab706c6 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -317,14 +317,15 @@ static void meta_backend_native_set_keymap (MetaBackend *backend, const char *layouts, const char *variants, - const char *options) + const char *options, + const char *model) { ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); ClutterSeat *seat; seat = clutter_backend_get_default_seat (clutter_backend); meta_seat_native_set_keyboard_map (META_SEAT_NATIVE (seat), - layouts, variants, options); + layouts, variants, options, model); meta_backend_notify_keymap_changed (backend); } diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c index 1c1621808..d91287568 100644 --- a/src/backends/native/meta-seat-native.c +++ b/src/backends/native/meta-seat-native.c @@ -157,7 +157,7 @@ meta_seat_native_constructed (GObject *object) seat->core_pointer = meta_seat_impl_get_pointer (seat->impl); seat->core_keyboard = meta_seat_impl_get_keyboard (seat->impl); - meta_seat_native_set_keyboard_map (seat, "us", "", ""); + meta_seat_native_set_keyboard_map (seat, "us", "", "", DEFAULT_XKB_MODEL); if (G_OBJECT_CLASS (meta_seat_native_parent_class)->constructed) G_OBJECT_CLASS (meta_seat_native_parent_class)->constructed (object); @@ -480,14 +480,15 @@ meta_seat_native_reclaim_devices (MetaSeatNative *seat) static struct xkb_keymap * create_keymap (const char *layouts, const char *variants, - const char *options) + const char *options, + const char *model) { struct xkb_rule_names names; struct xkb_keymap *keymap; struct xkb_context *context; names.rules = DEFAULT_XKB_RULES_FILE; - names.model = DEFAULT_XKB_MODEL; + names.model = model; names.layout = layouts; names.variant = variants; names.options = options; @@ -513,17 +514,18 @@ void meta_seat_native_set_keyboard_map (MetaSeatNative *seat, const char *layouts, const char *variants, - const char *options) + const char *options, + const char *model) { struct xkb_keymap *keymap, *impl_keymap; - keymap = create_keymap (layouts, variants, options); - impl_keymap = create_keymap (layouts, variants, options); + keymap = create_keymap (layouts, variants, options, model); + impl_keymap = create_keymap (layouts, variants, options, model); if (keymap == NULL) { g_warning ("Unable to load configured keymap: rules=%s, model=%s, layout=%s, variant=%s, options=%s", - DEFAULT_XKB_RULES_FILE, DEFAULT_XKB_MODEL, layouts, + DEFAULT_XKB_RULES_FILE, model, layouts, variants, options); return; } diff --git a/src/backends/native/meta-seat-native.h b/src/backends/native/meta-seat-native.h index b85cef66c..e82d0043b 100644 --- a/src/backends/native/meta-seat-native.h +++ b/src/backends/native/meta-seat-native.h @@ -103,7 +103,8 @@ void meta_seat_native_reclaim_devices (MetaSeatNative *seat); void meta_seat_native_set_keyboard_map (MetaSeatNative *seat, const char *layouts, const char *variants, - const char *options); + const char *options, + const char *model); struct xkb_keymap * meta_seat_native_get_keyboard_map (MetaSeatNative *seat); diff --git a/src/backends/x11/cm/meta-backend-x11-cm.c b/src/backends/x11/cm/meta-backend-x11-cm.c index 3b16042bc..12be06dc5 100644 --- a/src/backends/x11/cm/meta-backend-x11-cm.c +++ b/src/backends/x11/cm/meta-backend-x11-cm.c @@ -57,6 +57,7 @@ struct _MetaBackendX11Cm char *keymap_layouts; char *keymap_variants; char *keymap_options; + char *keymap_model; int locked_group; MetaInputSettings *input_settings; @@ -223,6 +224,7 @@ get_xkbrf_var_defs (Display *xdisplay, const char *layouts, const char *variants, const char *options, + const char *model, char **rules_p, XkbRF_VarDefsRec *var_defs) { @@ -232,7 +234,7 @@ get_xkbrf_var_defs (Display *xdisplay, if (!XkbRF_GetNamesProp (xdisplay, &rules, var_defs) || !rules) { rules = strdup (DEFAULT_XKB_RULES_FILE); - var_defs->model = strdup (DEFAULT_XKB_MODEL); + var_defs->model = NULL; var_defs->layout = NULL; var_defs->variant = NULL; var_defs->options = NULL; @@ -245,6 +247,8 @@ get_xkbrf_var_defs (Display *xdisplay, var_defs->variant = strdup (variants); free (var_defs->options); var_defs->options = strdup (options); + free (var_defs->model); + var_defs->model = strdup (model); /* Sometimes, the property is a file path, and sometimes it's not. Normalize it so it's always a file path. */ @@ -319,13 +323,15 @@ apply_keymap (MetaBackendX11 *x11) if (!x11_cm->keymap_layouts || !x11_cm->keymap_variants || - !x11_cm->keymap_options) + !x11_cm->keymap_options || + !x11_cm->keymap_model) return; get_xkbrf_var_defs (xdisplay, x11_cm->keymap_layouts, x11_cm->keymap_variants, x11_cm->keymap_options, + x11_cm->keymap_model, &rules_file_path, &xkb_var_defs); @@ -353,7 +359,8 @@ static void meta_backend_x11_cm_set_keymap (MetaBackend *backend, const char *layouts, const char *variants, - const char *options) + const char *options, + const char *model) { MetaBackendX11 *x11 = META_BACKEND_X11 (backend); MetaBackendX11Cm *x11_cm = META_BACKEND_X11_CM (x11); @@ -364,6 +371,8 @@ meta_backend_x11_cm_set_keymap (MetaBackend *backend, x11_cm->keymap_variants = g_strdup (variants); g_free (x11_cm->keymap_options); x11_cm->keymap_options = g_strdup (options); + g_free (x11_cm->keymap_model); + x11_cm->keymap_model = g_strdup (model); apply_keymap (x11); } diff --git a/src/backends/x11/nested/meta-backend-x11-nested.c b/src/backends/x11/nested/meta-backend-x11-nested.c index 9036ce81b..385098025 100644 --- a/src/backends/x11/nested/meta-backend-x11-nested.c +++ b/src/backends/x11/nested/meta-backend-x11-nested.c @@ -174,7 +174,8 @@ static void meta_backend_x11_nested_set_keymap (MetaBackend *backend, const char *layouts, const char *variants, - const char *options) + const char *options, + const char *model) { } diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c index 99de19ec7..6e430799f 100644 --- a/src/compositor/plugins/default.c +++ b/src/compositor/plugins/default.c @@ -374,6 +374,7 @@ init_keymap (MetaDefaultPlugin *self, g_autofree char *x11_layout = NULL; g_autofree char *x11_options = NULL; g_autofree char *x11_variant = NULL; + g_autofree char *x11_model = NULL; proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, (G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | @@ -421,7 +422,14 @@ init_keymap (MetaDefaultPlugin *self, if (!g_variant_lookup (props, "X11Variant", "s", &x11_variant)) x11_variant = g_strdup (""); - meta_backend_set_keymap (backend, x11_layout, x11_variant, x11_options); + if (!g_variant_lookup (props, "X11Model", "s", &x11_model)) + x11_model = g_strdup (""); + + meta_backend_set_keymap (backend, + x11_layout, + x11_variant, + x11_options, + x11_model); } static void diff --git a/src/meta/meta-backend.h b/src/meta/meta-backend.h index ef5a243ae..611f2d05f 100644 --- a/src/meta/meta-backend.h +++ b/src/meta/meta-backend.h @@ -44,7 +44,8 @@ META_EXPORT void meta_backend_set_keymap (MetaBackend *backend, const char *layouts, const char *variants, - const char *options); + const char *options, + const char *model); META_EXPORT void meta_backend_lock_layout_group (MetaBackend *backend,