summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Díaz <daniel.diaz@linaro.org>2016-10-21 14:03:13 -0500
committerDaniel Stone <daniels@collabora.com>2016-10-22 15:04:58 +0100
commit75b7197f4e072a4e2de124ddbe93b85cffb1c0f8 (patch)
tree08d2251df51200eeb39f2e7873bf914782f2396d
parent2dae4d0110a1e3699f0e99ca0e6a6a6904842253 (diff)
Add configuration option for no input device.
As it has been discussed in the past [1], running Weston without any input device at launch might be beneficial for some use cases. Certainly, it's best for the vast majority of users (and the project) to require an input device to be present, as to avoid frustration and hassle, but for those brave souls that so prefer, this patch lets them run without any input device at all. This introduces a simple configuration in weston.ini: [core] require-input=true True is the default, so no behavioral change is introduced. [1] https://lists.freedesktop.org/archives/wayland-devel/2015-November/025193.html Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--compositor/main.c5
-rw-r--r--libweston/compositor.h4
-rw-r--r--libweston/libinput-seat.c6
-rw-r--r--man/weston.ini.man5
-rw-r--r--weston.ini.in1
5 files changed, 21 insertions, 0 deletions
diff --git a/compositor/main.c b/compositor/main.c
index 8028ec32..080aa61c 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1738,6 +1738,7 @@ int main(int argc, char *argv[])
struct wl_listener primary_client_destroyed;
struct weston_seat *seat;
struct wet_compositor user_data;
+ int require_input;
const struct weston_option core_options[] = {
{ WESTON_OPTION_STRING, "backend", 'B', &backend },
@@ -1822,6 +1823,10 @@ int main(int argc, char *argv[])
if (weston_compositor_init_config(ec, config) < 0)
goto out;
+ weston_config_section_get_bool(section, "require-input",
+ &require_input, true);
+ ec->require_input = require_input;
+
if (load_backend(ec, backend, &argc, argv, config) < 0) {
weston_log("fatal: failed to create compositor backend\n");
goto out;
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 3e486d5e..e00d2853 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -830,6 +830,10 @@ struct weston_compositor {
void *user_data;
void (*exit)(struct weston_compositor *c);
+
+ /* Whether to let the compositor run without any input device. */
+ bool require_input;
+
};
struct weston_buffer {
diff --git a/libweston/libinput-seat.c b/libweston/libinput-seat.c
index 78a5fc44..8cf5666b 100644
--- a/libweston/libinput-seat.c
+++ b/libweston/libinput-seat.c
@@ -259,6 +259,12 @@ udev_input_enable(struct udev_input *input)
devices_found = 1;
}
+ if (devices_found == 0 && !c->require_input) {
+ weston_log("warning: no input devices found, but none required "
+ "as per configuration.\n");
+ return 0;
+ }
+
if (devices_found == 0) {
weston_log(
"warning: no input devices on entering Weston. "
diff --git a/man/weston.ini.man b/man/weston.ini.man
index 7aa78105..2eac098f 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -168,6 +168,11 @@ time, the one specified in the command-line will be used. On the other
hand, if none of these sets the value, default idle timeout will be
set to 300 seconds.
.RS
+.PP
+.RE
+.TP 7
+.BI "require-input=" true
+require an input device for launch
.SH "LIBINPUT SECTION"
The
diff --git a/weston.ini.in b/weston.ini.in
index 14a4c0c9..d837fb5d 100644
--- a/weston.ini.in
+++ b/weston.ini.in
@@ -2,6 +2,7 @@
#modules=xwayland.so,cms-colord.so
#shell=desktop-shell.so
#gbm-format=xrgb2101010
+#require-input=true
[shell]
background-image=/usr/share/backgrounds/gnome/Aqua.jpg