src/video/windows/SDL_windowswindow.c
changeset 8144 855b1d6d7d8e
parent 8093 b43765095a6f
child 8149 681eb46b8ac4
     1.1 --- a/src/video/windows/SDL_windowswindow.c	Thu Jan 30 12:27:24 2014 -0800
     1.2 +++ b/src/video/windows/SDL_windowswindow.c	Thu Jan 30 12:30:40 2014 -0800
     1.3 @@ -32,6 +32,7 @@
     1.4  
     1.5  #include "SDL_windowsvideo.h"
     1.6  #include "SDL_windowswindow.h"
     1.7 +#include "SDL_hints.h"
     1.8  
     1.9  /* Dropfile support */
    1.10  #include <shellapi.h>
    1.11 @@ -337,6 +338,31 @@
    1.12      if (SetupWindowData(_this, window, hwnd, SDL_FALSE) < 0) {
    1.13          return -1;
    1.14      }
    1.15 +
    1.16 +#if SDL_VIDEO_OPENGL_WGL
    1.17 +    {
    1.18 +        const char *hint = SDL_GetHint(SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT);
    1.19 +        if (hint) {
    1.20 +            // This hint is a pointer (in string form) of the address of
    1.21 +            // the window to share a pixel format with
    1.22 +            SDL_Window *otherWindow = NULL;
    1.23 +            SDL_sscanf(hint, "%p", (void**)&otherWindow);
    1.24 +
    1.25 +            // Do some error checking on the pointer
    1.26 +            if (otherWindow != NULL && otherWindow->magic == &_this->window_magic)
    1.27 +            {
    1.28 +                // If the otherWindow has SDL_WINDOW_OPENGL set, set it for the new window as well
    1.29 +                if (otherWindow->flags & SDL_WINDOW_OPENGL)
    1.30 +                {
    1.31 +                    window->flags |= SDL_WINDOW_OPENGL;
    1.32 +                    if(!WIN_GL_SetPixelFormatFrom(_this, otherWindow, window)) {
    1.33 +                        return -1;
    1.34 +                    }
    1.35 +                }
    1.36 +            }
    1.37 +        }
    1.38 +    }
    1.39 +#endif
    1.40      return 0;
    1.41  }
    1.42