Updated glfw to version 3.1.1.

This commit is contained in:
Faerbit 2015-06-03 23:15:52 +02:00
parent 8452d18575
commit 3437ce6173
42 changed files with 551 additions and 665 deletions

38
extern/glfw/CMake/AppleInfo.plist vendored Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${APPLE_GUI_EXECUTABLE}</string>
<key>CFBundleGetInfoString</key>
<string>${APPLE_GUI_INFO_STRING}</string>
<key>CFBundleIconFile</key>
<string>${APPLE_GUI_ICON}</string>
<key>CFBundleIdentifier</key>
<string>${APPLE_GUI_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${APPLE_GUI_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${APPLE_GUI_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${APPLE_GUI_SHORT_VERSION_STRING}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${APPLE_GUI_BUNDLE_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>${APPLE_GUI_COPYRIGHT}</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

View File

@ -1,19 +0,0 @@
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "glfw" for configuration "Release"
set_property(TARGET glfw APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(glfw PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libglfw3.a"
)
list(APPEND _IMPORT_CHECK_TARGETS glfw )
list(APPEND _IMPORT_CHECK_FILES_FOR_glfw "${_IMPORT_PREFIX}/lib/libglfw3.a" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)

View File

@ -1,84 +0,0 @@
# Generated by CMake 3.1.3
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget glfw)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
endif()
if(TARGET ${_expectedTarget})
list(APPEND _targetsDefined ${_expectedTarget})
endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
# Create imported target glfw
add_library(glfw STATIC IMPORTED)
# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/glfwTargets-*.cmake")
foreach(f ${CONFIG_FILES})
include(${f})
endforeach()
# Cleanup temporary variables.
set(_IMPORT_PREFIX)
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
if(NOT EXISTS "${file}" )
message(FATAL_ERROR "The imported target \"${target}\" references the file
\"${file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)
# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)

View File

@ -10,7 +10,7 @@ endif()
set(GLFW_VERSION_MAJOR "3")
set(GLFW_VERSION_MINOR "1")
set(GLFW_VERSION_PATCH "0")
set(GLFW_VERSION_PATCH "1")
set(GLFW_VERSION_EXTRA "")
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
@ -273,33 +273,33 @@ if (_GLFW_X11)
list(APPEND glfw_PKG_DEPS "xinerama")
# Check for XInput (high-resolution cursor motion)
if (NOT X11_Xinput_FOUND)
message(FATAL_ERROR "The XInput library and headers were not found")
endif()
if (X11_Xinput_FOUND)
list(APPEND glfw_INCLUDE_DIRS "${X11_Xinput_INCLUDE_PATH}")
list(APPEND glfw_PKG_DEPS "xi")
list(APPEND glfw_INCLUDE_DIRS "${X11_Xinput_INCLUDE_PATH}")
if (X11_Xinput_LIB)
list(APPEND glfw_LIBRARIES "${X11_Xinput_LIB}")
else()
# Backwards compatibility (bug in CMake 2.8.7)
list(APPEND glfw_LIBRARIES Xi)
endif()
if (X11_Xinput_LIB)
list(APPEND glfw_LIBRARIES "${X11_Xinput_LIB}")
else()
# Backwards compatibility (bug in CMake 2.8.7)
list(APPEND glfw_LIBRARIES Xi)
set(_GLFW_HAS_XINPUT TRUE)
endif()
list(APPEND glfw_PKG_DEPS "xi")
# Check for Xf86VidMode (fallback gamma control)
if (NOT X11_xf86vmode_FOUND)
message(FATAL_ERROR "The Xf86VidMode library and headers were not found")
endif()
if (X11_xf86vmode_FOUND)
list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}")
list(APPEND glfw_PKG_DEPS "xxf86vm")
list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}")
list(APPEND glfw_PKG_DEPS "xxf86vm")
if (X11_Xxf86vm_LIB)
list(APPEND glfw_LIBRARIES "${X11_Xxf86vm_LIB}")
else()
# Backwards compatibility (see CMake bug 0006976)
list(APPEND glfw_LIBRARIES Xxf86vm)
endif()
if (X11_Xxf86vm_LIB)
list(APPEND glfw_LIBRARIES "${X11_Xxf86vm_LIB}")
else()
# Backwards compatibility (see CMake bug 0006976)
list(APPEND glfw_LIBRARIES Xxf86vm)
set(_GLFW_HAS_XF86VM TRUE)
endif()
# Check for Xkb (X keyboard extension)

135
extern/glfw/README.md vendored
View File

@ -6,10 +6,8 @@ GLFW is a free, Open Source, multi-platform library for OpenGL and OpenGL ES
application development. It provides a simple, platform-independent API for
creating windows and contexts, reading input, handling events, etc.
Version 3.1 adds improved documentation, support for custom system cursors, file
drop events, main thread wake-up, window frame size retrieval, floating windows,
character input with modifier keys, single buffered windows, build improvements
and fixes for a large number of bugs.
Version 3.1.1 adds fixes for a number of bugs that together affect all supported
platforms, most notably workarounds for bugs in some popular window managers.
If you are new to GLFW, you may find the
[introductory tutorial](http://www.glfw.org/docs/latest/quick.html) for GLFW
@ -65,110 +63,26 @@ GLFW bundles a number of dependencies in the `deps/` directory.
## Changelog
- Added `GLFWcursor` custom system cursor handle
- Added `glfwCreateCursor`, `glfwCreateStandardCursor`, `glfwDestroyCursor` and
`glfwSetCursor` for managing system cursor images
- Added `GLFWimage` struct for passing 32-bit RGBA images
- Added monitor and adapter identifier access to native API
- Added `glfwSetDropCallback` and `GLFWdropfun` for receiving dropped files
- Added `glfwPostEmptyEvent` for allowing secondary threads to cause
`glfwWaitEvents` to return
- Added `empty` test program for verifying posting of empty events
- Added `glfwSetCharModsCallback` for receiving character events with modifiers
- Added `glfwGetWindowFrameSize` for retrieving the size of the frame around
the client area of a window
- Added `GLFW_AUTO_ICONIFY` for controlling whether full screen windows
automatically iconify (and restore the previous video mode) on focus loss
- Added `GLFW_DONT_CARE` for indicating that any value is acceptable
- Added `GLFW_DOUBLEBUFFER` for controlling whether to use double buffering
- Added `GLFW_CONTEXT_RELEASE_BEHAVIOR` and values
`GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` and
`GLFW_RELEASE_BEHAVIOR_NONE` for `GL_KHR_context_flush_control` support
- Added `GLFW_INCLUDE_ES31` for including the OpenGL ES 3.1 header
- Added `GLFW_FLOATING` for creating always-on-top windowed mode windows
- Added `GLFW_FOCUSED` window hint for controlling initial input focus
- Added *partial and experimental* support for Wayland
- Added *partial and experimental* support for Mir
- Changed the window state attributes (focused, iconified and visible) to query
the system directly
- Changed the default of `GLFW_REFRESH_RATE` to `GLFW_DONT_CARE` to maintain
the default behavior
- Changed static library to build as position independent code for easier use
from the Rust language
- Changed `glfwGetCursorPos` to query the system directly for all cursor modes
except captured mode
- Bugfix: The debug context attribute was set from `GL_ARB_debug_output` even
when a debug context had not been requested
- Bugfix: The particles example was not linked against the threading library
- Bugfix: The cursor was not positioned over newly created full screen windows
- Bugfix: The queried cursor position was not always up-to-date
- Bugfix: `glfwExtensionSupported` always failed for OpenGL ES 3.0 and later if
the library was compiled for OpenGL ES
- [Cocoa] Added `_GLFW_USE_RETINA` to control whether windows will use the full
resolution on Retina displays
- [Cocoa] Made content view subclass of `NSOpenGLView`
- [Cocoa] Bugfix: Using a 1x1 cursor for hidden mode caused some screen
recorders to fail
- [Cocoa] Bugfix: Some Core Foundation objects were leaked during joystick
enumeration and termination
- [Cocoa] Bugfix: One copy of each display name string was leaked
- [Cocoa] Bugfix: Monitor enumeration caused a segfault if no `NSScreen` was
found for a given `CGDisplay`
- [Cocoa] Bugfix: Modifier key events were lost if the corresponding modifier
bit field was unchanged
- [Cocoa] Bugfix: Joystick enumeration took hundreds of ms on some systems
- [Cocoa] Bugfix: The cursor was hidden when the user resized a GLFW window
- [Cocoa] Bugfix: The 10.10 Yosemite OpenGL 4.1 profile token was not used
- [Cocoa] Bugfix: The generic software OpenGL renderer could be selected under
certain conditions
- [Cocoa] Bugfix: The virtual cursor jumped unpredictably when entering
disabled cursor mode
- [Win32] Enabled generation of pkg-config file for MinGW
- [Win32] Removed option to require explicitly linking against `winmm.dll`
- [Win32] Bugfix: Failure to load winmm or its functions was not reported to
the error callback
- [Win32] Bugfix: Some keys were reported based on the current layout instead
of their physical location
- [Win32] Bugfix: Maximized hidden windows were restored by `glfwShowWindow`
- [Win32] Bugfix: Context re-creation was not triggered by sRGB hint
- [Win32] Bugfix: Full screen windows were incorrectly sized and placed on some
systems
- [Win32] Bugfix: Gamma ramp functions acted on entire desktop instead of the
specified monitor
- [Win32] Bugfix: The wrong incorrect physical size was returned for
non-primary monitors
- [Win32] Bugfix: X-axis scroll offsets were inverted
- [Win32] Bugfix: The Optimus HPG forcing variable was not correctly exported
- [Win32] Bugfix: The iconified window state attribute was not always updated
- [Win32] Bugfix: Previously focused windows with disabled cursor mode and that
had been iconified by Win+D were not visible when restored
- [Win32] Bugfix: The virtual cursor jumped unpredictably when entering
disabled cursor mode
- [X11] Added run-time support for systems lacking the XKB extension
- [X11] Made GLX 1.3 the minimum supported version
- [X11] Replaced `XRRGetScreenResources` with `XRRGetScreenResourcesCurrent`
for monitor property retrieval
- [X11] Bugfix: The case of finding no usable CRTCs was not detected
- [X11] Bugfix: Detection of broken Nvidia RandR gamma support did not verify
that at least one CRTC was present
- [X11] Bugfix: A stale `_NET_SUPPORTING_WM_CHECK` root window property would
cause an uncaught `BadWindow` error
- [X11] Bugfix: No check was made for the presence of GLX 1.3 when
`GLX_SGIX_fbconfig` was unavailable
- [X11] Bugfix: The message type of ICCCM protocol events was not checked
- [X11] Bugfix: `glfwDestroyWindow` did not flush the output buffer
- [X11] Bugfix: Window frame interactions were reported as focus events
- [X11] Bugfix: Workaround for legacy Compiz caused flickering during resize
- [X11] Bugfix: The name pointer of joysticks were not cleared on disconnection
- [X11] Bugfix: Video mode resolutions and monitor physical sizes were not
corrected for rotated CRTCs
- [X11] Bugfix: Unicode character input ignored dead keys
- [X11] Bugfix: X-axis scroll offsets were inverted
- [X11] Bugfix: Full screen override redirect windows were not always
positioned over the specified monitor
- [X11] Bugfix: Character input did not work for the default `"C"` locale
- [X11] Bugfix: Joysticks connected after `glfwInit` were not detected
(temporary inotify solution until proper libudev solution)
- Made library compilation fail if any header option macros are defined
- Removed support for LCC and Borland C++
- Bugfix: `glfwSetTime` silently accepted invalid values
- [Cocoa] Bugfix: `NSHighResolutionCapable` was not enabled for test and
example programs
- [Cocoa] Bugfix: Sleeping monitors were not included in the monitor list
- [Cocoa] Bugfix: `glfwSetWindowSize` did not change the video mode for full
screen windows
- [X11] Added support for Cygwin-X
- [X11] Made XInput2 optional at compile-time
- [X11] Made Xxf86vm optional at compile-time
- [X11] Bugfix: Moved `_NET_REQUEST_FRAME_EXTENTS` request to
`glfwGetWindowFrameSize` and added protocol-breaking timeout
as a workaround for broken support in Unity, Fluxbox and Xfwm
- [X11] Bugfix: Mouse button `GLFW_MOUSE_BUTTON_4` was never used
- [X11] Bugfix: `glfwTerminate` could close an unrelated file descriptor
- [X11] Bugfix: Some WMs (KWM, Fluxbox) did not respect cursor redefinition
- [WGL] Bugfix: The context flags debug bit was not set for OpenGL ES
- [GLX] Bugfix: The context flags debug bit was not set for OpenGL ES
- [EGL] Bugfix: The context flags debug bit was not set for OpenGL ES
## Contact
@ -216,6 +130,7 @@ skills.
- Michael Dickens
- Jonathan Dummer
- Ralph Eastwood
- Siavash Eliasi
- Michael Fogleman
- Gerald Franz
- GeO4d
@ -241,8 +156,10 @@ skills.
- Hans Mackowiak
- Kyle McDonald
- David Medlock
- Bryce Mehring
- Jonathan Mercier
- Marcel Metz
- Jonathan Miller
- Kenneth Miller
- Bruce Mitchener
- Jack Moffitt
@ -260,6 +177,7 @@ skills.
- Pieroman
- Jorge Rodriguez
- Ed Ropple
- Aleksey Rybalkin
- Riku Salminen
- Brandon Schaefer
- Sebastian Schuberth
@ -276,6 +194,7 @@ skills.
- Nathan Sweet
- TTK-Bandit
- Sergey Tikhomirov
- A. Tombs
- Samuli Tuomola
- urraka
- Jari Vetoniemi

View File

@ -1,3 +1,4 @@
#include <stdio.h>
#include <string.h>
#include <glad/glad.h>
@ -687,10 +688,34 @@ static void find_extensionsGL(void) {
}
static void find_coreGL(void) {
const char *v = (const char *)glGetString(GL_VERSION);
int major = v[0] - '0';
int minor = v[2] - '0';
GLVersion.major = major; GLVersion.minor = minor;
/* Thank you @elmindreda
* https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176
* https://github.com/glfw/glfw/blob/master/src/context.c#L36
*/
int i, major, minor;
const char* version;
const char* prefixes[] = {
"OpenGL ES-CM ",
"OpenGL ES-CL ",
"OpenGL ES ",
NULL
};
version = (const char*) glGetString(GL_VERSION);
if (!version) return;
for (i = 0; prefixes[i]; i++) {
const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) {
version += length;
break;
}
}
sscanf(version, "%d.%d", &major, &minor);
GLVersion.major = major; GLVersion.minor = minor;
GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
@ -704,10 +729,11 @@ static void find_coreGL(void) {
GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3;
}
void gladLoadGLLoader(GLADloadproc load) {
int gladLoadGLLoader(GLADloadproc load) {
GLVersion.major = 0; GLVersion.minor = 0;
glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
if(glGetString == NULL) return;
if(glGetString == NULL) return 0;
if(glGetString(GL_VERSION) == NULL) return 0;
find_coreGL();
load_GL_VERSION_1_0(load);
load_GL_VERSION_1_1(load);
@ -722,7 +748,6 @@ void gladLoadGLLoader(GLADloadproc load) {
load_GL_VERSION_3_2(load);
find_extensionsGL();
return;
return GLVersion.major != 0 || GLVersion.minor != 0;
}

View File

@ -22,15 +22,17 @@
#define APIENTRYP APIENTRY *
#endif
extern struct gladGLversionStruct {
int major;
int minor;
} GLVersion;
#ifdef __cplusplus
extern "C" {
#endif
struct gladGLversionStruct {
int major;
int minor;
};
extern struct gladGLversionStruct GLVersion;
typedef void* (* GLADloadproc)(const char *name);
#ifndef GLAPI
@ -58,7 +60,7 @@ typedef void* (* GLADloadproc)(const char *name);
# define GLAPI extern
# endif
#endif
GLAPI void gladLoadGLLoader(GLADloadproc);
GLAPI int gladLoadGLLoader(GLADloadproc);
#include <stddef.h>
#include <KHR/khrplatform.h>
@ -836,11 +838,13 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_UNIFORM_BUFFER_START 0x8A29
#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
@ -859,6 +863,7 @@ typedef GLintptr GLvdpauSurfaceNV;
#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
#define GL_INVALID_INDEX 0xFFFFFFFF
#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001

View File

@ -41,7 +41,9 @@ if (APPLE)
set_target_properties(Wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
set_target_properties(Boing Gears Heightmap Particles Simple SplitView Wave PROPERTIES
FOLDER "GLFW3/Examples")
FOLDER "GLFW3/Examples"
MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/AppleInfo.plist")
else()
# Set boring names for executables
add_executable(boing WIN32 boing.c)

View File

@ -371,7 +371,9 @@ static void framebufferSizeFun(GLFWwindow* window, int w, int h)
static void windowRefreshFun(GLFWwindow* window)
{
do_redraw = 1;
drawAllViews();
glfwSwapBuffers(window);
do_redraw = 0;
}
@ -485,15 +487,7 @@ int main(void)
{
// Only redraw if we need to
if (do_redraw)
{
// Draw all views
drawAllViews();
// Swap buffers
glfwSwapBuffers(window);
do_redraw = 0;
}
windowRefreshFun(window);
// Wait for new events
glfwWaitEvents();

View File

@ -68,28 +68,17 @@ extern "C" {
/*************************************************************************
* Global definitions
* Compiler- and platform-specific preprocessor work
*************************************************************************/
/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
/* Please report any problems that you find with your compiler, which may
* be solved in this section! There are several compilers that I have not
* been able to test this file with yet.
*
* First: If we are we on Windows, we want a single define for it (_WIN32)
* (Note: For Cygwin the compiler flag -mwin32 should be used, but to
* make sure that things run smoothly for Cygwin users, we add __CYGWIN__
* to the list of "valid Win32 identifiers", which removes the need for
* -mwin32)
/* If we are we on Windows, we want a single define for it.
*/
#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))
#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
#define _WIN32
#endif /* _WIN32 */
/* In order for extension support to be portable, we need to define an
* OpenGL function call method. We use the keyword APIENTRY, which is
* defined for Win32. (Note: Windows also needs this for <GL/gl.h>)
/* It is customary to use APIENTRY for OpenGL function pointer declarations on
* all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
*/
#ifndef APIENTRY
#ifdef _WIN32
@ -99,44 +88,23 @@ extern "C" {
#endif
#endif /* APIENTRY */
/* The following three defines are here solely to make some Windows-based
* <GL/gl.h> files happy. Theoretically we could include <windows.h>, but
* it has the major drawback of severely polluting our namespace.
/* Some Windows OpenGL headers need this.
*/
/* Under Windows, we need WINGDIAPI defined */
#if !defined(WINGDIAPI) && defined(_WIN32)
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)
/* Microsoft Visual C++, Borland C++ Builder and Pelles C */
#define WINGDIAPI __declspec(dllimport)
#elif defined(__LCC__)
/* LCC-Win32 */
#define WINGDIAPI __stdcall
#else
/* Others (e.g. MinGW, Cygwin) */
#define WINGDIAPI extern
#endif
#define WINGDIAPI __declspec(dllimport)
#define GLFW_WINGDIAPI_DEFINED
#endif /* WINGDIAPI */
/* Some <GL/glu.h> files also need CALLBACK defined */
/* Some Windows GLU headers need this.
*/
#if !defined(CALLBACK) && defined(_WIN32)
#if defined(_MSC_VER)
/* Microsoft Visual C++ */
#if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
#define CALLBACK __stdcall
#else
#define CALLBACK
#endif
#else
/* Other Windows compilers */
#define CALLBACK __stdcall
#endif
#define CALLBACK __stdcall
#define GLFW_CALLBACK_DEFINED
#endif /* CALLBACK */
/* Most GL/glu.h variants on Windows need wchar_t
* OpenGL/gl.h blocks the definition of ptrdiff_t by glext.h on OS X */
/* Most Windows GLU headers need wchar_t.
* The OS X OpenGL header blocks the definition of ptrdiff_t by glext.h.
*/
#if !defined(GLFW_INCLUDE_NONE)
#include <stddef.h>
#endif
@ -197,7 +165,7 @@ extern "C" {
* version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
* configuration header when compiling the DLL version of the library.
*/
#error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
#error "You may not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
#endif
/* GLFWAPI is used to declare public API functions for export
@ -208,11 +176,7 @@ extern "C" {
#define GLFWAPI __declspec(dllexport)
#elif defined(_WIN32) && defined(GLFW_DLL)
/* We are calling GLFW as a Win32 DLL */
#if defined(__LCC__)
#define GLFWAPI extern
#else
#define GLFWAPI __declspec(dllimport)
#endif
#define GLFWAPI __declspec(dllimport)
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
/* We are building GLFW as a shared / dynamic library */
#define GLFWAPI __attribute__((visibility("default")))
@ -221,8 +185,6 @@ extern "C" {
#define GLFWAPI
#endif
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
/*************************************************************************
* GLFW API tokens
@ -249,7 +211,7 @@ extern "C" {
* API changes.
* @ingroup init
*/
#define GLFW_VERSION_REVISION 0
#define GLFW_VERSION_REVISION 1
/*! @} */
/*! @name Key and button actions
@ -558,7 +520,9 @@ extern "C" {
/*! @brief GLFW could not find support for the requested client API on the
* system.
*
* GLFW could not find support for the requested client API on the system.
* GLFW could not find support for the requested client API on the system. If
* emitted by functions other than @ref glfwCreateWindow, no supported client
* API was found.
*
* @par Analysis
* The installed graphics driver does not support the requested client API, or
@ -575,8 +539,8 @@ extern "C" {
#define GLFW_API_UNAVAILABLE 0x00010006
/*! @brief The requested OpenGL or OpenGL ES version is not available.
*
* The requested OpenGL or OpenGL ES version (including any requested profile
* or context option) is not available on this machine.
* The requested OpenGL or OpenGL ES version (including any requested context
* or framebuffer hints) is not available on this machine.
*
* @par Analysis
* The machine does not support your requirements. If your application is
@ -598,7 +562,8 @@ extern "C" {
* specific categories.
*
* @par Analysis
* A bug in GLFW or the underlying operating system. Report the bug to our
* A bug or configuration error in GLFW, the underlying operating system or
* its drivers, or a lack of required resources. Report the issue to our
* [issue tracker](https://github.com/glfw/glfw/issues).
*/
#define GLFW_PLATFORM_ERROR 0x00010008
@ -988,7 +953,7 @@ typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
*
* @param[in] window The window that received the event.
* @param[in] count The number of dropped files.
* @param[in] names The UTF-8 encoded path names of the dropped files.
* @param[in] paths The UTF-8 encoded file and/or directory path names.
*
* @sa glfwSetDropCallback
*
@ -1462,7 +1427,8 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
/*! @brief Generates a gamma ramp and sets it for the specified monitor.
*
* This function generates a 256-element gamma ramp from the specified exponent
* and then calls @ref glfwSetGammaRamp with it.
* and then calls @ref glfwSetGammaRamp with it. The value must be a finite
* number greater than zero.
*
* @param[in] monitor The monitor whose gamma ramp to set.
* @param[in] gamma The desired exponent.
@ -1512,7 +1478,10 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
* @param[in] monitor The monitor whose gamma ramp to set.
* @param[in] ramp The gamma ramp to use.
*
* @note Gamma ramp sizes other than 256 are not supported by all hardware.
* @remarks Gamma ramp sizes other than 256 are not supported by all platforms
* or graphics hardware.
*
* @remarks __Windows:__ The gamma ramp size must be 256.
*
* @par Pointer Lifetime
* The specified gamma ramp is copied before this function returns.
@ -1648,6 +1617,13 @@ GLFWAPI void glfwWindowHint(int target, int hint);
* The menu bar can be disabled with a
* [compile-time option](@ref compile_options_osx).
*
* @remarks __OS X:__ On OS X 10.10 and later the window frame will not be
* rendered at full resolution on Retina displays unless the
* `NSHighResolutionCapable` key is enabled in the application bundle's
* `Info.plist`. For more information, see
* [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
* in the Mac Developer Library.
*
* @remarks __X11:__ There is no mechanism for setting the window icon yet.
*
* @remarks __X11:__ Some window managers will not respect the placement of
@ -3136,10 +3112,15 @@ GLFWAPI double glfwGetTime(void);
/*! @brief Sets the GLFW timer.
*
* This function sets the value of the GLFW timer. It then continues to count
* up from that value.
* up from that value. The value must be a positive finite number less than
* or equal to 18446744073.0, which is approximately 584.5 years.
*
* @param[in] time The new value, in seconds.
*
* @remarks The upper limit of the timer is calculated as
* floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
* storing nanoseconds in 64 bits. The limit may be increased in the future.
*
* @par Thread Safety
* This function may only be called from the main thread.
*
@ -3243,14 +3224,14 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
* @param[in] interval The minimum number of screen updates to wait for
* until the buffers are swapped by @ref glfwSwapBuffers.
*
* @note This function is not called during window creation, leaving the swap
* interval set to whatever is the default on that platform. This is done
* @remarks This function is not called during context creation, leaving the
* swap interval set to whatever is the default on that platform. This is done
* because some swap interval extensions used by GLFW do not allow the swap
* interval to be reset to zero once it has been set to a non-zero value.
*
* @note Some GPU drivers do not honor the requested swap interval, either
* because of user settings that override the request or due to bugs in the
* driver.
* @remarks Some GPU drivers do not honor the requested swap interval, either
* because of a user setting that overrides the application's request or due to
* bugs in the driver.
*
* @par Thread Safety
* This function may be called from any thread.
@ -3267,9 +3248,9 @@ GLFWAPI void glfwSwapInterval(int interval);
/*! @brief Returns whether the specified extension is available.
*
* This function returns whether the specified
* [API extension](@ref context_glext) is supported by the current OpenGL or
* OpenGL ES context. It searches both for OpenGL and OpenGL ES extension and
* platform-specific context creation API extensions.
* [client API extension](@ref context_glext) is supported by the current
* OpenGL or OpenGL ES context. It searches both for OpenGL and OpenGL ES
* extension and platform-specific context creation API extensions.
*
* A context must be current on the calling thread. Calling this function
* without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
@ -3298,7 +3279,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension);
* context.
*
* This function returns the address of the specified
* [client API or extension function](@ref context_glext), if it is supported
* [core or extension function](@ref context_glext), if it is supported
* by the current context.
*
* A context must be current on the calling thread. Calling this function
@ -3308,9 +3289,13 @@ GLFWAPI int glfwExtensionSupported(const char* extension);
* @return The address of the function, or `NULL` if the function is
* unavailable or an [error](@ref error_handling) occurred.
*
* @note The addresses of a given function is not guaranteed to be the same
* @remarks The addresses of a given function is not guaranteed to be the same
* between contexts.
*
* @remarks This function may return a non-`NULL` address despite the
* associated version or extension not being available. Always check the
* context version or extension string presence first.
*
* @par Pointer Lifetime
* The returned function pointer is valid until the context is destroyed or the
* library is terminated.

View File

@ -57,7 +57,8 @@ static char* getDisplayName(CGDirectDisplayID displayID)
(const void**) &value))
{
// This may happen if a desktop Mac is running headless
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to retrieve display name");
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to retrieve display name");
CFRelease(info);
return strdup("Unknown");
@ -263,9 +264,6 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
{
int j;
if (CGDisplayIsAsleep(displays[i]))
continue;
CGDirectDisplayID screenDisplayID = CGDisplayMirrorsDisplay(displays[i]);
if (screenDisplayID == kCGNullDirectDisplay)
screenDisplayID = displays[i];

View File

@ -592,17 +592,17 @@ static int translateKey(unsigned int key)
if (count)
{
NSEnumerator* e = [files objectEnumerator];
char** names = calloc(count, sizeof(char*));
char** paths = calloc(count, sizeof(char*));
int i;
for (i = 0; i < count; i++)
names[i] = strdup([[e nextObject] UTF8String]);
paths[i] = strdup([[e nextObject] UTF8String]);
_glfwInputDrop(window, count, (const char**) names);
_glfwInputDrop(window, count, (const char**) paths);
for (i = 0; i < count; i++)
free(names[i]);
free(names);
free(paths[i]);
free(paths);
}
return YES;
@ -990,7 +990,10 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
{
[window->ns.object setContentSize:NSMakeSize(width, height)];
if (window->monitor)
enterFullscreenMode(window);
else
[window->ns.object setContentSize:NSMakeSize(width, height)];
}
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
@ -1208,7 +1211,8 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
cursor->ns.object = getStandardCursor(shape);
if (!cursor->ns.object)
{
_glfwInputError(GLFW_INVALID_ENUM, "Cocoa: Invalid standard cursor");
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to retrieve standard cursor");
return GL_FALSE;
}
@ -1252,7 +1256,8 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
if (![[pasteboard types] containsObject:NSStringPboardType])
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL);
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"Cocoa: Failed to retrieve string from pasteboard");
return NULL;
}

View File

@ -89,7 +89,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
if (ctxconfig->api != GLFW_OPENGL_API &&
ctxconfig->api != GLFW_OPENGL_ES_API)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid client API requested");
_glfwInputError(GLFW_INVALID_ENUM, "Invalid client API");
return GL_FALSE;
}
@ -104,16 +104,13 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
// OpenGL 1.x series ended with version 1.5
// OpenGL 2.x series ended with version 2.1
// OpenGL 3.x series ended with version 3.3
// For now, let everything else through
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid OpenGL version %i.%i requested",
"Invalid OpenGL version %i.%i",
ctxconfig->major, ctxconfig->minor);
return GL_FALSE;
}
else
{
// For now, let everything else through
}
if (ctxconfig->profile)
{
@ -121,7 +118,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid OpenGL profile requested");
"Invalid OpenGL profile");
return GL_FALSE;
}
@ -132,8 +129,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
// and above
_glfwInputError(GLFW_INVALID_VALUE,
"Context profiles only exist for "
"OpenGL version 3.2 and above");
"Context profiles are only defined for OpenGL version 3.2 and above");
return GL_FALSE;
}
}
@ -142,8 +138,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
{
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
_glfwInputError(GLFW_INVALID_VALUE,
"Forward compatibility only exist for OpenGL "
"version 3.0 and above");
"Forward-compatibility is only defined for OpenGL version 3.0 and above");
return GL_FALSE;
}
}
@ -156,30 +151,11 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
// OpenGL ES 1.0 is the smallest valid version
// OpenGL ES 1.x series ended with version 1.1
// OpenGL ES 2.x series ended with version 2.0
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid OpenGL ES version %i.%i requested",
ctxconfig->major, ctxconfig->minor);
return GL_FALSE;
}
else
{
// For now, let everything else through
}
if (ctxconfig->profile)
{
// OpenGL ES does not support profiles
_glfwInputError(GLFW_INVALID_VALUE,
"Context profiles are not supported by OpenGL ES");
return GL_FALSE;
}
if (ctxconfig->forward)
{
// OpenGL ES does not support forward-compatibility
_glfwInputError(GLFW_INVALID_VALUE,
"Forward compatibility is not supported by OpenGL ES");
"Invalid OpenGL ES version %i.%i",
ctxconfig->major, ctxconfig->minor);
return GL_FALSE;
}
}
@ -189,8 +165,8 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION &&
ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET)
{
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid context robustness mode requested");
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid context robustness mode");
return GL_FALSE;
}
}
@ -200,8 +176,8 @@ GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE &&
ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH)
{
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid context release behavior requested");
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid context release behavior");
return GL_FALSE;
}
}

View File

@ -47,33 +47,25 @@ static const char* getErrorString(EGLint error)
case EGL_BAD_ALLOC:
return "EGL failed to allocate resources for the requested operation";
case EGL_BAD_ATTRIBUTE:
return "An unrecognized attribute or attribute value was passed "
"in the attribute list";
return "An unrecognized attribute or attribute value was passed in the attribute list";
case EGL_BAD_CONTEXT:
return "An EGLContext argument does not name a valid EGL "
"rendering context";
return "An EGLContext argument does not name a valid EGL rendering context";
case EGL_BAD_CONFIG:
return "An EGLConfig argument does not name a valid EGL frame "
"buffer configuration";
return "An EGLConfig argument does not name a valid EGL frame buffer configuration";
case EGL_BAD_CURRENT_SURFACE:
return "The current surface of the calling thread is a window, pixel "
"buffer or pixmap that is no longer valid";
return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid";
case EGL_BAD_DISPLAY:
return "An EGLDisplay argument does not name a valid EGL display "
"connection";
return "An EGLDisplay argument does not name a valid EGL display connection";
case EGL_BAD_SURFACE:
return "An EGLSurface argument does not name a valid surface "
"configured for GL rendering";
return "An EGLSurface argument does not name a valid surface configured for GL rendering";
case EGL_BAD_MATCH:
return "Arguments are inconsistent";
case EGL_BAD_PARAMETER:
return "One or more argument values are invalid";
case EGL_BAD_NATIVE_PIXMAP:
return "A NativePixmapType argument does not refer to a valid "
"native pixmap";
return "A NativePixmapType argument does not refer to a valid native pixmap";
case EGL_BAD_NATIVE_WINDOW:
return "A NativeWindowType argument does not refer to a valid "
"native window";
return "A NativeWindowType argument does not refer to a valid native window";
case EGL_CONTEXT_LOST:
return "The application must destroy all contexts and reinitialise";
}
@ -309,7 +301,7 @@ int _glfwCreateContext(_GLFWwindow* window,
{
if (!eglBindAPI(EGL_OPENGL_ES_API))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to bind OpenGL ES: %s",
getErrorString(eglGetError()));
return GL_FALSE;
@ -319,7 +311,7 @@ int _glfwCreateContext(_GLFWwindow* window,
{
if (!eglBindAPI(EGL_OPENGL_API))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to bind OpenGL: %s",
getErrorString(eglGetError()));
return GL_FALSE;
@ -339,11 +331,11 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->forward)
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
if (ctxconfig->debug)
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
}
if (ctxconfig->debug)
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
if (ctxconfig->robustness)
{
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
@ -389,7 +381,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (window->egl.context == EGL_NO_CONTEXT)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"EGL: Failed to create context: %s",
getErrorString(eglGetError()));
return GL_FALSE;

View File

@ -5,7 +5,7 @@ libdir=${exec_prefix}/lib
Name: GLFW
Description: A multi-platform library for OpenGL, window and input
Version: 3.1.0
Version: 3.1.1
URL: http://www.glfw.org/
Requires.private: x11 xrandr xinerama xi xxf86vm xcursor gl
Libs: -L${libdir} -lglfw3

View File

@ -4,7 +4,7 @@
# GLFW3_LIBRARY_DIR, folder in which the GLFW library is located
# GLFW3_LIBRARY, library to link against to use GLFW
set(GLFW3_VERSION "3.1.0")
set(GLFW3_VERSION "3.1.1")
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######

View File

@ -9,16 +9,16 @@
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "3.1.0")
set(PACKAGE_VERSION "3.1.1")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
if("3.1.0" MATCHES "^([0-9]+)\\.")
if("3.1.1" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_MAJOR "3.1.0")
set(CVF_VERSION_MAJOR "3.1.1")
endif()
if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${CVF_VERSION_MAJOR}")

View File

@ -62,6 +62,10 @@
// Define this to 1 to force use of high-performance GPU on Optimus systems
/* #undef _GLFW_USE_OPTIMUS_HPG */
// Define this to 1 if the XInput X11 extension is available
#define _GLFW_HAS_XINPUT
// Define this to 1 if the Xxf86vm X11 extension is available
#define _GLFW_HAS_XF86VM
// Define this to 1 if glXGetProcAddress is available
#define _GLFW_HAS_GLXGETPROCADDRESS
// Define this to 1 if glXGetProcAddressARB is available

View File

@ -62,6 +62,10 @@
// Define this to 1 to force use of high-performance GPU on Optimus systems
#cmakedefine _GLFW_USE_OPTIMUS_HPG
// Define this to 1 if the XInput X11 extension is available
#cmakedefine _GLFW_HAS_XINPUT
// Define this to 1 if the Xxf86vm X11 extension is available
#cmakedefine _GLFW_HAS_XF86VM
// Define this to 1 if glXGetProcAddress is available
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESS
// Define this to 1 if glXGetProcAddressARB is available

View File

@ -175,7 +175,7 @@ int _glfwInitContextAPI(void)
_glfw.glx.libGL = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL);
if (!_glfw.glx.libGL)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to find libGL");
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: Failed to find libGL");
return GL_FALSE;
}
#endif
@ -320,8 +320,7 @@ int _glfwCreateContext(_GLFWwindow* window,
!_glfw.glx.EXT_create_context_es2_profile)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"GLX: OpenGL ES requested but "
"GLX_EXT_create_context_es2_profile is unavailable");
"GLX: OpenGL ES requested but GLX_EXT_create_context_es2_profile is unavailable");
return GL_FALSE;
}
}
@ -331,8 +330,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (!_glfw.glx.ARB_create_context)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"GLX: Forward compatibility requested but "
"GLX_ARB_create_context_profile is unavailable");
"GLX: Forward compatibility requested but GLX_ARB_create_context_profile is unavailable");
return GL_FALSE;
}
}
@ -343,8 +341,7 @@ int _glfwCreateContext(_GLFWwindow* window,
!_glfw.glx.ARB_create_context_profile)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"GLX: An OpenGL profile requested but "
"GLX_ARB_create_context_profile is unavailable");
"GLX: An OpenGL profile requested but GLX_ARB_create_context_profile is unavailable");
return GL_FALSE;
}
}
@ -360,9 +357,6 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->forward)
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (ctxconfig->debug)
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
if (ctxconfig->profile)
{
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
@ -374,6 +368,9 @@ int _glfwCreateContext(_GLFWwindow* window,
else
mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
if (ctxconfig->debug)
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
if (ctxconfig->robustness)
{
if (_glfw.glx.ARB_create_context_robustness)
@ -454,7 +451,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (!window->glx.context)
{
_glfwInputXError(GLFW_PLATFORM_ERROR, "GLX: Failed to create context");
_glfwInputXError(GLFW_VERSION_UNAVAILABLE, "GLX: Failed to create context");
return GL_FALSE;
}

View File

@ -46,7 +46,7 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
newMode != GLFW_CURSOR_HIDDEN &&
newMode != GLFW_CURSOR_DISABLED)
{
_glfwInputError(GLFW_INVALID_ENUM, NULL);
_glfwInputError(GLFW_INVALID_ENUM, "Invalid cursor mode");
return;
}
@ -216,10 +216,10 @@ void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
window->callbacks.cursorEnter((GLFWwindow*) window, entered);
}
void _glfwInputDrop(_GLFWwindow* window, int count, const char** names)
void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths)
{
if (window->callbacks.drop)
window->callbacks.drop((GLFWwindow*) window, count, names);
window->callbacks.drop((GLFWwindow*) window, count, paths);
}
@ -242,7 +242,7 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
case GLFW_STICKY_MOUSE_BUTTONS:
return window->stickyMouseButtons;
default:
_glfwInputError(GLFW_INVALID_ENUM, NULL);
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode");
return 0;
}
}
@ -265,7 +265,7 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE);
break;
default:
_glfwInputError(GLFW_INVALID_ENUM, NULL);
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode");
break;
}
}
@ -278,7 +278,7 @@ GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
if (key < 0 || key > GLFW_KEY_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM, "The specified key is invalid");
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key");
return GLFW_RELEASE;
}
@ -301,7 +301,7 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM,
"The specified mouse button is invalid");
"Invalid mouse button");
return GLFW_RELEASE;
}
@ -384,6 +384,17 @@ GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (shape != GLFW_ARROW_CURSOR &&
shape != GLFW_IBEAM_CURSOR &&
shape != GLFW_CROSSHAIR_CURSOR &&
shape != GLFW_HAND_CURSOR &&
shape != GLFW_HRESIZE_CURSOR &&
shape != GLFW_VRESIZE_CURSOR)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor");
return NULL;
}
cursor = calloc(1, sizeof(_GLFWcursor));
cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor;
@ -518,7 +529,7 @@ GLFWAPI int glfwJoystickPresent(int joy)
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM, NULL);
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
return 0;
}
@ -533,7 +544,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM, NULL);
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
return NULL;
}
@ -548,7 +559,7 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM, NULL);
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
return NULL;
}
@ -561,7 +572,7 @@ GLFWAPI const char* glfwGetJoystickName(int joy)
if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM, NULL);
_glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
return NULL;
}
@ -591,6 +602,13 @@ GLFWAPI double glfwGetTime(void)
GLFWAPI void glfwSetTime(double time)
{
_GLFW_REQUIRE_INIT();
if (time != time || time < 0.0 || time > 18446744073.0)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid time");
return;
}
_glfwPlatformSetTime(time);
}

