Commit f8d80a93 authored by Camilla Berglund's avatar Camilla Berglund
Browse files

Internal header cleanup.

parent c85294e0
......@@ -54,14 +54,8 @@ typedef void* id;
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorNS ns
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific window structure
//------------------------------------------------------------------------
// Cocoa-specific per-window data
//
typedef struct _GLFWwindowNS
{
id object;
......@@ -69,12 +63,12 @@ typedef struct _GLFWwindowNS
id view;
unsigned int modifierFlags;
int cursorInside;
} _GLFWwindowNS;
//------------------------------------------------------------------------
// Platform-specific library global data for Cocoa
//------------------------------------------------------------------------
// Cocoa-specific global data
//
typedef struct _GLFWlibraryNS
{
CGEventSourceRef eventSource;
......@@ -87,9 +81,8 @@ typedef struct _GLFWlibraryNS
} _GLFWlibraryNS;
//------------------------------------------------------------------------
// Platform-specific monitor structure
//------------------------------------------------------------------------
// Cocoa-specific per-monitor data
//
typedef struct _GLFWmonitorNS
{
CGDirectDisplayID displayID;
......@@ -99,33 +92,27 @@ typedef struct _GLFWmonitorNS
} _GLFWmonitorNS;
//------------------------------------------------------------------------
// Platform-specific cursor structure
//------------------------------------------------------------------------
// Cocoa-specific per-cursor data
//
typedef struct _GLFWcursorNS
{
id object;
id object;
} _GLFWcursorNS;
//------------------------------------------------------------------------
// Platform-specific time structure
//------------------------------------------------------------------------
// Cocoa-specific global timer data
//
typedef struct _GLFWtimeNS
{
double base;
double resolution;
} _GLFWtimeNS;
double base;
double resolution;
} _GLFWtimeNS;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
// Time
void _glfwInitTimer(void);
// Fullscreen
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
......
......@@ -45,13 +45,8 @@
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryEGL egl
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific OpenGL context structure
//------------------------------------------------------------------------
// EGL-specific per-context data
//
typedef struct _GLFWcontextEGL
{
EGLConfig config;
......@@ -61,12 +56,12 @@ typedef struct _GLFWcontextEGL
#if defined(_GLFW_X11)
XVisualInfo* visual;
#endif
} _GLFWcontextEGL;
//------------------------------------------------------------------------
// Platform-specific library global data for EGL
//------------------------------------------------------------------------
// EGL-specific global data
//
typedef struct _GLFWlibraryEGL
{
EGLDisplay display;
......@@ -77,10 +72,6 @@ typedef struct _GLFWlibraryEGL
} _GLFWlibraryEGL;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
int _glfwInitContextAPI(void);
void _glfwTerminateContextAPI(void);
int _glfwCreateContext(_GLFWwindow* window,
......
......@@ -66,27 +66,22 @@ typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
#endif
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific OpenGL context structure
//------------------------------------------------------------------------
// GLX-specific per-context data
//
typedef struct _GLFWcontextGLX
{
GLXContext context; // OpenGL rendering context
XVisualInfo* visual; // Visual for selected GLXFBConfig
// Rendering context
GLXContext context;
// Visual of selected GLXFBConfig
XVisualInfo* visual;
} _GLFWcontextGLX;
//------------------------------------------------------------------------
// Platform-specific library global data for GLX
//------------------------------------------------------------------------
// GLX-specific global data
//
typedef struct _GLFWlibraryGLX
{
// Server-side GLX version
int versionMajor, versionMinor;
int eventBase;
int errorBase;
......@@ -108,14 +103,12 @@ typedef struct _GLFWlibraryGLX
GLboolean ARB_context_flush_control;
#if defined(_GLFW_DLOPEN_LIBGL)
void* libGL; // dlopen handle for libGL.so
// dlopen handle for libGL.so (for glfwGetProcAddress)
void* libGL;
#endif
} _GLFWlibraryGLX;
} _GLFWlibraryGLX;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
int _glfwInitContextAPI(void);
void _glfwTerminateContextAPI(void);
......
......@@ -135,7 +135,7 @@ typedef struct _GLFWcursor _GLFWcursor;
//========================================================================
// Internal types
// Platform-independent structures
//========================================================================
/*! @brief Window configuration.
......@@ -298,7 +298,6 @@ struct _GLFWmonitor
/*! @brief Cursor structure
*/
struct _GLFWcursor
{
_GLFWcursor* next;
......@@ -628,6 +627,7 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor);
*/
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
//========================================================================
// Event API functions
//========================================================================
......
......@@ -36,13 +36,8 @@
_GLFWjoystickIOKit iokit_js[GLFW_JOYSTICK_LAST + 1]
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific joystick structure
//------------------------------------------------------------------------
// IOKit-specific per-joystick data
//
typedef struct _GLFWjoystickIOKit
{
int present;
......@@ -56,12 +51,9 @@ typedef struct _GLFWjoystickIOKit
float* axes;
unsigned char* buttons;
} _GLFWjoystickIOKit;
} _GLFWjoystickIOKit;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
void _glfwInitJoysticks(void);
void _glfwTerminateJoysticks(void);
......
......@@ -31,13 +31,8 @@
_GLFWjoystickLinux linux_js[GLFW_JOYSTICK_LAST + 1]
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific joystick structure
//------------------------------------------------------------------------
// Linux-specific per-joystick data
//
typedef struct _GLFWjoystickLinux
{
int present;
......@@ -50,10 +45,6 @@ typedef struct _GLFWjoystickLinux
} _GLFWjoystickLinux;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
void _glfwInitJoysticks(void);
void _glfwTerminateJoysticks(void);
......
......@@ -32,35 +32,26 @@
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific OpenGL context structure
//------------------------------------------------------------------------
// NSGL-specific per-context data
//
typedef struct _GLFWcontextNSGL
{
id pixelFormat;
id context;
} _GLFWcontextNSGL;
//------------------------------------------------------------------------
// Platform-specific library global data for NSGL
//------------------------------------------------------------------------
// NSGL-specific global data
//
typedef struct _GLFWlibraryNSGL
{
// dlopen handle for dynamically loading OpenGL extension entry points
// dlopen handle for OpenGL.framework (for glfwGetProcAddress)
void* framework;
} _GLFWlibraryNSGL;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
int _glfwInitContextAPI(void);
void _glfwTerminateContextAPI(void);
int _glfwCreateContext(_GLFWwindow* window,
......
......@@ -32,6 +32,9 @@
#include <stdint.h>
// POSIX-specific global timer data
//
typedef struct _GLFWtimePOSIX
{
GLboolean monotonic;
......@@ -40,6 +43,7 @@ typedef struct _GLFWtimePOSIX
} _GLFWtimePOSIX;
void _glfwInitTimer(void);
#endif // _posix_time_h_
......@@ -33,10 +33,8 @@
#define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsPOSIX posix_tls
//========================================================================
// GLFW platform specific types
//========================================================================
// POSIX-specific global TLS data
//
typedef struct _GLFWtlsPOSIX
{
pthread_key_t context;
......@@ -44,10 +42,6 @@ typedef struct _GLFWtlsPOSIX
} _GLFWtlsPOSIX;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
int _glfwInitTLS(void);
void _glfwTerminateTLS(void);
void _glfwSetCurrentContext(_GLFWwindow* context);
......
......@@ -38,20 +38,14 @@
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific OpenGL context structure
//------------------------------------------------------------------------
// WGL-specific per-context data
//
typedef struct _GLFWcontextWGL
{
// Platform specific window resources
HDC dc; // Private GDI device context
HGLRC context; // Permanent rendering context
// Platform specific extensions (context specific)
// WGL extensions (context specific)
PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT;
PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB;
PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT;
......@@ -66,15 +60,15 @@ typedef struct _GLFWcontextWGL
GLboolean EXT_create_context_es2_profile;
GLboolean ARB_create_context_robustness;
GLboolean ARB_context_flush_control;
} _GLFWcontextWGL;
//------------------------------------------------------------------------
// Platform-specific library global data for WGL
//------------------------------------------------------------------------
// WGL-specific global data
//
typedef struct _GLFWlibraryWGL
{
// opengl32.dll
// opengl32.dll (for glfwGetProcAddress)
struct {
HINSTANCE instance;
} opengl32;
......@@ -82,10 +76,6 @@ typedef struct _GLFWlibraryWGL
} _GLFWlibraryWGL;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
int _glfwInitContextAPI(void);
void _glfwTerminateContextAPI(void);
int _glfwCreateContext(_GLFWwindow* window,
......
......@@ -72,9 +72,7 @@
#endif
//========================================================================
// Hack: Define things that some windows.h variants don't
//========================================================================
// HACK: Define macros that some older windows.h variants don't
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
......@@ -105,10 +103,6 @@ typedef struct tagCHANGEFILTERSTRUCT
#endif /*Windows 7*/
//========================================================================
// DLLs that are loaded at glfwInit()
//========================================================================
// winmm.dll function pointer typedefs
typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T)(UINT,LPJOYCAPS,UINT);
typedef MMRESULT (WINAPI * JOYGETPOS_T)(UINT,LPJOYINFO);
......@@ -156,32 +150,24 @@ typedef HRESULT (WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL*);
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWin32 win32
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific window structure
//------------------------------------------------------------------------
// Win32-specific per-window data
//
typedef struct _GLFWwindowWin32
{
// Platform specific window resources
HWND handle; // Window handle
DWORD dwStyle; // Window styles used for window creation
DWORD dwExStyle; // --"--
HWND handle;
DWORD dwStyle;
DWORD dwExStyle;
// Various platform specific internal variables
GLboolean cursorCentered;
GLboolean cursorInside;
GLboolean cursorHidden;
int oldCursorX, oldCursorY;
} _GLFWwindowWin32;
//------------------------------------------------------------------------
// Platform-specific library global data for Win32
//------------------------------------------------------------------------
// Win32-specific global data
//
typedef struct _GLFWlibraryWin32
{
DWORD foregroundLockTimeout;
......@@ -209,13 +195,11 @@ typedef struct _GLFWlibraryWin32
DWMISCOMPOSITIONENABLED_T DwmIsCompositionEnabled;
} dwmapi;
} _GLFWlibraryWin32;
//------------------------------------------------------------------------
// Platform-specific monitor structure
//------------------------------------------------------------------------
// Win32-specific per-monitor data
//
typedef struct _GLFWmonitorWin32
{
// This size matches the static size of DISPLAY_DEVICE.DeviceName
......@@ -225,18 +209,17 @@ typedef struct _GLFWmonitorWin32
} _GLFWmonitorWin32;
//------------------------------------------------------------------------
// Platform-specific cursor structure
//------------------------------------------------------------------------
// Win32-specific per-cursor data
//
typedef struct _GLFWcursorWin32
{
HCURSOR handle;
} _GLFWcursorWin32;
//------------------------------------------------------------------------
// Platform-specific time structure
//------------------------------------------------------------------------
// Win32-specific global timer data
//
typedef struct _GLFWtimeWin32
{
GLboolean hasPC;
......@@ -246,27 +229,17 @@ typedef struct _GLFWtimeWin32
} _GLFWtimeWin32;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
// Window class
GLboolean _glfwRegisterWindowClass(void);
void _glfwUnregisterWindowClass(void);
// Desktop compositing
BOOL _glfwIsCompositionEnabled(void);
// Wide strings
WCHAR* _glfwCreateWideStringFromUTF8(const char* source);
char* _glfwCreateUTF8FromWideString(const WCHAR* source);
// Time
void _glfwInitTimer(void);
// Fullscreen support
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
#endif // _win32_platform_h_
......@@ -31,10 +31,8 @@
#define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsWin32 win32_tls
//========================================================================
// GLFW platform specific types
//========================================================================
// Win32-specific global TLS data
//
typedef struct _GLFWtlsWin32
{
GLboolean allocated;
......@@ -43,10 +41,6 @@ typedef struct _GLFWtlsWin32
} _GLFWtlsWin32;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
int _glfwInitTLS(void);
void _glfwTerminateTLS(void);
void _glfwSetCurrentContext(_GLFWwindow* context);
......
......@@ -31,13 +31,8 @@
_GLFWjoystickWinMM winmm_js[GLFW_JOYSTICK_LAST + 1]
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific joystick structure
//------------------------------------------------------------------------
// WinMM-specific per-joystick data
//
typedef struct _GLFWjoystickWinMM
{
float axes[6];
......@@ -46,10 +41,6 @@ typedef struct _GLFWjoystickWinMM
} _GLFWjoystickWinMM;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
void _glfwInitJoysticks(void);
void _glfwTerminateJoysticks(void);
......
......@@ -50,8 +50,13 @@
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorWayland wl
// Wayland-specific video mode data
//
typedef struct _GLFWvidmodeWayland _GLFWvidmodeWayland;
// Wayland-specific per-window data
//
typedef struct _GLFWwindowWayland
{
int width, height;
......@@ -61,8 +66,12 @@ typedef struct _GLFWwindowWayland
struct wl_shell_surface* shell_surface;
EGLSurface egl_surface;
struct wl_callback* callback;
} _GLFWwindowWayland;
// Wayland-specific global data
//
typedef struct _GLFWlibraryWayland
{
struct wl_display* display;
......@@ -90,8 +99,12 @@ typedef struct _GLFWlibraryWayland
_GLFWwindow* pointerFocus;
_GLFWwindow* keyboardFocus;
} _GLFWlibraryWayland;
// Wayland-specific per-monitor data
//
typedef struct _GLFWmonitorWayland
{
struct wl_output* output;
......@@ -103,17 +116,18 @@ typedef struct _GLFWmonitorWayland
int x;
int y;
} _GLFWmonitorWayland;
// Wayland-specific per-cursor data
//
typedef struct _GLFWcursorWayland
{
int dummy;
} _GLFWcursorWayland;
} _GLFWcursorWayland;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
void _glfwAddOutput(uint32_t name, uint32_t version);
......
......@@ -618,7 +618,7 @@ static int errorHandler(Display *display, XErrorEvent* event)
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
// Install the X error handler
// Sets the X error handler callback
//
void _glfwGrabXErrorHandler(void)
{
......@@ -626,7 +626,7 @@ void _glfwGrabXErrorHandler(void)