mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
Merge branch 'master' into cursor-enter-leave
This commit is contained in:
+37
-52
@@ -1,69 +1,54 @@
|
||||
|
||||
if(UNIX)
|
||||
if (_GLFW_HAS_XRANDR)
|
||||
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr")
|
||||
endif()
|
||||
if (_GLFW_HAS_XF86VIDMODE)
|
||||
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm")
|
||||
endif()
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig)
|
||||
endif()
|
||||
|
||||
include_directories(${GLFW_SOURCE_DIR}/src
|
||||
${GLFW_BINARY_DIR}/src
|
||||
${GLFW_INCLUDE_DIR})
|
||||
${glfw_INCLUDE_DIRS})
|
||||
|
||||
set(common_SOURCES error.c fullscreen.c gamma.c init.c input.c
|
||||
joystick.c opengl.c time.c window.c)
|
||||
|
||||
if(_GLFW_COCOA_NSGL)
|
||||
set(libglfw_SOURCES ${common_SOURCES} cocoa_fullscreen.m cocoa_gamma.c
|
||||
cocoa_init.m cocoa_input.m cocoa_joystick.m
|
||||
cocoa_opengl.m cocoa_time.c cocoa_window.m)
|
||||
if (_GLFW_COCOA_NSGL)
|
||||
set(glfw_SOURCES ${common_SOURCES} cocoa_fullscreen.m cocoa_gamma.c
|
||||
cocoa_init.m cocoa_input.m cocoa_joystick.m
|
||||
cocoa_opengl.m cocoa_time.c cocoa_window.m)
|
||||
|
||||
# For some reason, CMake doesn't know about .m
|
||||
set_source_files_properties(${libglfw_SOURCES} PROPERTIES LANGUAGE C)
|
||||
elseif(_GLFW_WIN32_WGL)
|
||||
set(libglfw_SOURCES ${common_SOURCES} win32_fullscreen.c win32_gamma.c
|
||||
win32_init.c win32_input.c win32_joystick.c
|
||||
win32_opengl.c win32_time.c win32_window.c
|
||||
win32_dllmain.c)
|
||||
elseif(_GLFW_X11_GLX)
|
||||
set(libglfw_SOURCES ${common_SOURCES} x11_fullscreen.c x11_gamma.c
|
||||
x11_init.c x11_input.c x11_joystick.c
|
||||
x11_keysym2unicode.c x11_opengl.c x11_time.c
|
||||
x11_window.c)
|
||||
else()
|
||||
message(FATAL_ERROR "No supported platform was selected")
|
||||
set_source_files_properties(${glfw_SOURCES} PROPERTIES LANGUAGE C)
|
||||
elseif (_GLFW_WIN32_WGL)
|
||||
set(glfw_SOURCES ${common_SOURCES} win32_fullscreen.c win32_gamma.c
|
||||
win32_init.c win32_input.c win32_joystick.c
|
||||
win32_opengl.c win32_time.c win32_window.c
|
||||
win32_dllmain.c)
|
||||
elseif (_GLFW_X11_GLX)
|
||||
set(glfw_SOURCES ${common_SOURCES} x11_fullscreen.c x11_gamma.c
|
||||
x11_init.c x11_input.c x11_joystick.c
|
||||
x11_keysym2unicode.c x11_opengl.c x11_time.c
|
||||
x11_window.c)
|
||||
endif()
|
||||
|
||||
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)
|
||||
add_library(glfw ${glfw_SOURCES})
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(libglfwShared winmm)
|
||||
# The GLFW DLL needs a special compile-time macro and import library name
|
||||
set_target_properties(libglfwShared PROPERTIES
|
||||
COMPILE_DEFINITIONS "GLFW_BUILD_DLL;_GLFW_NO_DLOAD_GDI32;_GLFW_NO_DLOAD_WINMM"
|
||||
PREFIX ""
|
||||
IMPORT_PREFIX ""
|
||||
IMPORT_SUFFIX "dll.lib")
|
||||
endif()
|
||||
if (BUILD_SHARED_LIBS)
|
||||
|
||||
if(APPLE)
|
||||
# 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 "")
|
||||
if (_GLFW_WIN32_WGL)
|
||||
# The GLFW DLL needs a special compile-time macro and import library name
|
||||
set_target_properties(glfw PROPERTIES
|
||||
COMPILE_DEFINITIONS "_GLFW_BUILD_DLL;_GLFW_NO_DLOAD_GDI32;_GLFW_NO_DLOAD_WINMM"
|
||||
PREFIX ""
|
||||
IMPORT_PREFIX ""
|
||||
IMPORT_SUFFIX "dll.lib")
|
||||
elseif (_GLFW_COCOA_NSGL)
|
||||
# Append -fno-common to the compile flags to work around a bug in the Apple GCC
|
||||
get_target_property(glfw_CFLAGS glfw COMPILE_FLAGS)
|
||||
if (NOT glfw_CFLAGS)
|
||||
set(glfw_CFLAGS "")
|
||||
endif()
|
||||
set_target_properties(glfw PROPERTIES
|
||||
COMPILE_FLAGS "${glfw_CFLAGS} -fno-common")
|
||||
endif()
|
||||
set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common")
|
||||
|
||||
target_link_libraries(glfw ${glfw_LIBRARIES})
|
||||
target_link_libraries(glfw LINK_INTERFACE_LIBRARIES)
|
||||
endif()
|
||||
|
||||
install(TARGETS libglfwStatic libglfwShared DESTINATION lib)
|
||||
install(TARGETS glfw DESTINATION lib)
|
||||
|
||||
|
||||
+1
-1
@@ -728,7 +728,7 @@ static GLboolean createContext(_GLFWwindow* window,
|
||||
#define ADD_ATTR2(x, y) { ADD_ATTR(x); ADD_ATTR(y); }
|
||||
|
||||
// Arbitrary array size here
|
||||
NSOpenGLPixelFormatAttribute attributes[24];
|
||||
NSOpenGLPixelFormatAttribute attributes[40];
|
||||
|
||||
ADD_ATTR(NSOpenGLPFADoubleBuffer);
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@ libdir=${exec_prefix}/lib
|
||||
|
||||
Name: GLFW
|
||||
Description: A portable library for OpenGL, window and input
|
||||
Version: 3.0.0
|
||||
Version: @GLFW_VERSION_FULL@
|
||||
URL: http://www.glfw.org/
|
||||
Requires.private: gl x11 @GLFW_PKGLIBS@
|
||||
Libs: -L${libdir} -lglfw
|
||||
Requires.private: @GLFW_PKG_DEPS@
|
||||
Libs: -L${libdir} -lglfw
|
||||
Libs.private: @GLFW_PKG_LIBS@
|
||||
Cflags: -I${includedir}
|
||||
+2
-2
@@ -31,7 +31,7 @@
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#if defined(GLFW_BUILD_DLL)
|
||||
#if defined(_GLFW_BUILD_DLL)
|
||||
|
||||
//========================================================================
|
||||
// GLFW DLL entry point
|
||||
@@ -45,5 +45,5 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // GLFW_BUILD_DLL
|
||||
#endif // _GLFW_BUILD_DLL
|
||||
|
||||
|
||||
+3
-3
@@ -200,7 +200,7 @@ int _glfwPlatformInit(void)
|
||||
// as possible in the hope of still being the foreground process)
|
||||
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
|
||||
&_glfwLibrary.Win32.foregroundLockTimeout, 0);
|
||||
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID) 0,
|
||||
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0),
|
||||
SPIF_SENDCHANGE);
|
||||
|
||||
if (!initLibraries())
|
||||
@@ -246,7 +246,7 @@ int _glfwPlatformTerminate(void)
|
||||
|
||||
// Restore previous FOREGROUNDLOCKTIMEOUT system setting
|
||||
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
|
||||
(LPVOID) _glfwLibrary.Win32.foregroundLockTimeout,
|
||||
UIntToPtr(_glfwLibrary.Win32.foregroundLockTimeout),
|
||||
SPIF_SENDCHANGE);
|
||||
|
||||
return GL_TRUE;
|
||||
@@ -271,7 +271,7 @@ const char* _glfwPlatformGetVersionString(void)
|
||||
#else
|
||||
" (unknown compiler)"
|
||||
#endif
|
||||
#if defined(GLFW_BUILD_DLL)
|
||||
#if defined(_GLFW_BUILD_DLL)
|
||||
" DLL"
|
||||
#endif
|
||||
#if !defined(_GLFW_NO_DLOAD_GDI32)
|
||||
|
||||
@@ -51,7 +51,9 @@
|
||||
#endif
|
||||
|
||||
// GLFW requires Windows XP
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x0501
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
+1
-45
@@ -34,30 +34,6 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Convert BPP to RGB bits based on "best guess"
|
||||
//========================================================================
|
||||
|
||||
static void bpp2rgb(int bpp, int* r, int* g, int* b)
|
||||
{
|
||||
int delta;
|
||||
|
||||
// We assume that by 32 they really meant 24
|
||||
if (bpp == 32)
|
||||
bpp = 24;
|
||||
|
||||
// Convert "bits per pixel" to red, green & blue sizes
|
||||
|
||||
*r = *g = *b = bpp / 3;
|
||||
delta = bpp - (*r * 3);
|
||||
if (delta >= 1)
|
||||
*g = *g + 1;
|
||||
|
||||
if (delta == 2)
|
||||
*r = *r + 1;
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Enable/disable minimize/restore animations
|
||||
//========================================================================
|
||||
@@ -1620,29 +1596,10 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
||||
|
||||
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
{
|
||||
//int bpp, refresh;
|
||||
int newMode = 0;
|
||||
GLboolean sizeChanged = GL_FALSE;
|
||||
|
||||
if (window->mode == GLFW_FULLSCREEN)
|
||||
{
|
||||
// Get some info about the current mode
|
||||
|
||||
DEVMODE dm;
|
||||
|
||||
dm.dmSize = sizeof(DEVMODE);
|
||||
//if (EnumDisplaySettings(NULL, window->Win32.modeID, &dm))
|
||||
//{
|
||||
// We need to keep BPP the same for the OpenGL context to keep working
|
||||
//bpp = dm.dmBitsPerPel;
|
||||
|
||||
// Get closest match for target video mode
|
||||
//refresh = window->Win32.desiredRefreshRate;
|
||||
//newMode = _glfwGetClosestVideoModeBPP(&width, &height, &bpp, &refresh);
|
||||
//}
|
||||
//else
|
||||
//newMode = window->Win32.modeID;
|
||||
|
||||
if (width > window->width || height > window->height)
|
||||
{
|
||||
// The new video mode is larger than the current one, so we resize
|
||||
@@ -1654,8 +1611,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
sizeChanged = GL_TRUE;
|
||||
}
|
||||
|
||||
//if (newMode != window->Win32.modeID)
|
||||
//_glfwSetVideoModeMODE(newMode);
|
||||
// TODO: Change video mode
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -323,7 +323,7 @@ struct _glfwResolution
|
||||
int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
||||
{
|
||||
int count, k, l, r, g, b, rgba, gl;
|
||||
int depth, screen;
|
||||
int depth, screen = DefaultScreen(_glfwLibrary.X11.display);
|
||||
XVisualInfo* vislist;
|
||||
XVisualInfo dummy;
|
||||
int viscount, rgbcount, rescount;
|
||||
|
||||
+2
-2
@@ -470,8 +470,8 @@ static void initGammaRamp(void)
|
||||
// RandR gamma support is only available with version 1.2 and above
|
||||
if (_glfwLibrary.X11.RandR.available &&
|
||||
(_glfwLibrary.X11.RandR.majorVersion > 1 ||
|
||||
_glfwLibrary.X11.RandR.majorVersion == 1 &&
|
||||
_glfwLibrary.X11.RandR.minorVersion >= 2))
|
||||
(_glfwLibrary.X11.RandR.majorVersion == 1 &&
|
||||
_glfwLibrary.X11.RandR.minorVersion >= 2)))
|
||||
{
|
||||
// FIXME: Assumes that all monitors have the same size gamma tables
|
||||
// This is reasonable as I suspect the that if they did differ, it
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user