On Fri, 30 Sep 2016 23:25:29 +0200
Armin Krezović <krezovic.ar...@gmail.com> wrote:

> This adds weston specific output object, which contains information
> about output's position, relative to other outputs. DRM and Windowed
> backends code has been updated to make use of the new code and
> parse new configuration options for a given output, if it was
> specified.
> 
> New configuration file options for [output] section have been added:
> 
> left-of: Specifies which output should be on the right side of the
> current output.
> 
> right-of: Specifies which output should be on the left side of the
> current output.
> 
> Signed-off-by: Armin Krezović <krezovic.ar...@gmail.com>
> ---
>  compositor/main.c | 81 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 81 insertions(+)
> 
> diff --git a/compositor/main.c b/compositor/main.c
> index 503016e..e379d8d 100644
> --- a/compositor/main.c
> +++ b/compositor/main.c
> @@ -78,6 +78,18 @@ struct wet_compositor {
>       struct weston_config *config;
>       struct wet_output_config *parsed_options;
>       struct wl_listener pending_output_listener;
> +     struct wl_list output_layout_list;
> +};
> +
> +struct wet_output {
> +     struct weston_output *output;
> +     struct wl_listener output_destroy_listener;
> +     struct wl_list link;
> +
> +     char *left_output_name;
> +     char *right_output_name;

Hi

Rather than linking by name, would it not be easier to link by pointer
to struct wet_output?

That means when you encounter a directive like "left-of=F5" and there
is no output F5 yet, you would create a new struct wet_output for F5
but leave the weston_output pointer NULL, to be filled out if F5
actually appears.

That means you would always have a graph in memory instead of doing
searches to find if output of this name actually exists. I'm not sure
if that's actually simpler in the end.

Having the complete graph would allow you to "jump over" outputs that
do not exist at the moment: e.g. order F1 -> (F2) -> F3.

> +
> +     bool position_set;
>  };
>  

> +     weston_config_section_get_string(section, "left-of", &out, NULL);
> +     wet_output->right_output_name = out ? strdup(out) : NULL;
> +     free(out);
> +
> +     weston_config_section_get_string(section, "right-of", &out, NULL);
> +     wet_output->left_output_name = out ? strdup(out) : NULL;
> +     free(out);

Yes, this looks like an intuitive approach, storing the relationship in
inverse compared to how users write it out in weston.ini.


Thanks,
pq

Attachment: pgpOqdM0WjihR.pgp
Description: OpenPGP digital signature

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to