[gtk/opengl.win32.fixes] GDK/Win32: Fix up OpenGL a bit
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/opengl.win32.fixes] GDK/Win32: Fix up OpenGL a bit
- Date: Wed, 28 Jul 2021 03:32:26 +0000 (UTC)
commit 15817973d74dfbdabdd3ba00c9624515f5f04e14
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jul 28 11:19:17 2021 +0800
GDK/Win32: Fix up OpenGL a bit
Like the recent updates in GTK4, the HWND that we use to obtain the HDC
that we need for OpenGL/GLES operations should really be tied to
GdkWindow, not GdkDisplay, as that is where the Win32 HWND where we
originate from is located, so stop storing the GL HWND in
GdkWin32Display, but just grab them from the GdkWindow that is bound to
the GdkGLContext.
We are more conservative about freeing up GL resources in GTK3, so we
will continue to call ReleaseDC() as we did before.
gdk/win32/gdkdisplay-win32.h | 1 -
gdk/win32/gdkglcontext-win32.c | 7 +++----
gdk/win32/gdkwindow-win32.c | 9 ++++++---
3 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/gdk/win32/gdkdisplay-win32.h b/gdk/win32/gdkdisplay-win32.h
index f33b76bf34..67201582ed 100644
--- a/gdk/win32/gdkdisplay-win32.h
+++ b/gdk/win32/gdkdisplay-win32.h
@@ -84,7 +84,6 @@ struct _GdkWin32Display
/* WGL/OpenGL Items */
guint have_wgl : 1;
guint gl_version;
- HWND gl_hwnd;
#ifdef GDK_WIN32_ENABLE_EGL
/* EGL (Angle) Items */
diff --git a/gdk/win32/gdkglcontext-win32.c b/gdk/win32/gdkglcontext-win32.c
index e1683511e1..24d2b6facd 100644
--- a/gdk/win32/gdkglcontext-win32.c
+++ b/gdk/win32/gdkglcontext-win32.c
@@ -66,7 +66,7 @@ _gdk_win32_gl_context_dispose (GObject *gobject)
wglDeleteContext (context_win32->hglrc);
context_win32->hglrc = NULL;
- ReleaseDC (display_win32->gl_hwnd, context_win32->gl_hdc);
+ ReleaseDC (GDK_WINDOW_HWND (window), context_win32->gl_hdc);
}
#ifdef GDK_WIN32_ENABLE_EGL
@@ -84,7 +84,7 @@ _gdk_win32_gl_context_dispose (GObject *gobject)
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
- ReleaseDC (display_win32->gl_hwnd, context_win32->gl_hdc);
+ ReleaseDC (GDK_WINDOW_HWND (window), context_win32->gl_hdc);
}
#endif
@@ -1192,8 +1192,7 @@ _gdk_win32_window_create_gl_context (GdkWindow *window,
EGLConfig config;
#endif
- display_win32->gl_hwnd = GDK_WINDOW_HWND (window);
- hdc = GetDC (display_win32->gl_hwnd);
+ hdc = GetDC (GDK_WINDOW_HWND (window));
#ifdef GDK_WIN32_ENABLE_EGL
/* display_win32->hdc_egl_temp should *not* be destroyed here! It is destroyed at dispose()! */
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 2bccf59736..2d0faaca3e 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -6304,8 +6304,8 @@ gdk_win32_window_get_handle (GdkWindow *window)
#ifdef GDK_WIN32_ENABLE_EGL
EGLSurface
_gdk_win32_window_get_egl_surface (GdkWindow *window,
- EGLConfig config,
- gboolean is_dummy)
+ EGLConfig config,
+ gboolean is_dummy)
{
EGLSurface surface;
GdkWin32Display *display = GDK_WIN32_DISPLAY (gdk_window_get_display (window));
@@ -6325,7 +6325,10 @@ _gdk_win32_window_get_egl_surface (GdkWindow *window,
else
{
if (impl->egl_surface == EGL_NO_SURFACE)
- impl->egl_surface = eglCreateWindowSurface (display->egl_disp, config, display->gl_hwnd, NULL);
+ impl->egl_surface = eglCreateWindowSurface (display->egl_disp,
+ config,
+ GDK_WINDOW_HWND (window),
+ NULL);
return impl->egl_surface;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]