Internal header cleanup.

This commit is contained in:
Camilla Berglund 2014-09-02 19:42:43 +02:00
parent c85294e0b2
commit f8d80a936f
17 changed files with 113 additions and 229 deletions

View File

@ -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;
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);

View File

@ -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,

View File

@ -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,15 +103,13 @@ 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;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
int _glfwInitContextAPI(void);
void _glfwTerminateContextAPI(void);
int _glfwCreateContext(_GLFWwindow* window,

View File

@ -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
//========================================================================

View File

@ -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,13 +51,10 @@ typedef struct _GLFWjoystickIOKit
float* axes;
unsigned char* buttons;
} _GLFWjoystickIOKit;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
void _glfwInitJoysticks(void);
void _glfwTerminateJoysticks(void);

View File

@ -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);

View File

@ -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,

View File

@ -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_

View File

@ -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);

View File

@ -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,

View File

@ -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_

View File

@ -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);

View File

@ -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);

View File

@ -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,18 +116,19 @@ typedef struct _GLFWmonitorWayland
int x;
int y;
} _GLFWmonitorWayland;
// Wayland-specific per-cursor data
//
typedef struct _GLFWcursorWayland
{
int dummy;
} _GLFWcursorWayland;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
void _glfwAddOutput(uint32_t name, uint32_t version);
#endif // _wayland_platform_h_

View File

@ -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)
XSetErrorHandler(errorHandler);
}
// Remove the X error handler
// Clears the X error handler callback
//
void _glfwReleaseXErrorHandler(void)
{
@ -635,7 +635,7 @@ void _glfwReleaseXErrorHandler(void)
XSetErrorHandler(NULL);
}
// Report X error
// Reports the specified error, appending information about the last X error
//
void _glfwInputXError(int error, const char* message)
{
@ -646,7 +646,7 @@ void _glfwInputXError(int error, const char* message)
_glfwInputError(error, "%s: %s", message, buffer);
}
// Create a cursor object
// Creates a native cursor object from the specified image and hotspot
//
Cursor _glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
{

View File

@ -72,22 +72,14 @@
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorX11 x11
//========================================================================
// GLFW platform specific types
//========================================================================
//------------------------------------------------------------------------
// Platform-specific window structure
//------------------------------------------------------------------------
// X11-specific per-window data
//
typedef struct _GLFWwindowX11
{
// Platform specific window resources
Colormap colormap; // Window colormap
Window handle; // Window handle
Colormap colormap;
Window handle;
// Various platform specific internal variables
GLboolean overrideRedirect; // True if window is OverrideRedirect
GLboolean overrideRedirect;
// Cached position and size used to filter out duplicate events
int width, height;
@ -101,9 +93,8 @@ typedef struct _GLFWwindowX11
} _GLFWwindowX11;
//------------------------------------------------------------------------
// Platform-specific library global data for X11
//------------------------------------------------------------------------
// X11-specific global data
//
typedef struct _GLFWlibraryX11
{
Display* display;
@ -214,9 +205,8 @@ typedef struct _GLFWlibraryX11
} _GLFWlibraryX11;
//------------------------------------------------------------------------
// Platform-specific monitor structure
//------------------------------------------------------------------------
// X11-specific per-monitor data
//
typedef struct _GLFWmonitorX11
{
RROutput output;
@ -226,41 +216,30 @@ typedef struct _GLFWmonitorX11
} _GLFWmonitorX11;
//------------------------------------------------------------------------
// Platform-specific cursor structure
//------------------------------------------------------------------------
// X11-specific per-cursor data
//
typedef struct _GLFWcursorX11
{
Cursor handle;
} _GLFWcursorX11;
//========================================================================
// Prototypes for platform specific internal functions
//========================================================================
// Gamma
void _glfwInitGammaRamp(void);
// Fullscreen support
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
// Clipboard handling
void _glfwHandleSelectionClear(XEvent* event);
void _glfwHandleSelectionRequest(XEvent* event);
void _glfwPushSelectionToManager(_GLFWwindow* window);
Cursor _glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
// Window support
_GLFWwindow* _glfwFindWindowByHandle(Window handle);
unsigned long _glfwGetWindowProperty(Window window,
Atom property,
Atom type,
unsigned char** value);
// X11 error handler
void _glfwGrabXErrorHandler(void);
void _glfwReleaseXErrorHandler(void);
void _glfwInputXError(int error, const char* message);

View File

@ -27,7 +27,7 @@
#ifndef _xkb_unicode_h_
#define _xkb_unicode_h_
// Unicode support
long _glfwKeySym2Unicode(unsigned int keysym);
#endif // _xkb_unicode_h_