瀏覽代碼

Formatting.

Camilla Berglund 12 年之前
父節點
當前提交
1bc91bfe5b
共有 7 個文件被更改,包括 122 次插入126 次删除
  1. 9 9
      src/cocoa_platform.h
  2. 12 12
      src/glx_platform.h
  3. 39 41
      src/internal.h
  4. 5 5
      src/monitor.c
  5. 24 24
      src/win32_platform.h
  6. 6 8
      src/x11_monitor.c
  7. 27 27
      src/x11_platform.h

+ 9 - 9
src/cocoa_platform.h

@@ -66,10 +66,10 @@ typedef intptr_t GLFWintptr;
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
 typedef struct _GLFWwindowNS
 typedef struct _GLFWwindowNS
 {
 {
-    id           object;
-    id	         delegate;
-    id           view;
-    unsigned int modifierFlags;
+    id              object;
+    id	            delegate;
+    id              view;
+    unsigned int    modifierFlags;
 } _GLFWwindowNS;
 } _GLFWwindowNS;
 
 
 
 
@@ -79,16 +79,16 @@ typedef struct _GLFWwindowNS
 typedef struct _GLFWlibraryNS
 typedef struct _GLFWlibraryNS
 {
 {
     struct {
     struct {
-        double base;
-        double resolution;
+        double      base;
+        double      resolution;
     } timer;
     } timer;
 
 
     CGDisplayModeRef previousMode;
     CGDisplayModeRef previousMode;
     CGEventSourceRef eventSource;
     CGEventSourceRef eventSource;
-    id               delegate;
-    id               autoreleasePool;
+    id              delegate;
+    id              autoreleasePool;
 
 
-    char*            clipboardString;
+    char*           clipboardString;
 } _GLFWlibraryNS;
 } _GLFWlibraryNS;
 
 
 
 

+ 12 - 12
src/glx_platform.h

@@ -77,8 +77,8 @@ typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
 typedef struct _GLFWcontextGLX
 typedef struct _GLFWcontextGLX
 {
 {
-    GLXContext    context;           // OpenGL rendering context
-    XVisualInfo*  visual;            // Visual for selected GLXFBConfig
+    GLXContext      context; // OpenGL rendering context
+    XVisualInfo*    visual;  // Visual for selected GLXFBConfig
 
 
 } _GLFWcontextGLX;
 } _GLFWcontextGLX;
 
 
@@ -102,16 +102,16 @@ typedef struct _GLFWlibraryGLX
     PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX;
     PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX;
     PFNGLXGETVISUALFROMFBCONFIGSGIXPROC   GetVisualFromFBConfigSGIX;
     PFNGLXGETVISUALFROMFBCONFIGSGIXPROC   GetVisualFromFBConfigSGIX;
     PFNGLXCREATECONTEXTATTRIBSARBPROC     CreateContextAttribsARB;
     PFNGLXCREATECONTEXTATTRIBSARBPROC     CreateContextAttribsARB;
-    GLboolean   SGIX_fbconfig;
-    GLboolean   SGI_swap_control;
-    GLboolean   EXT_swap_control;
-    GLboolean   MESA_swap_control;
-    GLboolean   ARB_multisample;
-    GLboolean   ARB_framebuffer_sRGB;
-    GLboolean   ARB_create_context;
-    GLboolean   ARB_create_context_profile;
-    GLboolean   ARB_create_context_robustness;
-    GLboolean   EXT_create_context_es2_profile;
+    GLboolean       SGIX_fbconfig;
+    GLboolean       SGI_swap_control;
+    GLboolean       EXT_swap_control;
+    GLboolean       MESA_swap_control;
+    GLboolean       ARB_multisample;
+    GLboolean       ARB_framebuffer_sRGB;
+    GLboolean       ARB_create_context;
+    GLboolean       ARB_create_context_profile;
+    GLboolean       ARB_create_context_robustness;
+    GLboolean       EXT_create_context_es2_profile;
 
 
 #if defined(_GLFW_DLOPEN_LIBGL)
 #if defined(_GLFW_DLOPEN_LIBGL)
     void*           libGL;  // dlopen handle for libGL.so
     void*           libGL;  // dlopen handle for libGL.so

