[WESTON PATCH 1/1] compositor: Add idle timeout option to weston.ini

Bryce Harrington bryce at osg.samsung.com
Wed Oct 29 11:57:30 PDT 2014


On Mon, Oct 27, 2014 at 11:17:48AM -0400, Frederic Plourde wrote:
> Weston's idle timeout can already be set via the '-i' command-line
> option, but this patch lets users specify it also via weston.ini.
> Note that the command-line option takes precedence over the .ini,
> should the option be set by both.
> 
> This patch also Updates weston.ini man page with idle-timeout bits
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=83921
> Signed-off-by: Frederic Plourde <frederic.plourde at collabora.co.uk>

These docs are handy; I'd wondered if --idle-timeout controlled the
screensaver timing but had to just experiment with it to see.  (I wonder
if the option could be more obviously named?)  Improving the man page
will clarify this for others.

Reviewed-by: Bryce Harrington <b.harrington at samsung.com>

> ---
>  man/weston.ini.man | 19 +++++++++++++++++--
>  src/compositor.c   |  6 +++++-
>  2 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/man/weston.ini.man b/man/weston.ini.man
> index c05a221..a5566b0 100644
> --- a/man/weston.ini.man
> +++ b/man/weston.ini.man
> @@ -62,21 +62,21 @@ Comment lines are ignored:
>  .RS 4
>  .nf
>  .IR "#comment"
>  .fi
>  .RE
>  .PP
>  The section headers are:
>  .PP
>  .RS 4
>  .nf
> -.BR "core           " "The core modules"
> +.BR "core           " "The core modules and options"
>  .BR "libinput       " "Input device configuration"
>  .BR "shell          " "Desktop customization"
>  .BR "launcher       " "Add launcher to the panel"
>  .BR "screensaver    " "Screensaver selection"
>  .BR "output         " "Output configuration"
>  .BR "input-method   " "Onscreen keyboard input"
>  .BR "keyboard       " "Keyboard layouts"
>  .BR "terminal       " "Terminal application options"
>  .BR "xwayland       " "XWayland options"
>  .BR "screen-share   " "Screen sharing options"
> @@ -85,21 +85,21 @@ The section headers are:
>  .PP
>  Possible value types are string, signed and unsigned 32-bit
>  integer, and boolean. Strings must not be quoted, do not support any
>  escape sequences, and run till the end of the line. Integers can
>  be given in decimal (e.g. 123), octal (e.g. 0173), and hexadecimal
>  (e.g. 0x7b) form. Boolean values can be only 'true' or 'false'.
>  .RE
>  .SH "CORE SECTION"
>  The
>  .B core
> -section is used to select the startup compositor modules.
> +section is used to select the startup compositor modules and general options.
>  .TP 7
>  .BI "shell=" desktop-shell.so
>  specifies a shell to load (string). This can be used to load your own
>  implemented shell or one with Weston as default. Available shells
>  in the
>  .IR "__weston_modules_dir__"
>  directory are:
>  .PP
>  .RS 10
>  .nf
> @@ -139,20 +139,35 @@ directory are:
>  .fi
>  .RE
>  .BI "gbm-format="format
>  sets the GBM format used for the framebuffer for the GBM backend. Can be
>  .B xrgb8888,
>  .B xrgb2101010,
>  .B rgb565.
>  By default, xrgb8888 is used.
>  .RS
>  .PP
> +.RE
> +.TP 7
> +.BI "idle-time="seconds
> +sets Weston's idle timeout in seconds. This idle timeout is the time
> +after which Weston will enter an inactive mode, fading the screen to
> +black and possibly starting screensavers (if opt-in), etc.

We're leaving a question to the reader here, "What does 'if opt-in'
mean?"  It might be friendly to point them to further documentation on
hooking up and/or configuring screensavers here.

Btw, do you know if we have anything to inhibit/re-enable the
screensaver at runtime?

> +
> +.IR Important
> +: This option may also be set via Weston's '-i' command
> +line option and will take precedence over the current .ini option. This
> +means that if both weston.ini and command line define this idle-timeout
> +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
>  
>  .SH "LIBINPUT SECTION"
>  The
>  .B libinput
>  section is used to configure input devices when using the libinput input device
>  backend.
>  .PP
>  Available configuration are:
>  .TP 7
>  .BI "enable_tap=" true
> diff --git a/src/compositor.c b/src/compositor.c
> index 4540911..015037f 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -4603,21 +4603,21 @@ int main(int argc, char *argv[])
>  		*(*backend_init)(struct wl_display *display,
>  				 int *argc, char *argv[],
>  				 struct weston_config *config);
>  	int i, fd;
>  	char *backend = NULL;
>  	char *shell = NULL;
>  	char *modules = NULL;
>  	char *option_modules = NULL;
>  	char *log = NULL;
>  	char *server_socket = NULL, *end;
> -	int32_t idle_time = 300;
> +	int32_t idle_time = -1;
>
>  	int32_t help = 0;
>  	char *socket_name = NULL;
>  	int32_t version = 0;
>  	int32_t noconfig = 0;
>  	int32_t numlock_on;
>  	struct weston_config *config = NULL;
>  	struct weston_config_section *section;
>  	struct wl_client *primary_client;
>  	struct wl_listener primary_client_destroyed;
>  	struct weston_seat *seat;
> @@ -4701,20 +4701,24 @@ int main(int argc, char *argv[])
>  	ec = backend_init(display, &argc, argv, config);
>  	if (ec == NULL) {
>  		weston_log("fatal: failed to create compositor\n");
>  		ret = EXIT_FAILURE;
>  		goto out_signals;
>  	}
>  
>  	catch_signals();
>  	segv_compositor = ec;
>  
> +	if (idle_time < 0)
> +		weston_config_section_get_int(section, "idle-time", &idle_time, -1);
> +	if (idle_time < 0)
> +		idle_time = 300; /* default idle timeout, in seconds */
>  	ec->idle_time = idle_time;
>  	ec->default_pointer_grab = NULL;
>  
>  	for (i = 1; i < argc; i++)
>  		weston_log("fatal: unhandled option: %s\n", argv[i]);
>  	if (argc > 1) {
>  		ret = EXIT_FAILURE;
>  		goto out;
>  	}
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list