mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
surface: move subsurface lists to state
This commit is contained in:
parent
3ac99fa4dc
commit
90e62390d9
2 changed files with 30 additions and 36 deletions
|
@ -47,6 +47,9 @@ struct wlr_surface_state {
|
||||||
int width, height; // in surface-local coordinates
|
int width, height; // in surface-local coordinates
|
||||||
int buffer_width, buffer_height;
|
int buffer_width, buffer_height;
|
||||||
|
|
||||||
|
struct wl_list subsurfaces_below;
|
||||||
|
struct wl_list subsurfaces_above;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The viewport is applied after the surface transform and scale.
|
* The viewport is applied after the surface transform and scale.
|
||||||
*
|
*
|
||||||
|
@ -139,14 +142,6 @@ struct wlr_surface {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
// wlr_subsurface.parent_link
|
|
||||||
struct wl_list subsurfaces_below;
|
|
||||||
struct wl_list subsurfaces_above;
|
|
||||||
|
|
||||||
// wlr_subsurface.parent_pending_link
|
|
||||||
struct wl_list subsurfaces_pending_below;
|
|
||||||
struct wl_list subsurfaces_pending_above;
|
|
||||||
|
|
||||||
struct wl_list current_outputs; // wlr_surface_output::link
|
struct wl_list current_outputs; // wlr_surface_output::link
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
|
|
|
@ -341,11 +341,11 @@ static void surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
|
||||||
subsurface->reordered = false;
|
subsurface->reordered = false;
|
||||||
|
|
||||||
struct wlr_subsurface *child;
|
struct wlr_subsurface *child;
|
||||||
wl_list_for_each(child, &subsurface->surface->subsurfaces_below,
|
wl_list_for_each(child, &subsurface->surface->current.subsurfaces_below,
|
||||||
current.link) {
|
current.link) {
|
||||||
surface_damage_subsurfaces(child);
|
surface_damage_subsurfaces(child);
|
||||||
}
|
}
|
||||||
wl_list_for_each(child, &subsurface->surface->subsurfaces_above,
|
wl_list_for_each(child, &subsurface->surface->current.subsurfaces_above,
|
||||||
current.link) {
|
current.link) {
|
||||||
surface_damage_subsurfaces(child);
|
surface_damage_subsurfaces(child);
|
||||||
}
|
}
|
||||||
|
@ -459,10 +459,10 @@ static void surface_commit_state(struct wlr_surface *surface,
|
||||||
|
|
||||||
// commit subsurface order
|
// commit subsurface order
|
||||||
struct wlr_subsurface *subsurface;
|
struct wlr_subsurface *subsurface;
|
||||||
wl_list_for_each_reverse(subsurface, &surface->subsurfaces_pending_above,
|
wl_list_for_each_reverse(subsurface, &surface->pending.subsurfaces_above,
|
||||||
pending.link) {
|
pending.link) {
|
||||||
wl_list_remove(&subsurface->current.link);
|
wl_list_remove(&subsurface->current.link);
|
||||||
wl_list_insert(&surface->subsurfaces_above,
|
wl_list_insert(&surface->current.subsurfaces_above,
|
||||||
&subsurface->current.link);
|
&subsurface->current.link);
|
||||||
|
|
||||||
if (subsurface->reordered) {
|
if (subsurface->reordered) {
|
||||||
|
@ -470,10 +470,10 @@ static void surface_commit_state(struct wlr_surface *surface,
|
||||||
surface_damage_subsurfaces(subsurface);
|
surface_damage_subsurfaces(subsurface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wl_list_for_each_reverse(subsurface, &surface->subsurfaces_pending_below,
|
wl_list_for_each_reverse(subsurface, &surface->pending.subsurfaces_below,
|
||||||
pending.link) {
|
pending.link) {
|
||||||
wl_list_remove(&subsurface->current.link);
|
wl_list_remove(&subsurface->current.link);
|
||||||
wl_list_insert(&surface->subsurfaces_below,
|
wl_list_insert(&surface->current.subsurfaces_below,
|
||||||
&subsurface->current.link);
|
&subsurface->current.link);
|
||||||
|
|
||||||
if (subsurface->reordered) {
|
if (subsurface->reordered) {
|
||||||
|
@ -542,11 +542,11 @@ static void subsurface_parent_commit(struct wlr_subsurface *subsurface,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_subsurface *subsurface;
|
struct wlr_subsurface *subsurface;
|
||||||
wl_list_for_each(subsurface, &surface->subsurfaces_below,
|
wl_list_for_each(subsurface, &surface->current.subsurfaces_below,
|
||||||
current.link) {
|
current.link) {
|
||||||
subsurface_parent_commit(subsurface, true);
|
subsurface_parent_commit(subsurface, true);
|
||||||
}
|
}
|
||||||
wl_list_for_each(subsurface, &surface->subsurfaces_above,
|
wl_list_for_each(subsurface, &surface->current.subsurfaces_above,
|
||||||
current.link) {
|
current.link) {
|
||||||
subsurface_parent_commit(subsurface, true);
|
subsurface_parent_commit(subsurface, true);
|
||||||
}
|
}
|
||||||
|
@ -579,10 +579,10 @@ static void surface_commit(struct wl_client *client,
|
||||||
|
|
||||||
surface_commit_pending(surface);
|
surface_commit_pending(surface);
|
||||||
|
|
||||||
wl_list_for_each(subsurface, &surface->subsurfaces_below, current.link) {
|
wl_list_for_each(subsurface, &surface->current.subsurfaces_below, current.link) {
|
||||||
subsurface_parent_commit(subsurface, false);
|
subsurface_parent_commit(subsurface, false);
|
||||||
}
|
}
|
||||||
wl_list_for_each(subsurface, &surface->subsurfaces_above, current.link) {
|
wl_list_for_each(subsurface, &surface->current.subsurfaces_above, current.link) {
|
||||||
subsurface_parent_commit(subsurface, false);
|
subsurface_parent_commit(subsurface, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -649,6 +649,9 @@ static void surface_state_init(struct wlr_surface_state *state) {
|
||||||
state->scale = 1;
|
state->scale = 1;
|
||||||
state->transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
state->transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||||
|
|
||||||
|
wl_list_init(&state->subsurfaces_above);
|
||||||
|
wl_list_init(&state->subsurfaces_below);
|
||||||
|
|
||||||
wl_list_init(&state->frame_callback_list);
|
wl_list_init(&state->frame_callback_list);
|
||||||
|
|
||||||
pixman_region32_init(&state->surface_damage);
|
pixman_region32_init(&state->surface_damage);
|
||||||
|
@ -775,10 +778,6 @@ struct wlr_surface *surface_create(struct wl_client *client,
|
||||||
wl_signal_init(&surface->events.commit);
|
wl_signal_init(&surface->events.commit);
|
||||||
wl_signal_init(&surface->events.destroy);
|
wl_signal_init(&surface->events.destroy);
|
||||||
wl_signal_init(&surface->events.new_subsurface);
|
wl_signal_init(&surface->events.new_subsurface);
|
||||||
wl_list_init(&surface->subsurfaces_above);
|
|
||||||
wl_list_init(&surface->subsurfaces_below);
|
|
||||||
wl_list_init(&surface->subsurfaces_pending_above);
|
|
||||||
wl_list_init(&surface->subsurfaces_pending_below);
|
|
||||||
wl_list_init(&surface->current_outputs);
|
wl_list_init(&surface->current_outputs);
|
||||||
wl_list_init(&surface->cached);
|
wl_list_init(&surface->cached);
|
||||||
pixman_region32_init(&surface->buffer_damage);
|
pixman_region32_init(&surface->buffer_damage);
|
||||||
|
@ -911,12 +910,12 @@ static struct wlr_subsurface *subsurface_find_sibling(
|
||||||
struct wlr_surface *parent = subsurface->parent;
|
struct wlr_surface *parent = subsurface->parent;
|
||||||
|
|
||||||
struct wlr_subsurface *sibling;
|
struct wlr_subsurface *sibling;
|
||||||
wl_list_for_each(sibling, &parent->subsurfaces_below, current.link) {
|
wl_list_for_each(sibling, &parent->current.subsurfaces_below, current.link) {
|
||||||
if (sibling->surface == surface && sibling != subsurface) {
|
if (sibling->surface == surface && sibling != subsurface) {
|
||||||
return sibling;
|
return sibling;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wl_list_for_each(sibling, &parent->subsurfaces_above, current.link) {
|
wl_list_for_each(sibling, &parent->current.subsurfaces_above, current.link) {
|
||||||
if (sibling->surface == surface && sibling != subsurface) {
|
if (sibling->surface == surface && sibling != subsurface) {
|
||||||
return sibling;
|
return sibling;
|
||||||
}
|
}
|
||||||
|
@ -937,7 +936,7 @@ static void subsurface_handle_place_above(struct wl_client *client,
|
||||||
|
|
||||||
struct wl_list *node;
|
struct wl_list *node;
|
||||||
if (sibling_surface == subsurface->parent) {
|
if (sibling_surface == subsurface->parent) {
|
||||||
node = &subsurface->parent->subsurfaces_pending_above;
|
node = &subsurface->parent->pending.subsurfaces_above;
|
||||||
} else {
|
} else {
|
||||||
struct wlr_subsurface *sibling =
|
struct wlr_subsurface *sibling =
|
||||||
subsurface_find_sibling(subsurface, sibling_surface);
|
subsurface_find_sibling(subsurface, sibling_surface);
|
||||||
|
@ -969,7 +968,7 @@ static void subsurface_handle_place_below(struct wl_client *client,
|
||||||
|
|
||||||
struct wl_list *node;
|
struct wl_list *node;
|
||||||
if (sibling_surface == subsurface->parent) {
|
if (sibling_surface == subsurface->parent) {
|
||||||
node = &subsurface->parent->subsurfaces_pending_below;
|
node = &subsurface->parent->pending.subsurfaces_below;
|
||||||
} else {
|
} else {
|
||||||
struct wlr_subsurface *sibling =
|
struct wlr_subsurface *sibling =
|
||||||
subsurface_find_sibling(subsurface, sibling_surface);
|
subsurface_find_sibling(subsurface, sibling_surface);
|
||||||
|
@ -1061,11 +1060,11 @@ static void subsurface_consider_map(struct wlr_subsurface *subsurface,
|
||||||
|
|
||||||
// Try mapping all children too
|
// Try mapping all children too
|
||||||
struct wlr_subsurface *child;
|
struct wlr_subsurface *child;
|
||||||
wl_list_for_each(child, &subsurface->surface->subsurfaces_below,
|
wl_list_for_each(child, &subsurface->surface->current.subsurfaces_below,
|
||||||
current.link) {
|
current.link) {
|
||||||
subsurface_consider_map(child, false);
|
subsurface_consider_map(child, false);
|
||||||
}
|
}
|
||||||
wl_list_for_each(child, &subsurface->surface->subsurfaces_above,
|
wl_list_for_each(child, &subsurface->surface->current.subsurfaces_above,
|
||||||
current.link) {
|
current.link) {
|
||||||
subsurface_consider_map(child, false);
|
subsurface_consider_map(child, false);
|
||||||
}
|
}
|
||||||
|
@ -1081,11 +1080,11 @@ static void subsurface_unmap(struct wlr_subsurface *subsurface) {
|
||||||
|
|
||||||
// Unmap all children
|
// Unmap all children
|
||||||
struct wlr_subsurface *child;
|
struct wlr_subsurface *child;
|
||||||
wl_list_for_each(child, &subsurface->surface->subsurfaces_below,
|
wl_list_for_each(child, &subsurface->surface->current.subsurfaces_below,
|
||||||
current.link) {
|
current.link) {
|
||||||
subsurface_unmap(child);
|
subsurface_unmap(child);
|
||||||
}
|
}
|
||||||
wl_list_for_each(child, &subsurface->surface->subsurfaces_above,
|
wl_list_for_each(child, &subsurface->surface->current.subsurfaces_above,
|
||||||
current.link) {
|
current.link) {
|
||||||
subsurface_unmap(child);
|
subsurface_unmap(child);
|
||||||
}
|
}
|
||||||
|
@ -1196,8 +1195,8 @@ struct wlr_subsurface *subsurface_create(struct wlr_surface *surface,
|
||||||
subsurface->parent = parent;
|
subsurface->parent = parent;
|
||||||
wl_signal_add(&parent->events.destroy, &subsurface->parent_destroy);
|
wl_signal_add(&parent->events.destroy, &subsurface->parent_destroy);
|
||||||
subsurface->parent_destroy.notify = subsurface_handle_parent_destroy;
|
subsurface->parent_destroy.notify = subsurface_handle_parent_destroy;
|
||||||
wl_list_insert(parent->subsurfaces_above.prev, &subsurface->current.link);
|
wl_list_insert(parent->current.subsurfaces_above.prev, &subsurface->current.link);
|
||||||
wl_list_insert(parent->subsurfaces_pending_above.prev,
|
wl_list_insert(parent->pending.subsurfaces_above.prev,
|
||||||
&subsurface->pending.link);
|
&subsurface->pending.link);
|
||||||
|
|
||||||
surface->role_data = subsurface;
|
surface->role_data = subsurface;
|
||||||
|
@ -1233,7 +1232,7 @@ bool wlr_surface_point_accepts_input(struct wlr_surface *surface,
|
||||||
struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface,
|
struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface,
|
||||||
double sx, double sy, double *sub_x, double *sub_y) {
|
double sx, double sy, double *sub_x, double *sub_y) {
|
||||||
struct wlr_subsurface *subsurface;
|
struct wlr_subsurface *subsurface;
|
||||||
wl_list_for_each_reverse(subsurface, &surface->subsurfaces_above,
|
wl_list_for_each_reverse(subsurface, &surface->current.subsurfaces_above,
|
||||||
current.link) {
|
current.link) {
|
||||||
double _sub_x = subsurface->current.x;
|
double _sub_x = subsurface->current.x;
|
||||||
double _sub_y = subsurface->current.y;
|
double _sub_y = subsurface->current.y;
|
||||||
|
@ -1254,7 +1253,7 @@ struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface,
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each_reverse(subsurface, &surface->subsurfaces_below,
|
wl_list_for_each_reverse(subsurface, &surface->current.subsurfaces_below,
|
||||||
current.link) {
|
current.link) {
|
||||||
double _sub_x = subsurface->current.x;
|
double _sub_x = subsurface->current.x;
|
||||||
double _sub_y = subsurface->current.y;
|
double _sub_y = subsurface->current.y;
|
||||||
|
@ -1361,7 +1360,7 @@ void wlr_surface_send_frame_done(struct wlr_surface *surface,
|
||||||
static void surface_for_each_surface(struct wlr_surface *surface, int x, int y,
|
static void surface_for_each_surface(struct wlr_surface *surface, int x, int y,
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data) {
|
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||||
struct wlr_subsurface *subsurface;
|
struct wlr_subsurface *subsurface;
|
||||||
wl_list_for_each(subsurface, &surface->subsurfaces_below, current.link) {
|
wl_list_for_each(subsurface, &surface->current.subsurfaces_below, current.link) {
|
||||||
struct wlr_subsurface_parent_state *state = &subsurface->current;
|
struct wlr_subsurface_parent_state *state = &subsurface->current;
|
||||||
int sx = state->x;
|
int sx = state->x;
|
||||||
int sy = state->y;
|
int sy = state->y;
|
||||||
|
@ -1372,7 +1371,7 @@ static void surface_for_each_surface(struct wlr_surface *surface, int x, int y,
|
||||||
|
|
||||||
iterator(surface, x, y, user_data);
|
iterator(surface, x, y, user_data);
|
||||||
|
|
||||||
wl_list_for_each(subsurface, &surface->subsurfaces_above, current.link) {
|
wl_list_for_each(subsurface, &surface->current.subsurfaces_above, current.link) {
|
||||||
struct wlr_subsurface_parent_state *state = &subsurface->current;
|
struct wlr_subsurface_parent_state *state = &subsurface->current;
|
||||||
int sx = state->x;
|
int sx = state->x;
|
||||||
int sy = state->y;
|
int sy = state->y;
|
||||||
|
|
Loading…
Reference in a new issue