summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce Harrington <bryce@osg.samsung.com>2016-08-23 13:39:14 -0700
committerBryce Harrington <bryce@osg.samsung.com>2016-08-29 18:36:13 -0700
commitca5b62426a97b4607d60eaf1154881ac8c1ac994 (patch)
treeae11b6191355376873275dbef8cfeb907e252f57
parent689feced3c0022e8f5cce79df0b19cc370de6247 (diff)
libweston: Add a signal to fire when the idle inhibitor is dropped
-rw-r--r--libweston/compositor.c23
-rw-r--r--libweston/compositor.h1
2 files changed, 18 insertions, 6 deletions
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 92f74aaf..f5039333 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -459,6 +459,7 @@ weston_surface_create(struct weston_compositor *compositor)
wl_signal_init(&surface->destroy_signal);
wl_signal_init(&surface->commit_signal);
+ wl_signal_init(&surface->drop_idle_inhibitor_signal);
surface->compositor = compositor;
surface->ref_count = 1;
@@ -4729,23 +4730,33 @@ struct weston_idle_inhibitor {
struct weston_surface *surface;
};
+/* Called when the client requests destruction of the idle inhibitor */
static void
-destroy_idle_inhibitor(struct wl_resource *resource)
+idle_inhibitor_destroy(struct wl_client *client, struct wl_resource *resource)
{
struct weston_idle_inhibitor *inhibitor = wl_resource_get_user_data(resource);
- inhibitor->surface = NULL;
- free(inhibitor);
+ assert(inhibitor);
+
+ inhibitor->surface->inhibit_idling = false;
+
+ // Notify to re-queue any idle behaviors
+ wl_signal_emit(&inhibitor->surface->drop_idle_inhibitor_signal,
+ inhibitor->surface);
+
+ weston_log("idle_inhibitor_destroy\n");
}
+/* Called when the idle inhibitor is destroyed on the server-side */
static void
-idle_inhibitor_destroy(struct wl_client *client, struct wl_resource *resource)
+destroy_idle_inhibitor(struct wl_resource *resource)
{
struct weston_idle_inhibitor *inhibitor = wl_resource_get_user_data(resource);
- assert(inhibitor);
+ weston_log("destroy_idle_inhibitor\n");
- inhibitor->surface->inhibit_idling = false;
+ inhibitor->surface = NULL;
+ free(inhibitor);
}
static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_interface = {
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 673a4e85..0c688cc1 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1071,6 +1071,7 @@ struct weston_surface {
struct wl_signal destroy_signal; /* callback argument: this surface */
struct weston_compositor *compositor;
struct wl_signal commit_signal;
+ struct wl_signal drop_idle_inhibitor_signal;
/** Damage in local coordinates from the client, for tex upload. */
pixman_region32_t damage;