Merged with master.

This commit is contained in:
Marcel Metz 2012-01-24 18:00:51 +01:00
commit c7a5474bfc
10 changed files with 29 additions and 30 deletions

7
.gitignore vendored
View File

@ -22,13 +22,18 @@ Makefile
*.resource.txt *.resource.txt
*.so *.so
src/config.h src/config.h
src/libglfw.a
src/libglfw.pc
src/libglfw.so
*.swp *.swp
tests/accuracy tests/accuracy
tests/defaults tests/defaults
tests/dynamic
tests/events tests/events
tests/fsaa tests/fsaa
tests/fsfocus tests/fsfocus
tests/gamma tests/gamma
tests/glfwinfo
tests/iconify tests/iconify
tests/joysticks tests/joysticks
tests/listmodes tests/listmodes
@ -38,5 +43,3 @@ tests/sharing
tests/tearing tests/tearing
tests/version tests/version
tests/windows tests/windows
tests/dynamic
tests/glfwinfo

View File

@ -39,16 +39,6 @@ extern "C" {
* Global definitions * Global definitions
*************************************************************************/ *************************************************************************/
/* We need a NULL pointer from time to time */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void*) 0)
#endif
#endif /* NULL */
/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
/* Please report any probles that you find with your compiler, which may /* Please report any probles that you find with your compiler, which may
@ -75,7 +65,6 @@ extern "C" {
#else #else
#define APIENTRY #define APIENTRY
#endif #endif
#define GLFW_APIENTRY_DEFINED
#endif /* APIENTRY */ #endif /* APIENTRY */
@ -640,11 +629,6 @@ GLFWAPI void glfwDisable(GLFWwindow window, int token);
/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
#ifdef GLFW_APIENTRY_DEFINED
#undef APIENTRY
#undef GLFW_APIENTRY_DEFINED
#endif
#ifdef GLFW_WINGDIAPI_DEFINED #ifdef GLFW_WINGDIAPI_DEFINED
#undef WINGDIAPI #undef WINGDIAPI
#undef GLFW_WINGDIAPI_DEFINED #undef GLFW_WINGDIAPI_DEFINED

View File

@ -314,6 +314,7 @@ version of GLFW.</p>
<li>[X11] Added support for the <code>GLX_EXT_swap_control</code> extension as an alternative to <code>GLX_SGI_swap_control</code></li> <li>[X11] Added support for the <code>GLX_EXT_swap_control</code> extension as an alternative to <code>GLX_SGI_swap_control</code></li>
<li>[X11] Added the POSIX <code>CLOCK_MONOTONIC</code> time source as the preferred method</li> <li>[X11] Added the POSIX <code>CLOCK_MONOTONIC</code> time source as the preferred method</li>
<li>[X11] Bugfix: Calling <code>glXCreateContextAttribsARB</code> with an unavailable OpenGL version caused the application to terminate with a <code>BadMatch</code> Xlib error</li> <li>[X11] Bugfix: Calling <code>glXCreateContextAttribsARB</code> with an unavailable OpenGL version caused the application to terminate with a <code>BadMatch</code> Xlib error</li>
<li>[X11] Bugfix: A synchronization point necessary for jitter-free locked cursor mode was incorrectly removed</li>
<li>[Win32] Removed explicit support for versions of Windows older than Windows XP</li> <li>[Win32] Removed explicit support for versions of Windows older than Windows XP</li>
<li>[Win32] Bugfix: Window activation and iconification did not work as expected</li> <li>[Win32] Bugfix: Window activation and iconification did not work as expected</li>
<li>[Win32] Bugfix: Software rasterizer pixel formats were not discarded by the WGL_ARB_pixel_format code path</li> <li>[Win32] Bugfix: Software rasterizer pixel formats were not discarded by the WGL_ARB_pixel_format code path</li>

View File