View File

@ -33,7 +33,18 @@
#include "glfw_config.h"
#endif
#define _GLFW_VERSION_NUMBER "3.1.0"
#define _GLFW_VERSION_NUMBER "3.1.1"
#if defined(GLFW_INCLUDE_GLCOREARB) || \
defined(GLFW_INCLUDE_ES1) || \
defined(GLFW_INCLUDE_ES2) || \
defined(GLFW_INCLUDE_ES3) || \
defined(GLFW_INCLUDE_NONE) || \
defined(GLFW_INCLUDE_GLEXT) || \
defined(GLFW_INCLUDE_GLU) || \
defined(GLFW_DLL)
#error "You may not define any header option macros when compiling GLFW"
#endif
#if defined(_GLFW_USE_OPENGL)
// This is the default for glfw3.h

View File

@ -277,11 +277,13 @@ void _glfwTerminateJoysticks(void)
regfree(&_glfw.linux_js.regex);
if (_glfw.linux_js.watch > 0)
close(_glfw.linux_js.watch);
if (_glfw.linux_js.inotify > 0)
{
if (_glfw.linux_js.watch > 0)
inotify_rm_watch(_glfw.linux_js.inotify, _glfw.linux_js.watch);
close(_glfw.linux_js.inotify);
}
#endif // __linux__
}