+ 39 - 41
src/internal.h

@@ -202,30 +202,30 @@ struct _GLFWwindow
     struct _GLFWwindow* next;
     struct _GLFWwindow* next;
 
 
     // Window settings and state
     // Window settings and state
-    GLboolean iconified;       // GL_TRUE if this window is iconified
-    GLboolean closeRequested;  // GL_TRUE if this window should be closed
-    int       width, height;
-    int       positionX, positionY;
-    GLboolean resizable;       // GL_TRUE if user may resize this window
-    GLboolean visible;         // GL_TRUE if this window is visible
-    void*     userPointer;
-    _GLFWmonitor* monitor;
+    int                 width, height;
+    int                 positionX, positionY;
+    GLboolean           iconified;
+    GLboolean           resizable;
+    GLboolean           visible;
+    GLboolean           closeRequested;
+    void*               userPointer;
+    _GLFWmonitor*       monitor;
 
 
     // Window input state
     // Window input state
-    GLboolean stickyKeys;
-    GLboolean stickyMouseButtons;
-    int       cursorPosX, cursorPosY;
-    int       cursorMode;
-    double    scrollX, scrollY;
-    char      mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
-    char      key[GLFW_KEY_LAST + 1];
+    GLboolean           stickyKeys;
+    GLboolean           stickyMouseButtons;
+    int                 cursorPosX, cursorPosY;
+    int                 cursorMode;
+    double              scrollX, scrollY;
+    char                mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
+    char                key[GLFW_KEY_LAST + 1];
 
 
     // OpenGL extensions and context attributes
     // OpenGL extensions and context attributes
-    int       clientAPI;
-    int       glMajor, glMinor, glRevision;
-    GLboolean glForward, glDebug;
-    int       glProfile;
-    int       glRobustness;
+    int                 clientAPI;
+    int                 glMajor, glMinor, glRevision;
+    GLboolean           glForward, glDebug;
+    int                 glProfile;
+    int                 glRobustness;
     PFNGLGETSTRINGIPROC GetStringi;
     PFNGLGETSTRINGIPROC GetStringi;
 
 
     GLFWwindowposfun     windowPosCallback;
     GLFWwindowposfun     windowPosCallback;
