diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/output.c | 18 | ||||
-rw-r--r-- | sway/server.c | 7 |
2 files changed, 25 insertions, 0 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index ec662a8c..f5c84d96 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -977,3 +977,21 @@ void handle_output_manager_test(struct wl_listener *listener, void *data) { wlr_output_configuration_v1_send_succeeded(config); wlr_output_configuration_v1_destroy(config); } + +void handle_output_power_manager_set_mode(struct wl_listener *listener, + void *data) { + struct wlr_output_power_v1_set_mode_event *event = data; + struct sway_output *output = event->output->data; + + struct output_config *oc = new_output_config(output->wlr_output->name); + switch (event->mode) { + case ZWLR_OUTPUT_POWER_V1_MODE_OFF: + oc->dpms_state = DPMS_OFF; + break; + case ZWLR_OUTPUT_POWER_V1_MODE_ON: + oc->dpms_state = DPMS_ON; + break; + } + oc = store_output_config(oc); + apply_output_config(oc, output); +} diff --git a/sway/server.c b/sway/server.c index c97d098a..9be073a0 100644 --- a/sway/server.c +++ b/sway/server.c @@ -132,6 +132,13 @@ bool server_init(struct sway_server *server) { wl_signal_add(&server->output_manager_v1->events.test, &server->output_manager_test); + server->output_power_manager_v1 = + wlr_output_power_manager_v1_create(server->wl_display); + server->output_power_manager_set_mode.notify = + handle_output_power_manager_set_mode; + wl_signal_add(&server->output_power_manager_v1->events.set_mode, + &server->output_power_manager_set_mode); + wlr_export_dmabuf_manager_v1_create(server->wl_display); wlr_screencopy_manager_v1_create(server->wl_display); wlr_data_control_manager_v1_create(server->wl_display); |