View File

@ -65,7 +65,7 @@ int _glfwPlatformInit(void)
if (error)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Failed to create event mutex: %s\n",
"Mir: Failed to create event mutex: %s",
strerror(error));
return GL_FALSE;
}

View File

@ -127,12 +127,12 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}

View File

@ -470,7 +470,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (wndconfig->width > mode.width || wndconfig->height > mode.height)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Requested surface size is to large (%i %i)",
"Mir: Requested surface size too large: %ix%i",
wndconfig->width, wndconfig->height);
return GL_FALSE;
@ -502,13 +502,13 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
@ -516,19 +516,19 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
int* right, int* bottom)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
@ -552,39 +552,39 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
void _glfwPlatformHideWindow(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformShowWindow(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
int _glfwPlatformWindowFocused(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
return GL_FALSE;
}
int _glfwPlatformWindowIconified(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
return GL_FALSE;
}
int _glfwPlatformWindowVisible(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
return GL_FALSE;
}
@ -628,7 +628,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
int xhot, int yhot)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
return GL_FALSE;
}
@ -636,7 +636,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
return GL_FALSE;
}
@ -644,43 +644,43 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformApplyCursorMode(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
}
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Mir: Unsupported function %s!", __PRETTY_FUNCTION__);
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
return NULL;
}

