[gtk/fix-win32-gl-resize: 2/2] gdkglcontext-win32.c: Fix Resizing and moving



commit 7a45768efe1a2502a927bc87db9d22a558fefdf3
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Apr 1 14:47:36 2019 +0800

    gdkglcontext-win32.c: Fix Resizing and moving
    
    We preiously did not apply the resizes and moves as they were previously
    only done in the Cairo drawing context on Win32.  Fix this by applying
    this too in the GL drawing context.

 gdk/win32/gdkglcontext-win32.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/gdk/win32/gdkglcontext-win32.c b/gdk/win32/gdkglcontext-win32.c
index 4845f4ba16..f97dc67fc3 100644
--- a/gdk/win32/gdkglcontext-win32.c
+++ b/gdk/win32/gdkglcontext-win32.c
@@ -166,6 +166,27 @@ gdk_win32_gl_context_begin_frame (GdkDrawContext *draw_context,
 {
   GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
   GdkSurface *surface;
+  GdkSurfaceImplWin32 *impl;
+  RECT queued_window_rect;
+
+  surface = gdk_gl_context_get_surface (context);
+  impl = GDK_SURFACE_IMPL_WIN32 (surface->impl);
+
+  gdk_win32_surface_get_queued_window_rect (surface,
+                                            gdk_surface_get_scale_factor (surface),
+                                            &queued_window_rect);
+
+  /* Apply queued resizes GL windows before painting them
+   *  (we paint on the window DC directly, it must have the right size).
+   * Due to some poorly-understood issue delayed
+   * resizing of double-buffered windows can produce weird
+   * artefacts, so these are also resized before we paint.
+   */
+  if (impl->drag_move_resize_context.native_move_resize_pending)
+    {
+      impl->drag_move_resize_context.native_move_resize_pending = FALSE;
+      gdk_win32_surface_apply_queued_move_resize (surface, queued_window_rect);
+    }
 
   GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_parent_class)->begin_frame (draw_context, update_area);
   if (gdk_gl_context_get_shared_context (context))
@@ -176,7 +197,6 @@ gdk_win32_gl_context_begin_frame (GdkDrawContext *draw_context,
 
   /* If nothing else is known, repaint everything so that the back
      buffer is fully up-to-date for the swapbuffer */
-  surface = gdk_gl_context_get_surface (context);
   cairo_region_union_rectangle (update_area, &(GdkRectangle) {
                                                  0, 0,
                                                  gdk_surface_get_width (surface),


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