Skip to content

Commit f8d80a9

Browse files
committed
Internal header cleanup.
1 parent c85294e commit f8d80a9

17 files changed

+113
-229
lines changed

src/cocoa_platform.h

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,21 @@ typedef void* id;
5454
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorNS ns
5555

5656

57-
//========================================================================
58-
// GLFW platform specific types
59-
//========================================================================
60-
61-
62-
//------------------------------------------------------------------------
63-
// Platform-specific window structure
64-
//------------------------------------------------------------------------
57+
// Cocoa-specific per-window data
58+
//
6559
typedef struct _GLFWwindowNS
6660
{
6761
id object;
6862
id delegate;
6963
id view;
7064
unsigned int modifierFlags;
7165
int cursorInside;
66+
7267
} _GLFWwindowNS;
7368

7469

75-
//------------------------------------------------------------------------
76-
// Platform-specific library global data for Cocoa
77-
//------------------------------------------------------------------------
70+
// Cocoa-specific global data
71+
//
7872
typedef struct _GLFWlibraryNS
7973
{
8074
CGEventSourceRef eventSource;
@@ -87,9 +81,8 @@ typedef struct _GLFWlibraryNS
8781
} _GLFWlibraryNS;
8882

8983

90-
//------------------------------------------------------------------------
91-
// Platform-specific monitor structure
92-
//------------------------------------------------------------------------
84+
// Cocoa-specific per-monitor data
85+
//
9386
typedef struct _GLFWmonitorNS
9487
{
9588
CGDirectDisplayID displayID;
@@ -99,33 +92,27 @@ typedef struct _GLFWmonitorNS
9992
} _GLFWmonitorNS;
10093

10194

102-
//------------------------------------------------------------------------
103-
// Platform-specific cursor structure
104-
//------------------------------------------------------------------------
95+
// Cocoa-specific per-cursor data
96+
//
10597
typedef struct _GLFWcursorNS
10698
{
107-
id object;
99+
id object;
100+
108101
} _GLFWcursorNS;
109102

110103

111-
//------------------------------------------------------------------------
112-
// Platform-specific time structure
113-
//------------------------------------------------------------------------
104+
// Cocoa-specific global timer data
105+
//
114106
typedef struct _GLFWtimeNS
115107
{
116-
double base;
117-
double resolution;
118-
} _GLFWtimeNS;
108+
double base;
109+
double resolution;
119110

111+
} _GLFWtimeNS;
120112

121-
//========================================================================
122-
// Prototypes for platform specific internal functions
123-
//========================================================================
124113

125-
// Time
126114
void _glfwInitTimer(void);
127115

128-
// Fullscreen
129116
GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired);
130117
void _glfwRestoreVideoMode(_GLFWmonitor* monitor);
131118

src/egl_context.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,8 @@
4545
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryEGL egl
4646

4747

48-
//========================================================================
49-
// GLFW platform specific types
50-
//========================================================================
51-
52-
//------------------------------------------------------------------------
53-
// Platform-specific OpenGL context structure
54-
//------------------------------------------------------------------------
48+
// EGL-specific per-context data
49+
//
5550
typedef struct _GLFWcontextEGL
5651
{
5752
EGLConfig config;
@@ -61,12 +56,12 @@ typedef struct _GLFWcontextEGL
6156
#if defined(_GLFW_X11)
6257
XVisualInfo* visual;
6358
#endif
59+
6460
} _GLFWcontextEGL;
6561

6662

67-
//------------------------------------------------------------------------
68-
// Platform-specific library global data for EGL
69-
//------------------------------------------------------------------------
63+
// EGL-specific global data
64+
//
7065
typedef struct _GLFWlibraryEGL
7166
{
7267
EGLDisplay display;
@@ -77,10 +72,6 @@ typedef struct _GLFWlibraryEGL
7772
} _GLFWlibraryEGL;
7873

7974

80-
//========================================================================
81-
// Prototypes for platform specific internal functions
82-
//========================================================================
83-
8475
int _glfwInitContextAPI(void);
8576
void _glfwTerminateContextAPI(void);
8677
int _glfwCreateContext(_GLFWwindow* window,

src/glx_context.h

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,22 @@ typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
6666
#endif
6767

6868

69-
//========================================================================
70-
// GLFW platform specific types
71-
//========================================================================
72-
73-
//------------------------------------------------------------------------
74-
// Platform-specific OpenGL context structure
75-
//------------------------------------------------------------------------
69+
// GLX-specific per-context data
70+
//
7671
typedef struct _GLFWcontextGLX
7772
{
78-
GLXContext context; // OpenGL rendering context
79-
XVisualInfo* visual; // Visual for selected GLXFBConfig
73+
// Rendering context
74+
GLXContext context;
75+
// Visual of selected GLXFBConfig
76+
XVisualInfo* visual;
8077

8178
} _GLFWcontextGLX;
8279

8380

84-
//------------------------------------------------------------------------
85-
// Platform-specific library global data for GLX
86-
//------------------------------------------------------------------------
81+
// GLX-specific global data
82+
//
8783
typedef struct _GLFWlibraryGLX
8884
{
89-
// Server-side GLX version
9085
int versionMajor, versionMinor;
9186
int eventBase;
9287
int errorBase;
@@ -108,14 +103,12 @@ typedef struct _GLFWlibraryGLX
108103
GLboolean ARB_context_flush_control;
109104

110105
#if defined(_GLFW_DLOPEN_LIBGL)
111-
void* libGL; // dlopen handle for libGL.so
106+
// dlopen handle for libGL.so (for glfwGetProcAddress)
107+
void* libGL;
112108
#endif
113-
} _GLFWlibraryGLX;
114109

110+
} _GLFWlibraryGLX;
115111

