[PATCH weston 6/7] weston.ini: Allow a relative path for input-method

sardemff7+wayland at sardemff7.net sardemff7+wayland at sardemff7.net
Tue Jun 18 00:35:17 PDT 2013


On 18/06/2013 09:11, Quentin Glidic wrote:
> From: Quentin Glidic <sardemff7+git at sardemff7.net>
>
> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
> ---
>   man/Makefile.am    | 1 +
>   man/weston.ini.man | 3 ++-
>   src/text-backend.c | 8 ++++++++
>   weston.ini         | 2 +-
>   4 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/man/Makefile.am b/man/Makefile.am
> index 37174e2..b3a3881 100644
> --- a/man/Makefile.am
> +++ b/man/Makefile.am
> @@ -6,6 +6,7 @@ endif
>
>   MAN_SUBSTS = \
>   	-e 's|__weston_native_backend__|$(WESTON_NATIVE_BACKEND)|g' \
> +	-e 's|__weston_libexec_dir__|$(pkglibexecdir)|g' \
>   	-e 's|__weston_modules_dir__|$(moduledir)|g' \
>   	-e 's|__version__|$(PACKAGE_VERSION)|g'
>
> diff --git a/man/weston.ini.man b/man/weston.ini.man
> index c3e5747..e348c44 100644
> --- a/man/weston.ini.man
> +++ b/man/weston.ini.man
> @@ -290,8 +290,9 @@ be one of the following 8 strings:
>   .RE
>   .SH "INPUT-METHOD SECTION"
>   .TP 7
> -.BI "path=" "/usr/libexec/weston-keyboard"
> +.BI "path=" "/usr/libexec/weston/weston-keyboard"
>   sets the path of the on screen keyboard input method (string).
> +May be relative to __weston_libexec_dir__.
>   .RE
>   .RE
>   .SH "KEYBOARD SECTION"
> diff --git a/src/text-backend.c b/src/text-backend.c
> index e078e3f..316b2c3 100644
> --- a/src/text-backend.c
> +++ b/src/text-backend.c
> @@ -25,6 +25,7 @@
>
>   #include <stdlib.h>
>   #include <string.h>
> +#include <limits.h>
>   #include <unistd.h>
>   #include <time.h>
>
> @@ -916,12 +917,19 @@ static void
>   text_backend_configuration(struct text_backend *text_backend)
>   {
>   	struct weston_config_section *section;
> +	char path[PATH_MAX];
>
>   	section = weston_config_get_section(text_backend->compositor->config,
>   					    "input-method", NULL, NULL);
>   	weston_config_section_get_string(section, "path",
>   					 &text_backend->input_method.path,
>   					 PKGLIBEXECDIR "/weston-keyboard");
> +	if (text_backend->input_method.path[0] != '/') {
> +		snprintf(path, sizeof path, "%s/%s", PKGLIBEXECDIR, text_backend->input_method.path);
> +		free(text_backend->input_method.path);
> +		text_backend->input_method.path = strdup(path);
> +	}
> +	text_backend->input_method.path = path;

Of course this last line is a leftover. My bad.
Commit fixed locally.

>   }
>
>   static void
> diff --git a/weston.ini b/weston.ini
> index f2abceb..a9ddbc9 100644
> --- a/weston.ini
> +++ b/weston.ini
> @@ -40,7 +40,7 @@ path=/usr/libexec/weston-screensaver
>   duration=600
>
>   [input-method]
> -path=/usr/libexec/weston-keyboard
> +path=weston-keyboard
>
>   #[output]
>   #name=LVDS1
>


-- 

Quentin “Sardem FF7” Glidic


More information about the wayland-devel mailing list