mirror of
https://github.com/labwc/labwc.git
synced 2025-11-11 13:30:04 -05:00
support wlr-output-power-management
This commit is contained in:
parent
748b3d38e7
commit
c23397f362
3 changed files with 32 additions and 0 deletions
19
src/output.c
19
src/output.c
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,6 +339,13 @@ server_init(struct server *server)
|
|||
server->foreign_toplevel_manager =
|
||||
wlr_foreign_toplevel_manager_v1_create(server->wl_display);
|
||||
|
||||
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);
|
||||
|
||||
layers_init(server);
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue