src/video/x11/SDL_x11window.c
changeset 7659 ac4ce59c40e7
parent 7632 d6a8fa507a45
child 7677 871d43c6968a
equal deleted inserted replaced
7658:4033ba4fcc31 7659:ac4ce59c40e7
    32 #include "SDL_x11video.h"
    32 #include "SDL_x11video.h"
    33 #include "SDL_x11mouse.h"
    33 #include "SDL_x11mouse.h"
    34 #include "SDL_x11shape.h"
    34 #include "SDL_x11shape.h"
    35 #include "SDL_x11xinput2.h"
    35 #include "SDL_x11xinput2.h"
    36 
    36 
    37 #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
    37 #if SDL_VIDEO_OPENGL_EGL
    38 #include "SDL_x11opengles.h"
    38 #include "SDL_x11opengles.h"
    39 #endif
    39 #endif
    40 
    40 
    41 #include "SDL_timer.h"
    41 #include "SDL_timer.h"
    42 #include "SDL_syswm.h"
    42 #include "SDL_syswm.h"
   361     Atom _NET_WM_WINDOW_TYPE_NORMAL;
   361     Atom _NET_WM_WINDOW_TYPE_NORMAL;
   362     Atom _NET_WM_PID;
   362     Atom _NET_WM_PID;
   363     Atom XdndAware, xdnd_version = 5;
   363     Atom XdndAware, xdnd_version = 5;
   364     Uint32 fevent = 0;
   364     Uint32 fevent = 0;
   365 
   365 
   366 #if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
   366 #if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL
   367     if (window->flags & SDL_WINDOW_OPENGL) {
   367     if (window->flags & SDL_WINDOW_OPENGL) {
   368         XVisualInfo *vinfo;
   368         XVisualInfo *vinfo;
   369 
   369 
   370 #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
   370 #if SDL_VIDEO_OPENGL_EGL
   371         if (_this->gl_config.use_egl == 1) {
   371         if (_this->gl_config.use_egl == 1) {
   372             vinfo = X11_GLES_GetVisual(_this, display, screen);
   372             vinfo = X11_GLES_GetVisual(_this, display, screen);
   373         } else
   373         } else
   374 #endif
   374 #endif
   375         {
   375         {
   479                       (CWOverrideRedirect | CWBackPixel | CWBorderPixel |
   479                       (CWOverrideRedirect | CWBackPixel | CWBorderPixel |
   480                        CWColormap), &xattr);
   480                        CWColormap), &xattr);
   481     if (!w) {
   481     if (!w) {
   482         return SDL_SetError("Couldn't create window");
   482         return SDL_SetError("Couldn't create window");
   483     }
   483     }
   484 #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
       
   485     if ((window->flags & SDL_WINDOW_OPENGL) && (_this->gl_config.use_egl == 1)) {
       
   486         if (!_this->gles_data) {
       
   487             XDestroyWindow(display, w);
       
   488             return -1;
       
   489         }
       
   490 
       
   491         /* Create the GLES window surface */
       
   492         _this->gles_data->egl_surface =
       
   493             _this->gles_data->eglCreateWindowSurface(_this->gles_data->
       
   494                                                  egl_display,
       
   495                                                  _this->gles_data->egl_config,
       
   496                                                  (NativeWindowType) w, NULL);
       
   497 
       
   498         if (_this->gles_data->egl_surface == EGL_NO_SURFACE) {
       
   499             XDestroyWindow(display, w);
       
   500             return SDL_SetError("Could not create GLES window surface");
       
   501         }
       
   502     }
       
   503 #endif
       
   504 
   484 
   505     SetWindowBordered(display, screen, w,
   485     SetWindowBordered(display, screen, w,
   506                       (window->flags & SDL_WINDOW_BORDERLESS) == 0);
   486                       (window->flags & SDL_WINDOW_BORDERLESS) == 0);
   507 
   487 
   508     sizehints = XAllocSizeHints();
   488     sizehints = XAllocSizeHints();
   565 
   545 
   566     if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {
   546     if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {
   567         XDestroyWindow(display, w);
   547         XDestroyWindow(display, w);
   568         return -1;
   548         return -1;
   569     }
   549     }
       
   550 
       
   551 #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
       
   552     if ((window->flags & SDL_WINDOW_OPENGL) && (_this->gl_config.use_egl == 1)) {
       
   553         if (!_this->egl_data) {
       
   554             XDestroyWindow(display, w);
       
   555             return -1;
       
   556         }
       
   557 
       
   558         /* Create the GLES window surface */
       
   559         ((SDL_WindowData *) window->driverdata)->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) w);
       
   560 
       
   561         if (((SDL_WindowData *) window->driverdata)->egl_surface == EGL_NO_SURFACE) {
       
   562             XDestroyWindow(display, w);
       
   563             return SDL_SetError("Could not create GLES window surface");
       
   564         }
       
   565     }
       
   566 #endif
       
   567     
   570 
   568 
   571 #ifdef X_HAVE_UTF8_STRING
   569 #ifdef X_HAVE_UTF8_STRING
   572     if (SDL_X11_HAVE_UTF8) {
   570     if (SDL_X11_HAVE_UTF8) {
   573         pXGetICValues(((SDL_WindowData *) window->driverdata)->ic,
   571         pXGetICValues(((SDL_WindowData *) window->driverdata)->ic,
   574                       XNFilterEvents, &fevent, NULL);
   572                       XNFilterEvents, &fevent, NULL);