summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-10-24 16:21:28 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-10-24 16:26:46 -0700
commita96360a9517c38ead6c1381362ec49d7f7afd41c (patch)
treed3d57dcb2e05b2086404da8bb837d1f4dd6d431d
parentc8f2665f028d2a34370059f3aa204986f6341697 (diff)
apple: Implement applegl_unbind_context7.10
glXMakeCurrent(dpy, None, NULL) would not correctly unbind the context causing subsequent GLX requests to fail in peculiar ways http://xquartz.macosforge.org/trac/ticket/514 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> (cherry picked from commit 5c44c1348ea13f51a1616968daa7034bb48e42b1)
-rw-r--r--src/glx/applegl_glx.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c
index 92c785f988a..1fd30bf2bfb 100644
--- a/src/glx/applegl_glx.c
+++ b/src/glx/applegl_glx.c
@@ -65,6 +65,24 @@ applegl_bind_context(struct glx_context *gc, struct glx_context *old,
static void
applegl_unbind_context(struct glx_context *gc, struct glx_context *new)
{
+ Display *dpy;
+ bool error;
+
+ /* If we don't have a context, then we have nothing to unbind */
+ if (!gc)
+ return;
+
+ /* If we have a new context, keep this one around and remove it during bind. */
+ if (new)
+ return;
+
+ dpy = gc->psc->dpy;
+
+ error = apple_glx_make_current_context(dpy,
+ (gc != &dummyContext) ? gc->driContext : NULL,
+ NULL, None);
+
+ apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO");
}
static void