A => .gitignore +4 -0
@@ 1,4 @@
+*.o
+*.sw[po]
+/compile_commands.json
+/.cache/
A => meson.build +30 -0
@@ 1,30 @@
+project('gtklock-dpms', 'c',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'b_ndebug=if-release',
+ 'c_std=c11',
+ ],
+ license: 'GPL-3.0-only',
+ version: '1',
+)
+
+gtk3_dep = dependency('gtk+-3.0')
+gdk3_wl_dep = dependency('gdk-wayland-3.0')
+gmodule_dep = dependency('gmodule-2.0')
+wayland_dep = dependency('wayland-client')
+
+gtklock_dpms_module = shared_module('gtklock-dpms',
+ 'module.c',
+ 'wlr-output-power-management-v1.c',
+ c_args: [
+ '-DG_LOG_DOMAIN="GtkLock-DPMS"',
+ '-DVERSION="@0@"'.format(meson.project_version()),
+ ],
+ dependencies: [
+ gtk3_dep,
+ gdk3_wl_dep,
+ gmodule_dep,
+ wayland_dep,
+ ],
+ gnu_symbol_visibility: 'hidden',
+)
A => module.c +212 -0
@@ 1,212 @@
+/*
+ * module.c
+ * Copyright (C) 2024 Adrian Perez de Castro <aperez@igalia.com>
+ *
+ * Distributed under terms of the MIT license.
+ */
+
+#include <gmodule.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkwayland.h>
+#include "wlr-output-power-management-v1.h"
+
+struct Window {
+ GdkMonitor *monitor;
+ GtkWidget *window;
+};
+
+struct GtkLock {
+ GtkApplication *app;
+ GArray *windows;
+ GArray *messages;
+ GArray *errors;
+
+ struct Window *focused_window;
+ gboolean hidden;
+ guint idle_timeout;
+
+ gboolean use_layer_shell;
+ gboolean use_input_inhibit;
+ gboolean use_idle_hide;
+};
+
+G_MODULE_EXPORT unsigned module_major_version = 2;
+G_MODULE_EXPORT unsigned module_minor_version = 1;
+G_MODULE_EXPORT char* module_version = VERSION;
+
+typedef struct {
+ uint32_t name;
+ struct zwlr_output_power_v1 *power;
+ struct wl_list link;
+} DpmsOutput;
+
+static unsigned s_power_off_timeout = 0;
+static struct zwlr_output_power_manager_v1 *s_power_manager = NULL;
+static struct wl_list s_outputs;
+
+static void
+output_destroy(DpmsOutput *output)
+{
+ g_debug("%s: output = %p", G_STRFUNC, output);
+ wl_list_remove(&output->link);
+ g_clear_pointer(&output->power, zwlr_output_power_v1_destroy);
+ g_clear_pointer(&output, g_free);
+}
+
+static DpmsOutput*
+output_by_gdk_monitor(GdkMonitor *monitor)
+{
+ uint32_t name = wl_proxy_get_id((struct wl_proxy*) gdk_wayland_monitor_get_wl_output(monitor));
+
+ DpmsOutput *output;
+ wl_list_for_each(output, &s_outputs, link) {
+ if (name == output->name)
+ return output;
+ }
+
+ return NULL;
+}
+
+static DpmsOutput*
+output_create_with_gdk_monitor(GdkMonitor *monitor)
+{
+ DpmsOutput *output = g_new0(DpmsOutput, 1);
+ output->name = wl_proxy_get_id((struct wl_proxy*) gdk_wayland_monitor_get_wl_output(monitor));
+ output->power = zwlr_output_power_manager_v1_get_output_power(s_power_manager, gdk_wayland_monitor_get_wl_output(monitor));
+ wl_list_init(&output->link);
+ g_debug("%s: output = %p", G_STRFUNC, output);
+ return output;
+}
+
+static void
+populate_outputs(const GArray *windows)
+{
+ DpmsOutput *output, *tmp_output;
+ wl_list_for_each_safe(output, tmp_output, &s_outputs, link)
+ output_destroy(g_steal_pointer(&output));
+
+ for (unsigned i = 0; i < windows->len; i++) {
+ struct Window *window = g_array_index(windows, struct Window*, i);
+ if ((output = output_by_gdk_monitor(window->monitor)))
+ continue; // Already in the list.
+
+ output = output_create_with_gdk_monitor(window->monitor);
+ wl_list_insert(&s_outputs, &output->link);
+ }
+}
+
+static void
+handle_registry_global(void *data, struct wl_registry *registry, uint32_t name,
+ const char *interface, uint32_t version)
+{
+ if (!strcmp(interface, zwlr_output_power_manager_v1_interface.name)) {
+ s_power_manager = wl_registry_bind(registry, name, &zwlr_output_power_manager_v1_interface, 1);
+ }
+}
+
+static void
+handle_registry_global_remove(void *data, struct wl_registry *registry, uint32_t name)
+{
+ DpmsOutput *output, *tmp_output;
+ wl_list_for_each_safe(output, tmp_output, &s_outputs, link) {
+ if (output->name == name) {
+ g_debug("%s: Output #%" PRIu32 " removed.", G_STRFUNC, name);
+ output_destroy(g_steal_pointer(&output));
+ break;
+ }
+ }
+}
+
+static void
+handle_power_off_timeout(void *data)
+{
+ s_power_off_timeout = 0;
+
+ DpmsOutput *output;
+ wl_list_for_each(output, &s_outputs, link) {
+ if (output->power) {
+ g_debug("%s: Powering off output #%" PRIu32 ".", G_STRFUNC, output->name);
+ zwlr_output_power_v1_set_mode(output->power, ZWLR_OUTPUT_POWER_V1_MODE_OFF);
+ } else {
+ g_debug("%s: Skipping output #%" PRIu32 ", no power control.", G_STRFUNC, output->name);
+ }
+ }
+}
+
+G_MODULE_EXPORT void
+on_idle_hide(struct GtkLock *gtklock)
+{
+ if (!s_power_manager)
+ return;
+
+ g_debug("%s: window = %p, hidden = %s", G_STRFUNC,
+ gtklock->focused_window, gtklock->hidden ? "true" : "false");
+
+ g_clear_handle_id(&s_power_off_timeout, g_source_remove);
+ s_power_off_timeout = g_timeout_add_seconds_once(5, handle_power_off_timeout, NULL);
+ g_debug("%s: timeout #%u started.", G_STRFUNC, s_power_off_timeout);
+}
+
+G_MODULE_EXPORT void
+on_output_change(struct GtkLock *gtklock)
+{
+ g_debug("%s: window = %p, hidden = %s", G_STRFUNC,
+ gtklock->focused_window, gtklock->hidden ? "true" : "false");
+
+ static gboolean needs_init = TRUE;
+ if (needs_init && !s_power_manager) {
+ needs_init = FALSE;
+
+ GdkWaylandDisplay *display = gtk_widget_get_display(gtklock->focused_window->window);
+ struct wl_registry *registry = wl_display_get_registry(gdk_wayland_display_get_wl_display(display));
+ static const struct wl_registry_listener listener = {
+ .global = handle_registry_global,
+ .global_remove = handle_registry_global_remove,
+ };
+ wl_registry_add_listener(registry, &listener, gtklock);
+ wl_display_roundtrip(gdk_wayland_display_get_wl_display(display));
+ if (!s_power_manager)
+ g_debug("%s: Interface zwlr_output_power_manager_v1 unavailable.", G_STRFUNC);
+ }
+
+ if (!s_power_manager)
+ return;
+
+ populate_outputs(gtklock->windows);
+
+ if (!gtklock->use_idle_hide || !gtklock->hidden || g_application_get_is_busy(G_APPLICATION(gtklock->app)))
+ return;
+
+ on_idle_hide(gtklock);
+}
+
+G_MODULE_EXPORT void
+on_idle_show(struct GtkLock *gtklock)
+{
+ if (!s_power_manager)
+ return;
+
+ g_debug("%s: window = %p, hidden = %s", G_STRFUNC,
+ gtklock->focused_window, gtklock->hidden ? "true" : "false");
+
+ g_clear_handle_id(&s_power_off_timeout, g_source_remove);
+
+ DpmsOutput *output;
+ wl_list_for_each(output, &s_outputs, link) {
+ if (output->power) {
+ g_debug("%s: Powering on output #%" PRIu32 ".", G_STRFUNC, output->name);
+ zwlr_output_power_v1_set_mode(output->power, ZWLR_OUTPUT_POWER_V1_MODE_ON);
+ } else {
+ g_debug("%s: Skipping output #%" PRIu32 ", no power control.", G_STRFUNC, output->name);
+ }
+ }
+}
+
+G_MODULE_EXPORT void
+on_activation(struct GtkLock *gtklock)
+{
+ g_debug("%s: window = %p, hidden = %s", G_STRFUNC,
+ gtklock->focused_window, gtklock->hidden ? "true" : "false");
+
+ wl_list_init(&s_outputs);
+}
A => wlr-output-power-management-v1.c +75 -0
@@ 1,75 @@
+/* Generated by wayland-scanner 1.22.0 */
+
+/*
+ * Copyright © 2019 Purism SPC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+#ifndef __has_attribute
+# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
+#endif
+
+#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
+#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+#else
+#define WL_PRIVATE
+#endif
+
+extern const struct wl_interface wl_output_interface;
+extern const struct wl_interface zwlr_output_power_v1_interface;
+
+static const struct wl_interface *wlr_output_power_management_unstable_v1_types[] = {
+ NULL,
+ &zwlr_output_power_v1_interface,
+ &wl_output_interface,
+};
+
+static const struct wl_message zwlr_output_power_manager_v1_requests[] = {
+ { "get_output_power", "no", wlr_output_power_management_unstable_v1_types + 1 },
+ { "destroy", "", wlr_output_power_management_unstable_v1_types + 0 },
+};
+
+WL_PRIVATE const struct wl_interface zwlr_output_power_manager_v1_interface = {
+ "zwlr_output_power_manager_v1", 1,
+ 2, zwlr_output_power_manager_v1_requests,
+ 0, NULL,
+};
+
+static const struct wl_message zwlr_output_power_v1_requests[] = {
+ { "set_mode", "u", wlr_output_power_management_unstable_v1_types + 0 },
+ { "destroy", "", wlr_output_power_management_unstable_v1_types + 0 },
+};
+
+static const struct wl_message zwlr_output_power_v1_events[] = {
+ { "mode", "u", wlr_output_power_management_unstable_v1_types + 0 },
+ { "failed", "", wlr_output_power_management_unstable_v1_types + 0 },
+};
+
+WL_PRIVATE const struct wl_interface zwlr_output_power_v1_interface = {
+ "zwlr_output_power_v1", 1,
+ 2, zwlr_output_power_v1_requests,
+ 2, zwlr_output_power_v1_events,
+};
+
A => wlr-output-power-management-v1.h +313 -0
@@ 1,313 @@
+/* Generated by wayland-scanner 1.22.0 */
+
+#ifndef WLR_OUTPUT_POWER_MANAGEMENT_UNSTABLE_V1_CLIENT_PROTOCOL_H
+#define WLR_OUTPUT_POWER_MANAGEMENT_UNSTABLE_V1_CLIENT_PROTOCOL_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @page page_wlr_output_power_management_unstable_v1 The wlr_output_power_management_unstable_v1 protocol
+ * Control power management modes of outputs
+ *
+ * @section page_desc_wlr_output_power_management_unstable_v1 Description
+ *
+ * This protocol allows clients to control power management modes
+ * of outputs that are currently part of the compositor space. The
+ * intent is to allow special clients like desktop shells to power
+ * down outputs when the system is idle.
+ *
+ * To modify outputs not currently part of the compositor space see
+ * wlr-output-management.
+ *
+ * Warning! The protocol described in this file is experimental and
+ * backward incompatible changes may be made. Backward compatible changes
+ * may be added together with the corresponding interface version bump.
+ * Backward incompatible changes are done by bumping the version number in
+ * the protocol and interface names and resetting the interface version.
+ * Once the protocol is to be declared stable, the 'z' prefix and the
+ * version number in the protocol and interface names are removed and the
+ * interface version number is reset.
+ *
+ * @section page_ifaces_wlr_output_power_management_unstable_v1 Interfaces
+ * - @subpage page_iface_zwlr_output_power_manager_v1 - manager to create per-output power management
+ * - @subpage page_iface_zwlr_output_power_v1 - adjust power management mode for an output
+ * @section page_copyright_wlr_output_power_management_unstable_v1 Copyright
+ * <pre>
+ *
+ * Copyright © 2019 Purism SPC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * </pre>
+ */
+struct wl_output;
+struct zwlr_output_power_manager_v1;
+struct zwlr_output_power_v1;
+
+#ifndef ZWLR_OUTPUT_POWER_MANAGER_V1_INTERFACE
+#define ZWLR_OUTPUT_POWER_MANAGER_V1_INTERFACE
+/**
+ * @page page_iface_zwlr_output_power_manager_v1 zwlr_output_power_manager_v1
+ * @section page_iface_zwlr_output_power_manager_v1_desc Description
+ *
+ * This interface is a manager that allows creating per-output power
+ * management mode controls.
+ * @section page_iface_zwlr_output_power_manager_v1_api API
+ * See @ref iface_zwlr_output_power_manager_v1.
+ */
+/**
+ * @defgroup iface_zwlr_output_power_manager_v1 The zwlr_output_power_manager_v1 interface
+ *
+ * This interface is a manager that allows creating per-output power
+ * management mode controls.
+ */
+extern const struct wl_interface zwlr_output_power_manager_v1_interface;
+#endif
+#ifndef ZWLR_OUTPUT_POWER_V1_INTERFACE
+#define ZWLR_OUTPUT_POWER_V1_INTERFACE
+/**
+ * @page page_iface_zwlr_output_power_v1 zwlr_output_power_v1
+ * @section page_iface_zwlr_output_power_v1_desc Description
+ *
+ * This object offers requests to set the power management mode of
+ * an output.
+ * @section page_iface_zwlr_output_power_v1_api API
+ * See @ref iface_zwlr_output_power_v1.
+ */
+/**
+ * @defgroup iface_zwlr_output_power_v1 The zwlr_output_power_v1 interface
+ *
+ * This object offers requests to set the power management mode of
+ * an output.
+ */
+extern const struct wl_interface zwlr_output_power_v1_interface;
+#endif
+
+#define ZWLR_OUTPUT_POWER_MANAGER_V1_GET_OUTPUT_POWER 0
+#define ZWLR_OUTPUT_POWER_MANAGER_V1_DESTROY 1
+
+
+/**
+ * @ingroup iface_zwlr_output_power_manager_v1
+ */
+#define ZWLR_OUTPUT_POWER_MANAGER_V1_GET_OUTPUT_POWER_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwlr_output_power_manager_v1
+ */
+#define ZWLR_OUTPUT_POWER_MANAGER_V1_DESTROY_SINCE_VERSION 1
+
+/** @ingroup iface_zwlr_output_power_manager_v1 */
+static inline void
+zwlr_output_power_manager_v1_set_user_data(struct zwlr_output_power_manager_v1 *zwlr_output_power_manager_v1, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) zwlr_output_power_manager_v1, user_data);
+}
+
+/** @ingroup iface_zwlr_output_power_manager_v1 */
+static inline void *
+zwlr_output_power_manager_v1_get_user_data(struct zwlr_output_power_manager_v1 *zwlr_output_power_manager_v1)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) zwlr_output_power_manager_v1);
+}
+
+static inline uint32_t
+zwlr_output_power_manager_v1_get_version(struct zwlr_output_power_manager_v1 *zwlr_output_power_manager_v1)
+{
+ return wl_proxy_get_version((struct wl_proxy *) zwlr_output_power_manager_v1);
+}
+
+/**
+ * @ingroup iface_zwlr_output_power_manager_v1
+ *
+ * Create an output power management mode control that can be used to
+ * adjust the power management mode for a given output.
+ */
+static inline struct zwlr_output_power_v1 *
+zwlr_output_power_manager_v1_get_output_power(struct zwlr_output_power_manager_v1 *zwlr_output_power_manager_v1, struct wl_output *output)
+{
+ struct wl_proxy *id;
+
+ id = wl_proxy_marshal_flags((struct wl_proxy *) zwlr_output_power_manager_v1,
+ ZWLR_OUTPUT_POWER_MANAGER_V1_GET_OUTPUT_POWER, &zwlr_output_power_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwlr_output_power_manager_v1), 0, NULL, output);
+
+ return (struct zwlr_output_power_v1 *) id;
+}
+
+/**
+ * @ingroup iface_zwlr_output_power_manager_v1
+ *
+ * All objects created by the manager will still remain valid, until their
+ * appropriate destroy request has been called.
+ */
+static inline void
+zwlr_output_power_manager_v1_destroy(struct zwlr_output_power_manager_v1 *zwlr_output_power_manager_v1)
+{
+ wl_proxy_marshal_flags((struct wl_proxy *) zwlr_output_power_manager_v1,
+ ZWLR_OUTPUT_POWER_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwlr_output_power_manager_v1), WL_MARSHAL_FLAG_DESTROY);
+}
+
+#ifndef ZWLR_OUTPUT_POWER_V1_MODE_ENUM
+#define ZWLR_OUTPUT_POWER_V1_MODE_ENUM
+enum zwlr_output_power_v1_mode {
+ /**
+ * Output is turned off.
+ */
+ ZWLR_OUTPUT_POWER_V1_MODE_OFF = 0,
+ /**
+ * Output is turned on, no power saving
+ */
+ ZWLR_OUTPUT_POWER_V1_MODE_ON = 1,
+};
+#endif /* ZWLR_OUTPUT_POWER_V1_MODE_ENUM */
+
+#ifndef ZWLR_OUTPUT_POWER_V1_ERROR_ENUM
+#define ZWLR_OUTPUT_POWER_V1_ERROR_ENUM
+enum zwlr_output_power_v1_error {
+ /**
+ * nonexistent power save mode
+ */
+ ZWLR_OUTPUT_POWER_V1_ERROR_INVALID_MODE = 1,
+};
+#endif /* ZWLR_OUTPUT_POWER_V1_ERROR_ENUM */
+
+/**
+ * @ingroup iface_zwlr_output_power_v1
+ * @struct zwlr_output_power_v1_listener
+ */
+struct zwlr_output_power_v1_listener {
+ /**
+ * Report a power management mode change
+ *
+ * Report the power management mode change of an output.
+ *
+ * The mode event is sent after an output changed its power
+ * management mode. The reason can be a client using set_mode or
+ * the compositor deciding to change an output's mode. This event
+ * is also sent immediately when the object is created so the
+ * client is informed about the current power management mode.
+ * @param mode the output's new power management mode
+ */
+ void (*mode)(void *data,
+ struct zwlr_output_power_v1 *zwlr_output_power_v1,
+ uint32_t mode);
+ /**
+ * object no longer valid
+ *
+ * This event indicates that the output power management mode
+ * control is no longer valid. This can happen for a number of
+ * reasons, including: - The output doesn't support power
+ * management - Another client already has exclusive power
+ * management mode control for this output - The output disappeared
+ *
+ * Upon receiving this event, the client should destroy this
+ * object.
+ */
+ void (*failed)(void *data,
+ struct zwlr_output_power_v1 *zwlr_output_power_v1);
+};
+
+/**
+ * @ingroup iface_zwlr_output_power_v1
+ */
+static inline int
+zwlr_output_power_v1_add_listener(struct zwlr_output_power_v1 *zwlr_output_power_v1,
+ const struct zwlr_output_power_v1_listener *listener, void *data)
+{
+ return wl_proxy_add_listener((struct wl_proxy *) zwlr_output_power_v1,
+ (void (**)(void)) listener, data);
+}
+
+#define ZWLR_OUTPUT_POWER_V1_SET_MODE 0
+#define ZWLR_OUTPUT_POWER_V1_DESTROY 1
+
+/**
+ * @ingroup iface_zwlr_output_power_v1
+ */
+#define ZWLR_OUTPUT_POWER_V1_MODE_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwlr_output_power_v1
+ */
+#define ZWLR_OUTPUT_POWER_V1_FAILED_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_zwlr_output_power_v1
+ */
+#define ZWLR_OUTPUT_POWER_V1_SET_MODE_SINCE_VERSION 1
+/**
+ * @ingroup iface_zwlr_output_power_v1
+ */
+#define ZWLR_OUTPUT_POWER_V1_DESTROY_SINCE_VERSION 1
+
+/** @ingroup iface_zwlr_output_power_v1 */
+static inline void
+zwlr_output_power_v1_set_user_data(struct zwlr_output_power_v1 *zwlr_output_power_v1, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) zwlr_output_power_v1, user_data);
+}
+
+/** @ingroup iface_zwlr_output_power_v1 */
+static inline void *
+zwlr_output_power_v1_get_user_data(struct zwlr_output_power_v1 *zwlr_output_power_v1)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) zwlr_output_power_v1);
+}
+
+static inline uint32_t
+zwlr_output_power_v1_get_version(struct zwlr_output_power_v1 *zwlr_output_power_v1)
+{
+ return wl_proxy_get_version((struct wl_proxy *) zwlr_output_power_v1);
+}
+
+/**
+ * @ingroup iface_zwlr_output_power_v1
+ *
+ * Set an output's power save mode to the given mode. The mode change
+ * is effective immediately. If the output does not support the given
+ * mode a failed event is sent.
+ */
+static inline void
+zwlr_output_power_v1_set_mode(struct zwlr_output_power_v1 *zwlr_output_power_v1, uint32_t mode)
+{
+ wl_proxy_marshal_flags((struct wl_proxy *) zwlr_output_power_v1,
+ ZWLR_OUTPUT_POWER_V1_SET_MODE, NULL, wl_proxy_get_version((struct wl_proxy *) zwlr_output_power_v1), 0, mode);
+}
+
+/**
+ * @ingroup iface_zwlr_output_power_v1
+ *
+ * Destroys the output power management mode control object.
+ */
+static inline void
+zwlr_output_power_v1_destroy(struct zwlr_output_power_v1 *zwlr_output_power_v1)
+{
+ wl_proxy_marshal_flags((struct wl_proxy *) zwlr_output_power_v1,
+ ZWLR_OUTPUT_POWER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwlr_output_power_v1), WL_MARSHAL_FLAG_DESTROY);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif