Fix rendering of cg_view_child objects

This commit is contained in:
project-repo 2020-07-18 11:48:14 +02:00
commit a08b84b381
3 changed files with 10 additions and 6 deletions

5
view.c
View file

@ -56,7 +56,7 @@ view_child_handle_commit(struct wl_listener *listener, void *_data) {
struct cg_view_child *child = wl_container_of(listener, child, commit);
int x, y;
child->get_coords(child, &x, &y);
view_damage_child(child, x, y, false);
view_damage_child(child, x+child->view->ox, y+child->view->oy, false);
}
static void
@ -120,8 +120,7 @@ subsurface_handle_destroy(struct wl_listener *listener, void *_data) {
static void
subsurface_get_coords(struct cg_view_child *child, int *x, int *y) {
struct wlr_surface *surface = child->wlr_surface;
*x = -child->view->ox;
*y = -child->view->oy;
*x=*y=0;
if(child->parent && child->parent->get_coords) {
int sx, sy;

2
view.h
View file

@ -83,6 +83,8 @@ view_damage_part(struct cg_view *view);
void
view_damage_whole(struct cg_view *view);
void
view_damage_child(struct cg_view_child *view, int x, int y, bool whole);
void
view_activate(struct cg_view *view, bool activate);
void
view_position(struct cg_view *view);

View file

@ -59,7 +59,10 @@ xdg_popup_destroy(struct cg_view_child *child) {
return;
}
struct cg_xdg_popup *popup = (struct cg_xdg_popup *)child;
int x, y;
child->get_coords(child, &x, &y);
view_damage_child(child, x+child->view->ox, y+child->view->oy, true);
struct cg_xdg_popup *popup = (struct cg_xdg_popup *)child;
wl_list_remove(&popup->destroy.link);
wl_list_remove(&popup->map.link);
wl_list_remove(&popup->unmap.link);
@ -128,8 +131,8 @@ xdg_popup_get_coords(struct cg_view_child *child, int *x, int *y) {
struct cg_xdg_popup *popup = (struct cg_xdg_popup *)child;
struct wlr_xdg_surface *surface = popup->wlr_popup->base;
int x_offset = -surface->geometry.x - child->view->ox;
int y_offset = -surface->geometry.y - child->view->oy;
int x_offset = -surface->geometry.x;
int y_offset = -surface->geometry.y;
wlr_xdg_popup_get_toplevel_coords(
surface->popup, x_offset + surface->popup->geometry.x,