1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include "sd-bus.h" 5 6 #include "hashmap.h" 7 #include "locale-util.h" 8 #include "time-util.h" 9 10 typedef struct Context { 11 sd_bus_message *locale_cache; 12 usec_t locale_mtime; 13 char *locale[_VARIABLE_LC_MAX]; 14 15 sd_bus_message *x11_cache; 16 usec_t x11_mtime; 17 char *x11_layout; 18 char *x11_model; 19 char *x11_variant; 20 char *x11_options; 21 22 sd_bus_message *vc_cache; 23 usec_t vc_mtime; 24 char *vc_keymap; 25 char *vc_keymap_toggle; 26 27 Hashmap *polkit_registry; 28 } Context; 29 30 int find_converted_keymap(const char *x11_layout, const char *x11_variant, char **new_keymap); 31 int find_legacy_keymap(Context *c, char **new_keymap); 32 int find_language_fallback(const char *lang, char **language); 33 34 int locale_read_data(Context *c, sd_bus_message *m); 35 int vconsole_read_data(Context *c, sd_bus_message *m); 36 int x11_read_data(Context *c, sd_bus_message *m); 37 38 void context_clear(Context *c); 39 int vconsole_convert_to_x11(Context *c); 40 int vconsole_write_data(Context *c); 41 int x11_convert_to_vconsole(Context *c); 42 int x11_write_data(Context *c); 43 void locale_simplify(char *locale[_VARIABLE_LC_MAX]); 44 int locale_write_data(Context *c, char ***settings); 45 46 bool locale_gen_check_available(void); 47 int locale_gen_enable_locale(const char *locale); 48 int locale_gen_run(void); 49