xwayland: keep track of the wl_output enter/leave

Keep track of the output the surface enters/leaves.

This is fairly basic tracking though, we do not keep a full list of
outputs a surface may be covering partially, we just keep the output
the surface entered last.

This is sufficient as a preparation work for fullscreen though.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Olivier Fourdan 2022-05-12 15:30:38 +02:00
parent f80bf83465
commit c7a50db7ff
2 changed files with 31 additions and 0 deletions

View File

@ -413,6 +413,33 @@ static const struct xdg_surface_listener xdg_surface_listener = {
xdg_surface_handle_configure,
};
static void
xwl_window_surface_enter(void *data,
struct wl_surface *wl_surface,
struct wl_output *wl_output)
{
struct xwl_window *xwl_window = data;
if (xwl_window->wl_output != wl_output)
xwl_window->wl_output = wl_output;
}
static void
xwl_window_surface_leave(void *data,
struct wl_surface *wl_surface,
struct wl_output *wl_output)
{
struct xwl_window *xwl_window = data;
if (xwl_window->wl_output == wl_output)
xwl_window->wl_output = NULL;
}
static const struct wl_surface_listener surface_listener = {
xwl_window_surface_enter,
xwl_window_surface_leave
};
static Bool
ensure_surface_for_window(WindowPtr window)
{
@ -456,6 +483,9 @@ ensure_surface_for_window(WindowPtr window)
goto err_surf;
}
wl_surface_add_listener(xwl_window->surface,
&surface_listener, xwl_window);
xdg_surface_add_listener(xwl_window->xdg_surface,
&xdg_surface_listener, xwl_window);

View File

@ -51,6 +51,7 @@ struct xwl_window {
struct xorg_list window_buffers_available;
struct xorg_list window_buffers_unavailable;
OsTimerPtr window_buffers_timer;
struct wl_output *wl_output;
#ifdef GLAMOR_HAS_GBM
struct xorg_list frame_callback_list;
Bool present_flipped;