[PATCH weston 2/2] desktop-shell: Support panel-position 'none'

Quentin Glidic sardemff7+wayland at sardemff7.net
Mon Jan 16 15:12:28 UTC 2017


On 16/01/2017 14:23, Daniel Stone wrote:
> The manpage claims that none is valid, so let's make it so.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>

Hey, didn’t it work already? A tiny warning is no big. ;-)

Anyway:
Reviewed-by: Quentin Glidic <sardemff7+git at sardemff7.net>


> ---
>   clients/desktop-shell.c | 25 ++++++++++++-------------
>   1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
> index bd0032a..b133d86 100644
> --- a/clients/desktop-shell.c
> +++ b/clients/desktop-shell.c
> @@ -1362,25 +1362,24 @@ parse_panel_position(struct desktop *desktop, struct weston_config_section *s)
>   {
>   	char *position;
>   
> +	desktop->want_panel = 1;
> +
>   	weston_config_section_get_string(s, "panel-position", &position, "top");
> -	if (strcmp(position, "top") == 0)
> +	if (strcmp(position, "top") == 0) {
>   		desktop->panel_position = WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP;
> -	else if (strcmp(position, "bottom") == 0)
> +	} else if (strcmp(position, "bottom") == 0) {
>   		desktop->panel_position = WESTON_DESKTOP_SHELL_PANEL_POSITION_BOTTOM;
> -	else if (strcmp(position, "left") == 0)
> +	} else if (strcmp(position, "left") == 0) {
>   		desktop->panel_position = WESTON_DESKTOP_SHELL_PANEL_POSITION_LEFT;
> -	else if (strcmp(position, "right") == 0)
> +	} else if (strcmp(position, "right") == 0) {
>   		desktop->panel_position = WESTON_DESKTOP_SHELL_PANEL_POSITION_RIGHT;
> -	else

Style question: why not just strcmp(position, "none") != 0 as another 
else if?

Thanks,


> -		fprintf(stderr, "Wrong panel position: %s\n", position);
> -	free(position);
> -
> -	if (desktop->panel_position == WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP
> -	    || desktop->panel_position == WESTON_DESKTOP_SHELL_PANEL_POSITION_BOTTOM
> -	    || desktop->panel_position == WESTON_DESKTOP_SHELL_PANEL_POSITION_LEFT
> -	    || desktop->panel_position == WESTON_DESKTOP_SHELL_PANEL_POSITION_RIGHT) {
> -		desktop->want_panel = 1;
> +	} else {
> +		/* 'none' is valid here */
> +		if (strcmp(position, "none") != 0)
> +			fprintf(stderr, "Wrong panel position: %s\n", position);
> +		desktop->want_panel = 0;
>   	}
> +	free(position);
>   }
>   
>   static void
> 


-- 

Quentin “Sardem FF7” Glidic


More information about the wayland-devel mailing list