Implement support for output power management
This patch is based on the original stale patch by Guido Cella @guidocella. It has been modified to apply cleanly to the latest v5.0 tag. Since the SLOC limit is now lifted, this core feature should be merged into dwl upstream. Thanks to Dima Krasner @dimkr for the cherry-pick. Closes: #559, #525
This commit is contained in:
committed by
Leonardo Hernández Hernández
parent
92d1c286b8
commit
9b1f35e42b
14
dwl.c
14
dwl.c
@@ -34,6 +34,7 @@
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_output_management_v1.h>
|
||||
#include <wlr/types/wlr_output_power_management_v1.h>
|
||||
#include <wlr/types/wlr_pointer.h>
|
||||
#include <wlr/types/wlr_pointer_constraints_v1.h>
|
||||
#include <wlr/types/wlr_presentation_time.h>
|
||||
@@ -310,6 +311,7 @@ static void outputmgrtest(struct wl_listener *listener, void *data);
|
||||
static void pointerfocus(Client *c, struct wlr_surface *surface,
|
||||
double sx, double sy, uint32_t time);
|
||||
static void printstatus(void);
|
||||
static void powermgrsetmodenotify(struct wl_listener *listener, void *data);
|
||||
static void quit(const Arg *arg);
|
||||
static void rendermon(struct wl_listener *listener, void *data);
|
||||
static void requestdecorationmode(struct wl_listener *listener, void *data);
|
||||
@@ -381,6 +383,7 @@ static struct wlr_gamma_control_manager_v1 *gamma_control_mgr;
|
||||
static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
|
||||
static struct wlr_virtual_pointer_manager_v1 *virtual_pointer_mgr;
|
||||
static struct wlr_cursor_shape_manager_v1 *cursor_shape_mgr;
|
||||
static struct wlr_output_power_manager_v1 *power_mgr;
|
||||
|
||||
static struct wlr_pointer_constraints_v1 *pointer_constraints;
|
||||
static struct wlr_relative_pointer_manager_v1 *relative_pointer_mgr;
|
||||
@@ -2011,6 +2014,14 @@ printstatus(void)
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void
|
||||
powermgrsetmodenotify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct wlr_output_power_v1_set_mode_event *event = data;
|
||||
wlr_output_enable(event->output, event->mode);
|
||||
wlr_output_commit(event->output);
|
||||
}
|
||||
|
||||
void
|
||||
quit(const Arg *arg)
|
||||
{
|
||||
@@ -2422,6 +2433,9 @@ setup(void)
|
||||
gamma_control_mgr = wlr_gamma_control_manager_v1_create(dpy);
|
||||
LISTEN_STATIC(&gamma_control_mgr->events.set_gamma, setgamma);
|
||||
|
||||
power_mgr = wlr_output_power_manager_v1_create(dpy);
|
||||
LISTEN_STATIC(&power_mgr->events.set_mode, powermgrsetmodenotify);
|
||||
|
||||
/* Creates an output layout, which a wlroots utility for working with an
|
||||
* arrangement of screens in a physical layout. */
|
||||
output_layout = wlr_output_layout_create();
|
||||
|
Reference in New Issue
Block a user