|
@@ -398,8 +398,7 @@ static bool SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w
|
|
|
} else {
|
|
|
SDL_WindowData ** new_windowlist = (SDL_WindowData **)SDL_realloc(windowlist, (numwindows + 1) * sizeof(*windowlist));
|
|
|
if (!new_windowlist) {
|
|
|
- SDL_free(data);
|
|
|
- return false;
|
|
|
+ goto error_cleanup;
|
|
|
}
|
|
|
windowlist = new_windowlist;
|
|
|
windowlist[numwindows] = data;
|
|
@@ -458,9 +457,42 @@ static bool SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w
|
|
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_X11_SCREEN_NUMBER, screen);
|
|
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_X11_WINDOW_NUMBER, data->xwindow);
|
|
|
|
|
|
+
|
|
|
+#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) || defined(SDL_VIDEO_OPENGL_EGL)
|
|
|
+ if ((window->flags & SDL_WINDOW_OPENGL) &&
|
|
|
+ ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) ||
|
|
|
+ SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, false))
|
|
|
+#ifdef SDL_VIDEO_OPENGL_GLX
|
|
|
+ && (!_this->gl_data || X11_GL_UseEGL(_this))
|
|
|
+#endif
|
|
|
+ ) {
|
|
|
+#ifdef SDL_VIDEO_OPENGL_EGL
|
|
|
+ if (!_this->egl_data) {
|
|
|
+ goto error_cleanup;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Create the GLES window surface
|
|
|
+ data->egl_surface = SDL_EGL_CreateSurface(_this, window, (NativeWindowType)w);
|
|
|
+
|
|
|
+ if (data->egl_surface == EGL_NO_SURFACE) {
|
|
|
+ SDL_SetError("Could not create GLES window surface");
|
|
|
+ goto error_cleanup;
|
|
|
+ }
|
|
|
+#else
|
|
|
+ SDL_SetError("Could not create GLES window surface (EGL support not configured)");
|
|
|
+ goto error_cleanup;
|
|
|
+#endif // SDL_VIDEO_OPENGL_EGL
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
// All done!
|
|
|
window->internal = data;
|
|
|
return true;
|
|
|
+
|
|
|
+error_cleanup:
|
|
|
+ X11_DestroyInputContext(data);
|
|
|
+ SDL_free(data);
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
static void SetupWindowInput(SDL_VideoDevice *_this, SDL_Window *window)
|
|
@@ -858,31 +890,6 @@ bool X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properties
|
|
|
}
|
|
|
#endif /* SDL_VIDEO_DRIVER_X11_XSYNC */
|
|
|
|
|
|
-#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) || defined(SDL_VIDEO_OPENGL_EGL)
|
|
|
- if ((window->flags & SDL_WINDOW_OPENGL) &&
|
|
|
- ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) ||
|
|
|
- SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, false))
|
|
|
-#ifdef SDL_VIDEO_OPENGL_GLX
|
|
|
- && (!_this->gl_data || X11_GL_UseEGL(_this))
|
|
|
-#endif
|
|
|
- ) {
|
|
|
-#ifdef SDL_VIDEO_OPENGL_EGL
|
|
|
- if (!_this->egl_data) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- // Create the GLES window surface
|
|
|
- windowdata->egl_surface = SDL_EGL_CreateSurface(_this, window, (NativeWindowType)w);
|
|
|
-
|
|
|
- if (windowdata->egl_surface == EGL_NO_SURFACE) {
|
|
|
- return SDL_SetError("Could not create GLES window surface");
|
|
|
- }
|
|
|
-#else
|
|
|
- return SDL_SetError("Could not create GLES window surface (EGL support not configured)");
|
|
|
-#endif // SDL_VIDEO_OPENGL_EGL
|
|
|
- }
|
|
|
-#endif
|
|
|
-
|
|
|
#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE
|
|
|
// Tooltips do not receive input
|
|
|
if (window->flags & SDL_WINDOW_TOOLTIP) {
|
|
@@ -2180,13 +2187,8 @@ void X11_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#ifdef X_HAVE_UTF8_STRING
|
|
|
- if (data->ic) {
|
|
|
- X11_XDestroyIC(data->ic);
|
|
|
- SDL_free(data->preedit_text);
|
|
|
- SDL_free(data->preedit_feedback);
|
|
|
- }
|
|
|
-#endif
|
|
|
+
|
|
|
+ X11_DestroyInputContext(data);
|
|
|
|
|
|
#ifdef SDL_VIDEO_DRIVER_X11_XSYNC
|
|
|
X11_TermResizeSync(window);
|