@ -48,13 +48,11 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
CGGammaValue red[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue red[GLFW_GAMMA_RAMP_SIZE];
CGGammaValue green[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue green[GLFW_GAMMA_RAMP_SIZE];
CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE];
// For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE // For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE
// i.e. 256. I don't think anyone would want to change the gamma on
// Mac anyway...
if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE) if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE)
return; return;
CGGetDisplayTransferByTable(CGMainDisplayID(), GLFW_GAMMA_RAMP_SIZE, red, green, blue, CGGetDisplayTransferByTable(CGMainDisplayID(), GLFW_GAMMA_RAMP_SIZE, red, green, blue,
&sampleCount); &sampleCount);
@ -78,13 +76,11 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
CGGammaValue red[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue red[GLFW_GAMMA_RAMP_SIZE];
CGGammaValue green[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue green[GLFW_GAMMA_RAMP_SIZE];
CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE]; CGGammaValue blue[GLFW_GAMMA_RAMP_SIZE];
// For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE // For now, don't support anything that is not GLFW_GAMMA_RAMP_SIZE
// i.e. 256. I don't think anyone would want to change the gamma on
// Mac anyway...
if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE) if (_glfwLibrary.originalRampSize != GLFW_GAMMA_RAMP_SIZE)
return; return;
// Convert to float & take the difference of the original gamma and // Convert to float & take the difference of the original gamma and
// the linear function. // the linear function.
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
@ -93,6 +89,7 @@ void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
green[i] = ramp->green[i] / 65535.f; green[i] = ramp->green[i] / 65535.f;
blue[i] = ramp->blue[i] / 65535.f; blue[i] = ramp->blue[i] / 65535.f;
} }
CGSetDisplayTransferByTable(CGMainDisplayID(), GLFW_GAMMA_RAMP_SIZE, red, green, blue); CGSetDisplayTransferByTable(CGMainDisplayID(), GLFW_GAMMA_RAMP_SIZE, red, green, blue);
} }

View File

@ -261,7 +261,7 @@ int _glfwPlatformTerminate(void)
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)
{ {
const char* version = "GLFW " _GLFW_VERSION_FULL " Cocoa"; const char* version = _GLFW_VERSION_FULL " Cocoa";
return version; return version;
} }

View File

@ -117,6 +117,7 @@ GLFWAPI const char* glfwErrorString(int error)
//======================================================================== //========================================================================
// Sets the callback function for GLFW errors // Sets the callback function for GLFW errors
// This function may be called without GLFW having been initialized
//======================================================================== //========================================================================
GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun) GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun)

View File

@ -209,7 +209,7 @@ int _glfwPlatformTerminate(void)
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)
{ {
const char* version = "GLFW " _GLFW_VERSION_FULL const char* version = _GLFW_VERSION_FULL
#if defined(__MINGW32__) #if defined(__MINGW32__)
" MinGW" " MinGW"
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)

View File

@ -40,6 +40,11 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (to
// correctly declare a GL_ARB_debug_output callback, for example) but windows.h
// thinks it is the only one that gets to do so
#undef APIENTRY
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
#include <Dbt.h> #include <Dbt.h>

View File

@ -366,7 +366,7 @@ static void updateKeyCodeLUT(void)
static GLboolean initDisplay(void) static GLboolean initDisplay(void)
{ {
_glfwLibrary.X11.display = XOpenDisplay(0); _glfwLibrary.X11.display = XOpenDisplay(NULL);
if (!_glfwLibrary.X11.display) if (!_glfwLibrary.X11.display)
{ {
_glfwSetError(GLFW_OPENGL_UNAVAILABLE, "X11/GLX: Failed to open X display"); _glfwSetError(GLFW_OPENGL_UNAVAILABLE, "X11/GLX: Failed to open X display");
@ -624,7 +624,7 @@ int _glfwPlatformTerminate(void)
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)
{ {
const char* version = "GLFW " _GLFW_VERSION_FULL const char* version = _GLFW_VERSION_FULL
#if defined(_GLFW_HAS_XRANDR) #if defined(_GLFW_HAS_XRANDR)
" XRandR" " XRandR"
#endif #endif
@ -634,6 +634,9 @@ const char* _glfwPlatformGetVersionString(void)
#if !defined(_GLFW_HAS_XRANDR) && !defined(_GLFW_HAS_XF86VIDMODE) #if !defined(_GLFW_HAS_XRANDR) && !defined(_GLFW_HAS_XF86VIDMODE)
" no-mode-switching-support" " no-mode-switching-support"
#endif #endif
#if defined(_GLFW_HAS_XKB)
" Xkb"
#endif
#if defined(_GLFW_HAS_GLXGETPROCADDRESS) #if defined(_GLFW_HAS_GLXGETPROCADDRESS)
" glXGetProcAddress" " glXGetProcAddress"
#elif defined(_GLFW_HAS_GLXGETPROCADDRESSARB) #elif defined(_GLFW_HAS_GLXGETPROCADDRESSARB)

View File

@ -1736,6 +1736,11 @@ void _glfwPlatformPollEvents(void)
window->width / 2, window->width / 2,
window->height / 2); window->height / 2);
window->X11.cursorCentered = GL_TRUE; window->X11.cursorCentered = GL_TRUE;
// NOTE: This is a temporary fix. It works as long as you use
// offsets accumulated over the course of a frame, instead of
// performing the necessary actions per callback call.
XFlush( _glfwLibrary.X11.display );
} }
} }
} }