View File

@ -28,6 +28,7 @@
#include "internal.h"
#include <math.h>
#include <float.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
@ -385,10 +386,9 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
_GLFW_REQUIRE_INIT();
if (gamma <= 0.f)
if (gamma != gamma || gamma <= 0.f || gamma > FLT_MAX)
{
_glfwInputError(GLFW_INVALID_VALUE,
"Gamma value must be greater than zero");
_glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value");
return;
}

View File

@ -42,7 +42,7 @@ int _glfwInitContextAPI(void)
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
if (_glfw.nsgl.framework == NULL)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
_glfwInputError(GLFW_API_UNAVAILABLE,
"NSGL: Failed to locate OpenGL framework");
return GL_FALSE;
}
@ -76,8 +76,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->major == 3 && ctxconfig->minor < 2)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X does not "
"support OpenGL 3.0 or 3.1");
"NSGL: The targeted version of OS X does not support OpenGL 3.0 or 3.1");
return GL_FALSE;
}
@ -86,18 +85,14 @@ int _glfwCreateContext(_GLFWwindow* window,
if (!ctxconfig->forward)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X only "
"supports OpenGL 3.2 and later versions if they "
"are forward-compatible");
"NSGL: The targeted version of OS X only supports forward-compatible contexts for OpenGL 3.2 and above");
return GL_FALSE;
}
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X only "
"supports OpenGL 3.2 and later versions if they "
"use the core profile");
"NSGL: The targeted version of OS X only supports core profile contexts for OpenGL 3.2 and above");
return GL_FALSE;
}
}
@ -106,8 +101,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->major > 2)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X does not "
"support OpenGL version 3.0 or above");
"NSGL: The targeted version of OS X does not support OpenGL version 3.0 or above");
return GL_FALSE;
}
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
@ -232,7 +226,7 @@ int _glfwCreateContext(_GLFWwindow* window,
shareContext:share];
if (window->nsgl.context == nil)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: Failed to create OpenGL context");
return GL_FALSE;
}

