Mercurial > sdl-ios-xcode
annotate src/video/x11/SDL_x11dyn.c @ 1754:c67921b517c3
Date: Sun, 30 Apr 2006 14:20:05 +1000
From: Rob
Subject: [SDL] SDL pre-release
OpenGL fails on the zipped pre-release source accessible from
http://www.libsdl.org/svn.php.
Appears to be following lines in sdl_wing.c (lines 341-345):
wglext = (const char *)this->glGetString(GL_EXTENSIONS);
if ( !SDL_strstr(wglext, "WGL_EXT_swap_control") ) {
this->gl_data->wglSwapIntervalEXT = NULL;
this->gl_data->wglGetSwapIntervalEXT = NULL;
}
glGetString is a null pointer, as are other gl function pointers, so call
fails. Never looked at sdl source before, so no further than that as yet.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 01 May 2006 07:15:35 +0000 |
parents | 9f59d4c5aaea |
children | 14717b52abc0 |
rev | line source |
---|---|
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1 /* |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
3 Copyright (C) 1997-2004 Sam Lantinga |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
4 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
9 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
13 Library General Public License for more details. |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
14 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
18 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
19 Sam Lantinga |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
23 |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1587
diff
changeset
|
24 #define DEBUG_DYNAMIC_X11 0 |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
25 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
26 #include "SDL_x11dyn.h" |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
27 |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1587
diff
changeset
|
28 #if DEBUG_DYNAMIC_X11 |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
29 #include <stdio.h> |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
30 #endif |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
31 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1245
diff
changeset
|
32 #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
33 |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
34 #include "SDL_name.h" |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
35 #include "SDL_loadso.h" |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
36 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
37 typedef struct |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
38 { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
39 void *lib; |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
40 const char *libname; |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
41 } x11dynlib; |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
42 |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
43 #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
44 #define SDL_VIDEO_DRIVER_X11_DYNAMIC NULL |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
45 #endif |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
46 #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
47 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT NULL |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
48 #endif |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
49 #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
50 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER NULL |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
51 #endif |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
52 #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
53 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR NULL |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
54 #endif |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
55 |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
56 static x11dynlib x11libs[] = |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
57 { |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
58 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC }, |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
59 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT }, |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
60 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER }, |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
61 { NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR }, |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
62 }; |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
63 |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
64 static void *X11_GetSym(const char *fnname, int *rc) |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
65 { |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
66 int i; |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
67 void *fn = NULL; |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
68 for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
69 if (x11libs[i].lib != NULL) |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
70 { |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
71 fn = SDL_LoadFunction(x11libs[i].lib, fnname); |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
72 if (fn != NULL) |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
73 break; |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
74 } |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
75 } |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
76 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
77 #if DEBUG_DYNAMIC_X11 |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
78 if (fn != NULL) |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
79 printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, fn); |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
80 else |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
81 printf("X11: Symbol '%s' NOT FOUND!\n", fnname); |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
82 #endif |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
83 |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
84 if (fn == NULL) |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
85 *rc = 0; /* kill this module. */ |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
86 |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
87 return fn; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
88 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
89 |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
90 |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
91 /* Define all the function pointers and wrappers... */ |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
92 #define SDL_X11_MODULE(modname) |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
93 #define SDL_X11_SYM(rc,fn,params,args,ret) \ |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
94 static rc (*p##fn) params = NULL; \ |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
95 rc fn params { ret p##fn args ; } |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
96 #include "SDL_x11sym.h" |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
97 #undef SDL_X11_MODULE |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
98 #undef SDL_X11_SYM |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1245
diff
changeset
|
99 #endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */ |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
100 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
101 /* Annoying varargs entry point... */ |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
102 #ifdef X_HAVE_UTF8_STRING |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
103 XIC (*pXCreateIC)(XIM,...) = NULL; |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
104 #endif |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
105 |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
106 /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */ |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
107 #define SDL_X11_MODULE(modname) int SDL_X11_HAVE_##modname = 1; |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
108 #define SDL_X11_SYM(rc,fn,params,args,ret) |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
109 #include "SDL_x11sym.h" |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
110 #undef SDL_X11_MODULE |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
111 #undef SDL_X11_SYM |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
112 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
113 |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
114 static int x11_load_refcount = 0; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
115 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
116 void SDL_X11_UnloadSymbols(void) |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
117 { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
118 #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
119 /* Don't actually unload if more than one module is using the libs... */ |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
120 if (x11_load_refcount > 0) { |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
121 if (--x11_load_refcount == 0) { |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
122 int i; |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
123 |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
124 /* set all the function pointers to NULL. */ |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
125 #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
126 #define SDL_X11_SYM(rc,fn,params,args,ret) p##fn = NULL; |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
127 #include "SDL_x11sym.h" |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
128 #undef SDL_X11_MODULE |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
129 #undef SDL_X11_SYM |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
130 |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
131 #ifdef X_HAVE_UTF8_STRING |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
132 pXCreateIC = NULL; |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
133 #endif |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
134 |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
135 for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
136 if (x11libs[i].lib != NULL) { |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
137 SDL_UnloadObject(x11libs[i].lib); |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
138 x11libs[i].lib = NULL; |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
139 } |
1589
34cca785be57
Xrandr support in the X11 target.
Ryan C. Gordon <icculus@icculus.org>
parents:
1587
diff
changeset
|
140 } |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
141 } |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
142 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
143 #endif |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
144 } |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
145 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
146 /* returns non-zero if all needed symbols were loaded. */ |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
147 int SDL_X11_LoadSymbols(void) |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
148 { |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
149 int rc = 1; /* always succeed if not using Dynamic X11 stuff. */ |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
150 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
151 #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
152 /* deal with multiple modules (dga, x11, etc) needing these symbols... */ |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
153 if (x11_load_refcount++ == 0) { |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
154 int i; |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
155 int *thismod = NULL; |
1593
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
156 for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
157 if (x11libs[i].libname != NULL) { |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
158 x11libs[i].lib = SDL_LoadObject(x11libs[i].libname); |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
159 } |
5115439d67b1
Consolidate all the X11 libraries, so you don't have to update 12 different
Ryan C. Gordon <icculus@icculus.org>
parents:
1589
diff
changeset
|
160 } |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
161 #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname; |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
162 #define SDL_X11_SYM(a,fn,x,y,z) p##fn = X11_GetSym(#fn,thismod); |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
163 #include "SDL_x11sym.h" |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
164 #undef SDL_X11_MODULE |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
165 #undef SDL_X11_SYM |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
166 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
167 #ifdef X_HAVE_UTF8_STRING |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
168 pXCreateIC = X11_GetSym("XCreateIC",&SDL_X11_HAVE_UTF8); |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
169 #endif |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
170 |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
171 if (!SDL_X11_HAVE_BASEXLIB) { /* some required symbol didn't load. */ |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
172 SDL_X11_UnloadSymbols(); /* in case something got loaded... */ |
1610
a1ee5944412b
SDL_X11_LoadSymbols() was reporting success when required symbols weren't
Ryan C. Gordon <icculus@icculus.org>
parents:
1593
diff
changeset
|
173 rc = 0; |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
174 } |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
175 } |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
176 #else |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
177 #ifdef X_HAVE_UTF8_STRING |
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
178 pXCreateIC = XCreateIC; |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
179 #endif |
1575
3ba88cb7eb1b
Updated dynamic X11 code. See details in Bugzilla #170.
Ryan C. Gordon <icculus@icculus.org>
parents:
1402
diff
changeset
|
180 #endif |
1168
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
181 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
182 return rc; |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
183 } |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
184 |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
185 /* end of SDL_x11dyn.c ... */ |
045f186426e1
Dynamically load X11 libraries like we currently do for alsa, esd, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
186 |