mirror of
https://codeberg.org/dwl/dwl.git
synced 2025-11-02 09:01:42 -05:00
apply outputPowerManagement patch
This commit is contained in:
parent
184340c86c
commit
5af8444d1b
2 changed files with 47 additions and 3 deletions
39
dwl.c
39
dwl.c
|
|
@ -31,8 +31,10 @@
|
|||
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||
#include <wlr/types/wlr_linux_dmabuf_v1.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/interfaces/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_presentation_time.h>
|
||||
#include <wlr/types/wlr_primary_selection.h>
|
||||
|
|
@ -289,6 +291,8 @@ 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 wlr_output_damage_whole(struct wlr_output *output);
|
||||
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 requeststartdrag(struct wl_listener *listener, void *data);
|
||||
|
|
@ -367,6 +371,9 @@ static struct wlr_scene_rect *locked_bg;
|
|||
static struct wlr_session_lock_v1 *cur_lock;
|
||||
static struct wl_listener lock_listener = {.notify = locksession};
|
||||
|
||||
static struct wlr_output_power_manager_v1 *power_mgr;
|
||||
static struct wl_listener power_mgr_set_mode = {.notify = powermgrsetmodenotify};
|
||||
|
||||
static struct wlr_seat *seat;
|
||||
static struct wl_list keyboards;
|
||||
static unsigned int cursor_mode;
|
||||
|
|
@ -1851,6 +1858,35 @@ printstatus(void)
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
void
|
||||
wlr_output_damage_whole(struct wlr_output *output) {
|
||||
int width, height;
|
||||
pixman_region32_t damage;
|
||||
struct wlr_output_event_damage event;
|
||||
|
||||
wlr_output_transformed_resolution(output, &width, &height);
|
||||
|
||||
pixman_region32_init_rect(&damage, 0, 0, width, height);
|
||||
|
||||
event = (struct wlr_output_event_damage){
|
||||
.output = output,
|
||||
.damage = &damage,
|
||||
};
|
||||
wl_signal_emit_mutable(&output->events.damage, &event);
|
||||
|
||||
pixman_region32_fini(&damage);
|
||||
}
|
||||
|
||||
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);
|
||||
if (event->mode)
|
||||
wlr_output_damage_whole(event->output);
|
||||
wlr_output_commit(event->output);
|
||||
}
|
||||
|
||||
void
|
||||
quit(const Arg *arg)
|
||||
{
|
||||
|
|
@ -2239,6 +2275,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);
|
||||
wl_signal_add(&power_mgr->events.set_mode, &power_mgr_set_mode);
|
||||
|
||||
/* 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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue