Add options to specify xkb details

dev
Kristian Høgsberg 14 years ago
parent 30620609b2
commit c7c60646ad
  1. 39
      clients/window.c

@ -115,6 +115,20 @@ struct input {
struct wl_list link; struct wl_list link;
}; };
const char *option_xkb_layout = "us";
const char *option_xkb_variant = "";
const char *option_xkb_options = "";
static const GOptionEntry xkb_option_entries[] = {
{ "xkb-layout", 0, 0, G_OPTION_ARG_STRING,
&option_xkb_layout, "XKB Layout" },
{ "xkb-variant", 0, 0, G_OPTION_ARG_STRING,
&option_xkb_variant, "XKB Variant" },
{ "xkb-options", 0, 0, G_OPTION_ARG_STRING,
&option_xkb_options, "XKB Options" },
{ NULL }
};
static void static void
rounded_rect(cairo_t *cr, int x0, int y0, int x1, int y1, int radius) rounded_rect(cairo_t *cr, int x0, int y0, int x1, int y1, int radius)
{ {
@ -1215,9 +1229,9 @@ init_xkb(struct display *d)
names.rules = "evdev"; names.rules = "evdev";
names.model = "pc105"; names.model = "pc105";
names.layout = "us"; names.layout = option_xkb_layout;
names.variant = ""; names.variant = option_xkb_variant;
names.options = ""; names.options = option_xkb_options;
d->xkb = xkb_compile_keymap_from_rules(&names); d->xkb = xkb_compile_keymap_from_rules(&names);
if (!d->xkb) { if (!d->xkb) {
@ -1233,20 +1247,29 @@ display_create(int *argc, char **argv[], const GOptionEntry *option_entries)
EGLint major, minor; EGLint major, minor;
int fd; int fd;
GOptionContext *context; GOptionContext *context;
GOptionGroup *xkb_option_group;
GError *error; GError *error;
drm_magic_t magic; drm_magic_t magic;
g_type_init(); g_type_init();
context = g_option_context_new(NULL); context = g_option_context_new(NULL);
if (option_entries) { if (option_entries)
g_option_context_add_main_entries(context, option_entries, "Wayland View"); g_option_context_add_main_entries(context, option_entries, "Wayland View");
if (!g_option_context_parse(context, argc, argv, &error)) {
fprintf(stderr, "option parsing failed: %s\n", error->message); xkb_option_group = g_option_group_new("xkb",
exit(EXIT_FAILURE); "Keyboard options",
} "Show all XKB options",
NULL, NULL);
g_option_group_add_entries(xkb_option_group, xkb_option_entries);
g_option_context_add_group (context, xkb_option_group);
if (!g_option_context_parse(context, argc, argv, &error)) {
fprintf(stderr, "option parsing failed: %s\n", error->message);
exit(EXIT_FAILURE);
} }
d = malloc(sizeof *d); d = malloc(sizeof *d);
if (d == NULL) if (d == NULL)
return NULL; return NULL;

Loading…
Cancel
Save