mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 10:48:51 -05:00
Simplified function comment headers.
This commit is contained in:
parent
8ad7c456fd
commit
d97dddc8c4
|
@ -30,12 +30,11 @@
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include <sys/param.h> // For MAXPATHLEN
|
#include <sys/param.h> // For MAXPATHLEN
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Change to our application bundle's resources directory, if present
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#if defined(_GLFW_USE_CHDIR)
|
#if defined(_GLFW_USE_CHDIR)
|
||||||
|
|
||||||
|
// Change to our application bundle's resources directory, if present
|
||||||
|
//
|
||||||
static void changeToResourcesDirectory(void)
|
static void changeToResourcesDirectory(void)
|
||||||
{
|
{
|
||||||
char resourcesPath[MAXPATHLEN];
|
char resourcesPath[MAXPATHLEN];
|
||||||
|
|
|
@ -88,10 +88,8 @@ static _glfwJoystick _glfwJoysticks[GLFW_JOYSTICK_LAST + 1];
|
||||||
static void getElementsCFArrayHandler(const void* value, void* parameter);
|
static void getElementsCFArrayHandler(const void* value, void* parameter);
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Adds an element to the specified joystick
|
// Adds an element to the specified joystick
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void addJoystickElement(_glfwJoystick* joystick, CFTypeRef refElement)
|
static void addJoystickElement(_glfwJoystick* joystick, CFTypeRef refElement)
|
||||||
{
|
{
|
||||||
long elementType, usagePage, usage;
|
long elementType, usagePage, usage;
|
||||||
|
@ -183,22 +181,16 @@ static void addJoystickElement(_glfwJoystick* joystick, CFTypeRef refElement)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Adds an element to the specified joystick
|
// Adds an element to the specified joystick
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void getElementsCFArrayHandler(const void* value, void* parameter)
|
static void getElementsCFArrayHandler(const void* value, void* parameter)
|
||||||
{
|
{
|
||||||
if (CFGetTypeID(value) == CFDictionaryGetTypeID())
|
if (CFGetTypeID(value) == CFDictionaryGetTypeID())
|
||||||
addJoystickElement((_glfwJoystick*) parameter, (CFTypeRef) value);
|
addJoystickElement((_glfwJoystick*) parameter, (CFTypeRef) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Returns the value of the specified element of the specified joystick
|
// Returns the value of the specified element of the specified joystick
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static long getElementValue(_glfwJoystick* joystick, _glfwJoystickElement* element)
|
static long getElementValue(_glfwJoystick* joystick, _glfwJoystickElement* element)
|
||||||
{
|
{
|
||||||
IOReturn result = kIOReturnSuccess;
|
IOReturn result = kIOReturnSuccess;
|
||||||
|
@ -224,11 +216,8 @@ static long getElementValue(_glfwJoystick* joystick, _glfwJoystickElement* eleme
|
||||||
return (long) hidEvent.value;
|
return (long) hidEvent.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Removes the specified joystick
|
// Removes the specified joystick
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void removeJoystick(_glfwJoystick* joystick)
|
static void removeJoystick(_glfwJoystick* joystick)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -271,21 +260,15 @@ static void removeJoystick(_glfwJoystick* joystick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Callback for user-initiated joystick removal
|
// Callback for user-initiated joystick removal
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void removalCallback(void* target, IOReturn result, void* refcon, void* sender)
|
static void removalCallback(void* target, IOReturn result, void* refcon, void* sender)
|
||||||
{
|
{
|
||||||
removeJoystick((_glfwJoystick*) refcon);
|
removeJoystick((_glfwJoystick*) refcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Polls for joystick events and updates GLFW state
|
// Polls for joystick events and updates GLFW state
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void pollJoystickEvents(void)
|
static void pollJoystickEvents(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -326,10 +309,8 @@ static void pollJoystickEvents(void)
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize joystick interface
|
// Initialize joystick interface
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwInitJoysticks(void)
|
void _glfwInitJoysticks(void)
|
||||||
{
|
{
|
||||||
int deviceCounter = 0;
|
int deviceCounter = 0;
|
||||||
|
@ -471,11 +452,8 @@ void _glfwInitJoysticks(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Close all opened joystick handles
|
// Close all opened joystick handles
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwTerminateJoysticks(void)
|
void _glfwTerminateJoysticks(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -36,10 +36,8 @@
|
||||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Get the name of the specified display
|
// Get the name of the specified display
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
const char* getDisplayName(CGDirectDisplayID displayID)
|
const char* getDisplayName(CGDirectDisplayID displayID)
|
||||||
{
|
{
|
||||||
char* name;
|
char* name;
|
||||||
|
@ -68,11 +66,8 @@ const char* getDisplayName(CGDirectDisplayID displayID)
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Check whether the display mode should be included in enumeration
|
// Check whether the display mode should be included in enumeration
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLboolean modeIsGood(CGDisplayModeRef mode)
|
static GLboolean modeIsGood(CGDisplayModeRef mode)
|
||||||
{
|
{
|
||||||
uint32_t flags = CGDisplayModeGetIOFlags(mode);
|
uint32_t flags = CGDisplayModeGetIOFlags(mode);
|
||||||
|
@ -100,11 +95,8 @@ static GLboolean modeIsGood(CGDisplayModeRef mode)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Convert Core Graphics display mode to GLFW video mode
|
// Convert Core Graphics display mode to GLFW video mode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode)
|
static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode)
|
||||||
{
|
{
|
||||||
GLFWvidmode result;
|
GLFWvidmode result;
|
||||||
|
@ -135,10 +127,8 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode)
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Change the current video mode
|
// Change the current video mode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, int* width, int* height, int* bpp)
|
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, int* width, int* height, int* bpp)
|
||||||
{
|
{
|
||||||
CGDisplayModeRef bestMode = NULL;
|
CGDisplayModeRef bestMode = NULL;
|
||||||
|
@ -199,11 +189,8 @@ GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, int* width, int* height, int*
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Restore the previously saved (original) video mode
|
// Restore the previously saved (original) video mode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
CGDisplaySetDisplayMode(monitor->ns.displayID, monitor->ns.previousMode, NULL);
|
CGDisplaySetDisplayMode(monitor->ns.displayID, monitor->ns.previousMode, NULL);
|
||||||
|
|
|
@ -32,10 +32,8 @@
|
||||||
#include <mach/mach_time.h>
|
#include <mach/mach_time.h>
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Return raw time
|
// Return raw time
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static uint64_t getRawTime(void)
|
static uint64_t getRawTime(void)
|
||||||
{
|
{
|
||||||
return mach_absolute_time();
|
return mach_absolute_time();
|
||||||
|
@ -46,10 +44,8 @@ static uint64_t getRawTime(void)
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialise timer
|
// Initialise timer
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwInitTimer(void)
|
void _glfwInitTimer(void)
|
||||||
{
|
{
|
||||||
mach_timebase_info_data_t info;
|
mach_timebase_info_data_t info;
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
#include <crt_externs.h>
|
#include <crt_externs.h>
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//------------------------------------------------------------------------
|
||||||
// Delegate for window related notifications
|
// Delegate for window related notifications
|
||||||
//========================================================================
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
@interface GLFWWindowDelegate : NSObject
|
@interface GLFWWindowDelegate : NSObject
|
||||||
{
|
{
|
||||||
|
@ -104,9 +104,9 @@
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//------------------------------------------------------------------------
|
||||||
// Delegate for application related notifications
|
// Delegate for application related notifications
|
||||||
//========================================================================
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
@interface GLFWApplicationDelegate : NSObject
|
@interface GLFWApplicationDelegate : NSObject
|
||||||
@end
|
@end
|
||||||
|
@ -144,11 +144,8 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Converts a Mac OS X keycode to a GLFW keycode
|
// Converts a Mac OS X keycode to a GLFW keycode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int convertMacKeyCode(unsigned int macKeyCode)
|
static int convertMacKeyCode(unsigned int macKeyCode)
|
||||||
{
|
{
|
||||||
// Keyboard symbol translation table
|
// Keyboard symbol translation table
|
||||||
|
@ -292,9 +289,9 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//------------------------------------------------------------------------
|
||||||
// Content view class for the GLFW window
|
// Content view class for the GLFW window
|
||||||
//========================================================================
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
@interface GLFWContentView : NSView
|
@interface GLFWContentView : NSView
|
||||||
{
|
{
|
||||||
|
@ -497,9 +494,9 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//------------------------------------------------------------------------
|
||||||
// GLFW application class
|
// GLFW application class
|
||||||
//========================================================================
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
@interface GLFWApplication : NSApplication
|
@interface GLFWApplication : NSApplication
|
||||||
@end
|
@end
|
||||||
|
@ -519,11 +516,8 @@ static int convertMacKeyCode(unsigned int macKeyCode)
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Try to figure out what the calling application is called
|
// Try to figure out what the calling application is called
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static NSString* findAppName(void)
|
static NSString* findAppName(void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -564,17 +558,14 @@ static NSString* findAppName(void)
|
||||||
return @"GLFW Application";
|
return @"GLFW Application";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_GLFW_USE_MENUBAR)
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Set up the menu bar (manually)
|
// Set up the menu bar (manually)
|
||||||
// This is nasty, nasty stuff -- calls to undocumented semi-private APIs that
|
// This is nasty, nasty stuff -- calls to undocumented semi-private APIs that
|
||||||
// could go away at any moment, lots of stuff that really should be
|
// could go away at any moment, lots of stuff that really should be
|
||||||
// localize(d|able), etc. Loading a nib would save us this horror, but that
|
// localize(d|able), etc. Loading a nib would save us this horror, but that
|
||||||
// doesn't seem like a good thing to require of GLFW's clients.
|
// doesn't seem like a good thing to require of GLFW's clients.
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
#if defined(_GLFW_USE_MENUBAR)
|
|
||||||
|
|
||||||
static void createMenuBar(void)
|
static void createMenuBar(void)
|
||||||
{
|
{
|
||||||
NSString* appName = findAppName();
|
NSString* appName = findAppName();
|
||||||
|
@ -636,11 +627,8 @@ static void createMenuBar(void)
|
||||||
|
|
||||||
#endif /* _GLFW_USE_MENUBAR */
|
#endif /* _GLFW_USE_MENUBAR */
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize the Cocoa Application Kit
|
// Initialize the Cocoa Application Kit
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLboolean initializeAppKit(void)
|
static GLboolean initializeAppKit(void)
|
||||||
{
|
{
|
||||||
if (NSApp)
|
if (NSApp)
|
||||||
|
@ -661,11 +649,8 @@ static GLboolean initializeAppKit(void)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Create the Cocoa window
|
// Create the Cocoa window
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLboolean createWindow(_GLFWwindow* window,
|
static GLboolean createWindow(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig)
|
const _GLFWwndconfig* wndconfig)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,10 +36,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Parses the client API version string and extracts the version number
|
// Parses the client API version string and extracts the version number
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
|
||||||
{
|
{
|
||||||
int i, _api = GLFW_OPENGL_API, _major, _minor = 0, _rev = 0;
|
int i, _api = GLFW_OPENGL_API, _major, _minor = 0, _rev = 0;
|
||||||
|
|
|
@ -35,9 +35,8 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Thread local storage attribute macro
|
// Thread local storage attribute macro
|
||||||
//========================================================================
|
//
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define _GLFW_TLS __declspec(thread)
|
#define _GLFW_TLS __declspec(thread)
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
@ -47,16 +46,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// The per-thread current context/window pointer
|
// The per-thread current context/window pointer
|
||||||
//========================================================================
|
//
|
||||||
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
|
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Return a description of the specified EGL error
|
// Return a description of the specified EGL error
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static const char* getErrorString(EGLint error)
|
static const char* getErrorString(EGLint error)
|
||||||
{
|
{
|
||||||
switch (error)
|
switch (error)
|
||||||
|
@ -109,10 +105,8 @@ static const char* getErrorString(EGLint error)
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize EGL
|
// Initialize EGL
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
int _glfwInitContextAPI(void)
|
int _glfwInitContextAPI(void)
|
||||||
{
|
{
|
||||||
_glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY);
|
_glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY);
|
||||||
|
@ -140,21 +134,13 @@ int _glfwInitContextAPI(void)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Terminate EGL
|
// Terminate EGL
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwTerminateContextAPI(void)
|
void _glfwTerminateContextAPI(void)
|
||||||
{
|
{
|
||||||
eglTerminate(_glfw.egl.display);
|
eglTerminate(_glfw.egl.display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Prepare for creation of the OpenGL context
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#define setEGLattrib(attribName, attribValue) \
|
#define setEGLattrib(attribName, attribValue) \
|
||||||
{ \
|
{ \
|
||||||
attribs[index++] = attribName; \
|
attribs[index++] = attribName; \
|
||||||
|
@ -162,6 +148,8 @@ void _glfwTerminateContextAPI(void)
|
||||||
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prepare for creation of the OpenGL context
|
||||||
|
//
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
@ -357,11 +345,8 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
|
||||||
#undef setEGLattrib
|
#undef setEGLattrib
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Destroy the OpenGL context
|
// Destroy the OpenGL context
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window)
|
void _glfwDestroyContext(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
#if defined(_GLFW_X11)
|
#if defined(_GLFW_X11)
|
||||||
|
@ -385,11 +370,8 @@ void _glfwDestroyContext(_GLFWwindow* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Analyzes the specified context for possible recreation
|
// Analyzes the specified context for possible recreation
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
|
|
@ -44,9 +44,8 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Thread local storage attribute macro
|
// Thread local storage attribute macro
|
||||||
//========================================================================
|
//
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#define _GLFW_TLS __thread
|
#define _GLFW_TLS __thread
|
||||||
#else
|
#else
|
||||||
|
@ -54,33 +53,25 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// The X error code as provided to the X error handler
|
// The X error code as provided to the X error handler
|
||||||
//========================================================================
|
//
|
||||||
static unsigned long _glfwErrorCode = Success;
|
static unsigned long _glfwErrorCode = Success;
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// The per-thread current context/window pointer
|
// The per-thread current context/window pointer
|
||||||
//========================================================================
|
//
|
||||||
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
|
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Error handler used when creating a context
|
// Error handler used when creating a context
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int errorHandler(Display *display, XErrorEvent* event)
|
static int errorHandler(Display *display, XErrorEvent* event)
|
||||||
{
|
{
|
||||||
_glfwErrorCode = event->error_code;
|
_glfwErrorCode = event->error_code;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Create the OpenGL context using legacy API
|
// Create the OpenGL context using legacy API
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLXContext createLegacyContext(_GLFWwindow* window,
|
static GLXContext createLegacyContext(_GLFWwindow* window,
|
||||||
GLXFBConfig fbconfig,
|
GLXFBConfig fbconfig,
|
||||||
GLXContext share)
|
GLXContext share)
|
||||||
|
@ -108,10 +99,8 @@ static GLXContext createLegacyContext(_GLFWwindow* window,
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize GLX
|
// Initialize GLX
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
int _glfwInitContextAPI(void)
|
int _glfwInitContextAPI(void)
|
||||||
{
|
{
|
||||||
#ifdef _GLFW_DLOPEN_LIBGL
|
#ifdef _GLFW_DLOPEN_LIBGL
|
||||||
|
@ -231,11 +220,8 @@ int _glfwInitContextAPI(void)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Terminate GLX
|
// Terminate GLX
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwTerminateContextAPI(void)
|
void _glfwTerminateContextAPI(void)
|
||||||
{
|
{
|
||||||
// Unload libGL.so if necessary
|
// Unload libGL.so if necessary
|
||||||
|
@ -248,11 +234,6 @@ void _glfwTerminateContextAPI(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Prepare for creation of the OpenGL context
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#define setGLXattrib(attribName, attribValue) \
|
#define setGLXattrib(attribName, attribValue) \
|
||||||
{ \
|
{ \
|
||||||
attribs[index++] = attribName; \
|
attribs[index++] = attribName; \
|
||||||
|
@ -260,6 +241,8 @@ void _glfwTerminateContextAPI(void)
|
||||||
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prepare for creation of the OpenGL context
|
||||||
|
//
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
@ -517,11 +500,8 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
|
||||||
#undef setGLXattrib
|
#undef setGLXattrib
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Destroy the OpenGL context
|
// Destroy the OpenGL context
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window)
|
void _glfwDestroyContext(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->glx.visual)
|
if (window->glx.visual)
|
||||||
|
|
10
src/init.c
10
src/init.c
|
@ -36,26 +36,22 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Global state shared between compilation units of GLFW
|
// Global state shared between compilation units of GLFW
|
||||||
// These are documented in internal.h
|
// These are documented in internal.h
|
||||||
//------------------------------------------------------------------------
|
//
|
||||||
GLboolean _glfwInitialized = GL_FALSE;
|
GLboolean _glfwInitialized = GL_FALSE;
|
||||||
_GLFWlibrary _glfw;
|
_GLFWlibrary _glfw;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// The current error callback
|
// The current error callback
|
||||||
// This is outside of _glfw so it can be initialized and usable before
|
// This is outside of _glfw so it can be initialized and usable before
|
||||||
// glfwInit is called, which lets that function report errors
|
// glfwInit is called, which lets that function report errors
|
||||||
//------------------------------------------------------------------------
|
//
|
||||||
static GLFWerrorfun _glfwErrorCallback = NULL;
|
static GLFWerrorfun _glfwErrorCallback = NULL;
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Returns a generic string representation of the specified error
|
// Returns a generic string representation of the specified error
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static const char* getErrorString(int error)
|
static const char* getErrorString(int error)
|
||||||
{
|
{
|
||||||
switch (error)
|
switch (error)
|
||||||
|
|
14
src/input.c
14
src/input.c
|
@ -31,10 +31,8 @@
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Sets the cursor mode for the specified window
|
// Sets the cursor mode for the specified window
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void setCursorMode(_GLFWwindow* window, int newMode)
|
static void setCursorMode(_GLFWwindow* window, int newMode)
|
||||||
{
|
{
|
||||||
int width, height, oldMode, centerPosX, centerPosY;
|
int width, height, oldMode, centerPosX, centerPosY;
|
||||||
|
@ -66,11 +64,8 @@ static void setCursorMode(_GLFWwindow* window, int newMode)
|
||||||
_glfwInputCursorMotion(window, window->cursorPosX, window->cursorPosY);
|
_glfwInputCursorMotion(window, window->cursorPosX, window->cursorPosY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Set sticky keys mode for the specified window
|
// Set sticky keys mode for the specified window
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void setStickyKeys(_GLFWwindow* window, int enabled)
|
static void setStickyKeys(_GLFWwindow* window, int enabled)
|
||||||
{
|
{
|
||||||
if (window->stickyKeys == enabled)
|
if (window->stickyKeys == enabled)
|
||||||
|
@ -91,11 +86,8 @@ static void setStickyKeys(_GLFWwindow* window, int enabled)
|
||||||
window->stickyKeys = enabled;
|
window->stickyKeys = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Set sticky mouse buttons mode for the specified window
|
// Set sticky mouse buttons mode for the specified window
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void setStickyMouseButtons(_GLFWwindow* window, int enabled)
|
static void setStickyMouseButtons(_GLFWwindow* window, int enabled)
|
||||||
{
|
{
|
||||||
if (window->stickyMouseButtons == enabled)
|
if (window->stickyMouseButtons == enabled)
|
||||||
|
|
|
@ -40,10 +40,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Lexical comparison function for GLFW video modes, used by qsort
|
// Lexical comparison function for GLFW video modes, used by qsort
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int compareVideoModes(const void* firstPtr, const void* secondPtr)
|
static int compareVideoModes(const void* firstPtr, const void* secondPtr)
|
||||||
{
|
{
|
||||||
int firstBPP, secondBPP, firstSize, secondSize;
|
int firstBPP, secondBPP, firstSize, secondSize;
|
||||||
|
@ -70,11 +68,8 @@ static int compareVideoModes(const void* firstPtr, const void* secondPtr)
|
||||||
return firstSize - secondSize;
|
return firstSize - secondSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Retrieves the available modes for the specified monitor
|
// Retrieves the available modes for the specified monitor
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int refreshVideoModes(_GLFWmonitor* monitor)
|
static int refreshVideoModes(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
int modeCount;
|
int modeCount;
|
||||||
|
|
|
@ -32,9 +32,8 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// The per-thread current context/window pointer
|
// The per-thread current context/window pointer
|
||||||
//========================================================================
|
//
|
||||||
static pthread_key_t _glfwCurrentTLS;
|
static pthread_key_t _glfwCurrentTLS;
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,10 +41,8 @@ static pthread_key_t _glfwCurrentTLS;
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize OpenGL support
|
// Initialize OpenGL support
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
int _glfwInitContextAPI(void)
|
int _glfwInitContextAPI(void)
|
||||||
{
|
{
|
||||||
if (pthread_key_create(&_glfwCurrentTLS, NULL) != 0)
|
if (pthread_key_create(&_glfwCurrentTLS, NULL) != 0)
|
||||||
|
@ -58,21 +55,15 @@ int _glfwInitContextAPI(void)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Terminate OpenGL support
|
// Terminate OpenGL support
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwTerminateContextAPI(void)
|
void _glfwTerminateContextAPI(void)
|
||||||
{
|
{
|
||||||
pthread_key_delete(_glfwCurrentTLS);
|
pthread_key_delete(_glfwCurrentTLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Create the OpenGL context
|
// Create the OpenGL context
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
@ -228,11 +219,8 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Destroy the OpenGL context
|
// Destroy the OpenGL context
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window)
|
void _glfwDestroyContext(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
[window->nsgl.pixelFormat release];
|
[window->nsgl.pixelFormat release];
|
||||||
|
|
|
@ -35,9 +35,8 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Thread local storage attribute macro
|
// Thread local storage attribute macro
|
||||||
//========================================================================
|
//
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define _GLFW_TLS __declspec(thread)
|
#define _GLFW_TLS __declspec(thread)
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
@ -47,20 +46,17 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// The per-thread current context/window pointer
|
// The per-thread current context/window pointer
|
||||||
//========================================================================
|
//
|
||||||
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
|
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize WGL-specific extensions
|
// Initialize WGL-specific extensions
|
||||||
// This function is called once before initial context creation, i.e. before
|
// This function is called once before initial context creation, i.e. before
|
||||||
// any WGL extensions could be present. This is done in order to have both
|
// any WGL extensions could be present. This is done in order to have both
|
||||||
// extension variable clearing and loading in the same place, hopefully
|
// extension variable clearing and loading in the same place, hopefully
|
||||||
// decreasing the possibility of forgetting to add one without the other.
|
// decreasing the possibility of forgetting to add one without the other.
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void initWGLExtensions(_GLFWwindow* window)
|
static void initWGLExtensions(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// This needs to include every function pointer loaded below
|
// This needs to include every function pointer loaded below
|
||||||
|
@ -149,29 +145,19 @@ static void initWGLExtensions(_GLFWwindow* window)
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize WGL
|
// Initialize WGL
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
int _glfwInitContextAPI(void)
|
int _glfwInitContextAPI(void)
|
||||||
{
|
{
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Terminate WGL
|
// Terminate WGL
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwTerminateContextAPI(void)
|
void _glfwTerminateContextAPI(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Prepare for creation of the OpenGL context
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#define setWGLattrib(attribName, attribValue) \
|
#define setWGLattrib(attribName, attribValue) \
|
||||||
{ \
|
{ \
|
||||||
attribs[index++] = attribName; \
|
attribs[index++] = attribName; \
|
||||||
|
@ -179,6 +165,8 @@ void _glfwTerminateContextAPI(void)
|
||||||
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
assert(index < sizeof(attribs) / sizeof(attribs[0])); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prepare for creation of the OpenGL context
|
||||||
|
//
|
||||||
int _glfwCreateContext(_GLFWwindow* window,
|
int _glfwCreateContext(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
@ -417,11 +405,8 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
|
||||||
#undef setWGLattrib
|
#undef setWGLattrib
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Destroy the OpenGL context
|
// Destroy the OpenGL context
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwDestroyContext(_GLFWwindow* window)
|
void _glfwDestroyContext(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->wgl.context)
|
if (window->wgl.context)
|
||||||
|
@ -437,11 +422,8 @@ void _glfwDestroyContext(_GLFWwindow* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Analyzes the specified context for possible recreation
|
// Analyzes the specified context for possible recreation
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
int _glfwAnalyzeContext(const _GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
|
|
@ -39,22 +39,19 @@
|
||||||
#endif // __BORLANDC__
|
#endif // __BORLANDC__
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// GLFW DLL entry point
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
#if defined(_GLFW_BUILD_DLL)
|
#if defined(_GLFW_BUILD_DLL)
|
||||||
|
|
||||||
|
// GLFW DLL entry point
|
||||||
|
//
|
||||||
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _GLFW_BUILD_DLL
|
#endif // _GLFW_BUILD_DLL
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Load necessary libraries (DLLs)
|
// Load necessary libraries (DLLs)
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLboolean initLibraries(void)
|
static GLboolean initLibraries(void)
|
||||||
{
|
{
|
||||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||||
|
@ -85,11 +82,8 @@ static GLboolean initLibraries(void)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Unload used libraries (DLLs)
|
// Unload used libraries (DLLs)
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void freeLibraries(void)
|
static void freeLibraries(void)
|
||||||
{
|
{
|
||||||
#ifndef _GLFW_NO_DLOAD_WINMM
|
#ifndef _GLFW_NO_DLOAD_WINMM
|
||||||
|
@ -106,10 +100,8 @@ static void freeLibraries(void)
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Returns a wide string version of the specified UTF-8 string
|
// Returns a wide string version of the specified UTF-8 string
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
WCHAR* _glfwCreateWideStringFromUTF8(const char* source)
|
WCHAR* _glfwCreateWideStringFromUTF8(const char* source)
|
||||||
{
|
{
|
||||||
WCHAR* target;
|
WCHAR* target;
|
||||||
|
@ -130,11 +122,8 @@ WCHAR* _glfwCreateWideStringFromUTF8(const char* source)
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Returns a UTF-8 string version of the specified wide string
|
// Returns a UTF-8 string version of the specified wide string
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
char* _glfwCreateUTF8FromWideString(const WCHAR* source)
|
char* _glfwCreateUTF8FromWideString(const WCHAR* source)
|
||||||
{
|
{
|
||||||
char* target;
|
char* target;
|
||||||
|
|
|
@ -37,10 +37,8 @@
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Return GL_TRUE if joystick is present, otherwise GL_FALSE
|
// Return GL_TRUE if joystick is present, otherwise GL_FALSE
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLboolean isJoystickPresent(int joy)
|
static GLboolean isJoystickPresent(int joy)
|
||||||
{
|
{
|
||||||
JOYINFO ji;
|
JOYINFO ji;
|
||||||
|
@ -56,11 +54,8 @@ static GLboolean isJoystickPresent(int joy)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Calculate normalized joystick position
|
// Calculate normalized joystick position
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static float calcJoystickPos(DWORD pos, DWORD min, DWORD max)
|
static float calcJoystickPos(DWORD pos, DWORD min, DWORD max)
|
||||||
{
|
{
|
||||||
float fpos = (float) pos;
|
float fpos = (float) pos;
|
||||||
|
@ -75,19 +70,14 @@ static float calcJoystickPos(DWORD pos, DWORD min, DWORD max)
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize joystick interface
|
// Initialize joystick interface
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwInitJoysticks(void)
|
void _glfwInitJoysticks(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Close all opened joystick handles
|
// Close all opened joystick handles
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwTerminateJoysticks(void)
|
void _glfwTerminateJoysticks(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -48,10 +48,8 @@
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Change the current video mode
|
// Change the current video mode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
int _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* mode)
|
int _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* mode)
|
||||||
{
|
{
|
||||||
GLFWvidmode current;
|
GLFWvidmode current;
|
||||||
|
@ -86,11 +84,8 @@ int _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* mode)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Restore the previously saved (original) video mode
|
// Restore the previously saved (original) video mode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
ChangeDisplaySettingsEx(monitor->win32.name,
|
ChangeDisplaySettingsEx(monitor->win32.name,
|
||||||
|
|
|
@ -35,10 +35,8 @@
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialise timer
|
// Initialise timer
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwInitTimer(void)
|
void _glfwInitTimer(void)
|
||||||
{
|
{
|
||||||
__int64 freq;
|
__int64 freq;
|
||||||
|
|
|
@ -34,20 +34,15 @@
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Hide mouse cursor
|
// Hide mouse cursor
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void hideCursor(_GLFWwindow* window)
|
static void hideCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(window);
|
UNREFERENCED_PARAMETER(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Capture mouse cursor
|
// Capture mouse cursor
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void captureCursor(_GLFWwindow* window)
|
static void captureCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
RECT ClipWindowRect;
|
RECT ClipWindowRect;
|
||||||
|
@ -62,11 +57,8 @@ static void captureCursor(_GLFWwindow* window)
|
||||||
SetCapture(window->win32.handle);
|
SetCapture(window->win32.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Show mouse cursor
|
// Show mouse cursor
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void showCursor(_GLFWwindow* window)
|
static void showCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(window);
|
UNREFERENCED_PARAMETER(window);
|
||||||
|
@ -80,11 +72,8 @@ static void showCursor(_GLFWwindow* window)
|
||||||
ShowCursor(TRUE);
|
ShowCursor(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Translates a Windows key to the corresponding GLFW key
|
// Translates a Windows key to the corresponding GLFW key
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int translateKey(WPARAM wParam, LPARAM lParam)
|
static int translateKey(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
MSG next_msg;
|
MSG next_msg;
|
||||||
|
@ -306,11 +295,8 @@ static int translateKey(WPARAM wParam, LPARAM lParam)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Window callback function (handles window events)
|
// Window callback function (handles window events)
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
WPARAM wParam, LPARAM lParam)
|
WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -640,11 +626,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Translate client window size to full window size (including window borders)
|
// Translate client window size to full window size (including window borders)
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void getFullWindowSize(_GLFWwindow* window,
|
static void getFullWindowSize(_GLFWwindow* window,
|
||||||
int clientWidth, int clientHeight,
|
int clientWidth, int clientHeight,
|
||||||
int* fullWidth, int* fullHeight)
|
int* fullWidth, int* fullHeight)
|
||||||
|
@ -665,11 +648,8 @@ static void getFullWindowSize(_GLFWwindow* window,
|
||||||
*fullHeight = rect.bottom - rect.top + 1;
|
*fullHeight = rect.bottom - rect.top + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Registers the GLFW window class
|
// Registers the GLFW window class
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static ATOM registerWindowClass(void)
|
static ATOM registerWindowClass(void)
|
||||||
{
|
{
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
|
@ -705,11 +685,8 @@ static ATOM registerWindowClass(void)
|
||||||
return classAtom;
|
return classAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Creates the GLFW window and rendering context
|
// Creates the GLFW window and rendering context
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int createWindow(_GLFWwindow* window,
|
static int createWindow(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
|
@ -789,11 +766,8 @@ static int createWindow(_GLFWwindow* window,
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Destroys the GLFW window and rendering context
|
// Destroys the GLFW window and rendering context
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void destroyWindow(_GLFWwindow* window)
|
static void destroyWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwDestroyContext(window);
|
_glfwDestroyContext(window);
|
||||||
|
|
|
@ -38,10 +38,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Return the maxiumum of the specified values
|
// Return the maxiumum of the specified values
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int Max(int a, int b)
|
static int Max(int a, int b)
|
||||||
{
|
{
|
||||||
return (a > b) ? a : b;
|
return (a > b) ? a : b;
|
||||||
|
|
|
@ -39,10 +39,8 @@
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Set the specified property to the contents of the requested selection
|
// Set the specified property to the contents of the requested selection
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
Atom _glfwWriteSelection(XSelectionRequestEvent* request)
|
Atom _glfwWriteSelection(XSelectionRequestEvent* request)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -37,10 +37,8 @@
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Detect gamma ramp support and save original gamma ramp, if available
|
// Detect gamma ramp support and save original gamma ramp, if available
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwInitGammaRamp(void)
|
void _glfwInitGammaRamp(void)
|
||||||
{
|
{
|
||||||
// RandR gamma support is only available with version 1.2 and above
|
// RandR gamma support is only available with version 1.2 and above
|
||||||
|
@ -83,11 +81,8 @@ void _glfwInitGammaRamp(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Restore original gamma ramp if necessary
|
// Restore original gamma ramp if necessary
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwTerminateGammaRamp(void)
|
void _glfwTerminateGammaRamp(void)
|
||||||
{
|
{
|
||||||
if (_glfw.originalRampSize && _glfw.rampChanged)
|
if (_glfw.originalRampSize && _glfw.rampChanged)
|
||||||
|
|
|
@ -35,10 +35,8 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Translate an X11 key code to a GLFW key code.
|
// Translate an X11 key code to a GLFW key code.
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int keyCodeToGLFWKeyCode(int keyCode)
|
static int keyCodeToGLFWKeyCode(int keyCode)
|
||||||
{
|
{
|
||||||
int keySym;
|
int keySym;
|
||||||
|
@ -214,11 +212,8 @@ static int keyCodeToGLFWKeyCode(int keyCode)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Update the key code LUT
|
// Update the key code LUT
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void updateKeyCodeLUT(void)
|
static void updateKeyCodeLUT(void)
|
||||||
{
|
{
|
||||||
int i, keyCode, keyCodeGLFW;
|
int i, keyCode, keyCodeGLFW;
|
||||||
|
@ -317,11 +312,8 @@ static void updateKeyCodeLUT(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Check whether the specified atom is supported
|
// Check whether the specified atom is supported
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static Atom getSupportedAtom(Atom* supportedAtoms,
|
static Atom getSupportedAtom(Atom* supportedAtoms,
|
||||||
unsigned long atomCount,
|
unsigned long atomCount,
|
||||||
const char* atomName)
|
const char* atomName)
|
||||||
|
@ -341,11 +333,8 @@ static Atom getSupportedAtom(Atom* supportedAtoms,
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Check whether the running window manager is EWMH-compliant
|
// Check whether the running window manager is EWMH-compliant
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void detectEWMH(void)
|
static void detectEWMH(void)
|
||||||
{
|
{
|
||||||
Window* windowFromRoot = NULL;
|
Window* windowFromRoot = NULL;
|
||||||
|
@ -429,11 +418,8 @@ static void detectEWMH(void)
|
||||||
_glfw.x11.hasEWMH = GL_TRUE;
|
_glfw.x11.hasEWMH = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize X11 display and look for supported X11 extensions
|
// Initialize X11 display and look for supported X11 extensions
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLboolean initDisplay(void)
|
static GLboolean initDisplay(void)
|
||||||
{
|
{
|
||||||
Bool supported;
|
Bool supported;
|
||||||
|
@ -543,11 +529,8 @@ static GLboolean initDisplay(void)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Create a blank cursor (for locked mouse mode)
|
// Create a blank cursor (for locked mouse mode)
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static Cursor createNULLCursor(void)
|
static Cursor createNULLCursor(void)
|
||||||
{
|
{
|
||||||
Pixmap cursormask;
|
Pixmap cursormask;
|
||||||
|
@ -574,11 +557,8 @@ static Cursor createNULLCursor(void)
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Terminate X11 display
|
// Terminate X11 display
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void terminateDisplay(void)
|
static void terminateDisplay(void)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.display)
|
if (_glfw.x11.display)
|
||||||
|
|
|
@ -45,10 +45,8 @@
|
||||||
#endif // __linux__
|
#endif // __linux__
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Attempt to open the specified joystick device
|
// Attempt to open the specified joystick device
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int openJoystickDevice(int joy, const char* path)
|
static int openJoystickDevice(int joy, const char* path)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -107,11 +105,8 @@ static int openJoystickDevice(int joy, const char* path)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Polls for and processes events for all present joysticks
|
// Polls for and processes events for all present joysticks
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void pollJoystickEvents(void)
|
static void pollJoystickEvents(void)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -173,10 +168,8 @@ static void pollJoystickEvents(void)
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialize joystick interface
|
// Initialize joystick interface
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
int _glfwInitJoysticks(void)
|
int _glfwInitJoysticks(void)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -225,11 +218,8 @@ int _glfwInitJoysticks(void)
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Close all opened joystick handles
|
// Close all opened joystick handles
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwTerminateJoysticks(void)
|
void _glfwTerminateJoysticks(void)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
|
@ -39,10 +39,8 @@
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Set the current video mode for the specified monitor
|
// Set the current video mode for the specified monitor
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* mode)
|
void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* mode)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available)
|
||||||
|
@ -112,11 +110,8 @@ void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Restore the saved (original) video mode for the specified monitor
|
// Restore the saved (original) video mode for the specified monitor
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
|
||||||
{
|
{
|
||||||
if (_glfw.x11.randr.available)
|
if (_glfw.x11.randr.available)
|
||||||
|
|
|
@ -34,10 +34,8 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Return raw time
|
// Return raw time
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static uint64_t getRawTime(void)
|
static uint64_t getRawTime(void)
|
||||||
{
|
{
|
||||||
#if defined(CLOCK_MONOTONIC)
|
#if defined(CLOCK_MONOTONIC)
|
||||||
|
@ -58,11 +56,8 @@ static uint64_t getRawTime(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Initialise timer
|
// Initialise timer
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
void _glfwInitTimer(void)
|
void _glfwInitTimer(void)
|
||||||
{
|
{
|
||||||
#if defined(CLOCK_MONOTONIC)
|
#if defined(CLOCK_MONOTONIC)
|
||||||
|
|
|
@ -855,10 +855,8 @@ static struct codepair {
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Convert X11 KeySym to Unicode
|
// Convert X11 KeySym to Unicode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
long _glfwKeySym2Unicode( KeySym keysym )
|
long _glfwKeySym2Unicode( KeySym keysym )
|
||||||
{
|
{
|
||||||
int min = 0;
|
int min = 0;
|
||||||
|
|
|
@ -47,10 +47,8 @@
|
||||||
#define Button7 7
|
#define Button7 7
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Translates an X Window key to internal coding
|
// Translates an X Window key to internal coding
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int translateKey(int keycode)
|
static int translateKey(int keycode)
|
||||||
{
|
{
|
||||||
// Use the pre-filled LUT (see updateKeyCodeLUT() in x11_init.c)
|
// Use the pre-filled LUT (see updateKeyCodeLUT() in x11_init.c)
|
||||||
|
@ -60,11 +58,8 @@ static int translateKey(int keycode)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Translates an X Window event to Unicode
|
// Translates an X Window event to Unicode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static int translateChar(XKeyEvent* event)
|
static int translateChar(XKeyEvent* event)
|
||||||
{
|
{
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
|
@ -76,11 +71,8 @@ static int translateChar(XKeyEvent* event)
|
||||||
return (int) _glfwKeySym2Unicode(keysym);
|
return (int) _glfwKeySym2Unicode(keysym);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Create the X11 window (and its colormap)
|
// Create the X11 window (and its colormap)
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static GLboolean createWindow(_GLFWwindow* window,
|
static GLboolean createWindow(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig)
|
const _GLFWwndconfig* wndconfig)
|
||||||
{
|
{
|
||||||
|
@ -230,11 +222,8 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Hide cursor
|
// Hide cursor
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void hideCursor(_GLFWwindow* window)
|
static void hideCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// Un-grab cursor (in windowed mode only; in fullscreen mode we still
|
// Un-grab cursor (in windowed mode only; in fullscreen mode we still
|
||||||
|
@ -253,11 +242,8 @@ static void hideCursor(_GLFWwindow* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Capture cursor
|
// Capture cursor
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void captureCursor(_GLFWwindow* window)
|
static void captureCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
hideCursor(window);
|
hideCursor(window);
|
||||||
|
@ -276,11 +262,8 @@ static void captureCursor(_GLFWwindow* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Show cursor
|
// Show cursor
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void showCursor(_GLFWwindow* window)
|
static void showCursor(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
// Un-grab cursor (in windowed mode only; in fullscreen mode we still
|
// Un-grab cursor (in windowed mode only; in fullscreen mode we still
|
||||||
|
@ -300,11 +283,8 @@ static void showCursor(_GLFWwindow* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Enter fullscreen mode
|
// Enter fullscreen mode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void enterFullscreenMode(_GLFWwindow* window)
|
static void enterFullscreenMode(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (!_glfw.x11.saver.changed)
|
if (!_glfw.x11.saver.changed)
|
||||||
|
@ -391,11 +371,8 @@ static void enterFullscreenMode(_GLFWwindow* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Leave fullscreen mode
|
// Leave fullscreen mode
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void leaveFullscreenMode(_GLFWwindow* window)
|
static void leaveFullscreenMode(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
_glfwRestoreVideoMode(window->monitor);
|
_glfwRestoreVideoMode(window->monitor);
|
||||||
|
@ -439,11 +416,8 @@ static void leaveFullscreenMode(_GLFWwindow* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Return the GLFW window corresponding to the specified X11 window
|
// Return the GLFW window corresponding to the specified X11 window
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
_GLFWwindow* _glfwFindWindowByHandle(Window handle)
|
_GLFWwindow* _glfwFindWindowByHandle(Window handle)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
|
@ -457,11 +431,8 @@ _GLFWwindow* _glfwFindWindowByHandle(Window handle)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Process the specified X event
|
// Process the specified X event
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
static void processEvent(XEvent *event)
|
static void processEvent(XEvent *event)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = NULL;
|
_GLFWwindow* window = NULL;
|
||||||
|
@ -750,11 +721,9 @@ static void processEvent(XEvent *event)
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Retrieve a single window property of the specified type
|
// Retrieve a single window property of the specified type
|
||||||
// Inspired by fghGetWindowProperty from freeglut
|
// Inspired by fghGetWindowProperty from freeglut
|
||||||
//========================================================================
|
//
|
||||||
|
|
||||||
unsigned long _glfwGetWindowProperty(Window window,
|
unsigned long _glfwGetWindowProperty(Window window,
|
||||||
Atom property,
|
Atom property,
|
||||||
Atom type,
|
Atom type,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user