diff options
Diffstat (limited to 'gdk/win32/gdksurface-win32.c')
-rw-r--r-- | gdk/win32/gdksurface-win32.c | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index d47d67bfdb..a7900d2035 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -750,6 +750,7 @@ gdk_win32_surface_destroy (GdkSurface *window, { GdkSurfaceImplWin32 *surface_impl = GDK_SURFACE_IMPL_WIN32 (window->impl); GSList *tmp; + GdkWin32Display *display = NULL; g_return_if_fail (GDK_IS_SURFACE (window)); @@ -766,6 +767,22 @@ gdk_win32_surface_destroy (GdkSurface *window, gdk_surface_set_transient_for (child, NULL); } +#ifdef GDK_WIN32_ENABLE_EGL + display = GDK_WIN32_DISPLAY (gdk_surface_get_display (window)); + + /* Get rid of any EGLSurfaces that we might have created */ + if (surface_impl->egl_surface != EGL_NO_SURFACE) + { + eglDestroySurface (display->egl_disp, surface_impl->egl_surface); + surface_impl->egl_surface = EGL_NO_SURFACE; + } + if (surface_impl->egl_dummy_surface != EGL_NO_SURFACE) + { + eglDestroySurface (display->egl_disp, surface_impl->egl_dummy_surface); + surface_impl->egl_dummy_surface = EGL_NO_SURFACE; + } +#endif + /* Remove ourself from our transient owner */ if (surface_impl->transient_owner != NULL) { @@ -1349,14 +1366,15 @@ gdk_win32_surface_move_resize (GdkSurface *window, } else { + _gdk_win32_surface_invalidate_egl_framebuffer (window); if (with_move) - { - gdk_win32_surface_move_resize_internal (window, x, y, width, height); - } + { + gdk_win32_surface_move_resize_internal (window, x, y, width, height); + } else - { - gdk_win32_surface_resize (window, width, height); - } + { + gdk_win32_surface_resize (window, width, height); + } } out: @@ -4182,6 +4200,9 @@ gdk_win32_surface_end_move_resize_drag (GdkSurface *window) { GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl); GdkW32DragMoveResizeContext *context = &impl->drag_move_resize_context; + + if (context->op == GDK_WIN32_DRAGOP_RESIZE) + _gdk_win32_surface_invalidate_egl_framebuffer (window); context->op = GDK_WIN32_DRAGOP_NONE; @@ -4711,6 +4732,8 @@ gdk_win32_surface_unmaximize (GdkSurface *window) GDK_SURFACE_HWND (window), _gdk_win32_surface_state_to_string (window->state))); + _gdk_win32_surface_invalidate_egl_framebuffer (window); + if (GDK_SURFACE_IS_MAPPED (window)) GtkShowWindow (window, SW_RESTORE); else @@ -5388,3 +5411,34 @@ gdk_win32_surface_get_handle (GdkSurface *window) return GDK_SURFACE_HWND (window); } + +#ifdef GDK_WIN32_ENABLE_EGL +EGLSurface +_gdk_win32_surface_get_egl_surface (GdkSurface *surface, + EGLConfig config, + gboolean is_dummy) +{ + GdkWin32Display *display = GDK_WIN32_DISPLAY (gdk_surface_get_display (surface)); + GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (surface->impl); + + if (is_dummy) + { + if (impl->egl_dummy_surface == EGL_NO_SURFACE) + { + EGLint attribs[] = {EGL_WIDTH, 1, EGL_WIDTH, 1, EGL_NONE}; + impl->egl_dummy_surface = eglCreatePbufferSurface (display->egl_disp, + config, + attribs); + } + return impl->egl_dummy_surface; + } + else + { + if (impl->egl_surface == EGL_NO_SURFACE) + impl->egl_surface = eglCreateWindowSurface (display->egl_disp, config, display->gl_hwnd, NULL); + + return impl->egl_surface; + } + +} +#endif |