xwayland: reintroduce XWayland workaround

This was temporarily removed when introducing proper view abstractions.
Now that we have the cg_xwayland_view struct, we reintroduce this
workaround in its proper place.

This also fixes the previous workaround, which checked whether a view
was *currently* mapped and not if it *has ever* been mapped.

See #18, #19 and 443d955dfd.
This commit is contained in:
Jente Hidskes 2019-01-30 17:19:40 +01:00
parent 7175100d0d
commit 41d4ccfe44
3 changed files with 27 additions and 1 deletions

13
view.c
View file

@ -20,6 +20,9 @@
#include "seat.h"
#include "server.h"
#include "view.h"
#if CAGE_HAS_XWAYLAND
#include "xwayland.h"
#endif
char *
view_get_title(struct cg_view *view)
@ -115,6 +118,14 @@ void
view_destroy(struct cg_view *view)
{
struct cg_server *server = view->server;
bool ever_been_mapped = true;
#if CAGE_HAS_XWAYLAND
if (view->type == CAGE_XWAYLAND_VIEW) {
struct cg_xwayland_view *xwayland_view = xwayland_view_from_view(view);
ever_been_mapped = xwayland_view->ever_been_mapped;
}
#endif
if (view->wlr_surface != NULL) {
view_unmap(view);
@ -127,7 +138,7 @@ view_destroy(struct cg_view *view)
if (!empty) {
struct cg_view *prev = wl_container_of(server->views.next, prev, link);
seat_set_focus(server->seat, prev);
} else {
} else if (ever_been_mapped) {
/* The list is empty and the last view has been
mapped, so we can safely exit. */
wl_display_terminate(server->wl_display);