gdksurface-win32.c: Call gdk_surface_set_egl_native_window()
authorChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 23 Nov 2021 08:19:34 +0000 (16:19 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 3 Dec 2021 02:39:59 +0000 (10:39 +0800)
.. when creating the surface (with the HWND associated with the
newly-created surface) as well as destroying the surface (with NULL,
since the HWND is going to be destroyed), so that we can tie the EGL
calls to the HWND that we want to do the EGL stuff.

gdk/win32/gdksurface-win32.c

index 6cfe38f6797149f509284143f40de05800e42a0c..1b4effa80f0c7752ec03724770437879204f6faa 100644 (file)
@@ -638,6 +638,7 @@ _gdk_win32_display_create_surface (GdkDisplay     *display,
       return NULL;
     }
 
+  gdk_surface_set_egl_native_window (surface, (void *) impl->handle);
   if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
     gdk_winpointer_initialize_surface (surface);
 
@@ -693,6 +694,7 @@ gdk_win32_surface_destroy (GdkSurface *window,
 
   if (!foreign_destroy)
     {
+      gdk_surface_set_egl_native_window (window, NULL);
       window->destroyed = TRUE;
       DestroyWindow (GDK_SURFACE_HWND (window));
     }