support wlr-output-power-management

This commit is contained in:
bi4k8 2022-03-06 04:46:11 +00:00 committed by Johan Malm
parent 748b3d38e7
commit c23397f362
3 changed files with 32 additions and 0 deletions

View file

@ -9,6 +9,7 @@
#define _POSIX_C_SOURCE 200809L
#include "config.h"
#include <assert.h>
#include <types/wlr_output.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/types/wlr_output_damage.h>
@ -398,3 +399,21 @@ output_usable_area_from_cursor_coords(struct server *server)
struct output *output = output_from_wlr_output(server, wlr_output);
return output_usable_area_in_layout_coords(output);
}
void
handle_output_power_manager_set_mode(struct wl_listener *listener, void *data)
{
struct wlr_output_power_v1_set_mode_event *event = data;
switch (event->mode) {
case ZWLR_OUTPUT_POWER_V1_MODE_OFF:
wlr_output_enable(event->output, false);
wlr_output_commit(event->output);
break;
case ZWLR_OUTPUT_POWER_V1_MODE_ON:
wlr_output_enable(event->output, true);
output_ensure_buffer(event->output);
wlr_output_commit(event->output);
break;
}
}