rootston: replace view_damage with view_apply_damage and view_damage_whole
This commit is contained in:
parent
7f5a538cb7
commit
96d6f34edd
|
@ -66,7 +66,8 @@ struct roots_view *desktop_view_at(struct roots_desktop *desktop, double lx,
|
|||
void view_init(struct roots_view *view, struct roots_desktop *desktop);
|
||||
void view_destroy(struct roots_view *view);
|
||||
void view_activate(struct roots_view *view, bool activate);
|
||||
void view_damage(struct roots_view *view);
|
||||
void view_apply_damage(struct roots_view *view);
|
||||
void view_damage_whole(struct roots_view *view);
|
||||
void view_update_position(struct roots_view *view, double x, double y);
|
||||
|
||||
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
|
||||
|
|
|
@ -23,6 +23,9 @@ struct roots_output {
|
|||
void output_add_notify(struct wl_listener *listener, void *data);
|
||||
void output_remove_notify(struct wl_listener *listener, void *data);
|
||||
|
||||
void output_damage_view(struct roots_output *output, struct roots_view *view);
|
||||
void output_damage_whole_view(struct roots_output *output,
|
||||
struct roots_view *view);
|
||||
void output_damage_from_view(struct roots_output *output,
|
||||
struct roots_view *view);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -255,7 +255,7 @@ bool view_center(struct roots_view *view) {
|
|||
}
|
||||
|
||||
void view_destroy(struct roots_view *view) {
|
||||
view_damage(view);
|
||||
view_damage_whole(view);
|
||||
wl_signal_emit(&view->events.destroy, view);
|
||||
|
||||
if (view->fullscreen_output) {
|
||||
|
@ -268,7 +268,7 @@ void view_destroy(struct roots_view *view) {
|
|||
void view_init(struct roots_view *view, struct roots_desktop *desktop) {
|
||||
view->desktop = desktop;
|
||||
wl_signal_init(&view->events.destroy);
|
||||
view_damage(view);
|
||||
view_damage_whole(view);
|
||||
}
|
||||
|
||||
void view_setup(struct roots_view *view) {
|
||||
|
@ -283,18 +283,25 @@ void view_setup(struct roots_view *view) {
|
|||
view_update_output(view, NULL);
|
||||
}
|
||||
|
||||
void view_damage(struct roots_view *view) {
|
||||
void view_apply_damage(struct roots_view *view) {
|
||||
struct roots_output *output;
|
||||
wl_list_for_each(output, &view->desktop->outputs, link) {
|
||||
output_damage_view(output, view);
|
||||
output_damage_from_view(output, view);
|
||||
}
|
||||
}
|
||||
|
||||
void view_damage_whole(struct roots_view *view) {
|
||||
struct roots_output *output;
|
||||
wl_list_for_each(output, &view->desktop->outputs, link) {
|
||||
output_damage_whole_view(output, view);
|
||||
}
|
||||
}
|
||||
|
||||
void view_update_position(struct roots_view *view, double x, double y) {
|
||||
view_damage(view);
|
||||
view_damage_whole(view);
|
||||
view->x = x;
|
||||
view->y = y;
|
||||
view_damage(view);
|
||||
view_damage_whole(view);
|
||||
}
|
||||
|
||||
static bool view_at(struct roots_view *view, double lx, double ly,
|
||||
|
|
|
@ -379,7 +379,7 @@ static int handle_repaint(void *data) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void output_damage_surface(struct roots_output *output,
|
||||
static void output_damage_whole_surface(struct roots_output *output,
|
||||
struct wlr_surface *surface, double lx, double ly) {
|
||||
if (!wlr_surface_has_buffer(surface)) {
|
||||
return;
|
||||
|
@ -392,17 +392,24 @@ static void output_damage_surface(struct roots_output *output,
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO: use surface damage
|
||||
|
||||
pixman_region32_union_rect(&output->damage, &output->damage, box.x, box.y,
|
||||
box.width, box.height);
|
||||
}
|
||||
|
||||
void output_damage_view(struct roots_output *output, struct roots_view *view) {
|
||||
output_damage_surface(output, view->wlr_surface, view->x, view->y);
|
||||
void output_damage_whole_view(struct roots_output *output,
|
||||
struct roots_view *view) {
|
||||
output_damage_whole_surface(output, view->wlr_surface, view->x, view->y);
|
||||
|
||||
// TODO: subsurfaces, popups, etc
|
||||
}
|
||||
|
||||
void output_damage_from_view(struct roots_output *output,
|
||||
struct roots_view *view) {
|
||||
// TODO: use surface damage
|
||||
output_damage_whole_view(output, view);
|
||||
}
|
||||
|
||||
static void set_mode(struct wlr_output *output,
|
||||
struct roots_output_config *oc) {
|
||||
int mhz = (int)(oc->mode.refresh_rate * 1000);
|
||||
|
|
|
@ -103,7 +103,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
|||
view->pending_move_resize.update_y = false;
|
||||
}
|
||||
|
||||
view_damage(view);
|
||||
view_apply_damage(view);
|
||||
}
|
||||
|
||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||
|
|
|
@ -219,7 +219,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
}
|
||||
|
||||
view_damage(view);
|
||||
view_apply_damage(view);
|
||||
}
|
||||
|
||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||
|
|
|
@ -220,7 +220,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
|||
view->pending_move_resize.update_y = false;
|
||||
}
|
||||
|
||||
view_damage(view);
|
||||
view_apply_damage(view);
|
||||
}
|
||||
|
||||
static void handle_map_notify(struct wl_listener *listener, void *data) {
|
||||
|
@ -233,7 +233,7 @@ static void handle_map_notify(struct wl_listener *listener, void *data) {
|
|||
view->wlr_surface = xsurface->surface;
|
||||
view->x = xsurface->x;
|
||||
view->y = xsurface->y;
|
||||
view_damage(view);
|
||||
view_damage_whole(view);
|
||||
|
||||
roots_surface->surface_commit.notify = handle_surface_commit;
|
||||
wl_signal_add(&xsurface->surface->events.commit,
|
||||
|
@ -246,7 +246,7 @@ static void handle_unmap_notify(struct wl_listener *listener, void *data) {
|
|||
struct roots_xwayland_surface *roots_surface =
|
||||
wl_container_of(listener, roots_surface, unmap_notify);
|
||||
|
||||
view_damage(roots_surface->view);
|
||||
view_damage_whole(roots_surface->view);
|
||||
|
||||
roots_surface->view->wlr_surface = NULL;
|
||||
wl_list_remove(&roots_surface->surface_commit.link);
|
||||
|
|
Loading…
Reference in New Issue