Skip to content
  • Chun-wei Fan's avatar
    gdk/win32: Fix Win32 GL Context switching · d38a148f
    Chun-wei Fan authored
    Since on Windows we need to use a good amount of temporary GL contexts,
    we need to switch back to the original GL contexts we were using when
    we are done with the temporary GL contexts, otherwise multi-GL windows
    will cause confusions causing display artifacts and crashes.
    
    Also, use the GdkWin32GLContext::gl_hdc consistently throughout
    the code and remove the GdkWin32Display::gl_hdc as Lukas K pointed out
    that GdkWin32Display::gl_hdc becomes out-of-date and so the HDC that the
    GL context is bound to becomes incorrect in sceanarios using multiple
    windows with GtkGLArea/GdkGLArea items (which would cause the artifacts in
    programs that use multiple windows with GtkGLArea/GdkGLArea items, and it
    turns out that GdkWin32Display::gl_hdc is actually not necessary to help
    keep track of the HDCs we use for our GL contexts.
    
    Partly based on patch from Lukas K <lu@0x83.eu>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789213
    d38a148f