View File

@ -167,12 +167,6 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
NULL);
}
if (!nativeCount)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "WGL: No pixel formats found");
return GL_FALSE;
}
usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
usableCount = 0;
@ -325,7 +319,7 @@ int _glfwInitContextAPI(void)
_glfw.wgl.opengl32.instance = LoadLibraryW(L"opengl32.dll");
if (!_glfw.wgl.opengl32.instance)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to load opengl32.dll");
_glfwInputError(GLFW_PLATFORM_ERROR, "WGL: Failed to load opengl32.dll");
return GL_FALSE;
}
@ -367,7 +361,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (!window->wgl.dc)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to retrieve DC for window");
"WGL: Failed to retrieve DC for window");
return GL_FALSE;
}
@ -377,15 +371,14 @@ int _glfwCreateContext(_GLFWwindow* window,
if (!DescribePixelFormat(window->wgl.dc, pixelFormat, sizeof(pfd), &pfd))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to retrieve PFD for selected pixel "
"format");
"WGL: Failed to retrieve PFD for selected pixel format");
return GL_FALSE;
}
if (!SetPixelFormat(window->wgl.dc, pixelFormat, &pfd))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to set selected pixel format");
"WGL: Failed to set selected pixel format");
return GL_FALSE;
}
@ -398,9 +391,6 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->forward)
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (ctxconfig->debug)
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
if (ctxconfig->profile)
{
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
@ -412,6 +402,9 @@ int _glfwCreateContext(_GLFWwindow* window,
else
mask |= WGL_CONTEXT_ES2_PROFILE_BIT_EXT;
if (ctxconfig->debug)
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
if (ctxconfig->robustness)
{
if (window->wgl.ARB_create_context_robustness)
@ -478,7 +471,7 @@ int _glfwCreateContext(_GLFWwindow* window,
window->wgl.context = wglCreateContext(window->wgl.dc);
if (!window->wgl.context)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: Failed to create OpenGL context");
return GL_FALSE;
}
@ -488,8 +481,7 @@ int _glfwCreateContext(_GLFWwindow* window,
if (!wglShareLists(share, window->wgl.context))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"WGL: Failed to enable sharing with specified "
"OpenGL context");
"WGL: Failed to enable sharing with specified OpenGL context");
return GL_FALSE;
}
}
@ -535,9 +527,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
if (!window->wgl.ARB_create_context)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: A forward compatible OpenGL context "
"requested but WGL_ARB_create_context is "
"unavailable");
"WGL: A forward compatible OpenGL context requested but WGL_ARB_create_context is unavailable");
return _GLFW_RECREATION_IMPOSSIBLE;
}
@ -549,8 +539,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
if (!window->wgl.ARB_create_context_profile)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"WGL: OpenGL profile requested but "
"WGL_ARB_create_context_profile is unavailable");
"WGL: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable");
return _GLFW_RECREATION_IMPOSSIBLE;
}
@ -570,8 +559,7 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
!window->wgl.EXT_create_context_es2_profile)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"WGL: OpenGL ES requested but "
"WGL_ARB_create_context_es2_profile is unavailable");
"WGL: OpenGL ES requested but WGL_ARB_create_context_es2_profile is unavailable");
return _GLFW_RECREATION_IMPOSSIBLE;
}

View File

@ -30,11 +30,6 @@
#include <stdlib.h>
#include <malloc.h>
#ifdef __BORLANDC__
// With the Borland C++ compiler, we want to disable FPU exceptions
#include <float.h>
#endif // __BORLANDC__
#if defined(_GLFW_USE_OPTIMUS_HPG)
@ -335,12 +330,6 @@ int _glfwPlatformInit(void)
if (_glfw_SetProcessDPIAware)
_glfw_SetProcessDPIAware();
#ifdef __BORLANDC__
// With the Borland C++ compiler, we want to disable FPU exceptions
// (this is recommended for OpenGL applications under Windows)
_control87(MCW_EM, MCW_EM);
#endif
if (!_glfwRegisterWindowClass())
return GL_FALSE;
@ -381,8 +370,6 @@ const char* _glfwPlatformGetVersionString(void)
" MinGW"
#elif defined(_MSC_VER)
" VisualC"
#elif defined(__BORLANDC__)
" BorlandC"
#endif
#if defined(_GLFW_BUILD_DLL)
" DLL"

View File

@ -144,7 +144,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
if (!name)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Failed to convert string to UTF-8");
"Win32: Failed to convert string to UTF-8");
continue;
}

View File

@ -584,7 +584,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
int i;
const int count = DragQueryFileW(hDrop, 0xffffffff, NULL, 0);
char** names = calloc(count, sizeof(char*));
char** paths = calloc(count, sizeof(char*));
// Move the mouse to the position of the drop
DragQueryPoint(hDrop, &pt);
@ -596,16 +596,16 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
WCHAR* buffer = calloc(length + 1, sizeof(WCHAR));
DragQueryFileW(hDrop, i, buffer, length + 1);
names[i] = _glfwCreateUTF8FromWideString(buffer);
paths[i] = _glfwCreateUTF8FromWideString(buffer);
free(buffer);
}
_glfwInputDrop(window, count, (const char**) names);
_glfwInputDrop(window, count, (const char**) paths);
for (i = 0; i < count; i++)
free(names[i]);
free(names);
free(paths[i]);
free(paths);
DragFinish(hDrop);
return 0;
@ -679,7 +679,7 @@ static int createWindow(_GLFWwindow* window,
if (!wideTitle)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to convert title to wide string");
"Win32: Failed to convert window title to UTF-16");
return GL_FALSE;
}
@ -862,7 +862,7 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
if (!wideTitle)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to convert title to wide string");
"Win32: Failed to convert window title to UTF-16");
return;
}
@ -1168,18 +1168,12 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{
LPCWSTR native = translateCursorShape(shape);
if (!native)
{
_glfwInputError(GLFW_INVALID_ENUM, "Win32: Invalid standard cursor");
return GL_FALSE;
}
cursor->win32.handle = CopyCursor(LoadCursorW(NULL, native));
cursor->win32.handle =
CopyCursor(LoadCursorW(NULL, translateCursorShape(shape)));
if (!cursor->win32.handle)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to retrieve shared cursor");
"Win32: Failed to create standard cursor");
return GL_FALSE;
}
@ -1219,8 +1213,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
if (!wideString)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to convert clipboard string to "
"wide string");
"Win32: Failed to convert string to UTF-16");
return;
}
@ -1259,12 +1252,6 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
{
HANDLE stringHandle;
if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE, NULL);
return NULL;
}
if (!OpenClipboard(window->win32.handle))
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to open clipboard");
@ -1276,8 +1263,8 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
{
CloseClipboard();
_glfwInputError(GLFW_PLATFORM_ERROR,
"Win32: Failed to retrieve clipboard data");
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"Win32: Failed to convert clipboard to string");
return NULL;
}

View File

@ -394,7 +394,7 @@ GLFWAPI void glfwWindowHint(int target, int hint)
_glfw.hints.release = hint;
break;
default:
_glfwInputError(GLFW_INVALID_ENUM, NULL);
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint");
break;
}
}
@ -479,7 +479,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
if (window->monitor)
{
_glfwInputError(GLFW_INVALID_VALUE,
"Full screen windows cannot be positioned");
"Full screen windows cannot be moved");
return;
}
@ -624,7 +624,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
return window->context.release;
}
_glfwInputError(GLFW_INVALID_ENUM, NULL);
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute");
return 0;
}

View File

@ -479,11 +479,13 @@ static GLboolean initExtensions(void)
"_MOTIF_WM_HINTS",
False);
#if defined(_GLFW_HAS_XF86VM)
// Check for XF86VidMode extension
_glfw.x11.vidmode.available =
XF86VidModeQueryExtension(_glfw.x11.display,
&_glfw.x11.vidmode.eventBase,
&_glfw.x11.vidmode.errorBase);
#endif /*_GLFW_HAS_XF86VM*/
// Check for RandR extension
_glfw.x11.randr.available =
@ -535,6 +537,7 @@ static GLboolean initExtensions(void)
_glfw.x11.xinerama.available = GL_TRUE;
}
#if defined(_GLFW_HAS_XINPUT)
if (XQueryExtension(_glfw.x11.display,
"XInputExtension",
&_glfw.x11.xi.majorOpcode,
@ -551,6 +554,7 @@ static GLboolean initExtensions(void)
_glfw.x11.xi.available = GL_TRUE;
}
}
#endif /*_GLFW_HAS_XINPUT*/
// Check if Xkb is supported on this display
_glfw.x11.xkb.versionMajor = 1;
@ -583,7 +587,7 @@ static GLboolean initExtensions(void)
detectEWMH();
// Find or create string format atoms
_glfw.x11._NULL = XInternAtom(_glfw.x11.display, "NULL", False);
_glfw.x11.NULL_ = XInternAtom(_glfw.x11.display, "NULL", False);
_glfw.x11.UTF8_STRING =
XInternAtom(_glfw.x11.display, "UTF8_STRING", False);
_glfw.x11.COMPOUND_STRING =
@ -710,6 +714,8 @@ Cursor _glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
int _glfwPlatformInit(void)
{
// HACK: If the current locale is C, apply the environment's locale
// This is done because the C locale breaks character input
if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
setlocale(LC_CTYPE, "");
@ -718,7 +724,7 @@ int _glfwPlatformInit(void)
_glfw.x11.display = XOpenDisplay(NULL);
if (!_glfw.x11.display)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "X11: Failed to open X display");
_glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to open X display");
return GL_FALSE;
}

View File

