diff --git a/view.c b/view.c index 9a14f6d..6b55606 100644 --- a/view.c +++ b/view.c @@ -48,6 +48,8 @@ view_child_finish(struct cg_view_child *child) return; } + view_damage_whole(child->view); + wl_list_remove(&child->link); wl_list_remove(&child->commit.link); wl_list_remove(&child->new_subsurface.link); diff --git a/xdg_shell.c b/xdg_shell.c index 05bc59f..2ef22ac 100644 --- a/xdg_shell.c +++ b/xdg_shell.c @@ -26,16 +26,32 @@ xdg_popup_destroy(struct cg_view_child *child) 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); wl_list_remove(&popup->new_popup.link); view_child_finish(&popup->view_child); free(popup); } +static void +handle_xdg_popup_map(struct wl_listener *listener, void *data) +{ + struct cg_xdg_popup *popup = wl_container_of(listener, popup, map); + view_damage_whole(popup->view_child.view); +} + +static void +handle_xdg_popup_unmap(struct wl_listener *listener, void *data) +{ + struct cg_xdg_popup *popup = wl_container_of(listener, popup, unmap); + view_damage_whole(popup->view_child.view); +} + static void handle_xdg_popup_destroy(struct wl_listener *listener, void *data) { struct cg_xdg_popup *popup = wl_container_of(listener, popup, destroy); - struct cg_view_child *view_child = (struct cg_view_child *) popup + struct cg_view_child *view_child = (struct cg_view_child *) popup; xdg_popup_destroy(view_child); } @@ -81,6 +97,10 @@ xdg_popup_create(struct cg_view *view, struct wlr_xdg_popup *wlr_popup) popup->view_child.destroy = xdg_popup_destroy; popup->destroy.notify = handle_xdg_popup_destroy; wl_signal_add(&wlr_popup->base->events.destroy, &popup->destroy); + popup->map.notify = handle_xdg_popup_map; + wl_signal_add(&wlr_popup->base->events.map, &popup->map); + popup->unmap.notify = handle_xdg_popup_unmap; + wl_signal_add(&wlr_popup->base->events.unmap, &popup->unmap); popup->new_popup.notify = popup_handle_new_xdg_popup; wl_signal_add(&wlr_popup->base->events.new_popup, &popup->new_popup); @@ -197,6 +217,8 @@ handle_xdg_shell_surface_unmap(struct wl_listener *listener, void *data) struct cg_xdg_shell_view *xdg_shell_view = wl_container_of(listener, xdg_shell_view, unmap); struct cg_view *view = &xdg_shell_view->view; + view_damage_whole(view); + wl_list_remove(&xdg_shell_view->commit.link); view_unmap(view); @@ -212,6 +234,8 @@ handle_xdg_shell_surface_map(struct wl_listener *listener, void *data) wl_signal_add(&xdg_shell_view->xdg_surface->surface->events.commit, &xdg_shell_view->commit); view_map(view, xdg_shell_view->xdg_surface->surface); + + view_damage_whole(view); } static void diff --git a/xdg_shell.h b/xdg_shell.h index 2baf596..af87d8c 100644 --- a/xdg_shell.h +++ b/xdg_shell.h @@ -25,6 +25,8 @@ struct cg_xdg_popup { struct wlr_xdg_popup *wlr_popup; struct wl_listener destroy; + struct wl_listener map; + struct wl_listener unmap; struct wl_listener new_popup; }; diff --git a/xwayland.c b/xwayland.c index 4ad789a..3a73aaa 100644 --- a/xwayland.c +++ b/xwayland.c @@ -121,6 +121,8 @@ handle_xwayland_surface_unmap(struct wl_listener *listener, void *data) struct cg_xwayland_view *xwayland_view = wl_container_of(listener, xwayland_view, unmap); struct cg_view *view = &xwayland_view->view; + view_damage_whole(view); + wl_list_remove(&xwayland_view->commit.link); view_unmap(view); @@ -142,6 +144,8 @@ handle_xwayland_surface_map(struct wl_listener *listener, void *data) xwayland_view->ever_been_mapped = true; view_map(view, xwayland_view->xwayland_surface->surface); + + view_damage_whole(view); } static void