diff options
author | Benjamin Otte <otte@redhat.com> | 2016-12-01 01:38:20 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-12-05 15:02:47 +0100 |
commit | ca78f5d3cbdd9478ef1206b2c7f1c9472e28796d (patch) | |
tree | 3a959ae1e8396436010d474da2576bd448f14551 /gdk/mir | |
parent | 60567db486649746978850797e548a099df5aa0a (diff) | |
download | gtk+-ca78f5d3cbdd9478ef1206b2c7f1c9472e28796d.tar.gz |
gdk: Make gdk_window_begin_draw_frame() take a draw context
... instead of a gl context.
This requires some refactoring in the way we mark the shared context as
drawing: We now call begin_frame/end_frame() on it and ignore the call
on the main context.
Unfortunately we need to do this check in all vfuncs, which sucks. But I
haven't found a better way.
Diffstat (limited to 'gdk/mir')
-rw-r--r-- | gdk/mir/gdkmirglcontext.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gdk/mir/gdkmirglcontext.c b/gdk/mir/gdkmirglcontext.c index a4c00c211f..ae98c5282c 100644 --- a/gdk/mir/gdkmirglcontext.c +++ b/gdk/mir/gdkmirglcontext.c @@ -98,12 +98,17 @@ gdk_mir_gl_context_realize (GdkGLContext *context, } static void -gdk_mir_gl_context_begin_frame (GdkGLContext *context, +gdk_mir_gl_context_begin_frame (GdkDrawContext *draw_context, cairo_region_t *update_area) { - GdkDisplay *display = gdk_gl_context_get_display (window); + GdkGLContext *context = GDK_GL_CONTEXT (draw_context); + GdkDisplay *display = gdk_draw_context_get_display (draw_context); GdkWindow *window; + GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_parent_class)->begin_frame (draw_context, update_area); + if (gdk_gl_context_get_shared_context (context)) + return; + if (_gdk_mir_display_have_egl_swap_buffers_with_damage (display)) return; @@ -121,12 +126,17 @@ gdk_mir_gl_context_end_frame (GdkGLContext *context, cairo_region_t *painted, cairo_region_t *damage) { + GdkGLContext *context = GDK_GL_CONTEXT (draw_context); GdkWindow *window = gdk_gl_context_get_window (context); GdkDisplay *display = gdk_window_get_display (window); GdkMirGLContext *context_mir = GDK_MIR_GL_CONTEXT (context); EGLDisplay egl_display = _gdk_mir_display_get_egl_display (display); EGLSurface egl_surface; + GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_parent_class)->end_frame (draw_context, painted, damage); + if (gdk_gl_context_get_shared_context (context)) + return; + gdk_gl_context_make_current (context); egl_surface = _gdk_mir_window_get_egl_surface (window, |