diff --git a/dwl.c b/dwl.c index 64ef0c0..b6c98ea 100644 --- a/dwl.c +++ b/dwl.c @@ -338,6 +338,7 @@ static void pointerconstraintsetregion(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); @@ -2462,6 +2463,35 @@ powermgrsetmodenotify(struct wl_listener *listener, void *data) 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 quit(const Arg *arg) {