Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11window.c @ 3057:089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Make sure OpenGL library is loaded before working with OpenGL windows,
even those created with SDL_CreateWindowFrom()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 09 Feb 2009 05:32:12 +0000 |
parents | b7197d7e8566 |
children | 9b58f26ede81 |
comparison
equal
deleted
inserted
replaced
3056:a434fe6360df | 3057:089a77aebb7d |
---|---|
186 #endif | 186 #endif |
187 #ifdef SDL_VIDEO_OPENGL_GLX | 187 #ifdef SDL_VIDEO_OPENGL_GLX |
188 if (window->flags & SDL_WINDOW_OPENGL) { | 188 if (window->flags & SDL_WINDOW_OPENGL) { |
189 XVisualInfo *vinfo; | 189 XVisualInfo *vinfo; |
190 | 190 |
191 if (X11_GL_Initialize(_this) < 0) { | |
192 return -1; | |
193 } | |
194 vinfo = X11_GL_GetVisual(_this, data->display, displaydata->screen); | 191 vinfo = X11_GL_GetVisual(_this, data->display, displaydata->screen); |
195 if (!vinfo) { | 192 if (!vinfo) { |
196 return -1; | 193 return -1; |
197 } | 194 } |
198 visual = vinfo->visual; | 195 visual = vinfo->visual; |
459 RootWindow(data->display, displaydata->screen), x, y, | 456 RootWindow(data->display, displaydata->screen), x, y, |
460 window->w, window->h, 0, depth, InputOutput, visual, | 457 window->w, window->h, 0, depth, InputOutput, visual, |
461 (CWOverrideRedirect | CWBackPixel | CWBorderPixel | | 458 (CWOverrideRedirect | CWBackPixel | CWBorderPixel | |
462 CWColormap), &xattr); | 459 CWColormap), &xattr); |
463 if (!w) { | 460 if (!w) { |
464 #ifdef SDL_VIDEO_OPENGL_GLX | |
465 if (window->flags & SDL_WINDOW_OPENGL) { | |
466 X11_GL_Shutdown(_this); | |
467 } | |
468 #endif | |
469 SDL_SetError("Couldn't create window"); | 461 SDL_SetError("Couldn't create window"); |
470 return -1; | 462 return -1; |
471 } | 463 } |
472 | 464 |
473 sizehints = XAllocSizeHints(); | 465 sizehints = XAllocSizeHints(); |
620 | 612 |
621 /* Allow the window to be deleted by the window manager */ | 613 /* Allow the window to be deleted by the window manager */ |
622 XSetWMProtocols(data->display, w, &data->WM_DELETE_WINDOW, 1); | 614 XSetWMProtocols(data->display, w, &data->WM_DELETE_WINDOW, 1); |
623 | 615 |
624 if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) { | 616 if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) { |
625 #ifdef SDL_VIDEO_OPENGL_GLX | |
626 if (window->flags & SDL_WINDOW_OPENGL) { | |
627 X11_GL_Shutdown(_this); | |
628 } | |
629 #endif | |
630 XDestroyWindow(data->display, w); | 617 XDestroyWindow(data->display, w); |
631 return -1; | 618 return -1; |
632 } | 619 } |
633 #ifdef X_HAVE_UTF8_STRING | 620 #ifdef X_HAVE_UTF8_STRING |
634 { | 621 { |
940 videodata->numwindows--; | 927 videodata->numwindows--; |
941 break; | 928 break; |
942 } | 929 } |
943 } | 930 } |
944 } | 931 } |
945 #ifdef SDL_VIDEO_OPENGL_GLX | |
946 if (window->flags & SDL_WINDOW_OPENGL) { | |
947 X11_GL_Shutdown(_this); | |
948 } | |
949 #endif | |
950 #ifdef X_HAVE_UTF8_STRING | 932 #ifdef X_HAVE_UTF8_STRING |
951 if (data->ic) { | 933 if (data->ic) { |
952 XDestroyIC(data->ic); | 934 XDestroyIC(data->ic); |
953 } | 935 } |
954 #endif | 936 #endif |