mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
output: add damage event
This commit is contained in:
parent
7f9f918b78
commit
a0f24b809e
3 changed files with 6 additions and 3 deletions
|
@ -63,6 +63,7 @@ struct wlr_output {
|
||||||
int32_t refresh; // mHz
|
int32_t refresh; // mHz
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
struct wl_signal damage;
|
||||||
struct wl_signal frame;
|
struct wl_signal frame;
|
||||||
struct wl_signal swap_buffers;
|
struct wl_signal swap_buffers;
|
||||||
struct wl_signal enable;
|
struct wl_signal enable;
|
||||||
|
|
|
@ -107,9 +107,6 @@ static void init_globals() {
|
||||||
|
|
||||||
static void wlr_gles2_begin(struct wlr_renderer *_renderer,
|
static void wlr_gles2_begin(struct wlr_renderer *_renderer,
|
||||||
struct wlr_output *output) {
|
struct wlr_output *output) {
|
||||||
// TODO: let users customize the clear color?
|
|
||||||
//GL_CALL(glClearColor(0.25f, 0.25f, 0.25f, 1));
|
|
||||||
//GL_CALL(glClear(GL_COLOR_BUFFER_BIT));
|
|
||||||
GL_CALL(glViewport(0, 0, output->width, output->height));
|
GL_CALL(glViewport(0, 0, output->width, output->height));
|
||||||
|
|
||||||
// enable transparency
|
// enable transparency
|
||||||
|
|
|
@ -272,6 +272,7 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||||
output->scale = 1;
|
output->scale = 1;
|
||||||
wl_list_init(&output->cursors);
|
wl_list_init(&output->cursors);
|
||||||
wl_list_init(&output->wl_resources);
|
wl_list_init(&output->wl_resources);
|
||||||
|
wl_signal_init(&output->events.damage);
|
||||||
wl_signal_init(&output->events.frame);
|
wl_signal_init(&output->events.frame);
|
||||||
wl_signal_init(&output->events.swap_buffers);
|
wl_signal_init(&output->events.swap_buffers);
|
||||||
wl_signal_init(&output->events.enable);
|
wl_signal_init(&output->events.enable);
|
||||||
|
@ -494,6 +495,7 @@ uint32_t wlr_output_get_gamma_size(struct wlr_output *output) {
|
||||||
static void output_damage_whole(struct wlr_output *output) {
|
static void output_damage_whole(struct wlr_output *output) {
|
||||||
pixman_region32_union_rect(&output->damage, &output->damage, 0, 0,
|
pixman_region32_union_rect(&output->damage, &output->damage, 0, 0,
|
||||||
output->width, output->height);
|
output->width, output->height);
|
||||||
|
wl_signal_emit(&output->events.damage, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_fullscreen_surface_reset(struct wlr_output *output) {
|
static void output_fullscreen_surface_reset(struct wlr_output *output) {
|
||||||
|
@ -520,6 +522,8 @@ static void output_fullscreen_surface_handle_commit(
|
||||||
pixman_region32_translate(&damage, box.x, box.y);
|
pixman_region32_translate(&damage, box.x, box.y);
|
||||||
pixman_region32_union(&output->damage, &output->damage, &damage);
|
pixman_region32_union(&output->damage, &output->damage, &damage);
|
||||||
pixman_region32_fini(&damage);
|
pixman_region32_fini(&damage);
|
||||||
|
|
||||||
|
wl_signal_emit(&output->events.damage, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_fullscreen_surface_handle_destroy(
|
static void output_fullscreen_surface_handle_destroy(
|
||||||
|
@ -561,6 +565,7 @@ static void output_cursor_damage_whole(struct wlr_output_cursor *cursor) {
|
||||||
output_cursor_get_box(cursor, &box);
|
output_cursor_get_box(cursor, &box);
|
||||||
pixman_region32_union_rect(&cursor->output->damage, &cursor->output->damage,
|
pixman_region32_union_rect(&cursor->output->damage, &cursor->output->damage,
|
||||||
box.x, box.y, box.width, box.height);
|
box.x, box.y, box.width, box.height);
|
||||||
|
wl_signal_emit(&cursor->output->events.damage, cursor->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_cursor_reset(struct wlr_output_cursor *cursor) {
|
static void output_cursor_reset(struct wlr_output_cursor *cursor) {
|
||||||
|
|
Loading…
Reference in a new issue