From 176b471a8e968fcdef4822c32c231d4357bfc528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 15 May 2012 21:58:39 -0400 Subject: [PATCH] xwm: Don't repaint after destroying window --- src/xserver-launcher.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/xserver-launcher.c b/src/xserver-launcher.c index 3789281d..3ec13364 100644 --- a/src/xserver-launcher.c +++ b/src/xserver-launcher.c @@ -124,7 +124,7 @@ struct weston_wm_window { struct weston_surface *surface; struct shell_surface *shsurf; struct wl_listener surface_destroy_listener; - int repaint_scheduled; + struct wl_event_source *repaint_source; int properties_dirty; char *class; char *name; @@ -800,7 +800,7 @@ weston_wm_window_draw_decoration(void *data) weston_wm_window_read_properties(window); - window->repaint_scheduled = 0; + window->repaint_source = NULL; width = window->width + wm->border_width * 2; height = window->height + wm->border_width * 2 + wm->title_height; @@ -846,12 +846,13 @@ weston_wm_window_schedule_repaint(struct weston_wm_window *window) { struct weston_wm *wm = window->wm; - if (window->repaint_scheduled) + if (window->repaint_source) return; - wl_event_loop_add_idle(wm->server->loop, - weston_wm_window_draw_decoration, window); - window->repaint_scheduled = 1; + window->repaint_source = + wl_event_loop_add_idle(wm->server->loop, + weston_wm_window_draw_decoration, + window); } static void @@ -1227,6 +1228,9 @@ weston_wm_handle_destroy_notify(struct weston_wm *wm, xcb_generic_event_t *event fprintf(stderr, "XCB_DESTROY_NOTIFY, win %d (%p)\n", destroy_notify->window, window); + if (window->repaint_source) + wl_event_source_remove(window->repaint_source); + hash_table_remove(wm->window_hash, window->id); hash_table_remove(wm->window_hash, window->frame_id); xcb_destroy_window(wm->conn, window->frame_id);