apply outputPowerManagement patch

This commit is contained in:
korei999 2023-11-29 21:40:03 +02:00
parent b57dfa173a
commit 9737043174

30
dwl.c
View file

@ -338,6 +338,7 @@ static void pointerconstraintsetregion(struct wl_listener *listener, void *data)
static void pointerfocus(Client *c, struct wlr_surface *surface, static void pointerfocus(Client *c, struct wlr_surface *surface,
double sx, double sy, uint32_t time); double sx, double sy, uint32_t time);
static void printstatus(void); 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 powermgrsetmodenotify(struct wl_listener *listener, void *data);
static void quit(const Arg *arg); static void quit(const Arg *arg);
static void rendermon(struct wl_listener *listener, void *data); static void rendermon(struct wl_listener *listener, void *data);
@ -2462,6 +2463,35 @@ powermgrsetmodenotify(struct wl_listener *listener, void *data)
wlr_output_commit(event->output); wlr_output_commit(event->output);
} }
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 void
quit(const Arg *arg) quit(const Arg *arg)
{ {