Formatting pass (no code changes).

This commit is contained in:
Camilla Berglund 2010-09-08 15:58:43 +02:00
parent a04e041a6b
commit a4d888c2f5
10 changed files with 80 additions and 77 deletions

View File

@ -43,11 +43,11 @@
// Parses the OpenGL version string and extracts the version number // Parses the OpenGL version string and extracts the version number
//======================================================================== //========================================================================
void _glfwParseGLVersion(int *major, int *minor, int *rev) void _glfwParseGLVersion(int* major, int* minor, int* rev)
{ {
GLuint _major, _minor = 0, _rev = 0; GLuint _major, _minor = 0, _rev = 0;
const GLubyte *version; const GLubyte* version;
const GLubyte *ptr; const GLubyte* ptr;
// Get OpenGL version string // Get OpenGL version string
version = glGetString(GL_VERSION); version = glGetString(GL_VERSION);
@ -83,11 +83,12 @@ void _glfwParseGLVersion(int *major, int *minor, int *rev)
// Check if a string can be found in an OpenGL extension string // Check if a string can be found in an OpenGL extension string
//======================================================================== //========================================================================
int _glfwStringInExtensionString(const char *string, int _glfwStringInExtensionString(const char* string,
const GLubyte *extensions) const GLubyte* extensions)
{ {
const GLubyte *start; const GLubyte* start;
GLubyte *where, *terminator; GLubyte* where;
GLubyte* terminator;
// It takes a bit of care to be fool-proof about parsing the // It takes a bit of care to be fool-proof about parsing the
// OpenGL extensions string. Don't be fooled by sub-strings, // OpenGL extensions string. Don't be fooled by sub-strings,
@ -95,7 +96,7 @@ int _glfwStringInExtensionString(const char *string,
start = extensions; start = extensions;
for (;;) for (;;)
{ {
where = (GLubyte *) strstr((const char *) start, string); where = (GLubyte*) strstr((const char*) start, string);
if (!where) if (!where)
return GL_FALSE; return GL_FALSE;
@ -122,10 +123,10 @@ int _glfwStringInExtensionString(const char *string,
// Check if an OpenGL extension is available at runtime // Check if an OpenGL extension is available at runtime
//======================================================================== //========================================================================
GLFWAPI int glfwExtensionSupported(const char *extension) GLFWAPI int glfwExtensionSupported(const char* extension)
{ {
const GLubyte *extensions; const GLubyte* extensions;
GLubyte *where; GLubyte* where;
GLint count; GLint count;
int i; int i;
@ -133,7 +134,7 @@ GLFWAPI int glfwExtensionSupported(const char *extension)
return GL_FALSE; return GL_FALSE;
// Extension names should not have spaces // Extension names should not have spaces
where = (GLubyte *) strchr(extension, ' '); where = (GLubyte*) strchr(extension, ' ');
if (where || *extension == '\0') if (where || *extension == '\0')
return GL_FALSE; return GL_FALSE;
@ -177,7 +178,7 @@ GLFWAPI int glfwExtensionSupported(const char *extension)
// This function can be used to get access to extended OpenGL functions. // This function can be used to get access to extended OpenGL functions.
//======================================================================== //========================================================================
GLFWAPI void * glfwGetProcAddress(const char *procname) GLFWAPI void* glfwGetProcAddress(const char* procname)
{ {
if (!_glfwInitialized || !_glfwWin.opened) if (!_glfwInitialized || !_glfwWin.opened)
return NULL; return NULL;
@ -190,7 +191,7 @@ GLFWAPI void * glfwGetProcAddress(const char *procname)
// Returns the OpenGL version // Returns the OpenGL version
//======================================================================== //========================================================================
GLFWAPI void glfwGetGLVersion(int *major, int *minor, int *rev) GLFWAPI void glfwGetGLVersion(int* major, int* minor, int* rev)
{ {
if (!_glfwInitialized || !_glfwWin.opened) if (!_glfwInitialized || !_glfwWin.opened)
return; return;

View File

@ -90,7 +90,7 @@ GLFWAPI void glfwTerminate(void)
// Get GLFW version // Get GLFW version
//======================================================================== //========================================================================
GLFWAPI void glfwGetVersion(int *major, int *minor, int *rev) GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)
{ {
if (major != NULL) if (major != NULL)
*major = GLFW_VERSION_MAJOR; *major = GLFW_VERSION_MAJOR;

View File

@ -83,7 +83,7 @@ GLFWAPI int glfwGetMouseButton(int button)
// //
//======================================================================== //========================================================================
GLFWAPI void glfwGetMousePos(int *xpos, int *ypos) GLFWAPI void glfwGetMousePos(int* xpos, int* ypos)
{ {
if (!_glfwInitialized || !_glfwWin.opened) if (!_glfwInitialized || !_glfwWin.opened)
return; return;

View File

@ -52,7 +52,7 @@ GLFWAPI int glfwGetJoystickParam(int joy, int param)
// Get joystick axis positions // Get joystick axis positions
//======================================================================== //========================================================================
GLFWAPI int glfwGetJoystickPos(int joy, float *pos, int numaxes) GLFWAPI int glfwGetJoystickPos(int joy, float* pos, int numaxes)
{ {
int i; int i;
@ -72,7 +72,7 @@ GLFWAPI int glfwGetJoystickPos(int joy, float *pos, int numaxes)
//======================================================================== //========================================================================
GLFWAPI int glfwGetJoystickButtons(int joy, GLFWAPI int glfwGetJoystickButtons(int joy,
unsigned char *buttons, unsigned char* buttons,
int numbuttons) int numbuttons)
{ {
int i; int i;

View File

@ -214,8 +214,8 @@ void _glfwInputMouseClick(int button, int action)
// This is based on the manual GLX Visual selection from 2.6 // This is based on the manual GLX Visual selection from 2.6
//======================================================================== //========================================================================
const _GLFWfbconfig *_glfwChooseFBConfig(const _GLFWfbconfig *desired, const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
const _GLFWfbconfig *alternatives, const _GLFWfbconfig* alternatives,
unsigned int count) unsigned int count)
{ {
unsigned int i; unsigned int i;
@ -223,8 +223,8 @@ const _GLFWfbconfig *_glfwChooseFBConfig(const _GLFWfbconfig *desired,
unsigned int colorDiff, leastColorDiff = UINT_MAX; unsigned int colorDiff, leastColorDiff = UINT_MAX;
unsigned int extraDiff, leastExtraDiff = UINT_MAX; unsigned int extraDiff, leastExtraDiff = UINT_MAX;
GLboolean desiresColor = GL_FALSE; GLboolean desiresColor = GL_FALSE;
const _GLFWfbconfig *current; const _GLFWfbconfig* current;
const _GLFWfbconfig *closest = NULL; const _GLFWfbconfig* closest = NULL;
// Cache some long-winded preferences // Cache some long-winded preferences
@ -635,7 +635,7 @@ GLFWAPI void glfwCloseWindow(void)
// Set the window title // Set the window title
//======================================================================== //========================================================================
GLFWAPI void glfwSetWindowTitle(const char *title) GLFWAPI void glfwSetWindowTitle(const char* title)
{ {
if (!_glfwInitialized || !_glfwWin.opened) if (!_glfwInitialized || !_glfwWin.opened)
return; return;
@ -649,7 +649,7 @@ GLFWAPI void glfwSetWindowTitle(const char *title)
// Get the window size // Get the window size
//======================================================================== //========================================================================
GLFWAPI void glfwGetWindowSize(int *width, int *height) GLFWAPI void glfwGetWindowSize(int* width, int* height)
{ {
if (width != NULL) if (width != NULL)
*width = _glfwWin.width; *width = _glfwWin.width;

View File

@ -41,7 +41,7 @@
// Convert BPP to RGB bits (based on "best guess") // Convert BPP to RGB bits (based on "best guess")
//======================================================================== //========================================================================
static void BPP2RGB(int bpp, int *r, int *g, int *b) static void BPP2RGB(int bpp, int* r, int* g, int* b)
{ {
int delta; int delta;
@ -64,15 +64,15 @@ static void BPP2RGB(int bpp, int *r, int *g, int *b)
// Finds the video mode closest in size to the specified desired size // Finds the video mode closest in size to the specified desired size
//======================================================================== //========================================================================
int _glfwGetClosestVideoMode(int screen, int *width, int *height, int *rate) int _glfwGetClosestVideoMode(int screen, int* width, int* height, int* rate)
{ {
#if defined(_GLFW_HAS_XRANDR) #if defined(_GLFW_HAS_XRANDR)
int i, match, bestmatch; int i, match, bestmatch;
int sizecount, bestsize; int sizecount, bestsize;
int ratecount, bestrate; int ratecount, bestrate;
short *ratelist; short* ratelist;
XRRScreenConfiguration *sc; XRRScreenConfiguration* sc;
XRRScreenSize *sizelist; XRRScreenSize* sizelist;
if (_glfwLibrary.XRandR.available) if (_glfwLibrary.XRandR.available)
{ {
@ -131,7 +131,7 @@ int _glfwGetClosestVideoMode(int screen, int *width, int *height, int *rate)
return bestsize; return bestsize;
} }
#elif defined(_GLFW_HAS_XF86VIDMODE) #elif defined(_GLFW_HAS_XF86VIDMODE)
XF86VidModeModeInfo **modelist; XF86VidModeModeInfo** modelist;
int modecount, i, bestmode, bestmatch, match; int modecount, i, bestmode, bestmatch, match;
// Use the XF86VidMode extension to control video resolution // Use the XF86VidMode extension to control video resolution
@ -187,7 +187,7 @@ int _glfwGetClosestVideoMode(int screen, int *width, int *height, int *rate)
void _glfwSetVideoModeMODE(int screen, int mode, int rate) void _glfwSetVideoModeMODE(int screen, int mode, int rate)
{ {
#if defined(_GLFW_HAS_XRANDR) #if defined(_GLFW_HAS_XRANDR)
XRRScreenConfiguration *sc; XRRScreenConfiguration* sc;
Window root; Window root;
if (_glfwLibrary.XRandR.available) if (_glfwLibrary.XRandR.available)
@ -272,7 +272,7 @@ void _glfwSetVideoModeMODE(int screen, int mode, int rate)
// Change the current video mode // Change the current video mode
//======================================================================== //========================================================================
void _glfwSetVideoMode(int screen, int *width, int *height, int *rate) void _glfwSetVideoMode(int screen, int* width, int* height, int* rate)
{ {
int bestmode; int bestmode;
@ -295,7 +295,7 @@ void _glfwRestoreVideoMode(void)
#if defined(_GLFW_HAS_XRANDR) #if defined(_GLFW_HAS_XRANDR)
if (_glfwLibrary.XRandR.available) if (_glfwLibrary.XRandR.available)
{ {
XRRScreenConfiguration *sc; XRRScreenConfiguration* sc;
if (_glfwLibrary.XRandR.available) if (_glfwLibrary.XRandR.available)
{ {
@ -343,21 +343,22 @@ struct _glfwResolution
// List available video modes // List available video modes
//======================================================================== //========================================================================
int _glfwPlatformGetVideoModes(GLFWvidmode *list, int maxcount) int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
{ {
int count, k, l, r, g, b, rgba, gl; int count, k, l, r, g, b, rgba, gl;
int depth, screen; int depth, screen;
Display *dpy; Display* dpy;
XVisualInfo *vislist, dummy; XVisualInfo* vislist;
XVisualInfo dummy;
int viscount, rgbcount, rescount; int viscount, rgbcount, rescount;
int *rgbarray; int* rgbarray;
struct _glfwResolution *resarray; struct _glfwResolution* resarray;
#if defined(_GLFW_HAS_XRANDR) #if defined(_GLFW_HAS_XRANDR)
XRRScreenConfiguration *sc; XRRScreenConfiguration* sc;
XRRScreenSize *sizelist; XRRScreenSize* sizelist;
int sizecount; int sizecount;
#elif defined(_GLFW_HAS_XF86VIDMODE) #elif defined(_GLFW_HAS_XF86VIDMODE)
XF86VidModeModeInfo **modelist; XF86VidModeModeInfo** modelist;
int modecount, width, height; int modecount, width, height;
#endif #endif
@ -493,12 +494,12 @@ int _glfwPlatformGetVideoModes(GLFWvidmode *list, int maxcount)
// Get the desktop video mode // Get the desktop video mode
//======================================================================== //========================================================================
void _glfwPlatformGetDesktopMode(GLFWvidmode *mode) void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
{ {
Display *dpy; Display* dpy;
int bpp, screen; int bpp, screen;
#if defined(_GLFW_HAS_XF86VIDMODE) #if defined(_GLFW_HAS_XF86VIDMODE)
XF86VidModeModeInfo **modelist; XF86VidModeModeInfo** modelist;
int modecount; int modecount;
#endif #endif

View File

@ -31,9 +31,9 @@
#include "internal.h" #include "internal.h"
void (*glXGetProcAddress(const GLubyte *procName))(); void (*glXGetProcAddress(const GLubyte* procName))();
void (*glXGetProcAddressARB(const GLubyte *procName))(); void (*glXGetProcAddressARB(const GLubyte* procName))();
void (*glXGetProcAddressEXT(const GLubyte *procName))(); void (*glXGetProcAddressEXT(const GLubyte* procName))();
// We support four different ways for getting addresses for GL/GLX // We support four different ways for getting addresses for GL/GLX
// extension functions: glXGetProcAddress, glXGetProcAddressARB, // extension functions: glXGetProcAddress, glXGetProcAddressARB,
@ -60,9 +60,9 @@ void (*glXGetProcAddressEXT(const GLubyte *procName))();
// Check if an OpenGL extension is available at runtime // Check if an OpenGL extension is available at runtime
//======================================================================== //========================================================================
int _glfwPlatformExtensionSupported(const char *extension) int _glfwPlatformExtensionSupported(const char* extension)
{ {
const GLubyte *extensions; const GLubyte* extensions;
// Get list of GLX extensions // Get list of GLX extensions
extensions = (const GLubyte*) glXQueryExtensionsString(_glfwLibrary.display, extensions = (const GLubyte*) glXQueryExtensionsString(_glfwLibrary.display,
@ -81,8 +81,8 @@ int _glfwPlatformExtensionSupported(const char *extension)
// Get the function pointer to an OpenGL function // Get the function pointer to an OpenGL function
//======================================================================== //========================================================================
void * _glfwPlatformGetProcAddress(const char *procname) void* _glfwPlatformGetProcAddress(const char* procname)
{ {
return (void *) _glfw_glXGetProcAddress((const GLubyte *) procname); return (void*) _glfw_glXGetProcAddress((const GLubyte*) procname);
} }

View File

@ -43,7 +43,7 @@ static void initLibraries(void)
{ {
#ifdef _GLFW_DLOPEN_LIBGL #ifdef _GLFW_DLOPEN_LIBGL
int i; int i;
char *libGL_names[ ] = char* libGL_names[ ] =
{ {
"libGL.so", "libGL.so",
"libGL.so.1", "libGL.so.1",

View File

@ -81,7 +81,8 @@ void _glfwInitJoysticks(void)
{ {
#ifdef _GLFW_USE_LINUX_JOYSTICKS #ifdef _GLFW_USE_LINUX_JOYSTICKS
int k, n, fd, joy_count; int k, n, fd, joy_count;
char *joy_base_name, joy_dev_name[20]; char* joy_base_name;
char joy_dev_name[20];
int driver_version = 0x000800; int driver_version = 0x000800;
char ret_data; char ret_data;
#endif // _GLFW_USE_LINUX_JOYSTICKS #endif // _GLFW_USE_LINUX_JOYSTICKS
@ -139,7 +140,7 @@ void _glfwInitJoysticks(void)
// Allocate memory for joystick state // Allocate memory for joystick state
_glfwJoy[joy_count].Axis = _glfwJoy[joy_count].Axis =
(float *) malloc(sizeof(float) * (float*) malloc(sizeof(float) *
_glfwJoy[joy_count].NumAxes); _glfwJoy[joy_count].NumAxes);
if (_glfwJoy[joy_count].Axis == NULL) if (_glfwJoy[joy_count].Axis == NULL)
{ {
@ -147,7 +148,7 @@ void _glfwInitJoysticks(void)
continue; continue;
} }
_glfwJoy[joy_count].Button = _glfwJoy[joy_count].Button =
(unsigned char *) malloc(sizeof(char) * (unsigned char*) malloc(sizeof(char) *
_glfwJoy[joy_count].NumButtons); _glfwJoy[joy_count].NumButtons);
if (_glfwJoy[joy_count].Button == NULL) if (_glfwJoy[joy_count].Button == NULL)
{ {
@ -287,7 +288,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
// Get joystick axis positions // Get joystick axis positions
//======================================================================== //========================================================================
int _glfwPlatformGetJoystickPos(int joy, float *pos, int numaxes) int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes)
{ {
int i; int i;
@ -313,7 +314,7 @@ int _glfwPlatformGetJoystickPos(int joy, float *pos, int numaxes)
// Get joystick button states // Get joystick button states
//======================================================================== //========================================================================
int _glfwPlatformGetJoystickButtons(int joy, unsigned char *buttons, int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
int numbuttons) int numbuttons)
{ {
int i; int i;

View File

@ -55,7 +55,7 @@
// Checks whether the event is a MapNotify for the specified window // Checks whether the event is a MapNotify for the specified window
//======================================================================== //========================================================================
static Bool isMapNotify(Display *d, XEvent *e, char *arg) static Bool isMapNotify(Display* d, XEvent* e, char* arg)
{ {
return (e->type == MapNotify) && (e->xmap.window == (Window)arg); return (e->type == MapNotify) && (e->xmap.window == (Window)arg);
} }
@ -125,8 +125,8 @@ static Atom getSupportedAtom(Atom* supportedAtoms,
static GLboolean checkForEWMH(void) static GLboolean checkForEWMH(void)
{ {
Window *windowFromRoot = NULL; Window* windowFromRoot = NULL;
Window *windowFromChild = NULL; Window* windowFromChild = NULL;
// Hey kids; let's see if the window manager supports EWMH! // Hey kids; let's see if the window manager supports EWMH!
@ -175,7 +175,7 @@ static GLboolean checkForEWMH(void)
// We are now fairly sure that an EWMH-compliant window manager is running // We are now fairly sure that an EWMH-compliant window manager is running
Atom *supportedAtoms; Atom* supportedAtoms;
unsigned long atomCount; unsigned long atomCount;
// Now we need to check the _NET_SUPPORTED property of the root window // Now we need to check the _NET_SUPPORTED property of the root window
@ -338,7 +338,7 @@ static int translateKey(int keycode)
// 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;
@ -354,7 +354,7 @@ static int translateChar(XKeyEvent *event)
// Create a blank cursor (for locked mouse mode) // Create a blank cursor (for locked mouse mode)
//======================================================================== //========================================================================
static Cursor createNULLCursor(Display *display, Window root) static Cursor createNULLCursor(Display* display, Window root)
{ {
Pixmap cursormask; Pixmap cursormask;
XGCValues xgc; XGCValues xgc;
@ -403,10 +403,10 @@ static int getFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
// Return a list of available and usable framebuffer configs // Return a list of available and usable framebuffer configs
//======================================================================== //========================================================================
static _GLFWfbconfig *getFBConfigs(unsigned int *found) static _GLFWfbconfig* getFBConfigs(unsigned int* found)
{ {
GLXFBConfig *fbconfigs; GLXFBConfig* fbconfigs;
_GLFWfbconfig *result; _GLFWfbconfig* result;
int i, count = 0; int i, count = 0;
*found = 0; *found = 0;
@ -510,11 +510,11 @@ static _GLFWfbconfig *getFBConfigs(unsigned int *found)
attribs[index++] = attribName; \ attribs[index++] = attribName; \
attribs[index++] = attribValue; attribs[index++] = attribValue;
static int createContext(const _GLFWwndconfig *wndconfig, GLXFBConfigID fbconfigID) static int createContext(const _GLFWwndconfig* wndconfig, GLXFBConfigID fbconfigID)
{ {
int attribs[40]; int attribs[40];
int flags, dummy, index; int flags, dummy, index;
GLXFBConfig *fbconfig; GLXFBConfig* fbconfig;
// Retrieve the previously selected GLXFBConfig // Retrieve the previously selected GLXFBConfig
{ {
@ -723,7 +723,7 @@ static void initGLXExtensions(void)
//======================================================================== //========================================================================
static GLboolean createWindow(int width, int height, static GLboolean createWindow(int width, int height,
const _GLFWwndconfig *wndconfig) const _GLFWwndconfig* wndconfig)
{ {
XEvent event; XEvent event;
unsigned long wamask; unsigned long wamask;
@ -829,7 +829,7 @@ static GLboolean createWindow(int width, int height,
// Set ICCCM WM_HINTS property // Set ICCCM WM_HINTS property
{ {
XWMHints *hints = XAllocWMHints(); XWMHints* hints = XAllocWMHints();
if (!hints) if (!hints)
{ {
_glfwPlatformCloseWindow(); _glfwPlatformCloseWindow();
@ -845,7 +845,7 @@ static GLboolean createWindow(int width, int height,
// Set ICCCM WM_NORMAL_HINTS property (even if no parts are set) // Set ICCCM WM_NORMAL_HINTS property (even if no parts are set)
{ {
XSizeHints *hints = XAllocSizeHints(); XSizeHints* hints = XAllocSizeHints();
if (!hints) if (!hints)
{ {
_glfwPlatformCloseWindow(); _glfwPlatformCloseWindow();
@ -1348,8 +1348,8 @@ int _glfwPlatformOpenWindow(int width, int height,
// Choose the best available fbconfig // Choose the best available fbconfig
{ {
unsigned int fbcount; unsigned int fbcount;
_GLFWfbconfig *fbconfigs; _GLFWfbconfig* fbconfigs;
const _GLFWfbconfig *result; const _GLFWfbconfig* result;
fbconfigs = getFBConfigs(&fbcount); fbconfigs = getFBConfigs(&fbcount);
if (!fbconfigs) if (!fbconfigs)
@ -1474,7 +1474,7 @@ void _glfwPlatformCloseWindow(void)
// Set the window title // Set the window title
//======================================================================== //========================================================================
void _glfwPlatformSetWindowTitle(const char *title) void _glfwPlatformSetWindowTitle(const char* title)
{ {
// Set window & icon title // Set window & icon title
XStoreName(_glfwLibrary.display, _glfwWin.window, title); XStoreName(_glfwLibrary.display, _glfwWin.window, title);
@ -1489,7 +1489,7 @@ void _glfwPlatformSetWindowTitle(const char *title)
void _glfwPlatformSetWindowSize(int width, int height) void _glfwPlatformSetWindowSize(int width, int height)
{ {
int mode = 0, rate, sizeChanged = GL_FALSE; int mode = 0, rate, sizeChanged = GL_FALSE;
XSizeHints *sizehints; XSizeHints* sizehints;
rate = _glfwWin.refreshRate; rate = _glfwWin.refreshRate;
@ -1605,9 +1605,9 @@ void _glfwPlatformSwapInterval(int interval)
void _glfwPlatformRefreshWindowParams(void) void _glfwPlatformRefreshWindowParams(void)
{ {
int dummy; int dummy;
GLXFBConfig *fbconfig; GLXFBConfig* fbconfig;
#if defined(_GLFW_HAS_XRANDR) #if defined(_GLFW_HAS_XRANDR)
XRRScreenConfiguration *sc; XRRScreenConfiguration* sc;
#elif defined(_GLFW_HAS_XF86VIDMODE) #elif defined(_GLFW_HAS_XF86VIDMODE)
XF86VidModeModeLine modeline; XF86VidModeModeLine modeline;
int dotclock; int dotclock;