diff options
author | Quentin Glidic <sardemff7+git@sardemff7.net> | 2016-09-10 11:43:42 +0200 |
---|---|---|
committer | Quentin Glidic <sardemff7+git@sardemff7.net> | 2016-09-10 19:34:31 +0200 |
commit | 6d5c7a9a884751362b2f358cd8064cb6350f1e1a (patch) | |
tree | 351078981fc31b48627002245dbc0cdd1cfb9da5 | |
parent | f338131b33ac47eafd1c1fe2fa5dce5e770d3751 (diff) |
libweston-desktop: Forward idle inhibitors to the toplevel surface
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
-rw-r--r-- | libweston-desktop/surface.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libweston-desktop/surface.c b/libweston-desktop/surface.c index 2205107b..38254c32 100644 --- a/libweston-desktop/surface.c +++ b/libweston-desktop/surface.c @@ -52,6 +52,8 @@ struct weston_desktop_surface { struct weston_surface *surface; struct wl_list view_list; struct weston_position buffer_move; + struct wl_listener surface_start_inhibiting_listener; + struct wl_listener surface_stop_inhibiting_listener; struct wl_listener surface_commit_listener; struct wl_listener surface_destroy_listener; struct wl_listener client_destroy_listener; @@ -128,6 +130,8 @@ weston_desktop_surface_destroy(struct weston_desktop_surface *surface) struct weston_desktop_view *view, *next_view; struct weston_desktop_surface *child, *next_child; + wl_list_remove(&surface->surface_start_inhibiting_listener.link); + wl_list_remove(&surface->surface_stop_inhibiting_listener.link); wl_list_remove(&surface->surface_commit_listener.link); wl_list_remove(&surface->surface_destroy_listener.link); wl_list_remove(&surface->client_destroy_listener.link); @@ -163,6 +167,26 @@ weston_desktop_surface_destroy(struct weston_desktop_surface *surface) } static void +weston_desktop_surface_surface_start_inhibiting(struct wl_listener *listener, + void *data) +{ + struct weston_desktop_surface *surface = + wl_container_of(listener, surface, surface_start_inhibiting_listener); + + if (surface->parent == NULL) + return; + + weston_surface_reparent_inhibitors(surface->surface, + surface->parent->surface); +} + +static void +weston_desktop_surface_surface_idle_inhibitor(struct wl_listener *listener, + void *data) +{ +} + +static void weston_desktop_surface_surface_committed(struct wl_listener *listener, void *data) { @@ -269,6 +293,14 @@ weston_desktop_surface_create(struct weston_desktop *desktop, wsurface->committed = weston_desktop_surface_committed; wsurface->committed_private = surface; + surface->surface_start_inhibiting_listener.notify = + weston_desktop_surface_surface_start_inhibiting; + wl_signal_add(&surface->surface->start_inhibiting_signal, + &surface->surface_start_inhibiting_listener); + surface->surface_stop_inhibiting_listener.notify = + weston_desktop_surface_surface_idle_inhibitor; + wl_signal_add(&surface->surface->stop_inhibiting_signal, + &surface->surface_stop_inhibiting_listener); surface->surface_commit_listener.notify = weston_desktop_surface_surface_committed; wl_signal_add(&surface->surface->commit_signal, |