Parse XKB config options in weston_compositor_init
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
committed by
Kristian Høgsberg
parent
c1be8e59de
commit
e2ef43aa0e
+17
-16
@@ -2287,9 +2287,6 @@ weston_compositor_build_global_keymap(struct weston_compositor *ec)
|
|||||||
if (ec->xkb_info.keymap != NULL)
|
if (ec->xkb_info.keymap != NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ec->xkb_names.rules == NULL)
|
|
||||||
weston_compositor_xkb_init(ec, NULL);
|
|
||||||
|
|
||||||
ec->xkb_info.keymap = xkb_map_new_from_names(ec->xkb_context,
|
ec->xkb_info.keymap = xkb_map_new_from_names(ec->xkb_context,
|
||||||
&ec->xkb_names,
|
&ec->xkb_names,
|
||||||
0);
|
0);
|
||||||
@@ -2846,6 +2843,21 @@ weston_compositor_init(struct weston_compositor *ec,
|
|||||||
{
|
{
|
||||||
struct wl_event_loop *loop;
|
struct wl_event_loop *loop;
|
||||||
const char *extensions;
|
const char *extensions;
|
||||||
|
struct xkb_rule_names xkb_names;
|
||||||
|
const struct config_key keyboard_config_keys[] = {
|
||||||
|
{ "keymap_rules", CONFIG_KEY_STRING, &xkb_names.rules },
|
||||||
|
{ "keymap_model", CONFIG_KEY_STRING, &xkb_names.model },
|
||||||
|
{ "keymap_layout", CONFIG_KEY_STRING, &xkb_names.layout },
|
||||||
|
{ "keymap_variant", CONFIG_KEY_STRING, &xkb_names.variant },
|
||||||
|
{ "keymap_options", CONFIG_KEY_STRING, &xkb_names.options },
|
||||||
|
};
|
||||||
|
const struct config_section cs[] = {
|
||||||
|
{ "keyboard",
|
||||||
|
keyboard_config_keys, ARRAY_LENGTH(keyboard_config_keys) },
|
||||||
|
};
|
||||||
|
|
||||||
|
memset(&xkb_names, 0, sizeof(xkb_names));
|
||||||
|
parse_config_file(config_file, cs, ARRAY_LENGTH(cs), ec);
|
||||||
|
|
||||||
ec->wl_display = display;
|
ec->wl_display = display;
|
||||||
wl_signal_init(&ec->destroy_signal);
|
wl_signal_init(&ec->destroy_signal);
|
||||||
@@ -2936,6 +2948,8 @@ weston_compositor_init(struct weston_compositor *ec,
|
|||||||
vertex_shader, solid_fragment_shader) < 0)
|
vertex_shader, solid_fragment_shader) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
weston_compositor_xkb_init(ec, &xkb_names);
|
||||||
|
|
||||||
loop = wl_display_get_event_loop(ec->wl_display);
|
loop = wl_display_get_event_loop(ec->wl_display);
|
||||||
ec->idle_source = wl_event_loop_add_timer(loop, idle_handler, ec);
|
ec->idle_source = wl_event_loop_add_timer(loop, idle_handler, ec);
|
||||||
wl_event_source_timer_update(ec->idle_source, ec->idle_time * 1000);
|
wl_event_source_timer_update(ec->idle_source, ec->idle_time * 1000);
|
||||||
@@ -3051,25 +3065,14 @@ int main(int argc, char *argv[])
|
|||||||
int32_t xserver = 0;
|
int32_t xserver = 0;
|
||||||
char *socket_name = NULL;
|
char *socket_name = NULL;
|
||||||
char *config_file;
|
char *config_file;
|
||||||
struct xkb_rule_names xkb_names;
|
|
||||||
|
|
||||||
const struct config_key shell_config_keys[] = {
|
const struct config_key shell_config_keys[] = {
|
||||||
{ "type", CONFIG_KEY_STRING, &shell },
|
{ "type", CONFIG_KEY_STRING, &shell },
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct config_key keyboard_config_keys[] = {
|
|
||||||
{ "keymap_rules", CONFIG_KEY_STRING, &xkb_names.rules },
|
|
||||||
{ "keymap_model", CONFIG_KEY_STRING, &xkb_names.model },
|
|
||||||
{ "keymap_layout", CONFIG_KEY_STRING, &xkb_names.layout },
|
|
||||||
{ "keymap_variant", CONFIG_KEY_STRING, &xkb_names.variant },
|
|
||||||
{ "keymap_options", CONFIG_KEY_STRING, &xkb_names.options },
|
|
||||||
};
|
|
||||||
|
|
||||||
const struct config_section cs[] = {
|
const struct config_section cs[] = {
|
||||||
{ "shell",
|
{ "shell",
|
||||||
shell_config_keys, ARRAY_LENGTH(shell_config_keys) },
|
shell_config_keys, ARRAY_LENGTH(shell_config_keys) },
|
||||||
{ "keyboard",
|
|
||||||
keyboard_config_keys, ARRAY_LENGTH(keyboard_config_keys) },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct weston_option core_options[] = {
|
const struct weston_option core_options[] = {
|
||||||
@@ -3080,8 +3083,6 @@ int main(int argc, char *argv[])
|
|||||||
{ WESTON_OPTION_STRING, "module", 0, &module },
|
{ WESTON_OPTION_STRING, "module", 0, &module },
|
||||||
};
|
};
|
||||||
|
|
||||||
memset(&xkb_names, 0, sizeof(xkb_names));
|
|
||||||
|
|
||||||
argc = parse_options(core_options,
|
argc = parse_options(core_options,
|
||||||
ARRAY_LENGTH(core_options), argc, argv);
|
ARRAY_LENGTH(core_options), argc, argv);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user