From 8f66a57b4d46d309e07030a2ba4d88c1aebf18fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 7 Jan 2011 08:38:56 -0500 Subject: [PATCH] Ignore surface.map_toplevel() if already mapped --- compositor/compositor-x11.c | 2 +- compositor/compositor.c | 5 +++++ compositor/compositor.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/compositor/compositor-x11.c b/compositor/compositor-x11.c index df9329f..722bd94 100644 --- a/compositor/compositor-x11.c +++ b/compositor/compositor-x11.c @@ -288,7 +288,7 @@ x11_compositor_present(struct wlsc_compositor *base) XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT, XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT); free(xcb_dri2_copy_region_reply(c->conn, cookie, NULL)); - } + } gettimeofday(&tv, NULL); msec = tv.tv_sec * 1000 + tv.tv_usec / 1000; diff --git a/compositor/compositor.c b/compositor/compositor.c index 29a1f52..2ba484f 100644 --- a/compositor/compositor.c +++ b/compositor/compositor.c @@ -130,6 +130,7 @@ wlsc_surface_create(struct wlsc_compositor *compositor, wl_list_init(&surface->surface.destroy_listener_list); wl_list_init(&surface->link); + surface->mapped = 0; glGenTextures(1, &surface->texture); glBindTexture(GL_TEXTURE_2D, surface->texture); @@ -440,12 +441,16 @@ surface_map_toplevel(struct wl_client *client, { struct wlsc_surface *es = (struct wlsc_surface *) surface; + if (es->mapped) + return; + es->x = 10 + random() % 400; es->y = 10 + random() % 400; wlsc_surface_update_matrix(es); wl_list_insert(es->compositor->surface_list.prev, &es->link); wlsc_compositor_schedule_repaint(es->compositor); + es->mapped = 1; } static void diff --git a/compositor/compositor.h b/compositor/compositor.h index 81072f6..99035c7 100644 --- a/compositor/compositor.h +++ b/compositor/compositor.h @@ -146,6 +146,7 @@ struct wlsc_surface { struct wlsc_matrix matrix_inv; struct wl_visual *visual; struct wl_buffer *buffer; + int mapped; }; void -- 2.7.4