diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index ab32f08b3..9224cab8d 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -476,7 +476,7 @@ shell_configuration(struct desktop_shell *shell) "allow-zap", &allow_zap, true); shell->allow_zap = allow_zap; - shell->binding_modifier = weston_shell_get_binding_modifier(config, MODIFIER_SUPER); + shell->binding_modifier = weston_config_get_binding_modifier(config, MODIFIER_SUPER); weston_config_section_get_string(section, "animation", &s, "none"); shell->win_animation_type = get_animation_type(s); diff --git a/include/libweston/config-parser.h b/include/libweston/config-parser.h index 81f28b59a..8ed14a3b5 100644 --- a/include/libweston/config-parser.h +++ b/include/libweston/config-parser.h @@ -104,6 +104,9 @@ int weston_config_next_section(struct weston_config *config, struct weston_config_section **section, const char **name); +uint32_t +weston_config_get_binding_modifier(struct weston_config *config, uint32_t default_mod); + #ifdef __cplusplus } #endif diff --git a/include/libweston/shell-utils.h b/include/libweston/shell-utils.h index 5e10b15d4..57d51f8f1 100644 --- a/include/libweston/shell-utils.h +++ b/include/libweston/shell-utils.h @@ -27,9 +27,6 @@ #include "shared/helpers.h" #include -#include -#include - #ifdef __cplusplus extern "C" { #endif @@ -75,9 +72,6 @@ weston_shell_utils_curtain_create(struct weston_compositor *compositor, void weston_shell_utils_curtain_destroy(struct weston_curtain *curtain); -uint32_t -weston_shell_get_binding_modifier(struct weston_config *config, uint32_t default_mod); - #ifdef __cplusplus } #endif diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c index c1ab171f3..cf9ee1e3e 100644 --- a/kiosk-shell/kiosk-shell.c +++ b/kiosk-shell/kiosk-shell.c @@ -1068,7 +1068,7 @@ kiosk_shell_add_bindings(struct kiosk_shell *shell) { uint32_t mod = 0; - mod = weston_shell_get_binding_modifier(shell->config, MODIFIER_SUPER); + mod = weston_config_get_binding_modifier(shell->config, MODIFIER_SUPER); weston_compositor_add_button_binding(shell->compositor, BTN_LEFT, 0, kiosk_shell_click_to_activate_binding, diff --git a/libweston/shell-utils/shell-utils.c b/libweston/shell-utils/shell-utils.c index a81897dfb..287d60fd5 100644 --- a/libweston/shell-utils/shell-utils.c +++ b/libweston/shell-utils/shell-utils.c @@ -216,34 +216,3 @@ weston_shell_utils_curtain_destroy(struct weston_curtain *curtain) weston_buffer_destroy_solid(curtain->buffer_ref); free(curtain); } - -WL_EXPORT uint32_t -weston_shell_get_binding_modifier(struct weston_config *config, - uint32_t default_mod) -{ - struct weston_config_section *shell_section = NULL; - char *mod_string = NULL; - uint32_t mod = default_mod; - - if (config) - shell_section = weston_config_get_section(config, "shell", NULL, NULL); - - if (shell_section) - weston_config_section_get_string(shell_section, - "binding-modifier", &mod_string, "super"); - - if (!mod_string || !strcmp(mod_string, "none")) - mod = default_mod; - else if (!strcmp(mod_string, "super")) - mod = MODIFIER_SUPER; - else if (!strcmp(mod_string, "alt")) - mod = MODIFIER_ALT; - else if (!strcmp(mod_string, "ctrl")) - mod = MODIFIER_CTRL; - else if (!strcmp(mod_string, "shift")) - mod = MODIFIER_SHIFT; - - free(mod_string); - - return mod; -} diff --git a/shared/config-parser.c b/shared/config-parser.c index 30779ae4f..cf4adddfe 100644 --- a/shared/config-parser.c +++ b/shared/config-parser.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "helpers.h" #include "string-helpers.h" @@ -541,3 +542,34 @@ weston_config_destroy(struct weston_config *config) free(config); } + +WL_EXPORT uint32_t +weston_config_get_binding_modifier(struct weston_config *config, + uint32_t default_mod) +{ + struct weston_config_section *shell_section = NULL; + char *mod_string = NULL; + uint32_t mod = default_mod; + + if (config) + shell_section = weston_config_get_section(config, "shell", NULL, NULL); + + if (shell_section) + weston_config_section_get_string(shell_section, + "binding-modifier", &mod_string, "super"); + + if (!mod_string || !strcmp(mod_string, "none")) + mod = default_mod; + else if (!strcmp(mod_string, "super")) + mod = MODIFIER_SUPER; + else if (!strcmp(mod_string, "alt")) + mod = MODIFIER_ALT; + else if (!strcmp(mod_string, "ctrl")) + mod = MODIFIER_CTRL; + else if (!strcmp(mod_string, "shift")) + mod = MODIFIER_SHIFT; + + free(mod_string); + + return mod; +} diff --git a/shared/meson.build b/shared/meson.build index 8b71fb87a..8ed3c0a05 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -6,7 +6,7 @@ srcs_libshared = [ 'os-compatibility.c', 'process-util.c', ] -deps_libshared = [dep_wayland_client, dep_wayland_server] +deps_libshared = [dep_wayland_client, dep_wayland_server, dep_pixman] lib_libshared = static_library( 'shared',