summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-06-02 15:23:57 +0200
committerBenjamin Otte <otte@redhat.com>2010-06-07 13:37:48 +0200
commitce36be5c67fa5b574eb11eb98cdd8c9cd7e09335 (patch)
treefb2221fc35231b4607ff2d6b05ca5a75bb2862bc
parent5819bb07eb7ac64f0e2fbe6a46cc3db0de1d92ce (diff)
glx: When acquiring device, use the correct drawable
-rw-r--r--src/cairo-glx-context.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/cairo-glx-context.c b/src/cairo-glx-context.c
index c1c69c83..d289051d 100644
--- a/src/cairo-glx-context.c
+++ b/src/cairo-glx-context.c
@@ -67,13 +67,23 @@ static void
_glx_acquire (void *abstract_ctx)
{
cairo_glx_context_t *ctx = abstract_ctx;
+ GLXDrawable current_drawable;
ctx->prev_context = glXGetCurrentContext ();
ctx->prev_drawable = glXGetCurrentDrawable ();
- /* XXX: This is necessary with current code, but shouldn't be */
- if (ctx->prev_context != ctx->context)
- glXMakeCurrent (ctx->display, ctx->dummy_window, ctx->context);
+ if (ctx->base.current_target == NULL ||
+ _cairo_gl_surface_is_texture (ctx->base.current_target)) {
+ current_drawable = ctx->dummy_window;
+ } else {
+ cairo_glx_surface_t *surface = (cairo_glx_surface_t *) ctx->base.current_target;
+ current_drawable = surface->win;
+ }
+
+ if (ctx->prev_context != ctx->context ||
+ (ctx->prev_drawable != current_drawable &&
+ current_drawable != ctx->dummy_window))
+ glXMakeCurrent (ctx->display, current_drawable, ctx->context);
}
static void