For core functions that need to know the current context, like the forthcoming wflinfo-like function.
Signed-off-by: Frank Henigman <fjhenig...@google.com> --- src/waffle/api/waffle_gl_misc.c | 11 +++++++---- src/waffle/core/wcore_display.c | 1 + src/waffle/core/wcore_display.h | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/waffle/api/waffle_gl_misc.c b/src/waffle/api/waffle_gl_misc.c index 138974d..4161ce8 100644 --- a/src/waffle/api/waffle_gl_misc.c +++ b/src/waffle/api/waffle_gl_misc.c @@ -94,10 +94,13 @@ waffle_make_current( if (!api_check_entry(obj_list, len)) return false; - return api_platform->vtbl->make_current(api_platform, - wc_dpy, - wc_window, - wc_ctx); + bool ok = api_platform->vtbl->make_current(api_platform, + wc_dpy, + wc_window, + wc_ctx); + if (ok) + wc_dpy->current_context = wc_ctx; + return ok; } WAFFLE_API void* diff --git a/src/waffle/core/wcore_display.c b/src/waffle/core/wcore_display.c index 18262c3..bcaeacb 100644 --- a/src/waffle/core/wcore_display.c +++ b/src/waffle/core/wcore_display.c @@ -52,6 +52,7 @@ wcore_display_init(struct wcore_display *self, mtx_unlock(&mutex); self->platform = platform; + self->current_context = NULL; if (self->api.display_id == 0) { fprintf(stderr, "waffle: error: internal counter wrapped to 0\n"); diff --git a/src/waffle/core/wcore_display.h b/src/waffle/core/wcore_display.h index 6e374e3..1ccff6f 100644 --- a/src/waffle/core/wcore_display.h +++ b/src/waffle/core/wcore_display.h @@ -37,12 +37,14 @@ extern "C" { #endif +struct wcore_context; struct wcore_display; struct wcore_platform; union waffle_native_display; struct wcore_display { struct api_object api; + struct wcore_context *current_context; struct wcore_platform *platform; }; -- 2.6.0.rc2.230.g3dd15c0 _______________________________________________ waffle mailing list waffle@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/waffle