From 67285c1d5758526688f0023e27c4a6b24730a2fa Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Fri, 23 Feb 2018 13:18:05 +0100 Subject: [PATCH] idle-inhibit: style adjustments and motivation --- examples/idle-inhibit.c | 18 +++++++++--------- include/wlr/types/wlr_idle_inhibit_v1.h | 12 ++++++++++++ types/wlr_idle_inhibit_v1.c | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/examples/idle-inhibit.c b/examples/idle-inhibit.c index bc7dda43d..b7b9c21c8 100644 --- a/examples/idle-inhibit.c +++ b/examples/idle-inhibit.c @@ -68,41 +68,41 @@ static void pointer_handle_button(void *data, struct wl_pointer *pointer, uint32 static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y) { - /* NOOP: ignore event */ + // This space intentionally left blank } static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface) { - /* NOOP: ignore event */ + // This space intentionally left blank } static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { - /* NOOP: ignore event */ + // This space intentionally left blank } static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value) { - /* NOOP: ignore event */ + // This space intentionally left blank } static void pointer_handle_frame(void *data, struct wl_pointer *wl_pointer) { - /* NOOP: ignore event */ + // This space intentionally left blank } static void pointer_handle_axis_source(void *data, struct wl_pointer *wl_pointer, uint32_t axis_source) { - /* NOOP: ignore event */ + // This space intentionally left blank } static void pointer_handle_axis_stop(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis) { - /* NOOP: ignore event */ + // This space intentionally left blank } static void pointer_handle_axis_discrete(void *data, struct wl_pointer *wl_pointer, uint32_t axis, int32_t discrete) { - /* NOOP: ignore event */ + // This space intentionally left blank } static const struct wl_pointer_listener pointer_listener = { @@ -225,7 +225,7 @@ int main(int argc, char **argv) { draw(); while (wl_display_dispatch(display) != -1) { - /** Do Nothing */ + // This space intentionally left blank } return EXIT_SUCCESS; diff --git a/include/wlr/types/wlr_idle_inhibit_v1.h b/include/wlr/types/wlr_idle_inhibit_v1.h index c06a82e80..a777ff43a 100644 --- a/include/wlr/types/wlr_idle_inhibit_v1.h +++ b/include/wlr/types/wlr_idle_inhibit_v1.h @@ -3,6 +3,18 @@ #include +/* This interface permits clients to inhibit the idle behavior such as + * screenblanking, locking, and screensaving. + * + * This allows clients to ensure they stay visible instead of being hidden by + * power-saving. + * + * Inhibitors are created for surfaces. They should only be in effect, while + * this surface is visible. + * The effect could also be limited to outputs it is displayed on (e.g. + * dimm/dpms off outputs, except the one a video is displayed on). + */ + struct wlr_idle_inhibit_manager_v1 { struct wl_list wl_resources; // wl_resource_get_link struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1::link diff --git a/types/wlr_idle_inhibit_v1.c b/types/wlr_idle_inhibit_v1.c index fb302c5b9..3a5fc8103 100644 --- a/types/wlr_idle_inhibit_v1.c +++ b/types/wlr_idle_inhibit_v1.c @@ -12,14 +12,14 @@ static struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl; static struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl; -struct wlr_idle_inhibit_manager_v1 * +static struct wlr_idle_inhibit_manager_v1 * wlr_idle_inhibit_manager_v1_from_resource(struct wl_resource *resource) { assert(wl_resource_instance_of(resource, &zwp_idle_inhibit_manager_v1_interface, &idle_inhibit_impl)); return wl_resource_get_user_data(resource); } -struct wlr_idle_inhibitor_v1 * +static struct wlr_idle_inhibitor_v1 * wlr_idle_inhibitor_v1_from_resource(struct wl_resource *resource) { assert(wl_resource_instance_of(resource, &zwp_idle_inhibitor_v1_interface, &idle_inhibitor_impl));