GDK-Win32: Move some functions out of gdkglcontext-win32.c
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 14 Jul 2021 04:19:52 +0000 (12:19 +0800)
committerBenjamin Otte <otte@redhat.com>
Thu, 22 Jul 2021 14:28:16 +0000 (16:28 +0200)
We want these to be out of the way as we split between WGL and EGL/ANGLE
GL contexts, so that they don't get in the way.

gdk/win32/gdkdisplay-win32.c
gdk/win32/gdkglcontext-win32.c
gdk/win32/gdksurface-win32.c

index fe2a4ff480eee745b5a82fe8187dfb246143c73c..88b6eb5d6ef2f552b245e07f2082e2e6a1717895 100644 (file)
@@ -1140,6 +1140,34 @@ gdk_win32_display_get_setting (GdkDisplay  *display,
   return _gdk_win32_get_setting (name, value);
 }
 
+/**
+ * gdk_win32_display_get_egl_display:
+ * @display: (type GdkWin32Display): a Win32 display
+ *
+ * Retrieves the EGL display connection object for the given GDK display.
+ *
+ * Returns: (nullable): the EGL display
+ */
+gpointer
+gdk_win32_display_get_egl_display (GdkDisplay *display)
+{
+  GdkWin32Display *display_win32;
+
+  g_return_val_if_fail (GDK_IS_WIN32_DISPLAY (display), NULL);
+
+#ifdef GDK_WIN32_ENABLE_EGL
+  display_win32 = GDK_WIN32_DISPLAY (display);
+
+  if (display_win32->have_wgl)
+    return NULL;
+
+  return display_win32->egl_disp;
+#else
+  /* no EGL support */
+  return NULL;
+#endif
+}
+
 static void
 gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
 {
index 44010df3a3709f5fde1b5ea28be66a18fccdd058..2107933a6c7de46ae6b4bf529c77d9eba119b27e 100644 (file)
@@ -548,37 +548,6 @@ _gdk_win32_display_init_gl (GdkDisplay *display)
   return TRUE;
 }
 
-/**
- * gdk_win32_display_get_egl_display:
- * @display: (type GdkWin32Display): a Win32 display
- *
- * Retrieves the EGL display connection object for the given GDK display.
- *
- * Returns: (nullable): the EGL display
- */
-gpointer
-gdk_win32_display_get_egl_display (GdkDisplay *display)
-{
-  GdkWin32Display *display_win32;
-
-  g_return_val_if_fail (GDK_IS_WIN32_DISPLAY (display), NULL);
-
-#ifdef GDK_WIN32_ENABLE_EGL
-  if (!_gdk_win32_display_init_gl (display))
-    return NULL;
-
-  display_win32 = GDK_WIN32_DISPLAY (display);
-
-  if (display_win32->have_wgl)
-    return NULL;
-
-  return display_win32->egl_disp;
-#else
-  /* no EGL support */
-  return NULL;
-#endif
-}
-
 /* Setup the legacy context after creating it */
 static gboolean
 _ensure_legacy_gl_context (HDC           hdc,
@@ -1236,20 +1205,3 @@ gdk_win32_display_get_wgl_version (GdkDisplay *display,
 
   return TRUE;
 }
-
-void
-_gdk_win32_surface_invalidate_egl_framebuffer (GdkSurface *surface)
-{
-/* If we are using ANGLE, we need to force redraw of the whole Window and its child windows
- *  as we need to re-acquire the EGL surfaces that we rendered to upload to Cairo explicitly,
- *  using gdk_window_invalidate_rect (), when we maximize or restore or use aerosnap
- */
-#ifdef GDK_WIN32_ENABLE_EGL
-  if (surface->gl_paint_context != NULL && gdk_gl_context_get_use_es (surface->gl_paint_context))
-    {
-      GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
-
-      impl->egl_force_redraw_all = TRUE;
-    }
-#endif
-}
index 48194888a96995d4d0cde4644264c0e4ec0b9bfd..f224e919a347e4dc88988f7ab060f777dfa09a69 100644 (file)
@@ -5151,3 +5151,20 @@ gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context)
 
   return queued_window_rect;
 }
+
+void
+_gdk_win32_surface_invalidate_egl_framebuffer (GdkSurface *surface)
+{
+/* If we are using ANGLE, we need to force redraw of the whole Window and its child windows
+ *  as we need to re-acquire the EGL surfaces that we rendered to upload to Cairo explicitly,
+ *  using gdk_window_invalidate_rect (), when we maximize or restore or use aerosnap
+ */
+#ifdef GDK_WIN32_ENABLE_EGL
+  if (surface->gl_paint_context != NULL && gdk_gl_context_get_use_es (surface->gl_paint_context))
+    {
+      GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
+
+      impl->egl_force_redraw_all = TRUE;
+    }
+#endif
+}