Merge fix.

This commit is contained in:
Camilla Berglund
2010-10-24 23:41:34 +02:00
36 changed files with 656 additions and 830 deletions
+14 -19
View File
@@ -1,42 +1,37 @@
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${GLFW_SOURCE_DIR}/src
${GLFW_BINARY_DIR}/src
${GLFW_INCLUDE_DIR})
set(cocoa_SOURCES
cocoa_enable.m
cocoa_fullscreen.m
cocoa_gamma.m
cocoa_glext.m
cocoa_init.m
cocoa_joystick.m
cocoa_time.m
cocoa_window.m)
set(cocoa_SOURCES cocoa_enable.m
cocoa_fullscreen.m
cocoa_gamma.m
cocoa_glext.m
cocoa_init.m
cocoa_joystick.m
cocoa_time.m
cocoa_window.m)
# For some reason, CMake doesn't know about .m
set_source_files_properties(${cocoa_SOURCES} PROPERTIES LANGUAGE C)
set(libglfw_SOURCES
${common_SOURCES}
${cocoa_SOURCES})
set(libglfw_SOURCES ${common_SOURCES} ${cocoa_SOURCES})
add_library(libglfwStatic STATIC ${libglfw_SOURCES})
add_library(libglfwShared SHARED ${libglfw_SOURCES})
target_link_libraries(libglfwShared ${GLFW_LIBRARIES})
set_target_properties(libglfwStatic libglfwShared PROPERTIES
CLEAN_DIRECT_OUTPUT 1
OUTPUT_NAME glfw
)
CLEAN_DIRECT_OUTPUT 1
OUTPUT_NAME glfw)
# Append -fno-common to the compile flags to work around a bug in the Apple GCC
get_target_property(CFLAGS libglfwShared COMPILE_FLAGS)
if(NOT CFLAGS)
set(CFLAGS "")
set(CFLAGS "")
endif(NOT CFLAGS)
set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common")
+8 -8
View File
@@ -70,8 +70,8 @@
window->width = contentRect.size.width;
window->height = contentRect.size.height;
if (window->windowSizeCallback)
window->windowSizeCallback(window, window->width, window->height);
if (_glfwLibrary.windowSizeCallback)
_glfwLibrary.windowSizeCallback(window, window->width, window->height);
}
- (void)windowDidMove:(NSNotification *)notification
@@ -95,16 +95,16 @@
{
window->iconified = GL_TRUE;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
if (_glfwLibrary.windowIconifyCallback)
_glfwLibrary.windowIconifyCallback(window, window->iconified);
}
- (void)windowDidDeminiaturize:(NSNotification *)notification
{
window->iconified = GL_FALSE;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
if (_glfwLibrary.windowIconifyCallback)
_glfwLibrary.windowIconifyCallback(window, window->iconified);
}
- (void)windowDidBecomeKey:(NSNotification *)notification
@@ -362,8 +362,8 @@ static int convertMacKeyCode(unsigned int macKeyCode)
window->mousePosY = [[window->NS.window contentView] bounds].size.height - p.y;
}
if (window->mousePosCallback)
window->mousePosCallback(window, window->mousePosX, window->mousePosY);
if (_glfwLibrary.mousePosCallback)
_glfwLibrary.mousePosCallback(window, window->mousePosX, window->mousePosY);
}
- (void)rightMouseDown:(NSEvent *)event
+4 -4
View File
@@ -54,11 +54,11 @@ static void enableMouseCursor(_GLFWwindow* window)
window->mousePosX = centerPosX;
window->mousePosY = centerPosY;
if (window->mousePosCallback)
if (_glfwLibrary.mousePosCallback)
{
window->mousePosCallback(window,
window->mousePosX,
window->mousePosY);
_glfwLibrary.mousePosCallback(window,
window->mousePosX,
window->mousePosY);
}
}
+1 -1
View File
@@ -82,7 +82,7 @@ GLFWAPI void glfwSetGammaFormula(float gamma, float blacklevel, float gain)
//========================================================================
// Return the currently set gamma ramp
// Return the cached currently set gamma ramp
//========================================================================
GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp)
+16 -16
View File
@@ -171,7 +171,7 @@ GLFWAPI void glfwGetScrollOffset(GLFWwindow window, int* x, int* y)
// Set callback function for keyboard input
//========================================================================
GLFWAPI void glfwSetKeyCallback(GLFWwindow window, GLFWkeyfun cbfun)
GLFWAPI void glfwSetKeyCallback(GLFWkeyfun cbfun)
{
if (!_glfwInitialized)
{
@@ -179,7 +179,7 @@ GLFWAPI void glfwSetKeyCallback(GLFWwindow window, GLFWkeyfun cbfun)
return;
}
window->keyCallback = cbfun;
_glfwLibrary.keyCallback = cbfun;
}
@@ -187,7 +187,7 @@ GLFWAPI void glfwSetKeyCallback(GLFWwindow window, GLFWkeyfun cbfun)
// Set callback function for character input
//========================================================================
GLFWAPI void glfwSetCharCallback(GLFWwindow window, GLFWcharfun cbfun)
GLFWAPI void glfwSetCharCallback(GLFWcharfun cbfun)
{
if (!_glfwInitialized)
{
@@ -195,7 +195,7 @@ GLFWAPI void glfwSetCharCallback(GLFWwindow window, GLFWcharfun cbfun)
return;
}
window->charCallback = cbfun;
_glfwLibrary.charCallback = cbfun;
}
@@ -203,7 +203,7 @@ GLFWAPI void glfwSetCharCallback(GLFWwindow window, GLFWcharfun cbfun)
// Set callback function for mouse clicks
//========================================================================
GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow window, GLFWmousebuttonfun cbfun)
GLFWAPI void glfwSetMouseButtonCallback(GLFWmousebuttonfun cbfun)
{
if (!_glfwInitialized)
{
@@ -211,7 +211,7 @@ GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow window, GLFWmousebuttonfun cb
return;
}
window->mouseButtonCallback = cbfun;
_glfwLibrary.mouseButtonCallback = cbfun;
}
@@ -219,7 +219,7 @@ GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow window, GLFWmousebuttonfun cb
// Set callback function for mouse moves
//========================================================================
GLFWAPI void glfwSetMousePosCallback(GLFWwindow window, GLFWmouseposfun cbfun)
GLFWAPI void glfwSetMousePosCallback(GLFWmouseposfun cbfun)
{
if (!_glfwInitialized)
{
@@ -228,12 +228,17 @@ GLFWAPI void glfwSetMousePosCallback(GLFWwindow window, GLFWmouseposfun cbfun)
}
// Set callback function
window->mousePosCallback = cbfun;
_glfwLibrary.mousePosCallback = cbfun;
// Call the callback function to let the application know the current
// mouse position
if (cbfun)
cbfun(window, window->mousePosX, window->mousePosY);
{
_GLFWwindow* window;
for (window = _glfwLibrary.windowListHead; window; window = window->next)
cbfun(window, window->mousePosX, window->mousePosY);
}
}
@@ -241,7 +246,7 @@ GLFWAPI void glfwSetMousePosCallback(GLFWwindow window, GLFWmouseposfun cbfun)
// Set callback function for scroll events
//========================================================================
GLFWAPI void glfwSetScrollCallback(GLFWwindow window, GLFWscrollfun cbfun)
GLFWAPI void glfwSetScrollCallback(GLFWscrollfun cbfun)
{
if (!_glfwInitialized)
{
@@ -250,11 +255,6 @@ GLFWAPI void glfwSetScrollCallback(GLFWwindow window, GLFWscrollfun cbfun)
}
// Set callback function
window->scrollCallback = cbfun;
// Call the callback function to let the application know the current
// scroll offset
if (cbfun)
cbfun(window, window->scrollX, window->scrollY);
_glfwLibrary.scrollCallback = cbfun;
}
+11 -12
View File
@@ -152,18 +152,6 @@ struct _GLFWwindow
{
struct _GLFWwindow* next;
// User callback functions
GLFWwindowsizefun windowSizeCallback;
GLFWwindowclosefun windowCloseCallback;
GLFWwindowrefreshfun windowRefreshCallback;
GLFWwindowfocusfun windowFocusCallback;
GLFWwindowiconifyfun windowIconifyCallback;
GLFWmousebuttonfun mouseButtonCallback;
GLFWmouseposfun mousePosCallback;
GLFWscrollfun scrollCallback;
GLFWkeyfun keyCallback;
GLFWcharfun charCallback;
// Window settings and state
GLboolean iconified; // GL_TRUE if this window is iconified
GLboolean closeRequested; // GL_TRUE if this window should be closed
@@ -223,6 +211,17 @@ struct _GLFWlibrary
_GLFWwindow* activeWindow;
_GLFWwindow* cursorLockWindow;
GLFWwindowsizefun windowSizeCallback;
GLFWwindowclosefun windowCloseCallback;
GLFWwindowrefreshfun windowRefreshCallback;
GLFWwindowfocusfun windowFocusCallback;
GLFWwindowiconifyfun windowIconifyCallback;
GLFWmousebuttonfun mouseButtonCallback;
GLFWmouseposfun mousePosCallback;
GLFWscrollfun scrollCallback;
GLFWkeyfun keyCallback;
GLFWcharfun charCallback;
GLFWgammaramp currentRamp;
GLFWgammaramp originalRamp;
int originalRampSize;
+22 -22
View File
@@ -1,8 +1,8 @@
if(CYGWIN)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
# These lines are intended to remove the --export-all-symbols
# flag added in the Modules/Platform/CYGWIN.cmake file of the
@@ -19,36 +19,36 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${GLFW_BINARY_DIR}/src
${GLFW_INCLUDE_DIR})
set(libglfw_SOURCES
${common_SOURCES}
win32_enable.c
win32_fullscreen.c
win32_gamma.c
win32_glext.c
win32_init.c
win32_joystick.c
win32_time.c
win32_window.c
win32_dllmain.c)
set(libglfw_SOURCES ${common_SOURCES}
win32_enable.c
win32_fullscreen.c
win32_gamma.c
win32_glext.c
win32_init.c
win32_joystick.c
win32_time.c
win32_window.c
win32_dllmain.c)
add_library(libglfwStatic STATIC ${libglfw_SOURCES})
add_library(libglfwShared SHARED ${libglfw_SOURCES})
target_link_libraries(libglfwShared ${OPENGL_gl_LIBRARY})
set_target_properties(libglfwShared PROPERTIES
DEFINE_SYMBOL GLFW_BUILD_DLL
PREFIX ""
IMPORT_PREFIX ""
IMPORT_SUFFIX "dll.lib")
DEFINE_SYMBOL GLFW_BUILD_DLL
PREFIX ""
IMPORT_PREFIX ""
IMPORT_SUFFIX "dll.lib")
set_target_properties(libglfwStatic libglfwShared PROPERTIES
CLEAN_DIRECT_OUTPUT 1
OUTPUT_NAME glfw)
CLEAN_DIRECT_OUTPUT 1
OUTPUT_NAME glfw)
if(CYGWIN)
# Build for the regular Win32 environment (not Cygwin)
set_target_properties(libglfwStatic libglfwShared PROPERTIES COMPILE_FLAGS "-mwin32 -mno-cygwin")
set_target_properties(libglfwStatic libglfwShared PROPERTIES LINK_FLAGS "-mwin32 -mno-cygwin")
set_target_properties(libglfwStatic libglfwShared PROPERTIES
COMPILE_FLAGS "-mwin32 -mno-cygwin"
LINK_FLAGS "-mwin32 -mno-cygwin")
endif(CYGWIN)
install(TARGETS libglfwStatic libglfwShared DESTINATION lib)
-1
View File
@@ -270,7 +270,6 @@ typedef struct _GLFWlibraryWin32
ATOM classAtom; // Window class atom
HHOOK keyboardHook; // Keyboard hook handle
DWORD foregroundLockTimeout;
HDC desktopDC;
// Default monitor
struct {
+12 -22
View File
@@ -1,11 +1,10 @@
//========================================================================
// GLFW - An OpenGL framework
// Platform: Win32/WGL
// API version: 2.7
// API version: 3.0
// WWW: http://www.glfw.org/
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
@@ -33,35 +32,26 @@
#include <limits.h>
//************************************************************************
//**** GLFW internal functions ****
//************************************************************************
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
//========================================================================
// Save the gamma ramp to our internal copy
// Retrieve the currently set gamma ramp
//========================================================================
void _glfwPlatformSaveGammaRamp(int ramp)
void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
{
if (!_glfwLibrary.gammaSize)
{
return;
}
_glfw_GetDeviceGammaRamp(_glfwLibrary.Win32.desktopDC,
_glfwLibrary.gammaRamp[ramp]);
_glfw_GetDeviceGammaRamp(GetDC(GetDesktopWindow()), (WORD*) ramp);
}
//========================================================================
// Restore the gamma ramp to our internal copy of the gamma ramp
// Push the specified gamma ramp to the monitor
//========================================================================
void _glfwPlatformRestoreGammaRamp(int ramp)
void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
{
if (!_glfwLibrary.gammaSize)
{
return;
}
_glfw_SetDeviceGammaRamp(_glfwLibrary.Win32.desktopDC,
_glfwLibrary.gammaRamp[ramp]);
_glfw_SetDeviceGammaRamp(GetDC(GetDesktopWindow()), (WORD*) ramp);
}
+3 -16
View File
@@ -160,18 +160,9 @@ int _glfwPlatformInit(void)
_glfwLibrary.Win32.instance = GetModuleHandle(NULL);
// Initialise the internal gamma ramp
_glfwLibrary.gammaSize = 256;
_glfwLibrary.gammaRamp[GLFW_GAMMA_ORIG] =
malloc(256 * sizeof(unsigned short) * 3);
_glfwLibrary.gammaRamp[GLFW_GAMMA_CURR] =
malloc(256 * sizeof(unsigned short) * 3);
// Get the desktop DC
_glfwLibrary.Win32.desktopDC = GetDC(GetDesktopWindow());
// Save the original gamma ramp
_glfwPlatformSaveGammaRamp(GLFW_GAMMA_ORIG);
_glfwLibrary.originalRampSize = 256;
_glfwPlatformGetGammaRamp(&_glfwLibrary.originalRamp);
_glfwInitTimer();
@@ -186,11 +177,7 @@ int _glfwPlatformInit(void)
int _glfwPlatformTerminate(void)
{
// Restore the original gamma ramp
_glfwPlatformRestoreGammaRamp(GLFW_GAMMA_ORIG);
// Free the gamma ramps
free(_glfwLibrary.gammaRamp[GLFW_GAMMA_ORIG]);
free(_glfwLibrary.gammaRamp[GLFW_GAMMA_CURR]);
_glfwPlatformSetGammaRamp(&_glfwLibrary.originalRamp);
if (_glfwLibrary.Win32.classAtom)
{
+11 -11
View File
@@ -713,8 +713,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
{
window->iconified = iconified;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
if (_glfwLibrary.windowIconifyCallback)
_glfwLibrary.windowIconifyCallback(window, window->iconified);
}
return 0;
@@ -756,7 +756,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
{
_glfwInputKey(window, translateKey(wParam, lParam), GLFW_PRESS);
if (window->charCallback)
if (_glfwLibrary.charCallback)
translateChar(window, (DWORD) wParam, (DWORD) lParam);
return 0;
@@ -879,11 +879,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
window->Win32.oldMouseY = newMouseY;
window->Win32.mouseMoved = GL_TRUE;
if (window->mousePosCallback)
if (_glfwLibrary.mousePosCallback)
{
window->mousePosCallback(window,
window->mousePosX,
window->mousePosY);
_glfwLibrary.mousePosCallback(window,
window->mousePosX,
window->mousePosY);
}
}
@@ -917,8 +917,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
ClipCursor(&ClipWindowRect);
}
if (window->windowSizeCallback)
window->windowSizeCallback(window, window->width, window->height);
if (_glfwLibrary.windowSizeCallback)
_glfwLibrary.windowSizeCallback(window, window->width, window->height);
return 0;
}
@@ -941,8 +941,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
// Was the window contents damaged?
case WM_PAINT:
{
if (window->windowRefreshCallback)
window->windowRefreshCallback(window);
if (_glfwLibrary.windowRefreshCallback)
_glfwLibrary.windowRefreshCallback(window);
break;
}
+30 -25
View File
@@ -55,8 +55,8 @@ static void closeFlaggedWindows(void)
for (window = _glfwLibrary.windowListHead; window; )
{
if (window->closeRequested && window->windowCloseCallback)
window->closeRequested = window->windowCloseCallback(window);
if (window->closeRequested && _glfwLibrary.windowCloseCallback)
window->closeRequested = _glfwLibrary.windowCloseCallback(window);
if (window->closeRequested)
{
@@ -144,8 +144,8 @@ void _glfwInputKey(_GLFWwindow* window, int key, int action)
}
// Call user callback function
if (window->keyCallback && (window->keyRepeat || !keyrepeat))
window->keyCallback(window, key, action);
if (_glfwLibrary.keyCallback && (window->keyRepeat || !keyrepeat))
_glfwLibrary.keyCallback(window, key, action);
}
@@ -159,8 +159,8 @@ void _glfwInputChar(_GLFWwindow* window, int character)
if (!((character >= 32 && character <= 126) || character >= 160))
return;
if (window->charCallback)
window->charCallback(window, character);
if (_glfwLibrary.charCallback)
_glfwLibrary.charCallback(window, character);
}
@@ -173,8 +173,8 @@ void _glfwInputScroll(_GLFWwindow* window, int x, int y)
window->scrollX += x;
window->scrollY += y;
if (window->scrollCallback)
window->scrollCallback(window, x, y);
if (_glfwLibrary.scrollCallback)
_glfwLibrary.scrollCallback(window, x, y);
}
@@ -193,8 +193,8 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action)
else
window->mouseButton[button] = (char) action;
if (window->mouseButtonCallback)
window->mouseButtonCallback(window, button, action);
if (_glfwLibrary.mouseButtonCallback)
_glfwLibrary.mouseButtonCallback(window, button, action);
}
@@ -210,8 +210,8 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean activated)
{
_glfwLibrary.activeWindow = window;
if (window->windowFocusCallback)
window->windowFocusCallback(window, activated);
if (_glfwLibrary.windowFocusCallback)
_glfwLibrary.windowFocusCallback(window, activated);
}
}
else
@@ -236,8 +236,8 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean activated)
_glfwLibrary.activeWindow = NULL;
if (window->windowFocusCallback)
window->windowFocusCallback(window, activated);
if (_glfwLibrary.windowFocusCallback)
_glfwLibrary.windowFocusCallback(window, activated);
}
}
}
@@ -1076,7 +1076,7 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window)
// Set callback function for window size changes
//========================================================================
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfun)
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindowsizefun cbfun)
{
if (!_glfwInitialized)
{
@@ -1084,19 +1084,24 @@ GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfu
return;
}
window->windowSizeCallback = cbfun;
_glfwLibrary.windowSizeCallback = cbfun;
// Call the callback function to let the application know the current
// window size
if (cbfun)
cbfun(window, window->width, window->height);
{
_GLFWwindow* window;
for (window = _glfwLibrary.windowListHead; window; window = window->next)
cbfun(window, window->width, window->height);
}
}
//========================================================================
// Set callback function for window close events
//========================================================================
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cbfun)
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindowclosefun cbfun)
{
if (!_glfwInitialized)
{
@@ -1104,7 +1109,7 @@ GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cb
return;
}
window->windowCloseCallback = cbfun;
_glfwLibrary.windowCloseCallback = cbfun;
}
@@ -1112,7 +1117,7 @@ GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cb
// Set callback function for window refresh events
//========================================================================
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfun cbfun)
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindowrefreshfun cbfun)
{
if (!_glfwInitialized)
{
@@ -1120,7 +1125,7 @@ GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfu
return;
}
window->windowRefreshCallback = cbfun;
_glfwLibrary.windowRefreshCallback = cbfun;
}
@@ -1128,7 +1133,7 @@ GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfu
// Set callback function for window focus events
//========================================================================
GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cbfun)
GLFWAPI void glfwSetWindowFocusCallback(GLFWwindowfocusfun cbfun)
{
if (!_glfwInitialized)
{
@@ -1136,7 +1141,7 @@ GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cb
return;
}
window->windowFocusCallback = cbfun;
_glfwLibrary.windowFocusCallback = cbfun;
}
@@ -1144,7 +1149,7 @@ GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cb
// Set callback function for window iconification events
//========================================================================
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow window, GLFWwindowiconifyfun cbfun)
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindowiconifyfun cbfun)
{
if (!_glfwInitialized)
{
@@ -1152,7 +1157,7 @@ GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow window, GLFWwindowiconifyfu
return;
}
window->windowIconifyCallback = cbfun;
_glfwLibrary.windowIconifyCallback = cbfun;
}
+14 -17
View File
@@ -1,32 +1,29 @@
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${GLFW_SOURCE_DIR}/src
${GLFW_BINARY_DIR}/src
${GLFW_INCLUDE_DIR})
set(libglfw_SOURCES
${common_SOURCES}
x11_enable.c
x11_fullscreen.c
x11_gamma.c
x11_glext.c
x11_init.c
x11_joystick.c
x11_keysym2unicode.c
x11_time.c
x11_window.c)
set(libglfw_SOURCES ${common_SOURCES}
x11_enable.c
x11_fullscreen.c
x11_gamma.c
x11_glext.c
x11_init.c
x11_joystick.c
x11_keysym2unicode.c
x11_time.c
x11_window.c)
add_library(libglfwStatic STATIC ${libglfw_SOURCES})
add_library(libglfwShared SHARED ${libglfw_SOURCES})
target_link_libraries(libglfwShared ${GLFW_LIBRARIES})
set_target_properties(libglfwStatic libglfwShared PROPERTIES
CLEAN_DIRECT_OUTPUT 1
OUTPUT_NAME glfw
)
CLEAN_DIRECT_OUTPUT 1
OUTPUT_NAME glfw)
install(TARGETS libglfwStatic libglfwShared DESTINATION lib)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig)
+7 -5
View File
@@ -33,12 +33,12 @@
#include <string.h>
//************************************************************************
//**** GLFW internal functions ****
//************************************************************************
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
//========================================================================
// Save the original gamma ramp so that we can restore it later
// Retrieve the currently set gamma ramp
//========================================================================
void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
@@ -55,6 +55,8 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
XRRCrtcGamma* gamma = XRRGetCrtcGamma(_glfwLibrary.X11.display,
rr->crtcs[0]);
// TODO: Handle case of original ramp size having a size other than 256
memcpy(ramp->red, gamma->red, size);
memcpy(ramp->green, gamma->green, size);
memcpy(ramp->blue, gamma->blue, size);
@@ -78,7 +80,7 @@ void _glfwPlatformGetGammaRamp(GLFWgammaramp* ramp)
//========================================================================
// Make the specified gamma ramp current
// Push the specified gamma ramp to the monitor
//========================================================================
void _glfwPlatformSetGammaRamp(const GLFWgammaramp* ramp)
+4 -4
View File
@@ -176,7 +176,7 @@ static void initGammaRamp(void)
#endif /*_GLFW_HAS_XF86VIDMODE*/
if (!_glfwLibrary.originalRampSize)
fprintf(stderr, "Gamma ramp setting unsupported\n");
fprintf(stderr, "No supported gamma ramp API found\n");
// Save the original gamma ramp
_glfwPlatformGetGammaRamp(&_glfwLibrary.originalRamp);
@@ -310,14 +310,14 @@ const char* _glfwPlatformGetVersionString(void)
#elif defined(_GLFW_HAS_GLXGETPROCADDRESSEXT)
" glXGetProcAddressEXT"
#elif defined(_GLFW_DLOPEN_LIBGL)
" dlopen(libGL)"
" dlsym(libGL)"
#else
" (no OpenGL extension support)"
#endif
#if defined(_GLFW_USE_LINUX_JOYSTICKS)
" Linux joystick API"
" Linux-joystick-API"
#else
" (no joystick support)"
" no-joystick-support"
#endif
;
+14 -14
View File
@@ -1197,11 +1197,11 @@ static void processSingleEvent(void)
window->X11.cursorPosY = event.xmotion.y;
window->X11.mouseMoved = GL_TRUE;
if (window->mousePosCallback)
if (_glfwLibrary.mousePosCallback)
{
window->mousePosCallback(window,
window->mousePosX,
window->mousePosY);
_glfwLibrary.mousePosCallback(window,
window->mousePosX,
window->mousePosY);
}
}
break;
@@ -1224,11 +1224,11 @@ static void processSingleEvent(void)
window->width = event.xconfigure.width;
window->height = event.xconfigure.height;
if (window->windowSizeCallback)
if (_glfwLibrary.windowSizeCallback)
{
window->windowSizeCallback(window,
window->width,
window->height);
_glfwLibrary.windowSizeCallback(window,
window->width,
window->height);
}
}
@@ -1288,8 +1288,8 @@ static void processSingleEvent(void)
window->iconified = GL_FALSE;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
if (_glfwLibrary.windowIconifyCallback)
_glfwLibrary.windowIconifyCallback(window, window->iconified);
break;
}
@@ -1306,8 +1306,8 @@ static void processSingleEvent(void)
window->iconified = GL_TRUE;
if (window->windowIconifyCallback)
window->windowIconifyCallback(window, window->iconified);
if (_glfwLibrary.windowIconifyCallback)
_glfwLibrary.windowIconifyCallback(window, window->iconified);
break;
}
@@ -1358,8 +1358,8 @@ static void processSingleEvent(void)
return;
}
if (window->windowRefreshCallback)
window->windowRefreshCallback(window);
if (_glfwLibrary.windowRefreshCallback)
_glfwLibrary.windowRefreshCallback(window);
break;
}