mirror of
https://github.com/glfw/glfw.git
synced 2026-09-19 23:43:15 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fd4ea8bc25 | |||
| d3f3e2d6c5 | |||
| 546c794321 | |||
| d69796d9e0 | |||
| 4ff8095dee | |||
| 3415f3ccde | |||
| 6770ae0556 | |||
| bb5581690d | |||
| 57b8be1c24 | |||
| c93b120252 | |||
| 5cf8587269 | |||
| b998d4fe01 | |||
| d0a0e37b2b | |||
| 3f74712540 | |||
| 124bc392ab | |||
| 8c1588b14e |
+15
-2
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 2.8)
|
|||||||
|
|
||||||
set(GLFW_VERSION_MAJOR "3")
|
set(GLFW_VERSION_MAJOR "3")
|
||||||
set(GLFW_VERSION_MINOR "0")
|
set(GLFW_VERSION_MINOR "0")
|
||||||
set(GLFW_VERSION_PATCH "2")
|
set(GLFW_VERSION_PATCH "3")
|
||||||
set(GLFW_VERSION_EXTRA "")
|
set(GLFW_VERSION_EXTRA "")
|
||||||
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
|
set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}")
|
||||||
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
|
set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}")
|
||||||
@@ -163,6 +163,13 @@ if (_GLFW_WIN32)
|
|||||||
if (GLFW_USE_OPTIMUS_HPG)
|
if (GLFW_USE_OPTIMUS_HPG)
|
||||||
set(_GLFW_USE_OPTIMUS_HPG 1)
|
set(_GLFW_USE_OPTIMUS_HPG 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before
|
||||||
|
# the inclusion of stddef.h (by glfw3.h), which is itself included before
|
||||||
|
# win32_platform.h. We define them here until a saner solution can be found
|
||||||
|
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
|
||||||
|
add_definitions(-DUNICODE)
|
||||||
|
add_definitions(-DWINVER=0x0501)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
@@ -204,7 +211,13 @@ if (_GLFW_X11)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND glfw_INCLUDE_DIRS ${X11_Xinput_INCLUDE_PATH})
|
list(APPEND glfw_INCLUDE_DIRS ${X11_Xinput_INCLUDE_PATH})
|
||||||
list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB})
|
|
||||||
|
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()
|
||||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xi")
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xi")
|
||||||
|
|
||||||
# Check for Xf86VidMode (fallback gamma control)
|
# Check for Xf86VidMode (fallback gamma control)
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ GLFW is a free, Open Source, portable library for OpenGL and OpenGL ES
|
|||||||
application development. It provides a simple, platform-independent API for
|
application development. It provides a simple, platform-independent API for
|
||||||
creating windows and contexts, reading input, handling events, etc.
|
creating windows and contexts, reading input, handling events, etc.
|
||||||
|
|
||||||
Version 3.0.2 adds support for OpenGL 4 on and precise scrolling deltas on OS
|
Version 3.0.3 adds fixes for a number of bugs that together affect all supported
|
||||||
X and fixes for a number of bugs that together affect all supported platforms.
|
platforms, most notably MinGW compilation issues and cursor mode issues on OS X.
|
||||||
As this is a patch release, there are no API changes.
|
As this is a patch release, there are no API changes.
|
||||||
|
|
||||||
If you are new to GLFW, you may find the
|
If you are new to GLFW, you may find the
|
||||||
@@ -205,35 +205,13 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/).
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Allowed character callback to be triggered regardless of modifier keys
|
- [Win32] Bugfix: `_WIN32_WINNT` was not set to Windows XP or later
|
||||||
- Bugfix: The `-Wall` flag was not used with Clang and other GCC compatibles
|
- [Win32] Bugfix: Legacy MinGW needs `WINVER` and `UNICODE` before `stddef.h`
|
||||||
- Bugfix: The default for `GLFW_ALPHA_BITS` was set to zero
|
- [Cocoa] Bugfix: Cursor was not visible in normal mode in full screen
|
||||||
- Bugfix: `glfwInit` would segfault if monitor enumeration failed and no error
|
- [Cocoa] Bugfix: Cursor was not actually hidden in hidden mode
|
||||||
callback was set
|
- [Cocoa] Bugfix: Cursor modes were not applied to inactive windows
|
||||||
- [Win32] Added `_GLFW_USE_DWM_SWAP_INTERVAL` for forcing the swap interval
|
- [X11] Bugfix: Events for mouse buttons 4 and above were not reported
|
||||||
to be set even when DWM compositing is enabled
|
- [X11] Bugfix: CMake 2.8.7 does not set `X11_Xinput_LIB` even when found
|
||||||
- [Win32] Added support for forcing the use of the high-performance GPU
|
|
||||||
on nVidia Optimus systems
|
|
||||||
- [Win32] Bugfix: The clipboard string was not freed on terminate
|
|
||||||
- [Win32] Bugfix: Entry points for OpenGL 1.0 and 1.1 functions were not
|
|
||||||
returned by `glfwGetProcAddress`
|
|
||||||
- [Win32] Bugfix: The `user32` and `dwmapi` module handles were not freed on
|
|
||||||
library termination
|
|
||||||
- [Cocoa] Added support for precise scrolling deltas on OS X 10.7 and later
|
|
||||||
- [Cocoa] Enabled explicit creation of OpenGL 3.x and 4.x contexts as supported
|
|
||||||
by OS X 10.9
|
|
||||||
- [Cocoa] Bugfix: The clipboard string was not freed on terminate
|
|
||||||
- [Cocoa] Bugfix: Selectors were used that are not declared by the 10.6 SDK
|
|
||||||
- [Cocoa] Bugfix: The position set by `glfwSetWindowPos` was incorrect
|
|
||||||
- [X11] Bugfix: Override-redirect windows were resized to the desired instead
|
|
||||||
of the actual resolution of the selected video mode
|
|
||||||
- [X11] Bugfix: Screensaver override for full screen windows had a possible
|
|
||||||
race condition
|
|
||||||
- [X11] Bugfix: The reported window position did not account for the size of
|
|
||||||
the window frame on some WMs
|
|
||||||
- [X11] Bugfix: The original video mode of a monitor was overwritten by calls
|
|
||||||
to `glfwSetWindowSize`
|
|
||||||
- [X11] Bugfix: Key release events for `GLFW_KEY_KP_5` were discarded.
|
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
@@ -304,6 +282,7 @@ skills.
|
|||||||
- Bruce Mitchener
|
- Bruce Mitchener
|
||||||
- Jeff Molofee
|
- Jeff Molofee
|
||||||
- Jon Morton
|
- Jon Morton
|
||||||
|
- Pierre Moulon
|
||||||
- Julian Møller
|
- Julian Møller
|
||||||
- Ozzy
|
- Ozzy
|
||||||
- Peoro
|
- Peoro
|
||||||
|
|||||||
+36
-37
@@ -133,10 +133,38 @@ extern "C" {
|
|||||||
|
|
||||||
/* Most GL/glu.h variants on Windows need wchar_t
|
/* 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 */
|
* OpenGL/gl.h blocks the definition of ptrdiff_t by glext.h on OS X */
|
||||||
#include <stddef.h>
|
#if !defined(GLFW_INCLUDE_NONE)
|
||||||
|
#include <stddef.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Include the chosen client API headers.
|
||||||
/* ---------------- GLFW related system specific defines ----------------- */
|
*/
|
||||||
|
#if defined(__APPLE_CC__)
|
||||||
|
#if defined(GLFW_INCLUDE_GLCOREARB)
|
||||||
|
#include <OpenGL/gl3.h>
|
||||||
|
#elif !defined(GLFW_INCLUDE_NONE)
|
||||||
|
#define GL_GLEXT_LEGACY
|
||||||
|
#include <OpenGL/gl.h>
|
||||||
|
#endif
|
||||||
|
#if defined(GLFW_INCLUDE_GLU)
|
||||||
|
#include <OpenGL/glu.h>
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if defined(GLFW_INCLUDE_GLCOREARB)
|
||||||
|
#include <GL/glcorearb.h>
|
||||||
|
#elif defined(GLFW_INCLUDE_ES1)
|
||||||
|
#include <GLES/gl.h>
|
||||||
|
#elif defined(GLFW_INCLUDE_ES2)
|
||||||
|
#include <GLES2/gl2.h>
|
||||||
|
#elif defined(GLFW_INCLUDE_ES3)
|
||||||
|
#include <GLES3/gl3.h>
|
||||||
|
#elif !defined(GLFW_INCLUDE_NONE)
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#endif
|
||||||
|
#if defined(GLFW_INCLUDE_GLU)
|
||||||
|
#include <GL/glu.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
|
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
|
||||||
/* GLFW_DLL is defined by users of GLFW when compiling programs that will link
|
/* GLFW_DLL is defined by users of GLFW when compiling programs that will link
|
||||||
@@ -173,35 +201,6 @@ extern "C" {
|
|||||||
|
|
||||||
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
|
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
|
||||||
|
|
||||||
/* Include the chosen client API headers.
|
|
||||||
*/
|
|
||||||
#if defined(__APPLE_CC__)
|
|
||||||
#if defined(GLFW_INCLUDE_GLCOREARB)
|
|
||||||
#include <OpenGL/gl3.h>
|
|
||||||
#elif !defined(GLFW_INCLUDE_NONE)
|
|
||||||
#define GL_GLEXT_LEGACY
|
|
||||||
#include <OpenGL/gl.h>
|
|
||||||
#endif
|
|
||||||
#if defined(GLFW_INCLUDE_GLU)
|
|
||||||
#include <OpenGL/glu.h>
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#if defined(GLFW_INCLUDE_GLCOREARB)
|
|
||||||
#include <GL/glcorearb.h>
|
|
||||||
#elif defined(GLFW_INCLUDE_ES1)
|
|
||||||
#include <GLES/gl.h>
|
|
||||||
#elif defined(GLFW_INCLUDE_ES2)
|
|
||||||
#include <GLES2/gl2.h>
|
|
||||||
#elif defined(GLFW_INCLUDE_ES3)
|
|
||||||
#include <GLES3/gl3.h>
|
|
||||||
#elif !defined(GLFW_INCLUDE_NONE)
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#endif
|
|
||||||
#if defined(GLFW_INCLUDE_GLU)
|
|
||||||
#include <GL/glu.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* GLFW API tokens
|
* GLFW API tokens
|
||||||
@@ -228,7 +227,7 @@ extern "C" {
|
|||||||
* API changes.
|
* API changes.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_REVISION 2
|
#define GLFW_VERSION_REVISION 3
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @name Key and button actions
|
/*! @name Key and button actions
|
||||||
@@ -793,7 +792,7 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
|
|||||||
*
|
*
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct GLFWvidmode
|
||||||
{
|
{
|
||||||
/*! The width, in screen coordinates, of the video mode.
|
/*! The width, in screen coordinates, of the video mode.
|
||||||
*/
|
*/
|
||||||
@@ -823,7 +822,7 @@ typedef struct
|
|||||||
*
|
*
|
||||||
* @ingroup monitor
|
* @ingroup monitor
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct GLFWgammaramp
|
||||||
{
|
{
|
||||||
/*! An array of value describing the response of the red channel.
|
/*! An array of value describing the response of the red channel.
|
||||||
*/
|
*/
|
||||||
@@ -1854,9 +1853,9 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
|
|||||||
*
|
*
|
||||||
* @param[in] window The desired window.
|
* @param[in] window The desired window.
|
||||||
* @param[in] xpos The desired x-coordinate, relative to the left edge of the
|
* @param[in] xpos The desired x-coordinate, relative to the left edge of the
|
||||||
* client area, or `NULL`.
|
* client area.
|
||||||
* @param[in] ypos The desired y-coordinate, relative to the top edge of the
|
* @param[in] ypos The desired y-coordinate, relative to the top edge of the
|
||||||
* client area, or `NULL`.
|
* client area.
|
||||||
*
|
*
|
||||||
* @sa glfwGetCursorPos
|
* @sa glfwGetCursorPos
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -105,8 +105,6 @@ typedef struct _GLFWlibraryNS
|
|||||||
id autoreleasePool;
|
id autoreleasePool;
|
||||||
id cursor;
|
id cursor;
|
||||||
|
|
||||||
GLboolean cursorHidden;
|
|
||||||
|
|
||||||
char* clipboardString;
|
char* clipboardString;
|
||||||
|
|
||||||
_GLFWjoy joysticks[GLFW_JOYSTICK_LAST + 1];
|
_GLFWjoy joysticks[GLFW_JOYSTICK_LAST + 1];
|
||||||
|
|||||||
+31
-43
@@ -30,6 +30,25 @@
|
|||||||
#include <crt_externs.h>
|
#include <crt_externs.h>
|
||||||
|
|
||||||
|
|
||||||
|
// Center the cursor in the view of the window
|
||||||
|
//
|
||||||
|
static void centerCursor(_GLFWwindow *window)
|
||||||
|
{
|
||||||
|
int width, height;
|
||||||
|
_glfwPlatformGetWindowSize(window, &width, &height);
|
||||||
|
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the cursor to match the specified cursor mode
|
||||||
|
//
|
||||||
|
static void setModeCursor(_GLFWwindow* window, int mode)
|
||||||
|
{
|
||||||
|
if (mode == GLFW_CURSOR_NORMAL)
|
||||||
|
[[NSCursor arrowCursor] set];
|
||||||
|
else
|
||||||
|
[(NSCursor*) _glfw.ns.cursor set];
|
||||||
|
}
|
||||||
|
|
||||||
// Enter fullscreen mode
|
// Enter fullscreen mode
|
||||||
//
|
//
|
||||||
static void enterFullscreenMode(_GLFWwindow* window)
|
static void enterFullscreenMode(_GLFWwindow* window)
|
||||||
@@ -94,13 +113,6 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
|
|||||||
|
|
||||||
@implementation GLFWWindowDelegate
|
@implementation GLFWWindowDelegate
|
||||||
|
|
||||||
static void centerCursor(_GLFWwindow *window)
|
|
||||||
{
|
|
||||||
int width, height;
|
|
||||||
_glfwPlatformGetWindowSize(window, &width, &height);
|
|
||||||
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithGlfwWindow:(_GLFWwindow *)initWindow
|
- (id)initWithGlfwWindow:(_GLFWwindow *)initWindow
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
@@ -159,14 +171,13 @@ static void centerCursor(_GLFWwindow *window)
|
|||||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
_glfwInputWindowFocus(window, GL_TRUE);
|
_glfwInputWindowFocus(window, GL_TRUE);
|
||||||
|
_glfwPlatformSetCursorMode(window, window->cursorMode);
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
|
||||||
centerCursor(window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidResignKey:(NSNotification *)notification
|
- (void)windowDidResignKey:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
_glfwInputWindowFocus(window, GL_FALSE);
|
_glfwInputWindowFocus(window, GL_FALSE);
|
||||||
|
_glfwPlatformSetCursorMode(window, GLFW_CURSOR_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -445,6 +456,11 @@ static int translateKey(unsigned int key)
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)cursorUpdate:(NSEvent *)event
|
||||||
|
{
|
||||||
|
setModeCursor(window, window->cursorMode);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)mouseDown:(NSEvent *)event
|
- (void)mouseDown:(NSEvent *)event
|
||||||
{
|
{
|
||||||
_glfwInputMouseClick(window,
|
_glfwInputMouseClick(window,
|
||||||
@@ -548,7 +564,8 @@ static int translateKey(unsigned int key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
|
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
|
||||||
NSTrackingActiveAlways |
|
NSTrackingActiveInKeyWindow |
|
||||||
|
NSTrackingCursorUpdate |
|
||||||
NSTrackingInVisibleRect;
|
NSTrackingInVisibleRect;
|
||||||
|
|
||||||
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
||||||
@@ -625,12 +642,6 @@ static int translateKey(unsigned int key)
|
|||||||
_glfwInputScroll(window, deltaX, deltaY);
|
_glfwInputScroll(window, deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)resetCursorRects
|
|
||||||
{
|
|
||||||
[self discardCursorRects];
|
|
||||||
[self addCursorRect:[self bounds] cursor:_glfw.ns.cursor];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@@ -759,7 +770,7 @@ static void createMenuBar(void)
|
|||||||
[NSApp setWindowsMenu:windowMenu];
|
[NSApp setWindowsMenu:windowMenu];
|
||||||
[windowMenuItem setSubmenu:windowMenu];
|
[windowMenuItem setSubmenu:windowMenu];
|
||||||
|
|
||||||
[windowMenu addItemWithTitle:@"Miniaturize"
|
[windowMenu addItemWithTitle:@"Minimize"
|
||||||
action:@selector(performMiniaturize:)
|
action:@selector(performMiniaturize:)
|
||||||
keyEquivalent:@"m"];
|
keyEquivalent:@"m"];
|
||||||
[windowMenu addItemWithTitle:@"Zoom"
|
[windowMenu addItemWithTitle:@"Zoom"
|
||||||
@@ -848,7 +859,6 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
[window->ns.object setContentView:window->ns.view];
|
[window->ns.object setContentView:window->ns.view];
|
||||||
[window->ns.object setDelegate:window->ns.delegate];
|
[window->ns.object setDelegate:window->ns.delegate];
|
||||||
[window->ns.object setAcceptsMouseMovedEvents:YES];
|
[window->ns.object setAcceptsMouseMovedEvents:YES];
|
||||||
[window->ns.object disableCursorRects];
|
|
||||||
[window->ns.object center];
|
[window->ns.object center];
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
@@ -1058,37 +1068,15 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
|||||||
|
|
||||||
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
||||||
{
|
{
|
||||||
if (mode == GLFW_CURSOR_HIDDEN)
|
setModeCursor(window, mode);
|
||||||
{
|
|
||||||
[window->ns.object enableCursorRects];
|
|
||||||
[window->ns.object invalidateCursorRectsForView:window->ns.view];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[window->ns.object disableCursorRects];
|
|
||||||
[window->ns.object invalidateCursorRectsForView:window->ns.view];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == GLFW_CURSOR_DISABLED)
|
if (mode == GLFW_CURSOR_DISABLED)
|
||||||
{
|
{
|
||||||
CGAssociateMouseAndMouseCursorPosition(false);
|
CGAssociateMouseAndMouseCursorPosition(false);
|
||||||
|
centerCursor(window);
|
||||||
if (!_glfw.ns.cursorHidden)
|
|
||||||
{
|
|
||||||
[NSCursor hide];
|
|
||||||
_glfw.ns.cursorHidden = GL_TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
CGAssociateMouseAndMouseCursorPosition(true);
|
CGAssociateMouseAndMouseCursorPosition(true);
|
||||||
|
|
||||||
if (_glfw.ns.cursorHidden)
|
|
||||||
{
|
|
||||||
[NSCursor unhide];
|
|
||||||
_glfw.ns.cursorHidden = GL_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+9
-10
@@ -40,7 +40,7 @@ int _glfwInitContextAPI(void)
|
|||||||
if (pthread_key_create(&_glfw.nsgl.current, NULL) != 0)
|
if (pthread_key_create(&_glfw.nsgl.current, NULL) != 0)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"NSOpenGL: Failed to create context TLS");
|
"NSGL: Failed to create context TLS");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,16 +81,15 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: This API does not support OpenGL ES");
|
"NSGL: This API does not support OpenGL ES");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
// Fail if any OpenGL version above 2.1 other than 3.2 was requested
|
|
||||||
if (wndconfig->glMajor == 3 && wndconfig->glMinor < 2)
|
if (wndconfig->glMajor == 3 && wndconfig->glMinor < 2)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of OS X does not "
|
"NSGL: The targeted version of OS X does not "
|
||||||
"support OpenGL 3.0 or 3.1");
|
"support OpenGL 3.0 or 3.1");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -100,7 +99,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (!wndconfig->glForward)
|
if (!wndconfig->glForward)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of OS X only "
|
"NSGL: The targeted version of OS X only "
|
||||||
"supports OpenGL 3.2 and later versions if they "
|
"supports OpenGL 3.2 and later versions if they "
|
||||||
"are forward-compatible");
|
"are forward-compatible");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@@ -109,7 +108,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE)
|
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of OS X only "
|
"NSGL: The targeted version of OS X only "
|
||||||
"supports OpenGL 3.2 and later versions if they "
|
"supports OpenGL 3.2 and later versions if they "
|
||||||
"use the core profile");
|
"use the core profile");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
@@ -120,7 +119,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (wndconfig->glMajor > 2)
|
if (wndconfig->glMajor > 2)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: The targeted version of OS X does not "
|
"NSGL: The targeted version of OS X does not "
|
||||||
"support OpenGL version 3.0 or above");
|
"support OpenGL version 3.0 or above");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -130,7 +129,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (wndconfig->glRobustness)
|
if (wndconfig->glRobustness)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
||||||
"NSOpenGL: OS X does not support OpenGL robustness "
|
"NSGL: OS X does not support OpenGL robustness "
|
||||||
"strategies");
|
"strategies");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -191,7 +190,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (window->nsgl.pixelFormat == nil)
|
if (window->nsgl.pixelFormat == nil)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"NSOpenGL: Failed to create OpenGL pixel format");
|
"NSGL: Failed to create OpenGL pixel format");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +205,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
if (window->nsgl.context == nil)
|
if (window->nsgl.context == nil)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"NSOpenGL: Failed to create OpenGL context");
|
"NSGL: Failed to create OpenGL context");
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,10 +52,15 @@
|
|||||||
#define UNICODE
|
#define UNICODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GLFW requires Windows XP
|
// GLFW requires Windows XP or later
|
||||||
#ifndef WINVER
|
#if WINVER < 0x0501
|
||||||
|
#undef WINVER
|
||||||
#define WINVER 0x0501
|
#define WINVER 0x0501
|
||||||
#endif
|
#endif
|
||||||
|
#if _WIN32_WINNT < 0x0501
|
||||||
|
#undef _WIN32_WINNT
|
||||||
|
#define _WIN32_WINNT 0x0501
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
|||||||
@@ -553,6 +553,16 @@ static void processEvent(XEvent *event)
|
|||||||
else if (event->xbutton.button == Button7)
|
else if (event->xbutton.button == Button7)
|
||||||
_glfwInputScroll(window, 1.0, 0.0);
|
_glfwInputScroll(window, 1.0, 0.0);
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 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,
|
||||||
|
GLFW_PRESS,
|
||||||
|
mods);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,6 +591,15 @@ static void processEvent(XEvent *event)
|
|||||||
GLFW_RELEASE,
|
GLFW_RELEASE,
|
||||||
mods);
|
mods);
|
||||||
}
|
}
|
||||||
|
else if (event->xbutton.button > Button7)
|
||||||
|
{
|
||||||
|
// 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,
|
||||||
|
GLFW_RELEASE,
|
||||||
|
mods);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user