mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Merge branch 'master' of github.com:elmindreda/glfw
This commit is contained in:
commit
904db4c605
@ -3,7 +3,7 @@ link_libraries(glfw ${OPENGL_glu_LIBRARY})
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_definitions(-DGLFW_DLL)
|
||||
link_libraries(${OPENGL_gl_LIBRARY})
|
||||
link_libraries(${OPENGL_gl_LIBRARY} ${MATH_LIBRARY})
|
||||
else()
|
||||
link_libraries(${glfw_LIBRARIES})
|
||||
endif()
|
||||
|
@ -838,6 +838,8 @@ their skills. Special thanks go out to:</p>
|
||||
<li>Keith Bauer, for his invaluable help with porting and maintaining GLFW on
|
||||
Mac OS X, and for his many ideas</li>
|
||||
|
||||
<li>Lambert Clara, for a bug fix for the modes test</li>
|
||||
|
||||
<li>Jarrod Davis, for the Delphi port of GLFW</li>
|
||||
|
||||
<li>Olivier Delannoy, for the initial implementation of FSAA support on
|
||||
|
@ -81,9 +81,9 @@ int _glfwPlatformInit(void)
|
||||
{
|
||||
_glfwLibrary.NS.autoreleasePool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
_glfwLibrary.NS.OpenGLFramework =
|
||||
_glfwLibrary.NSGL.framework =
|
||||
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
|
||||
if (_glfwLibrary.NS.OpenGLFramework == NULL)
|
||||
if (_glfwLibrary.NSGL.framework == NULL)
|
||||
{
|
||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
||||
"glfwInit: Failed to locate OpenGL framework");
|
||||
|
@ -94,7 +94,7 @@ void* _glfwPlatformGetProcAddress(const char* procname)
|
||||
procname,
|
||||
kCFStringEncodingASCII);
|
||||
|
||||
void* symbol = CFBundleGetFunctionPointerForName(_glfwLibrary.NS.OpenGLFramework,
|
||||
void* symbol = CFBundleGetFunctionPointerForName(_glfwLibrary.NSGL.framework,
|
||||
symbolName);
|
||||
|
||||
CFRelease(symbolName);
|
||||
|
@ -43,8 +43,9 @@ typedef void* id;
|
||||
|
||||
|
||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS NS
|
||||
#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryNS NS
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL NSGL
|
||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNS NS
|
||||
#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryNSGL NSGL
|
||||
|
||||
|
||||
//========================================================================
|
||||
@ -80,7 +81,7 @@ typedef struct _GLFWwindowNS
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific library global data
|
||||
// Platform-specific library global data for Cocoa
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWlibraryNS
|
||||
{
|
||||
@ -89,8 +90,6 @@ typedef struct _GLFWlibraryNS
|
||||
double resolution;
|
||||
} timer;
|
||||
|
||||
// dlopen handle for dynamically loading OpenGL extension entry points
|
||||
void* OpenGLFramework;
|
||||
CGDisplayModeRef desktopMode;
|
||||
CGEventSourceRef eventSource;
|
||||
id delegate;
|
||||
@ -100,6 +99,16 @@ typedef struct _GLFWlibraryNS
|
||||
} _GLFWlibraryNS;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific library global data for NSGL
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWlibraryNSGL
|
||||
{
|
||||
// dlopen handle for dynamically loading OpenGL extension entry points
|
||||
void* framework;
|
||||
} _GLFWlibraryNSGL;
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Prototypes for platform specific internal functions
|
||||
//========================================================================
|
||||
|
@ -1168,7 +1168,7 @@ void _glfwPlatformSetMouseCursorPos(_GLFWwindow* window, int x, int y)
|
||||
// calculating the maximum y coordinate of all screens, since Cocoa's
|
||||
// "global coordinates" are upside down from CG's...
|
||||
|
||||
NSPoint localPoint = NSMakePoint(x, y);
|
||||
NSPoint localPoint = NSMakePoint(x, window->height - y);
|
||||
NSPoint globalPoint = [window->NS.object convertBaseToScreen:localPoint];
|
||||
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
|
||||
double mainScreenHeight = CGDisplayBounds(CGMainDisplayID()).size.height;
|
||||
|
@ -247,7 +247,8 @@ struct _GLFWlibrary
|
||||
int originalRampSize;
|
||||
|
||||
// This is defined in the current port's platform.h
|
||||
_GLFW_PLATFORM_LIBRARY_STATE;
|
||||
_GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
|
||||
_GLFW_PLATFORM_LIBRARY_OPENGL_STATE;
|
||||
};
|
||||
|
||||
|
||||
|
@ -517,8 +517,7 @@ GLFWAPI void glfwSwapBuffers(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (_glfwLibrary.currentWindow)
|
||||
_glfwPlatformSwapBuffers();
|
||||
_glfwPlatformSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,8 +111,9 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void);
|
||||
|
||||
|
||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWin32 Win32
|
||||
#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryWin32 Win32
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL WGL
|
||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 Win32
|
||||
#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryWGL WGL
|
||||
|
||||
|
||||
//========================================================================
|
||||
@ -169,7 +170,7 @@ typedef struct _GLFWwindowWin32
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific library global data
|
||||
// Platform-specific library global data for Win32
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWlibraryWin32
|
||||
{
|
||||
@ -210,6 +211,16 @@ typedef struct _GLFWlibraryWin32
|
||||
} _GLFWlibraryWin32;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific library global data for WGL
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWlibraryWGL
|
||||
{
|
||||
int dummy;
|
||||
|
||||
} _GLFWlibraryWGL;
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Prototypes for platform specific internal functions
|
||||
//========================================================================
|
||||
|
@ -55,8 +55,8 @@ static void initLibraries(void)
|
||||
|
||||
for (i = 0; libGL_names[i] != NULL; i++)
|
||||
{
|
||||
_glfwLibrary.X11.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (_glfwLibrary.X11.libGL)
|
||||
_glfwLibrary.GLX.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
|
||||
if (_glfwLibrary.GLX.libGL)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -569,8 +569,8 @@ static GLboolean initDisplay(void)
|
||||
}
|
||||
|
||||
if (!glXQueryVersion(_glfwLibrary.X11.display,
|
||||
&_glfwLibrary.X11.glxMajor,
|
||||
&_glfwLibrary.X11.glxMinor))
|
||||
&_glfwLibrary.GLX.majorVersion,
|
||||
&_glfwLibrary.GLX.minorVersion))
|
||||
{
|
||||
_glfwSetError(GLFW_OPENGL_UNAVAILABLE,
|
||||
"X11/GLX: Failed to query GLX version");
|
||||
@ -775,10 +775,10 @@ int _glfwPlatformTerminate(void)
|
||||
|
||||
// Unload libGL.so if necessary
|
||||
#ifdef _GLFW_DLOPEN_LIBGL
|
||||
if (_glfwLibrary.X11.libGL != NULL)
|
||||
if (_glfwLibrary.GLX.libGL != NULL)
|
||||
{
|
||||
dlclose(_glfwLibrary.X11.libGL);
|
||||
_glfwLibrary.X11.libGL = NULL;
|
||||
dlclose(_glfwLibrary.GLX.libGL);
|
||||
_glfwLibrary.GLX.libGL = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -75,15 +75,16 @@
|
||||
#elif defined(_GLFW_HAS_GLXGETPROCADDRESSEXT)
|
||||
#define _glfw_glXGetProcAddress(x) glXGetProcAddressEXT(x)
|
||||
#elif defined(_GLFW_HAS_DLOPEN)
|
||||
#define _glfw_glXGetProcAddress(x) dlsym(_glfwLibrary.X11.libGL, x)
|
||||
#define _glfw_glXGetProcAddress(x) dlsym(_glfwLibrary.GLX.libGL, x)
|
||||
#define _GLFW_DLOPEN_LIBGL
|
||||
#else
|
||||
#error "No OpenGL entry point retrieval mechanism was enabled"
|
||||
#endif
|
||||
|
||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowX11 X11
|
||||
#define _GLFW_PLATFORM_LIBRARY_STATE _GLFWlibraryX11 X11
|
||||
#define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX GLX
|
||||
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryX11 X11
|
||||
#define _GLFW_PLATFORM_LIBRARY_OPENGL_STATE _GLFWlibraryGLX GLX
|
||||
|
||||
// Clipboard format atom indices
|
||||
#define _GLFW_CLIPBOARD_FORMAT_UTF8 0
|
||||
@ -157,7 +158,7 @@ typedef struct _GLFWwindowX11
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific library global data
|
||||
// Platform-specific library global data for X11
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWlibraryX11
|
||||
{
|
||||
@ -177,9 +178,6 @@ typedef struct _GLFWlibraryX11
|
||||
// True if window manager supports EWMH
|
||||
GLboolean hasEWMH;
|
||||
|
||||
// Server-side GLX version
|
||||
int glxMajor, glxMinor;
|
||||
|
||||
struct {
|
||||
GLboolean available;
|
||||
int eventBase;
|
||||
@ -248,10 +246,21 @@ typedef struct _GLFWlibraryX11
|
||||
int status;
|
||||
} selection;
|
||||
|
||||
} _GLFWlibraryX11;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Platform-specific library global data for GLX
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct _GLFWlibraryGLX
|
||||
{
|
||||
// Server-side GLX version
|
||||
int majorVersion, minorVersion;
|
||||
|
||||
#if defined(_GLFW_DLOPEN_LIBGL)
|
||||
void* libGL; // dlopen handle for libGL.so
|
||||
#endif
|
||||
} _GLFWlibraryX11;
|
||||
} _GLFWlibraryGLX;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -131,7 +131,7 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
||||
|
||||
*found = 0;
|
||||
|
||||
if (_glfwLibrary.X11.glxMajor == 1 && _glfwLibrary.X11.glxMinor < 3)
|
||||
if (_glfwLibrary.GLX.majorVersion == 1 && _glfwLibrary.GLX.minorVersion < 3)
|
||||
{
|
||||
if (!window->GLX.SGIX_fbconfig)
|
||||
{
|
||||
@ -1287,7 +1287,6 @@ static void processSingleEvent(void)
|
||||
break;
|
||||
}
|
||||
|
||||
// Was the window destroyed?
|
||||
case DestroyNotify:
|
||||
return;
|
||||
|
||||
|
@ -3,7 +3,7 @@ link_libraries(glfw ${OPENGL_glu_LIBRARY})
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_definitions(-DGLFW_DLL)
|
||||
link_libraries(${OPENGL_gl_LIBRARY})
|
||||
link_libraries(${OPENGL_gl_LIBRARY} ${MATH_LIBRARY})
|
||||
else()
|
||||
link_libraries(${glfw_LIBRARIES})
|
||||
endif()
|
||||
|
@ -153,7 +153,7 @@ static void test_modes(GLFWvidmode* modes, int count)
|
||||
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
|
||||
if (width != modes[i].width || height != height)
|
||||
if (width != modes[i].width || height != modes[i].height)
|
||||
{
|
||||
printf("*** Size mismatch: %ix%i instead of %ix%i\n",
|
||||
width, height,
|
||||
|
Loading…
Reference in New Issue
Block a user