mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-26 19:39:49 +01:00
rootston: fix damage tracking for SSD
This commit is contained in:
parent
861d5bdff2
commit
63736be214
6 changed files with 38 additions and 21 deletions
|
@ -69,6 +69,7 @@ void view_activate(struct roots_view *view, bool activate);
|
|||
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 view_update_size(struct roots_view *view, uint32_t width, uint32_t height);
|
||||
|
||||
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
|
||||
void handle_wl_shell_surface(struct wl_listener *listener, void *data);
|
||||
|
|
|
@ -62,6 +62,7 @@ struct roots_view {
|
|||
struct wl_list link; // roots_desktop::views
|
||||
|
||||
double x, y;
|
||||
uint32_t width, height;
|
||||
float rotation;
|
||||
|
||||
bool decorated;
|
||||
|
@ -108,11 +109,7 @@ struct roots_view {
|
|||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
// TODO: This would probably be better as a field that's updated on a
|
||||
// configure event from the xdg_shell
|
||||
// If not then this should follow the typical type/impl pattern we use
|
||||
// elsewhere
|
||||
void (*get_size)(const struct roots_view *view, struct wlr_box *box);
|
||||
// TODO: this should follow the typical type/impl pattern we use elsewhere
|
||||
void (*activate)(struct roots_view *view, bool active);
|
||||
void (*move)(struct roots_view *view, double x, double y);
|
||||
void (*resize)(struct roots_view *view, uint32_t width, uint32_t height);
|
||||
|
|
|
@ -24,18 +24,8 @@
|
|||
void view_get_box(const struct roots_view *view, struct wlr_box *box) {
|
||||
box->x = view->x;
|
||||
box->y = view->y;
|
||||
if (view->get_size) {
|
||||
view->get_size(view, box);
|
||||
} else {
|
||||
if (view->wlr_surface == NULL) {
|
||||
// View is unmapped
|
||||
box->width = box->height = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
box->width = view->wlr_surface->current->width;
|
||||
box->height = view->wlr_surface->current->height;
|
||||
}
|
||||
box->width = view->width;
|
||||
box->height = view->height;
|
||||
}
|
||||
|
||||
void view_get_deco_box(const struct roots_view *view, struct wlr_box *box) {
|
||||
|
@ -469,6 +459,17 @@ void view_update_position(struct roots_view *view, double x, double y) {
|
|||
view_damage_whole(view);
|
||||
}
|
||||
|
||||
void view_update_size(struct roots_view *view, uint32_t width, uint32_t height) {
|
||||
if (view->width == width && view->height == height) {
|
||||
return;
|
||||
}
|
||||
|
||||
view_damage_whole(view);
|
||||
view->width = width;
|
||||
view->height = height;
|
||||
view_damage_whole(view);
|
||||
}
|
||||
|
||||
static bool view_at(struct roots_view *view, double lx, double ly,
|
||||
struct wlr_surface **surface, double *sx, double *sy) {
|
||||
if (view->type == ROOTS_WL_SHELL_VIEW &&
|
||||
|
|
|
@ -147,6 +147,8 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
|||
|
||||
int width = wlr_surface->current->width;
|
||||
int height = wlr_surface->current->height;
|
||||
view_update_size(view, width, height);
|
||||
|
||||
double x = view->x;
|
||||
double y = view->y;
|
||||
if (view->pending_move_resize.update_x) {
|
||||
|
@ -231,6 +233,8 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
|||
return;
|
||||
}
|
||||
view->type = ROOTS_WL_SHELL_VIEW;
|
||||
view->width = surface->surface->current->width;
|
||||
view->height = surface->surface->current->height;
|
||||
|
||||
view->wl_shell_surface = surface;
|
||||
view->roots_wl_shell_surface = roots_surface;
|
||||
|
|
|
@ -245,12 +245,13 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
|||
|
||||
view_apply_damage(view);
|
||||
|
||||
struct wlr_box size;
|
||||
get_size(view, &size);
|
||||
view_update_size(view, size.width, size.height);
|
||||
|
||||
uint32_t pending_serial =
|
||||
roots_surface->pending_move_resize_configure_serial;
|
||||
if (pending_serial > 0 && pending_serial >= surface->configure_serial) {
|
||||
struct wlr_box size;
|
||||
get_size(view, &size);
|
||||
|
||||
double x = view->x;
|
||||
double y = view->y;
|
||||
if (view->pending_move_resize.update_x) {
|
||||
|
@ -338,10 +339,10 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
|
|||
return;
|
||||
}
|
||||
view->type = ROOTS_XDG_SHELL_V6_VIEW;
|
||||
|
||||
view->xdg_surface_v6 = surface;
|
||||
view->roots_xdg_surface_v6 = roots_surface;
|
||||
view->wlr_surface = surface->surface;
|
||||
view->get_size = get_size;
|
||||
view->activate = activate;
|
||||
view->resize = resize;
|
||||
view->move_resize = move_resize;
|
||||
|
@ -349,6 +350,12 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
|
|||
view->set_fullscreen = set_fullscreen;
|
||||
view->close = close;
|
||||
roots_surface->view = view;
|
||||
|
||||
struct wlr_box box;
|
||||
get_size(view, &box);
|
||||
view->width = box.width;
|
||||
view->height = box.height;
|
||||
|
||||
view_init(view, desktop);
|
||||
wl_list_insert(&desktop->views, &view->link);
|
||||
|
||||
|
|
|
@ -209,6 +209,8 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
|
|||
|
||||
int width = wlr_surface->current->width;
|
||||
int height = wlr_surface->current->height;
|
||||
view_update_size(view, width, height);
|
||||
|
||||
double x = view->x;
|
||||
double y = view->y;
|
||||
if (view->pending_move_resize.update_x) {
|
||||
|
@ -234,6 +236,8 @@ 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->width = xsurface->surface->current->width;
|
||||
view->height = xsurface->surface->current->height;
|
||||
wl_list_insert(&desktop->views, &view->link);
|
||||
|
||||
struct wlr_subsurface *subsurface;
|
||||
|
@ -264,6 +268,7 @@ static void handle_unmap_notify(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
view->wlr_surface = NULL;
|
||||
view->width = view->height = 0;
|
||||
wl_list_remove(&view->link);
|
||||
}
|
||||
|
||||
|
@ -314,6 +319,8 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
|||
view->type = ROOTS_XWAYLAND_VIEW;
|
||||
view->x = (double)surface->x;
|
||||
view->y = (double)surface->y;
|
||||
view->width = surface->surface->current->width;
|
||||
view->height = surface->surface->current->height;
|
||||
|
||||
view->xwayland_surface = surface;
|
||||
view->roots_xwayland_surface = roots_surface;
|
||||
|
|
Loading…
Reference in a new issue