@ -432,6 +432,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
XRRFreeGamma(gamma);
}
#if defined(_GLFW_HAS_XF86VM)
else if (_glfw.x11.vidmode.available)
{
int size;
@ -443,6 +444,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
_glfw.x11.screen,
ramp->size, ramp->red, ramp->green, ramp->blue);
}
#endif /*_GLFW_HAS_XF86VM*/
}
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
@ -458,6 +460,7 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
XRRSetCrtcGamma(_glfw.x11.display, monitor->x11.crtc, gamma);
XRRFreeGamma(gamma);
}
#if defined(_GLFW_HAS_XF86VM)
else if (_glfw.x11.vidmode.available)
{
XF86VidModeSetGammaRamp(_glfw.x11.display,
@ -467,6 +470,7 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
(unsigned short*) ramp->green,
(unsigned short*) ramp->blue);
}
#endif /*_GLFW_HAS_XF86VM*/
}

View File

@ -37,21 +37,25 @@
#include <X11/Xatom.h>
#include <X11/Xcursor/Xcursor.h>
// The Xf86VidMode extension provides fallback gamma control
#include <X11/extensions/xf86vmode.h>
// The XRandR extension provides mode setting and gamma control
#include <X11/extensions/Xrandr.h>
// The XInput2 extension provides improved input events
#include <X11/extensions/XInput2.h>
// The Xkb extension provides improved keyboard support
#include <X11/XKBlib.h>
// The Xinerama extension provides legacy monitor indices
#include <X11/extensions/Xinerama.h>
#if defined(_GLFW_HAS_XINPUT)
// The XInput2 extension provides improved input events
#include <X11/extensions/XInput2.h>
#endif
#if defined(_GLFW_HAS_XF86VM)
// The Xf86VidMode extension provides fallback gamma control
#include <X11/extensions/xf86vmode.h>
#endif
#include "posix_tls.h"
#if defined(_GLFW_GLX)
@ -156,18 +160,12 @@ typedef struct _GLFWlibraryX11
Atom CLIPBOARD;
Atom CLIPBOARD_MANAGER;
Atom SAVE_TARGETS;
Atom _NULL;
Atom NULL_;
Atom UTF8_STRING;
Atom COMPOUND_STRING;
Atom ATOM_PAIR;
Atom GLFW_SELECTION;
struct {
GLboolean available;
int eventBase;
int errorBase;
} vidmode;
struct {
GLboolean available;
int eventBase;
@ -188,15 +186,6 @@ typedef struct _GLFWlibraryX11
int versionMinor;
} xkb;
struct {
GLboolean available;
int majorOpcode;
int eventBase;
int errorBase;
int versionMajor;
int versionMinor;
} xi;
struct {
int count;
int timeout;
@ -215,6 +204,25 @@ typedef struct _GLFWlibraryX11
int versionMinor;
} xinerama;
#if defined(_GLFW_HAS_XINPUT)
struct {
GLboolean available;
int majorOpcode;
int eventBase;
int errorBase;
int versionMajor;
int versionMinor;
} xi;
#endif /*_GLFW_HAS_XINPUT*/
#if defined(_GLFW_HAS_XF86VM)
struct {
GLboolean available;
int eventBase;
int errorBase;
} vidmode;
#endif /*_GLFW_HAS_XF86VM*/
} _GLFWlibraryX11;

View File

@ -28,6 +28,7 @@
#include "internal.h"
#include <X11/cursorfont.h>
#include <X11/Xmd.h>
#include <sys/select.h>
@ -57,6 +58,22 @@ typedef struct
#define MWM_HINTS_DECORATIONS (1L << 1)
// Wait for data to arrive
//
void selectDisplayConnection(struct timeval* timeout)
{
fd_set fds;
const int fd = ConnectionNumber(_glfw.x11.display);
FD_ZERO(&fds);
FD_SET(fd, &fds);
// select(1) is used instead of an X function like XNextEvent, as the
// wait inside those are guarded by the mutex protecting the display
// struct, locking out other threads from using X (including GLX)
select(fd + 1, &fds, NULL, NULL, timeout);
}
// Returns whether the window is iconified
//
static int getWindowState(_GLFWwindow* window)
@ -183,11 +200,12 @@ static void changeWindowState(_GLFWwindow* window, Atom state, int action)
}
// Splits and translates a text/uri-list into separate file paths
// NOTE: This function destroys the provided string
//
static char** parseUriList(char* text, int* count)
{
const char* prefix = "file://";
char** names = NULL;
char** paths = NULL;
char* line;
*count = 0;
@ -196,7 +214,7 @@ static char** parseUriList(char* text, int* count)
{
text = NULL;
if (*line == '#')
if (line[0] == '#')
continue;
if (strncmp(line, prefix, strlen(prefix)) == 0)
@ -204,27 +222,27 @@ static char** parseUriList(char* text, int* count)
(*count)++;
char* name = calloc(strlen(line) + 1, 1);
names = realloc(names, *count * sizeof(char*));
names[*count - 1] = name;
char* path = calloc(strlen(line) + 1, 1);
paths = realloc(paths, *count * sizeof(char*));
paths[*count - 1] = path;
while (*line)
{
if (line[0] == '%' && line[1] && line[2])
{
const char digits[3] = { line[1], line[2], '\0' };
*name = strtol(digits, NULL, 16);
*path = strtol(digits, NULL, 16);
line += 2;
}
else
*name = *line;
*path = *line;
name++;
path++;
line++;
}
}
return names;
return paths;
}
// Create the X11 window (and its colormap)
@ -411,6 +429,7 @@ static GLboolean createWindow(_GLFWwindow* window,
XFree(hint);
}
#if defined(_GLFW_HAS_XINPUT)
if (_glfw.x11.xi.available)
{
// Select for XInput2 events
@ -425,6 +444,7 @@ static GLboolean createWindow(_GLFWwindow* window,
XISelectEvents(_glfw.x11.display, window->x11.handle, &eventmask, 1);
}
#endif /*_GLFW_HAS_XINPUT*/
if (_glfw.x11.XdndAware)
{
@ -435,27 +455,6 @@ static GLboolean createWindow(_GLFWwindow* window,
PropModeReplace, (unsigned char*) &version, 1);
}
if (_glfw.x11.NET_REQUEST_FRAME_EXTENTS)
{
// Ensure _NET_FRAME_EXTENTS is set, allowing glfwGetWindowFrameSize to
// function before the window is mapped
XEvent event;
memset(&event, 0, sizeof(event));
event.type = ClientMessage;
event.xclient.window = window->x11.handle;
event.xclient.format = 32; // Data is 32-bit longs
event.xclient.message_type = _glfw.x11.NET_REQUEST_FRAME_EXTENTS;
XSendEvent(_glfw.x11.display,
_glfw.x11.root,
False,
SubstructureNotifyMask | SubstructureRedirectMask,
&event);
XIfEvent(_glfw.x11.display, &event, isFrameExtentsEvent, (XPointer) window);
}
if (wndconfig->floating && !wndconfig->monitor)
{
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_ABOVE)
@ -629,7 +628,7 @@ static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
XChangeProperty(_glfw.x11.display,
request->requestor,
request->property,
_glfw.x11._NULL,
_glfw.x11.NULL_,
32,
PropModeReplace,
NULL,
@ -701,33 +700,35 @@ static void pushSelectionToManager(_GLFWwindow* window)
{
XEvent event;
if (!XCheckIfEvent(_glfw.x11.display, &event, isSelectionEvent, NULL))
continue;
switch (event.type)
while (XCheckIfEvent(_glfw.x11.display, &event, isSelectionEvent, NULL))
{
case SelectionRequest:
handleSelectionRequest(&event);
break;
case SelectionClear:
handleSelectionClear(&event);
break;
case SelectionNotify:
switch (event.type)
{
if (event.xselection.target == _glfw.x11.SAVE_TARGETS)
{
// This means one of two things; either the selection was
// not owned, which means there is no clipboard manager, or
// the transfer to the clipboard manager has completed
// In either case, it means we are done here
return;
}
case SelectionRequest:
handleSelectionRequest(&event);
break;
break;
case SelectionClear:
handleSelectionClear(&event);
break;
case SelectionNotify:
{
if (event.xselection.target == _glfw.x11.SAVE_TARGETS)
{
// This means one of two things; either the selection was
// not owned, which means there is no clipboard manager, or
// the transfer to the clipboard manager has completed
// In either case, it means we are done here
return;
}
break;
}
}
}
selectDisplayConnection(NULL);
}
}
@ -1007,7 +1008,7 @@ static void processEvent(XEvent *event)
// Additional buttons after 7 are treated as regular buttons
// We subtract 4 to fill the gap left by scroll input above
_glfwInputMouseClick(window,
event->xbutton.button - 4,
event->xbutton.button - Button1 - 4,
GLFW_PRESS,
mods);
}
@ -1045,7 +1046,7 @@ static void processEvent(XEvent *event)
// Additional buttons after 7 are treated as regular buttons
// We subtract 4 to fill the gap left by scroll input above
_glfwInputMouseClick(window,
event->xbutton.button - 4,
event->xbutton.button - Button1 - 4,
GLFW_RELEASE,
mods);
}
@ -1054,6 +1055,11 @@ static void processEvent(XEvent *event)
case EnterNotify:
{
// HACK: This is a workaround for WMs (KWM, Fluxbox) that otherwise
// ignore the defined cursor for hidden cursor mode
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
hideCursor(window);
_glfwInputCursorEnter(window, GL_TRUE);
break;
}
@ -1216,13 +1222,13 @@ static void processEvent(XEvent *event)
if (result)
{
int i, count;
char** names = parseUriList(data, &count);
char** paths = parseUriList(data, &count);
_glfwInputDrop(window, count, (const char**) names);
_glfwInputDrop(window, count, (const char**) paths);
for (i = 0; i < count; i++)
free(names[i]);
free(names);
free(paths[i]);
free(paths);
}
XFree(data);
@ -1309,6 +1315,7 @@ static void processEvent(XEvent *event)
case DestroyNotify:
return;
#if defined(_GLFW_HAS_XINPUT)
case GenericEvent:
{
if (event->xcookie.extension == _glfw.x11.xi.majorOpcode &&
@ -1354,6 +1361,7 @@ static void processEvent(XEvent *event)
XFreeEventData(_glfw.x11.display, &event->xcookie);
break;
}
#endif /*_GLFW_HAS_XINPUT*/
default:
{
@ -1447,8 +1455,8 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
if (window->x11.handle)
{
if (window->x11.handle ==
XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD))
if (XGetSelectionOwner(_glfw.x11.display, _glfw.x11.CLIPBOARD) ==
window->x11.handle)
{
pushSelectionToManager(window);
}
@ -1596,6 +1604,56 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
if (_glfw.x11.NET_FRAME_EXTENTS == None)
return;
if (!_glfwPlatformWindowVisible(window) &&
_glfw.x11.NET_REQUEST_FRAME_EXTENTS)
{
// Ensure _NET_FRAME_EXTENTS is set, allowing glfwGetWindowFrameSize to
// function before the window is mapped
double base;
XEvent event;
memset(&event, 0, sizeof(event));
event.type = ClientMessage;
event.xclient.window = window->x11.handle;
event.xclient.format = 32; // Data is 32-bit longs
event.xclient.message_type = _glfw.x11.NET_REQUEST_FRAME_EXTENTS;
XSendEvent(_glfw.x11.display,
_glfw.x11.root,
False,
SubstructureNotifyMask | SubstructureRedirectMask,
&event);
// HACK: Poll with timeout for the required response instead of blocking
// This is done because some window managers (at least Unity,
// Fluxbox and Xfwm) failed to send the required response
// They have been fixed but broken versions are still in the wild
// If you are affected by this and your window manager is NOT
// listed above, PLEASE report it to their and our issue trackers
base = _glfwPlatformGetTime();
while (!XCheckIfEvent(_glfw.x11.display,
&event,
isFrameExtentsEvent,
(XPointer) window))
{
double remaining;
struct timeval timeout;
remaining = 0.5 + base - _glfwPlatformGetTime();
if (remaining <= 0.0)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: The window manager has a broken _NET_REQUEST_FRAME_EXTENTS implementation; please report this issue");
return;
}
timeout.tv_sec = 0;
timeout.tv_usec = (long) (remaining * 1e6);
selectDisplayConnection(&timeout);
}
}
if (_glfwGetWindowProperty(window->x11.handle,
_glfw.x11.NET_FRAME_EXTENTS,
XA_CARDINAL,
@ -1621,9 +1679,8 @@ void _glfwPlatformIconifyWindow(_GLFWwindow* window)
{
// Override-redirect windows cannot be iconified or restored, as those
// tasks are performed by the window manager
_glfwInputError(GLFW_API_UNAVAILABLE,
"X11: Iconification of full screen windows requires "
"a WM that supports EWMH");
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Iconification of full screen windows requires a WM that supports EWMH");
return;
}
@ -1637,9 +1694,8 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
{
// Override-redirect windows cannot be iconified or restored, as those
// tasks are performed by the window manager
_glfwInputError(GLFW_API_UNAVAILABLE,
"X11: Iconification of full screen windows requires "
"a WM that supports EWMH");
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Iconification of full screen windows requires a WM that supports EWMH");
return;
}
@ -1708,19 +1764,7 @@ void _glfwPlatformPollEvents(void)
void _glfwPlatformWaitEvents(void)
{
if (!XPending(_glfw.x11.display))
{
fd_set fds;
const int fd = ConnectionNumber(_glfw.x11.display);
FD_ZERO(&fds);
FD_SET(fd, &fds);
// select(1) is used instead of an X function like XNextEvent, as the
// wait inside those are guarded by the mutex protecting the display
// struct, locking out other threads from using X (including GLX)
if (select(fd + 1, &fds, NULL, NULL, NULL) < 0)
return;
}
selectDisplayConnection(NULL);
_glfwPlatformPollEvents();
}
@ -1734,7 +1778,7 @@ void _glfwPlatformPostEmptyEvent(void)
event.type = ClientMessage;
event.xclient.window = window->x11.handle;
event.xclient.format = 32; // Data is 32-bit longs
event.xclient.message_type = _glfw.x11._NULL;
event.xclient.message_type = _glfw.x11.NULL_;
XSendEvent(_glfw.x11.display, window->x11.handle, False, 0, &event);
XFlush(_glfw.x11.display);
@ -1796,14 +1840,8 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{
const unsigned int native = translateCursorShape(shape);
if (!native)
{
_glfwInputError(GLFW_INVALID_ENUM, "X11: Invalid standard cursor");
return GL_FALSE;
}
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
cursor->x11.handle = XCreateFontCursor(_glfw.x11.display,
translateCursorShape(shape));
if (!cursor->x11.handle)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
@ -1846,7 +1884,7 @@ void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
window->x11.handle)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Failed to become owner of the clipboard selection");
"X11: Failed to become owner of clipboard selection");
}
}
@ -1883,7 +1921,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
// XCheckTypedEvent is used instead of XIfEvent in order not to lock
// other threads out from the display during the entire wait period
while (!XCheckTypedEvent(_glfw.x11.display, SelectionNotify, &event))
;
selectDisplayConnection(NULL);
if (event.xselection.property == None)
continue;
@ -1909,7 +1947,7 @@ const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
if (_glfw.x11.clipboardString == NULL)
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"X11: Failed to convert selection to string");
"X11: Failed to convert clipboard to string");
}
return _glfw.x11.clipboardString;

