|
@@ -32,6 +32,7 @@
|
|
|
|
|
|
#include "SDL_windowsvideo.h"
|
|
|
#include "SDL_windowswindow.h"
|
|
|
+#include "SDL_hints.h"
|
|
|
|
|
|
/* Dropfile support */
|
|
|
#include <shellapi.h>
|
|
@@ -337,6 +338,31 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
|
|
|
if (SetupWindowData(_this, window, hwnd, SDL_FALSE) < 0) {
|
|
|
return -1;
|
|
|
}
|
|
|
+
|
|
|
+#if SDL_VIDEO_OPENGL_WGL
|
|
|
+ {
|
|
|
+ const char *hint = SDL_GetHint(SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT);
|
|
|
+ if (hint) {
|
|
|
+ // This hint is a pointer (in string form) of the address of
|
|
|
+ // the window to share a pixel format with
|
|
|
+ SDL_Window *otherWindow = NULL;
|
|
|
+ SDL_sscanf(hint, "%p", (void**)&otherWindow);
|
|
|
+
|
|
|
+ // Do some error checking on the pointer
|
|
|
+ if (otherWindow != NULL && otherWindow->magic == &_this->window_magic)
|
|
|
+ {
|
|
|
+ // If the otherWindow has SDL_WINDOW_OPENGL set, set it for the new window as well
|
|
|
+ if (otherWindow->flags & SDL_WINDOW_OPENGL)
|
|
|
+ {
|
|
|
+ window->flags |= SDL_WINDOW_OPENGL;
|
|
|
+ if(!WIN_GL_SetPixelFormatFrom(_this, otherWindow, window)) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
return 0;
|
|
|
}
|
|
|
|