From 9d2220380a3bce0cb19372c94332d8f35969f86c Mon Sep 17 00:00:00 2001 From: Eric Toombs <3672-ewtoombs@users.noreply.gitlab.freedesktop.org> Date: Thu, 31 Jan 2019 18:24:04 -0500 Subject: [PATCH] weston: deprecate enable_tap in favour of enable-tap This is to increase consistency in config option naming in weston.ini. (Prefer hyphens over underscores to separate words.) If enable_tap is present in weston.ini, an obnoxious error message is logged with weston_log(). In terms of configuration, if enable-tap is present, enable_tap is ignored. Signed-off-by: Eric Toombs <3672-ewtoombs@users.noreply.gitlab.freedesktop.org> --- compositor/main.c | 24 +++++++++++++++--------- man/weston.ini.man | 2 +- weston.ini.in | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/compositor/main.c b/compositor/main.c index b4fdbfe9d..6fdb6bae1 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -1464,21 +1464,27 @@ configure_input_device(struct weston_compositor *compositor, { struct weston_config_section *s; struct weston_config *config = wet_get_config(compositor); + int has_enable_tap = 0; int enable_tap; - int enable_tap_default; s = weston_config_get_section(config, "libinput", NULL, NULL); if (libinput_device_config_tap_get_finger_count(device) > 0) { - enable_tap_default = - libinput_device_config_tap_get_default_enabled( - device); - weston_config_section_get_bool(s, "enable_tap", - &enable_tap, - enable_tap_default); - libinput_device_config_tap_set_enabled(device, - enable_tap); + if (weston_config_section_get_bool(s, "enable_tap", + &enable_tap, 0) == 0) { + weston_log("!!DEPRECATION WARNING!!: In weston.ini, " + "enable_tap is deprecated in favour of " + "enable-tap. Support for it may be removed " + "at any time!"); + has_enable_tap = 1; + } + if (weston_config_section_get_bool(s, "enable-tap", + &enable_tap, 0) == 0) + has_enable_tap = 1; + if (has_enable_tap) + libinput_device_config_tap_set_enabled(device, + enable_tap); } } diff --git a/man/weston.ini.man b/man/weston.ini.man index c81032ce4..dea80ca07 100644 --- a/man/weston.ini.man +++ b/man/weston.ini.man @@ -216,7 +216,7 @@ backend. .PP Available configuration are: .TP 7 -.BI "enable_tap=" true +.BI "enable-tap=" true enables tap to click on touchpad devices .TP 7 .BI "touchscreen_calibrator=" true diff --git a/weston.ini.in b/weston.ini.in index 257c4ec4c..1a9acee41 100644 --- a/weston.ini.in +++ b/weston.ini.in @@ -60,7 +60,7 @@ path=@libexecdir@/weston-keyboard #transform=flipped-90 #[libinput] -#enable_tap=true +#enable-tap=true #[touchpad] #constant_accel_factor = 50