View File

@ -1,5 +1,5 @@
link_libraries(glfw "${OPENGL_glu_LIBRARY}")
link_libraries(glfw)
if (BUILD_SHARED_LIBS)
add_definitions(-DGLFW_DLL)
@ -28,7 +28,7 @@ add_executable(gamma gamma.c ${GETOPT})
add_executable(glfwinfo glfwinfo.c ${GETOPT})
add_executable(iconify iconify.c ${GETOPT})
add_executable(joysticks joysticks.c)
add_executable(modes modes.c ${GETOPT})
add_executable(monitors monitors.c ${GETOPT})
add_executable(peter peter.c)
add_executable(reopen reopen.c)
add_executable(cursor cursor.c)
@ -62,7 +62,7 @@ target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")
set(WINDOWS_BINARIES accuracy empty sharing tearing threads title windows cursoranim)
set(CONSOLE_BINARIES clipboard defaults events fsaa gamma glfwinfo
iconify joysticks modes peter reopen cursor)
iconify joysticks monitors peter reopen cursor)
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
FOLDER "GLFW3/Tests")
@ -76,6 +76,7 @@ endif()
if (APPLE)
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL})
MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL}
MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/AppleInfo.plist")
endif()

View File

@ -27,7 +27,6 @@
//
//========================================================================
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <stdio.h>

View File

@ -398,7 +398,7 @@ static void char_mods_callback(GLFWwindow* window, unsigned int codepoint, int m
get_mods_name(mods));
}
static void drop_callback(GLFWwindow* window, int count, const char** names)
static void drop_callback(GLFWwindow* window, int count, const char** paths)
{
int i;
Slot* slot = glfwGetWindowUserPointer(window);
@ -407,7 +407,7 @@ static void drop_callback(GLFWwindow* window, int count, const char** names)
counter++, slot->number, glfwGetTime());
for (i = 0; i < count; i++)
printf(" %i: \"%s\"\n", i, names[i]);
printf(" %i: \"%s\"\n", i, paths[i]);
}
static void monitor_callback(GLFWmonitor* monitor, int event)

View File

@ -110,7 +110,7 @@ static void draw_joystick(Joystick* j, int x, int y, int width, int height)
static void draw_joysticks(GLFWwindow* window)
{
int i, width, height;
int i, width, height, offset = 0;
glfwGetFramebufferSize(window, &width, &height);
@ -126,8 +126,9 @@ static void draw_joysticks(GLFWwindow* window)
if (j->present)
{
draw_joystick(j,
0, i * height / joystick_count,
0, offset * height / joystick_count,
width, height / joystick_count);
offset++;
}
}
}

View File

@ -1,5 +1,5 @@
//========================================================================
// Video mode test
// Monitor information tool
// Copyright (c) Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
@ -23,7 +23,8 @@
//
//========================================================================
//
// This test enumerates or verifies video modes
// This test prints monitor and video mode information or verifies video
// modes
//
//========================================================================
@ -43,8 +44,8 @@ enum Mode
static void usage(void)
{
printf("Usage: modes [-t]\n");
printf(" modes -h\n");
printf("Usage: monitors [-t]\n");
printf(" monitors -h\n");
}
static const char* format_mode(const GLFWvidmode* mode)