116-
//========================================================================
117-
// Prototypes for platform specific internal functions
118-
//========================================================================
119112

120113
int _glfwInitContextAPI(void);
121114
void _glfwTerminateContextAPI(void);

src/internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ typedef struct _GLFWcursor _GLFWcursor;
135135

136136

137137
//========================================================================
138-
// Internal types
138+
// Platform-independent structures
139139
//========================================================================
140140

141141
/*! @brief Window configuration.
@@ -298,7 +298,6 @@ struct _GLFWmonitor
298298

299299
/*! @brief Cursor structure
300300
*/
301-
302301
struct _GLFWcursor
303302
{
304303
_GLFWcursor* next;
@@ -628,6 +627,7 @@ void _glfwPlatformDestroyCursor(_GLFWcursor* cursor);
628627
*/
629628
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
630629

630+
631631
//========================================================================
632632
// Event API functions
633633
//========================================================================

src/iokit_joystick.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,8 @@
3636
_GLFWjoystickIOKit iokit_js[GLFW_JOYSTICK_LAST + 1]
3737

3838

39-
//========================================================================
40-
// GLFW platform specific types
41-
//========================================================================
42-
43-
//------------------------------------------------------------------------
44-
// Platform-specific joystick structure
45-
//------------------------------------------------------------------------
39+
// IOKit-specific per-joystick data
40+
//
4641
typedef struct _GLFWjoystickIOKit
4742
{
4843
int present;
@@ -56,12 +51,9 @@ typedef struct _GLFWjoystickIOKit
5651

5752
float* axes;
5853
unsigned char* buttons;
59-
} _GLFWjoystickIOKit;
6054

55+
} _GLFWjoystickIOKit;
6156

62-
//========================================================================
63-
// Prototypes for platform specific internal functions
64-
//========================================================================
6557

6658
void _glfwInitJoysticks(void);
6759
void _glfwTerminateJoysticks(void);

src/linux_joystick.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,8 @@
3131
_GLFWjoystickLinux linux_js[GLFW_JOYSTICK_LAST + 1]
3232

3333

34-
//========================================================================
35-
// GLFW platform specific types
36-
//========================================================================
37-
38-
//------------------------------------------------------------------------
39-
// Platform-specific joystick structure
40-
//------------------------------------------------------------------------
34+
// Linux-specific per-joystick data
35+
//
4136
typedef struct _GLFWjoystickLinux
4237
{
4338
int present;
@@ -50,10 +45,6 @@ typedef struct _GLFWjoystickLinux
5045
} _GLFWjoystickLinux;
5146

5247

53-
//========================================================================
54-
// Prototypes for platform specific internal functions
55-
//========================================================================
56-
5748
void _glfwInitJoysticks(void);
5849
void _glfwTerminateJoysticks(void);
5950

src/nsgl_context.h

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,26 @@
3232
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl
3333

3434

35-
//========================================================================
36-
// GLFW platform specific types
37-
//========================================================================
38-
39-
//------------------------------------------------------------------------
40-
// Platform-specific OpenGL context structure
41-
//------------------------------------------------------------------------
35+
// NSGL-specific per-context data
36+
//
4237
typedef struct _GLFWcontextNSGL
4338
{
4439
id pixelFormat;
4540
id context;
41+
4642
} _GLFWcontextNSGL;
4743

4844

49-
//------------------------------------------------------------------------
50-
// Platform-specific library global data for NSGL
51-
//------------------------------------------------------------------------
45+
// NSGL-specific global data
46+
//
5247
typedef struct _GLFWlibraryNSGL
5348
{
54-
// dlopen handle for dynamically loading OpenGL extension entry points
49+
// dlopen handle for OpenGL.framework (for glfwGetProcAddress)
5550
void* framework;
5651

5752
} _GLFWlibraryNSGL;
5853

5954

60-
//========================================================================
61-
// Prototypes for platform specific internal functions
62-
//========================================================================
63-
6455
int _glfwInitContextAPI(void);
6556
void _glfwTerminateContextAPI(void);
6657
int _glfwCreateContext(_GLFWwindow* window,

src/posix_time.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232

3333
#include <stdint.h>
3434

35+
36+
// POSIX-specific global timer data
37+
//
3538
typedef struct _GLFWtimePOSIX
3639
{
3740
GLboolean monotonic;
@@ -40,6 +43,7 @@ typedef struct _GLFWtimePOSIX
4043

4144
} _GLFWtimePOSIX;
4245

46+
4347
void _glfwInitTimer(void);
4448

4549
#endif // _posix_time_h_

src/posix_tls.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,15 @@
3333
#define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsPOSIX posix_tls
3434

3535

36-
//========================================================================
37-
// GLFW platform specific types
38-
//========================================================================
39-
36+
// POSIX-specific global TLS data
37+
//
4038
typedef struct _GLFWtlsPOSIX
4139
{
4240
pthread_key_t context;
4341

4442
} _GLFWtlsPOSIX;
4543

4644

47-
//========================================================================
48-
// Prototypes for platform specific internal functions
49-
//========================================================================
50-
5145
int _glfwInitTLS(void);
5246
void _glfwTerminateTLS(void);
5347
void _glfwSetCurrentContext(_GLFWwindow* context);

0 commit comments

Comments
 (0)