19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL - Simple DirectMedia Layer 39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Copyright (C) 1997-2012 Sam Lantinga 49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is free software; you can redistribute it and/or 69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall modify it under the terms of the GNU Library General Public 79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License as published by the Free Software Foundation; either 89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall version 2 of the License, or (at your option) any later version. 99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is distributed in the hope that it will be useful, 119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall but WITHOUT ANY WARRANTY; without even the implied warranty of 129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Library General Public License for more details. 149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall You should have received a copy of the GNU Library General Public 169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License along with this library; if not, write to the Free 179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Sam Lantinga 209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall slouken@libsdl.org 219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_config.h" 239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define DEBUG_DYNAMIC_X11 0 259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_x11dyn.h" 279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if DEBUG_DYNAMIC_X11 299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include <stdio.h> 309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC 339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_name.h" 359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_loadso.h" 369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct 389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall void *lib; 409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const char *libname; 419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} x11dynlib; 429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC 449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_VIDEO_DRIVER_X11_DYNAMIC NULL 459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT 479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT NULL 489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER 509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER NULL 519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR 539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR NULL 549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic x11dynlib x11libs[] = 579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC }, 599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT }, 609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER }, 619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR }, 629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall}; 639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void *X11_GetSym(const char *fnname, int *rc) 659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall void *fn = NULL; 679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int i; 689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { 699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (x11libs[i].lib != NULL) 709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall { 719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall fn = SDL_LoadFunction(x11libs[i].lib, fnname); 729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (fn != NULL) 739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall break; 749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #if DEBUG_DYNAMIC_X11 789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (fn != NULL) 799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, *fn); 809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall else 819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall printf("X11: Symbol '%s' NOT FOUND!\n", fnname); 829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #endif 839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (fn == NULL) 859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall *rc = 0; /* kill this module. */ 869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return fn; 889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Define all the function pointers and wrappers... */ 929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_X11_MODULE(modname) 939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_X11_SYM(rc,fn,params,args,ret) \ 949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall static rc (*p##fn) params = NULL; \ 959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall rc fn params { ret p##fn args ; } 969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_x11sym.h" 979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#undef SDL_X11_MODULE 989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#undef SDL_X11_SYM 999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */ 1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Annoying varargs entry point... */ 1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef X_HAVE_UTF8_STRING 1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallXIC (*pXCreateIC)(XIM,...) = NULL; 1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallchar *(*pXGetICValues)(XIC, ...) = NULL; 1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */ 1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_X11_MODULE(modname) int SDL_X11_HAVE_##modname = 1; 1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_X11_SYM(rc,fn,params,args,ret) 1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_x11sym.h" 1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#undef SDL_X11_MODULE 1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#undef SDL_X11_SYM 1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic void *SDL_XGetRequest_workaround(Display* dpy, CARD8 type, size_t len) 1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall xReq *req; 1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall WORD64ALIGN 1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (dpy->bufptr + len > dpy->bufmax) 1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall _XFlush(dpy); 1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dpy->last_req = dpy->bufptr; 1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall req = (xReq*)dpy->bufptr; 1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall req->reqType = type; 1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall req->length = len / 4; 1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dpy->bufptr += len; 1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall dpy->request++; 1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return req; 1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallstatic int x11_load_refcount = 0; 1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallvoid SDL_X11_UnloadSymbols(void) 1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC 1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* Don't actually unload if more than one module is using the libs... */ 1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (x11_load_refcount > 0) { 1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (--x11_load_refcount == 0) { 1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int i; 1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* set all the function pointers to NULL. */ 1419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; 1429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define SDL_X11_SYM(rc,fn,params,args,ret) p##fn = NULL; 1439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #include "SDL_x11sym.h" 1449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #undef SDL_X11_MODULE 1459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #undef SDL_X11_SYM 1469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #ifdef X_HAVE_UTF8_STRING 1489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall pXCreateIC = NULL; 1499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall pXGetICValues = NULL; 1509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #endif 1519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { 1539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (x11libs[i].lib != NULL) { 1549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_UnloadObject(x11libs[i].lib); 1559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall x11libs[i].lib = NULL; 1569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #endif 1619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 1629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* returns non-zero if all needed symbols were loaded. */ 1649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallint SDL_X11_LoadSymbols(void) 1659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall{ 1669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int rc = 1; /* always succeed if not using Dynamic X11 stuff. */ 1679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC 1699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* deal with multiple modules (dga, x11, etc) needing these symbols... */ 1709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (x11_load_refcount++ == 0) { 1719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int i; 1729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int *thismod = NULL; 1739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { 1749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (x11libs[i].libname != NULL) { 1759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall x11libs[i].lib = SDL_LoadObject(x11libs[i].libname); 1769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 1789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname; 1799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #define SDL_X11_SYM(rc,fn,params,args,ret) \ 1809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall p##fn = (rc(*)params) X11_GetSym(#fn, thismod); 1819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #include "SDL_x11sym.h" 1829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #undef SDL_X11_MODULE 1839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #undef SDL_X11_SYM 1849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #ifdef X_HAVE_UTF8_STRING 1869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall pXCreateIC = (XIC(*)(XIM,...)) X11_GetSym("XCreateIC", 1879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall &SDL_X11_HAVE_UTF8); 1889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall pXGetICValues = (char * (*)(XIC,...)) X11_GetSym("XGetICValues", 1899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall &SDL_X11_HAVE_UTF8); 1909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #endif 1919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /* 1939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * In case we're built with newer Xlib headers, we need to make sure 1949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * that _XGetRequest() is available, even on older systems. 1959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Otherwise, various Xlib macros we use will call a NULL pointer. 1969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 1979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (!SDL_X11_HAVE_XGETREQUEST) { 1989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall p_XGetRequest = SDL_XGetRequest_workaround; 1999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 2009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall if (SDL_X11_HAVE_BASEXLIB) { /* all required symbols loaded. */ 2029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_ClearError(); 203e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall XInitThreads(); 2049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } else { 2059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_X11_UnloadSymbols(); /* in case something got loaded... */ 2069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall rc = 0; 2079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 2089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } 2099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #else 2109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #if DEBUG_DYNAMIC_X11 2119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall printf("X11: No dynamic X11 support in this build of SDL.\n"); 2129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #endif 2139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #ifdef X_HAVE_UTF8_STRING 2149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall pXCreateIC = XCreateIC; 2159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall pXGetICValues = XGetICValues; 2169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #endif 2179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #endif 2189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall return rc; 2209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 2219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* end of SDL_x11dyn.c ... */ 2239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 224