aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--window_texture.c7
-rw-r--r--window_texture.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/window_texture.c b/window_texture.c
index 67a0319..c40d4c4 100644
--- a/window_texture.c
+++ b/window_texture.c
@@ -19,11 +19,13 @@ int window_texture_init(WindowTexture *window_texture, Display *display, Window
window_texture->pixmap = None;
window_texture->glx_pixmap = None;
window_texture->texture_id = 0;
+ window_texture->redirected = 0;
if(!x11_supports_composite_named_window_pixmap(display))
return 1;
XCompositeRedirectWindow(display, window, CompositeRedirectAutomatic);
+ window_texture->redirected = 1;
return window_texture_on_resize(window_texture);
}
@@ -46,7 +48,10 @@ static void window_texture_cleanup(WindowTexture *self, int delete_texture) {
}
void window_texture_deinit(WindowTexture *self) {
- XCompositeUnredirectWindow(self->display, self->window, CompositeRedirectAutomatic);
+ if(self->redirected) {
+ XCompositeUnredirectWindow(self->display, self->window, CompositeRedirectAutomatic);
+ self->redirected = 0;
+ }
window_texture_cleanup(self, 1);
}
diff --git a/window_texture.h b/window_texture.h
index d543a79..acf349a 100644
--- a/window_texture.h
+++ b/window_texture.h
@@ -13,6 +13,7 @@ typedef struct {
Pixmap pixmap;
GLXPixmap glx_pixmap;
GLuint texture_id;
+ int redirected;
} WindowTexture;
/* Returns 0 on success */