[PATCH weston v2] compositor: add an option to set the default numlock value
Pekka Paalanen
ppaalanen at gmail.com
Thu Aug 28 02:17:43 PDT 2014
On Fri, 22 Aug 2014 11:48:59 +0300
Giulio Camuffo <giuliocamuffo at gmail.com> wrote:
> Add a new "numlock-on" option in the [keyboard] section of weston.ini
> which, if set to true, is used to enable the numlock of the keyboards
> attached at startup.
> ---
> man/weston.ini.man | 6 ++++++
> src/compositor.c | 13 +++++++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/man/weston.ini.man b/man/weston.ini.man
> index 4be752b..2ee092a 100644
> --- a/man/weston.ini.man
> +++ b/man/weston.ini.man
> @@ -432,6 +432,12 @@ sets the delay in milliseconds since key down until repeating starts (unsigned
> integer)
> .RE
> .RE
> +.TP 7
> +.BI "numlock-on=" "false"
> +sets the default state of the numlock on weston startup for the backends which
> +support it.
> +.RE
> +.RE
> .SH "TERMINAL SECTION"
> Contains settings for the weston terminal application (weston-terminal). It
> allows to customize the font and shell of the command line interface.
> diff --git a/src/compositor.c b/src/compositor.c
> index 96e3435..4f373f5 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -4241,10 +4241,12 @@ int main(int argc, char *argv[])
> const 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;
>
> const struct weston_option core_options[] = {
> { WESTON_OPTION_STRING, "backend", 'B', &option_backend },
> @@ -4415,6 +4417,17 @@ int main(int argc, char *argv[])
> if (load_modules(ec, option_modules, &argc, argv) < 0)
> goto out;
>
> + section = weston_config_get_section(config, "keyboard", NULL, NULL);
> + weston_config_section_get_bool(section, "numlock-on", &numlock_on, 0);
> + if (numlock_on) {
> + wl_list_for_each(seat, &ec->seat_list, link) {
> + if (seat->keyboard)
> + weston_keyboard_set_locks(seat->keyboard,
> + NUM_LOCK,
> + NUM_LOCK);
> + }
> + }
> +
> weston_compositor_wake(ec);
>
> wl_display_run(display);
This looks good to me, but I'd like a re-spin of the first patch, like
I commented.
Thanks,
pq
More information about the wayland-devel
mailing list