@@ -252,19 +252,17 @@ struct _GLFWwindow
  */
  */
 struct _GLFWmonitor
 struct _GLFWmonitor
 {
 {
-    char*     name;
+    char*           name;
 
 
-    GLboolean primary;
+    GLboolean       primary;
 
 
-    // physical dimensions in millimeters.
-    int       physicalWidth;
-    int       physicalHeight;
-    // logical orientation of the screen on the desktop
-    int       positionX;
-    int       positionY;
+    // Physical dimensions in millimeters.
+    int             widthMM, heightMM;
+    // Logical orientation of the screen on the desktop
+    int             positionX, positionY;
 
 
-    GLFWvidmode*  modes;
-    int           modeCount;
+    GLFWvidmode*    modes;
+    int             modeCount;
 
 
     // This is defined in the window API's platform.h
     // This is defined in the window API's platform.h
     _GLFW_PLATFORM_MONITOR_STATE;
     _GLFW_PLATFORM_MONITOR_STATE;
@@ -275,19 +273,19 @@ struct _GLFWmonitor
  */
  */
 struct _GLFWlibrary
 struct _GLFWlibrary
 {
 {
-    _GLFWhints    hints;
+    _GLFWhints      hints;
 
 
-    _GLFWwindow*  windowListHead;
-    _GLFWwindow*  focusedWindow;
+    _GLFWwindow*    windowListHead;
+    _GLFWwindow*    focusedWindow;
 
 
-    _GLFWmonitor** monitors;
-    int            monitorCount;
-    GLFWmonitorfun monitorCallback;
+    _GLFWmonitor**  monitors;
+    int             monitorCount;
+    GLFWmonitorfun  monitorCallback;
 
 
-    GLFWgammaramp currentRamp;
-    GLFWgammaramp originalRamp;
-    int           originalRampSize;
-    GLboolean     rampChanged;
+    GLFWgammaramp   currentRamp;
+    GLFWgammaramp   originalRamp;
+    int             originalRampSize;
+    GLboolean       rampChanged;
 
 
     // This is defined in the window API's platform.h
     // This is defined in the window API's platform.h
     _GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
     _GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
@@ -706,7 +704,7 @@ GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig);
  */
  */
 _GLFWmonitor* _glfwCreateMonitor(const char* name,
 _GLFWmonitor* _glfwCreateMonitor(const char* name,
                                  GLboolean primary,
                                  GLboolean primary,
-                                 int physicalWidth, int physicalHeight,
+                                 int widthMM, int heightMM,
                                  int x, int y);
                                  int x, int y);
 
 
 /*! @ingroup utility
 /*! @ingroup utility

+ 5 - 5
src/monitor.c

@@ -81,7 +81,7 @@ static int compareVideoModes(const void* firstPtr, const void* secondPtr)
 
 
 _GLFWmonitor* _glfwCreateMonitor(const char* name,
 _GLFWmonitor* _glfwCreateMonitor(const char* name,
                                  GLboolean primary,
                                  GLboolean primary,
-                                 int physicalWidth, int physicalHeight,
+                                 int widthMM, int heightMM,
                                  int x, int y)
                                  int x, int y)
 {
 {
     _GLFWmonitor* monitor = (_GLFWmonitor*) calloc(1, sizeof(_GLFWmonitor));
     _GLFWmonitor* monitor = (_GLFWmonitor*) calloc(1, sizeof(_GLFWmonitor));
@@ -93,8 +93,8 @@ _GLFWmonitor* _glfwCreateMonitor(const char* name,
 
 
     monitor->name = strdup(name);
     monitor->name = strdup(name);
     monitor->primary = primary;
     monitor->primary = primary;
-    monitor->physicalWidth = physicalWidth;
-    monitor->physicalHeight = physicalHeight;
+    monitor->widthMM = widthMM;
+    monitor->heightMM = heightMM;
     monitor->positionX = x;
     monitor->positionX = x;
     monitor->positionY = y;
     monitor->positionY = y;
 
 
@@ -357,9 +357,9 @@ GLFWAPI int glfwGetMonitorParam(GLFWmonitor handle, int param)
     switch (param)
     switch (param)
     {
     {
         case GLFW_MONITOR_WIDTH_MM:
         case GLFW_MONITOR_WIDTH_MM:
-            return monitor->physicalWidth;
+            return monitor->widthMM;
         case GLFW_MONITOR_HEIGHT_MM:
         case GLFW_MONITOR_HEIGHT_MM:
-            return monitor->physicalHeight;
+            return monitor->heightMM;
         case GLFW_MONITOR_POS_X:
         case GLFW_MONITOR_POS_X:
             return monitor->positionX;
             return monitor->positionX;
         case GLFW_MONITOR_POS_Y:
         case GLFW_MONITOR_POS_Y:

+ 24 - 24
src/win32_platform.h

@@ -141,14 +141,14 @@ typedef INT_PTR GLFWintptr;
 typedef struct _GLFWwindowWin32
 typedef struct _GLFWwindowWin32
 {
 {
     // Platform specific window resources
     // Platform specific window resources
-    HWND      handle;          // Window handle
-    DWORD     dwStyle;         // Window styles used for window creation
-    DWORD     dwExStyle;       // --"--
+    HWND                handle;    // Window handle
+    DWORD               dwStyle;   // Window styles used for window creation
+    DWORD               dwExStyle; // --"--
 
 
     // Various platform specific internal variables
     // Various platform specific internal variables
-    GLboolean cursorCentered;
-    GLboolean cursorInside;
-    int       oldCursorX, oldCursorY;
+    GLboolean           cursorCentered;
+    GLboolean           cursorInside;
+    int                 oldCursorX, oldCursorY;
 } _GLFWwindowWin32;
 } _GLFWwindowWin32;
 
 
 
 
@@ -157,35 +157,35 @@ typedef struct _GLFWwindowWin32
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
 typedef struct _GLFWlibraryWin32
 typedef struct _GLFWlibraryWin32
 {
 {
-    HINSTANCE                 instance;     // Instance of the application
-    ATOM                      classAtom;    // Window class atom
-    DWORD                     foregroundLockTimeout;
-    char*                     clipboardString;
+    HINSTANCE           instance;
+    ATOM                classAtom;
+    DWORD               foregroundLockTimeout;
+    char*               clipboardString;
 
 
     // Default monitor
     // Default monitor
     struct {
     struct {
-        GLboolean             modeChanged;
-        int                   width;
-        int                   height;
-        int                   bitsPerPixel;
+        GLboolean       modeChanged;
+        int             width;
+        int             height;
+        int             bitsPerPixel;
     } monitor;
     } monitor;
 
 
     // Timer data
     // Timer data
     struct {
     struct {
-        GLboolean             hasPC;
-        double                resolution;
-        unsigned int          t0_32;
-        __int64               t0_64;
+        GLboolean       hasPC;
+        double          resolution;
+        unsigned int    t0_32;
+        __int64         t0_64;
     } timer;
     } timer;
 
 
 #ifndef _GLFW_NO_DLOAD_WINMM
 #ifndef _GLFW_NO_DLOAD_WINMM
     // winmm.dll
     // winmm.dll
     struct {
     struct {
-        HINSTANCE             instance;
-        JOYGETDEVCAPS_T       joyGetDevCaps;
-        JOYGETPOS_T           joyGetPos;
-        JOYGETPOSEX_T         joyGetPosEx;
-        TIMEGETTIME_T         timeGetTime;
+        HINSTANCE       instance;
+        JOYGETDEVCAPS_T joyGetDevCaps;
+        JOYGETPOS_T     joyGetPos;
+        JOYGETPOSEX_T   joyGetPosEx;
+        TIMEGETTIME_T   timeGetTime;
     } winmm;
     } winmm;
 #endif // _GLFW_NO_DLOAD_WINMM
 #endif // _GLFW_NO_DLOAD_WINMM
 
 
@@ -201,7 +201,7 @@ typedef struct _GLFWlibraryWin32
 //------------------------------------------------------------------------
 //------------------------------------------------------------------------
 typedef struct _GLFWmonitorWin32
 typedef struct _GLFWmonitorWin32
 {
 {
-    WCHAR* name;
+    WCHAR*              name;
 
 
 } _GLFWmonitorWin32;
 } _GLFWmonitorWin32;
 
 

+ 6 - 8
src/x11_monitor.c

@@ -224,7 +224,7 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
         {
         {
             XRROutputInfo* oi;
             XRROutputInfo* oi;
             XRRCrtcInfo* ci;
             XRRCrtcInfo* ci;
-            int physicalWidth, physicalHeight;
+            int widthMM, heightMM;
 
 
             oi = XRRGetOutputInfo(_glfw.x11.display, sr, sr->outputs[i]);
             oi = XRRGetOutputInfo(_glfw.x11.display, sr, sr->outputs[i]);
             if (oi->connection != RR_Connected)
             if (oi->connection != RR_Connected)
@@ -235,22 +235,20 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
 
 
             if (oi->mm_width && oi->mm_height)
             if (oi->mm_width && oi->mm_height)
             {
             {
-                physicalWidth = oi->mm_width;
-                physicalHeight = oi->mm_height;
+                widthMM = oi->mm_width;
+                heightMM = oi->mm_height;
             }
             }
             else
             else
             {
             {
-                physicalWidth = DisplayWidthMM(_glfw.x11.display,
-                                               _glfw.x11.screen);
-                physicalHeight = DisplayHeightMM(_glfw.x11.display,
-                                                 _glfw.x11.screen);
+                widthMM = DisplayWidthMM(_glfw.x11.display, _glfw.x11.screen);
+                heightMM = DisplayHeightMM(_glfw.x11.display, _glfw.x11.screen);
             }
             }
 
 
             ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
             ci = XRRGetCrtcInfo(_glfw.x11.display, sr, oi->crtc);
 
 
             monitors[found] = _glfwCreateMonitor(oi->name,
             monitors[found] = _glfwCreateMonitor(oi->name,
                                                  sr->outputs[i] == primary,
                                                  sr->outputs[i] == primary,
-                                                 physicalWidth, physicalHeight,
+                                                 widthMM, heightMM,
                                                  ci->x, ci->y);
                                                  ci->x, ci->y);
 
 
             XRRFreeCrtcInfo(ci);
             XRRFreeCrtcInfo(ci);

+ 27 - 27
src/x11_platform.h

@@ -97,21 +97,21 @@ typedef intptr_t GLFWintptr;
 typedef struct _GLFWwindowX11
 typedef struct _GLFWwindowX11
 {
 {
     // Platform specific window resources
     // Platform specific window resources
-    Colormap      colormap;          // Window colormap
-    Window        handle;            // Window handle
+    Colormap        colormap;          // Window colormap
+    Window          handle;            // Window handle
 
 
     // Various platform specific internal variables
     // Various platform specific internal variables
-    GLboolean     overrideRedirect; // True if window is OverrideRedirect
-    GLboolean     cursorGrabbed;    // True if cursor is currently grabbed
-    GLboolean     cursorHidden;     // True if cursor is currently hidden
-    GLboolean     cursorCentered;   // True if cursor was moved since last poll
-    int           cursorPosX, cursorPosY;
+    GLboolean       overrideRedirect; // True if window is OverrideRedirect
+    GLboolean       cursorGrabbed;    // True if cursor is currently grabbed
+    GLboolean       cursorHidden;     // True if cursor is currently hidden
+    GLboolean       cursorCentered;   // True if cursor was moved since last poll
+    int             cursorPosX, cursorPosY;
 
 
     // Window position hint (commited the first time the window is shown)
     // Window position hint (commited the first time the window is shown)
-    GLboolean     windowPosSet;     // False until the window position has
-                                    // been set
-    int           positionX;        // The window position to be set the
-    int           positionY;        // first time the window is shown
+    GLboolean       windowPosSet;     // False until the window position has
+                                      // been set
+    int             positionX;        // The window position to be set the
+    int             positionY;        // first time the window is shown
 
 
 } _GLFWwindowX11;
 } _GLFWwindowX11;
 
 
@@ -196,23 +196,23 @@ typedef struct _GLFWlibraryX11
 
 
     // Selection data
     // Selection data
     struct {
     struct {
-        Atom atom;
-        Atom formats[_GLFW_CLIPBOARD_FORMAT_COUNT];
-        char* string;
-        Atom target;
-        Atom targets;
-        Atom property;
-        int status;
+        Atom        atom;
+        Atom        formats[_GLFW_CLIPBOARD_FORMAT_COUNT];
+        char*       string;
+        Atom        target;
+        Atom        targets;
+        Atom        property;
+        int         status;
     } selection;
     } selection;
 
 
     struct {
     struct {
-        int             present;
-        int             fd;
-        int             numAxes;
-        int             numButtons;
-        float*          axis;
-        unsigned char*  button;
-        char*           name;
+        int         present;
+        int         fd;
+        int         numAxes;
+        int         numButtons;
+        float*      axis;
+        unsigned char* button;
+        char*       name;
     } joystick[GLFW_JOYSTICK_LAST + 1];
     } joystick[GLFW_JOYSTICK_LAST + 1];
 
 
 } _GLFWlibraryX11;
 } _GLFWlibraryX11;
@@ -224,9 +224,9 @@ typedef struct _GLFWlibraryX11
 typedef struct _GLFWmonitorX11
 typedef struct _GLFWmonitorX11
 {
 {
 #if defined(_GLFW_HAS_XRANDR)
 #if defined(_GLFW_HAS_XRANDR)
-    XRROutputInfo* output;
+    XRROutputInfo*  output;
 #else
 #else
-    int dummy;
+    int             dummy;
 #endif /*_GLFW_HAS_XRANDR*/
 #endif /*_GLFW_HAS_XRANDR*/
 
 
 } _GLFWmonitorX11;
 } _GLFWmonitorX11;