frontend: Expand simple head function

In order to allow passing additional pre/post callbacks. This allows
further re-use of the simple_head_enable() function instead of
creating a similar dedicated function. We can then re-use the same
function for enabling remote outputs.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2024-06-26 19:41:50 +03:00 committed by Derek Foreman
parent 14cfb97949
commit 3842c1c737
2 changed files with 14 additions and 3 deletions

View File

@ -1869,7 +1869,9 @@ weston_output_lazy_align(struct weston_output *output)
static void
simple_head_enable(struct wet_compositor *wet, struct wet_backend *wb,
struct weston_head *head)
struct weston_head *head, struct weston_head *head_to_mirror,
wet_head_additional_setup wet_head_pre_enable,
wet_head_additional_setup wet_head_post_enable)
{
struct weston_output *output;
int ret = 0;
@ -1884,7 +1886,10 @@ simple_head_enable(struct wet_compositor *wet, struct wet_backend *wb,
return;
}
weston_output_lazy_align(output);
if (wet_head_pre_enable && head_to_mirror)
wet_head_pre_enable(head, head_to_mirror);
else
weston_output_lazy_align(output);
if (wb->simple_output_configure)
ret = wb->simple_output_configure(output);
@ -1906,6 +1911,9 @@ simple_head_enable(struct wet_compositor *wet, struct wet_backend *wb,
return;
}
if (wet_head_post_enable && head)
wet_head_post_enable(head, head_to_mirror);
wet_head_tracker_create(wet, head);
/* The weston_compositor will track and destroy the output on exit. */
@ -1958,7 +1966,7 @@ simple_heads_changed(struct wl_listener *listener, void *arg)
non_desktop = weston_head_is_non_desktop(head);
if (connected && !enabled && !non_desktop) {
simple_head_enable(wet, wb, head);
simple_head_enable(wet, wb, head, NULL, NULL, NULL);
} else if (!connected && enabled) {
simple_head_disable(head);
} else if (enabled && changed) {

View File

@ -50,3 +50,6 @@ int
wet_output_set_colorimetry_mode(struct weston_output *output,
struct weston_config_section *section,
bool have_color_manager);
typedef void (*wet_head_additional_setup)(struct weston_head *head,
struct weston_head *head_to_mirror);