[gtk+] GDK/Win32: Fix build after GDKGL refactoring



commit 060365a9bb5077c36c0ea9c36170096c110cffd3
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Dec 6 14:37:42 2016 +0800

    GDK/Win32: Fix build after GDKGL refactoring
    
    There were some parts that need some updates after the refactoring in
    GDKGL, so that the code will continue to build and run.
    
    For gdkwindow-win32.c, comment out the parts where we check for use_gl
    (which was removed), since we are going to move all drawing to OpenGL,
    but don't remove/disable the whole portion as that transition is not
    complete at this point.
    
    There a is new GDKGL function that checks for the damaged area of the back
    buffer, but since the notion of "damage" is for *NIX (GLX/EGL for
    Wayland/mir), meaning that there is no such extension for Windows in this
    regard, so we can't support this on Windows as-is, at least for now.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773299

 gdk/win32/gdkglcontext-win32.c |   15 +++++++++------
 gdk/win32/gdkwindow-win32.c    |   22 ++++++++++++++++++----
 2 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/gdk/win32/gdkglcontext-win32.c b/gdk/win32/gdkglcontext-win32.c
index 477886b..e367bf2 100644
--- a/gdk/win32/gdkglcontext-win32.c
+++ b/gdk/win32/gdkglcontext-win32.c
@@ -110,8 +110,9 @@ gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context,
   GdkWindow *window = gdk_gl_context_get_window (context);
   GdkWin32Display *display = (GDK_WIN32_DISPLAY (gdk_gl_context_get_display (context)));
   gboolean can_wait = display->hasWglOMLSyncControl;
+  cairo_rectangle_int_t whole_window;
 
-  GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_parent_class)->end_frame (draw_context, painted, damage);
+  GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_parent_class)->end_frame (draw_context, painted, damage);
   if (gdk_gl_context_get_shared_context (context))
     return;
 
@@ -167,7 +168,7 @@ gdk_win32_gl_context_begin_frame (GdkDrawContext *draw_context,
   GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
   GdkWindow *window;
 
-  GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_parent_class)->begin_frame (draw_context, update_area);
+  GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_parent_class)->begin_frame (draw_context, update_area);
   if (gdk_gl_context_get_shared_context (context))
     return;
 
@@ -715,12 +716,14 @@ gdk_win32_gl_context_realize (GdkGLContext *context,
 static void
 gdk_win32_gl_context_class_init (GdkWin32GLContextClass *klass)
 {
-  GdkGLContextClass *context_class = GDK_GL_CONTEXT_CLASS (klass);
+  GdkGLContextClass *gl_context_class = GDK_GL_CONTEXT_CLASS(klass);
+  GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS(klass);
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  context_class->begin_frame = gdk_win32_gl_context_begin_frame;
-  context_class->end_frame = gdk_win32_gl_context_end_frame;
-  context_class->realize = _gdk_win32_gl_context_realize;
+  gl_context_class->realize = gdk_win32_gl_context_realize;
+
+  draw_context_class->begin_frame = gdk_win32_gl_context_begin_frame;
+  draw_context_class->end_frame = gdk_win32_gl_context_end_frame;
 
   gobject_class->dispose = _gdk_win32_gl_context_dispose;
 }
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index f6fdbf2..7d1a3b2 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -326,12 +326,19 @@ gdk_win32_window_begin_paint (GdkWindow *window)
   if (impl->layered)
     return FALSE;
 
+  /* FIXME: Possibly remove the following lines when we transition to GL
+   *        drawing fully.  This will probably mean that we won't
+   *        be able to use layered windows, as layered windows seem
+   *        to support only up to OpenGL 1.1, which is not enough for our
+   *        needs here.
+   */
+
   /* Non-GL windows are moved *after* repaint.
    * We don't supply our own surface, return TRUE to make GDK create
    * one by itself.
-   */
+   *//*
   if (!window->current_paint.use_gl)
-    return TRUE;
+    return TRUE;*/
 
   /* GL windows are moved *before* repaint (otherwise
    * repainting doesn't work), but if there's no move queued up,
@@ -355,6 +362,13 @@ gdk_win32_window_begin_paint (GdkWindow *window)
 static void
 gdk_win32_window_end_paint (GdkWindow *window)
 {
+  /* FIXME: Possibly make gdk_win32_window_end_paint() a
+   *        no-op stub, like what is done in Wayland, as
+   *        the items here rely on layered window usage,
+   *        when we transition to full GL drawing, as
+   *        layered windows do not support enough GL
+   *        for our needs here
+   */
   GdkWindowImplWin32 *impl;
   RECT window_rect;
   HDC hdc;
@@ -370,8 +384,8 @@ gdk_win32_window_end_paint (GdkWindow *window)
   impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   /* GL windows are moved *before* repaint */
-  if (window->current_paint.use_gl)
-    return;
+  /*if (window->current_paint.use_gl)
+    return;*/
 
   /* No move/resize is queued up, and we don't need to update
    * the contents of a layered window, so return immediately.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]