mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-22 18:28:52 -05:00
Minor X11 library struct changes.
This commit is contained in:
parent
8074209af4
commit
8a04910a45
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user