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

Quentin Glidic sardemff7+wayland at sardemff7.net
Mon Jul 1 08:03:06 PDT 2013


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 | 7 +++++++
 weston.ini         | 2 +-
 4 files changed, 11 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 9c22b3f..f457d34 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -299,8 +299,9 @@ present. This seat can be constrained like any other.
 .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 5815053..a0de119 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>
 
@@ -912,12 +913,18 @@ 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);
+	}
 }
 
 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
-- 
1.8.3.1



More information about the wayland-devel mailing list