Minor X11 library struct changes.

This commit is contained in:
Camilla Berglund 2010-09-09 20:25:33 +02:00
Родитель 8074209af4
Коммит 8a04910a45
4 изменённых файлов: 13 добавлений и 15 удалений

Просмотреть файл

@ -264,12 +264,10 @@ typedef struct _GLFWlibraryX11
struct {
double resolution;
long long t0;
} Timer;
} timer;
#if defined(_GLFW_DLOPEN_LIBGL)
struct {
void* libGL; // dlopen handle for libGL.so
} Libs;
void* libGL; // dlopen handle for libGL.so
#endif
} _GLFWlibraryX11;

Просмотреть файл

@ -45,7 +45,7 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))();
#elif defined(_GLFW_HAS_GLXGETPROCADDRESSEXT)
#define _glfw_glXGetProcAddress(x) glXGetProcAddressEXT(x)
#elif defined(_GLFW_HAS_DLOPEN)
#define _glfw_glXGetProcAddress(x) dlsym(_glfwLibs.libGL,x)
#define _glfw_glXGetProcAddress(x) dlsym(_glfwLibrary.X11.libGL, x)
#define _GLFW_DLOPEN_LIBGL
#else
#define _glfw_glXGetProcAddress(x) NULL

Просмотреть файл

@ -54,11 +54,11 @@ static void initLibraries(void)
NULL
};
_glfwLibrary.Libs.libGL = NULL;
_glfwLibrary.X11.libGL = NULL;
for (i = 0; libGL_names[i] != NULL; i++)
{
_glfwLibrary.Libs.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
if (_glfwLibrary.Libs.libGL)
_glfwLibrary.X11.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
if (_glfwLibrary.X11.libGL)
break;
}
#endif
@ -191,10 +191,10 @@ int _glfwPlatformTerminate(void)
// Unload libGL.so if necessary
#ifdef _GLFW_DLOPEN_LIBGL
if (_glfwLibrary.Libs.libGL != NULL)
if (_glfwLibrary.X11.libGL != NULL)
{
dlclose(_glfwLibrary.Libs.libGL);
_glfwLibrary.Libs.libGL = NULL;
dlclose(_glfwLibrary.X11.libGL);
_glfwLibrary.X11.libGL = NULL;
}
#endif

Просмотреть файл

@ -40,11 +40,11 @@ void _glfwInitTimer(void)
struct timeval tv;
// "Resolution" is 1 us
_glfwLibrary.X11.Timer.resolution = 1e-6;
_glfwLibrary.X11.timer.resolution = 1e-6;
// Set start-time for timer
gettimeofday(&tv, NULL);
_glfwLibrary.X11.Timer.t0 = (long long) tv.tv_sec * (long long) 1000000 +
_glfwLibrary.X11.timer.t0 = (long long) tv.tv_sec * (long long) 1000000 +
(long long) tv.tv_usec;
}
@ -66,7 +66,7 @@ double _glfwPlatformGetTime(void)
t = (long long) tv.tv_sec * (long long) 1000000 +
(long long) tv.tv_usec;
return (double)(t - _glfwLibrary.X11.Timer.t0) * _glfwLibrary.X11.Timer.resolution;
return (double)(t - _glfwLibrary.X11.timer.t0) * _glfwLibrary.X11.timer.resolution;
}
@ -84,6 +84,6 @@ void _glfwPlatformSetTime(double t)
(long long) tv.tv_usec;
// Calulate new starting time
_glfwLibrary.X11.Timer.t0 = t0 - (long long)(t / _glfwLibrary.X11.Timer.resolution);
_glfwLibrary.X11.timer.t0 = t0 - (long long)(t / _glfwLibrary.X11.timer.resolution);
}