mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Formatting pass (no code changes).
This commit is contained in:
parent
a04e041a6b
commit
a4d888c2f5
29
lib/glext.c
29
lib/glext.c
@ -43,11 +43,11 @@
|
||||
// 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;
|
||||
const GLubyte *version;
|
||||
const GLubyte *ptr;
|
||||
const GLubyte* version;
|
||||
const GLubyte* ptr;
|
||||
|
||||
// Get OpenGL version string
|
||||
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
|
||||
//========================================================================
|
||||
|
||||
int _glfwStringInExtensionString(const char *string,
|
||||
const GLubyte *extensions)
|
||||
int _glfwStringInExtensionString(const char* string,
|
||||
const GLubyte* extensions)
|
||||
{
|
||||
const GLubyte *start;
|
||||
GLubyte *where, *terminator;
|
||||
const GLubyte* start;
|
||||
GLubyte* where;
|
||||
GLubyte* terminator;
|
||||
|
||||
// It takes a bit of care to be fool-proof about parsing the
|
||||
// OpenGL extensions string. Don't be fooled by sub-strings,
|
||||
@ -95,7 +96,7 @@ int _glfwStringInExtensionString(const char *string,
|
||||
start = extensions;
|
||||
for (;;)
|
||||
{
|
||||
where = (GLubyte *) strstr((const char *) start, string);
|
||||
where = (GLubyte*) strstr((const char*) start, string);
|
||||
if (!where)
|
||||
return GL_FALSE;
|
||||
|
||||
@ -122,10 +123,10 @@ int _glfwStringInExtensionString(const char *string,
|
||||
// Check if an OpenGL extension is available at runtime
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI int glfwExtensionSupported(const char *extension)
|
||||
GLFWAPI int glfwExtensionSupported(const char* extension)
|
||||
{
|
||||
const GLubyte *extensions;
|
||||
GLubyte *where;
|
||||
const GLubyte* extensions;
|
||||
GLubyte* where;
|
||||
GLint count;
|
||||
int i;
|
||||
|
||||
@ -133,7 +134,7 @@ GLFWAPI int glfwExtensionSupported(const char *extension)
|
||||
return GL_FALSE;
|
||||
|
||||
// Extension names should not have spaces
|
||||
where = (GLubyte *) strchr(extension, ' ');
|
||||
where = (GLubyte*) strchr(extension, ' ');
|
||||
if (where || *extension == '\0')
|
||||
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.
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI void * glfwGetProcAddress(const char *procname)
|
||||
GLFWAPI void* glfwGetProcAddress(const char* procname)
|
||||
{
|
||||
if (!_glfwInitialized || !_glfwWin.opened)
|
||||
return NULL;
|
||||
@ -190,7 +191,7 @@ GLFWAPI void * glfwGetProcAddress(const char *procname)
|
||||
// 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)
|
||||
return;
|
||||
|
@ -90,7 +90,7 @@ GLFWAPI void glfwTerminate(void)
|
||||
// Get GLFW version
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI void glfwGetVersion(int *major, int *minor, int *rev)
|
||||
GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)
|
||||
{
|
||||
if (major != NULL)
|
||||
*major = GLFW_VERSION_MAJOR;
|
||||
|
@ -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)
|
||||
return;
|
||||
|
@ -52,7 +52,7 @@ GLFWAPI int glfwGetJoystickParam(int joy, int param)
|
||||
// Get joystick axis positions
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI int glfwGetJoystickPos(int joy, float *pos, int numaxes)
|
||||
GLFWAPI int glfwGetJoystickPos(int joy, float* pos, int numaxes)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -72,7 +72,7 @@ GLFWAPI int glfwGetJoystickPos(int joy, float *pos, int numaxes)
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI int glfwGetJoystickButtons(int joy,
|
||||
unsigned char *buttons,
|
||||
unsigned char* buttons,
|
||||
int numbuttons)
|
||||
{
|
||||
int i;
|
||||
|
12
lib/window.c
12
lib/window.c
@ -214,8 +214,8 @@ void _glfwInputMouseClick(int button, int action)
|
||||
// This is based on the manual GLX Visual selection from 2.6
|
||||
//========================================================================
|
||||
|
||||
const _GLFWfbconfig *_glfwChooseFBConfig(const _GLFWfbconfig *desired,
|
||||
const _GLFWfbconfig *alternatives,
|
||||
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||
const _GLFWfbconfig* alternatives,
|
||||
unsigned int count)
|
||||
{
|
||||
unsigned int i;
|
||||
@ -223,8 +223,8 @@ const _GLFWfbconfig *_glfwChooseFBConfig(const _GLFWfbconfig *desired,
|
||||
unsigned int colorDiff, leastColorDiff = UINT_MAX;
|
||||
unsigned int extraDiff, leastExtraDiff = UINT_MAX;
|
||||
GLboolean desiresColor = GL_FALSE;
|
||||
const _GLFWfbconfig *current;
|
||||
const _GLFWfbconfig *closest = NULL;
|
||||
const _GLFWfbconfig* current;
|
||||
const _GLFWfbconfig* closest = NULL;
|
||||
|
||||
// Cache some long-winded preferences
|
||||
|
||||
@ -635,7 +635,7 @@ GLFWAPI void glfwCloseWindow(void)
|
||||
// Set the window title
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI void glfwSetWindowTitle(const char *title)
|
||||
GLFWAPI void glfwSetWindowTitle(const char* title)
|
||||
{
|
||||
if (!_glfwInitialized || !_glfwWin.opened)
|
||||
return;
|
||||
@ -649,7 +649,7 @@ GLFWAPI void glfwSetWindowTitle(const char *title)
|
||||
// Get the window size
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI void glfwGetWindowSize(int *width, int *height)
|
||||
GLFWAPI void glfwGetWindowSize(int* width, int* height)
|
||||
{
|
||||
if (width != NULL)
|
||||
*width = _glfwWin.width;
|
||||
|
@ -41,7 +41,7 @@
|
||||
// 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;
|
||||
|
||||
@ -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
|
||||
//========================================================================
|
||||
|
||||
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)
|
||||
int i, match, bestmatch;
|
||||
int sizecount, bestsize;
|
||||
int ratecount, bestrate;
|
||||
short *ratelist;
|
||||
XRRScreenConfiguration *sc;
|
||||
XRRScreenSize *sizelist;
|
||||
short* ratelist;
|
||||
XRRScreenConfiguration* sc;
|
||||
XRRScreenSize* sizelist;
|
||||
|
||||
if (_glfwLibrary.XRandR.available)
|
||||
{
|
||||
@ -131,7 +131,7 @@ int _glfwGetClosestVideoMode(int screen, int *width, int *height, int *rate)
|
||||
return bestsize;
|
||||
}
|
||||
#elif defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeInfo **modelist;
|
||||
XF86VidModeModeInfo** modelist;
|
||||
int modecount, i, bestmode, bestmatch, match;
|
||||
|
||||
// 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)
|
||||
{
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
XRRScreenConfiguration *sc;
|
||||
XRRScreenConfiguration* sc;
|
||||
Window root;
|
||||
|
||||
if (_glfwLibrary.XRandR.available)
|
||||
@ -272,7 +272,7 @@ void _glfwSetVideoModeMODE(int screen, int mode, int rate)
|
||||
// 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;
|
||||
|
||||
@ -295,7 +295,7 @@ void _glfwRestoreVideoMode(void)
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
if (_glfwLibrary.XRandR.available)
|
||||
{
|
||||
XRRScreenConfiguration *sc;
|
||||
XRRScreenConfiguration* sc;
|
||||
|
||||
if (_glfwLibrary.XRandR.available)
|
||||
{
|
||||
@ -343,21 +343,22 @@ struct _glfwResolution
|
||||
// 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 depth, screen;
|
||||
Display *dpy;
|
||||
XVisualInfo *vislist, dummy;
|
||||
Display* dpy;
|
||||
XVisualInfo* vislist;
|
||||
XVisualInfo dummy;
|
||||
int viscount, rgbcount, rescount;
|
||||
int *rgbarray;
|
||||
struct _glfwResolution *resarray;
|
||||
int* rgbarray;
|
||||
struct _glfwResolution* resarray;
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
XRRScreenConfiguration *sc;
|
||||
XRRScreenSize *sizelist;
|
||||
XRRScreenConfiguration* sc;
|
||||
XRRScreenSize* sizelist;
|
||||
int sizecount;
|
||||
#elif defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeInfo **modelist;
|
||||
XF86VidModeModeInfo** modelist;
|
||||
int modecount, width, height;
|
||||
#endif
|
||||
|
||||
@ -493,12 +494,12 @@ int _glfwPlatformGetVideoModes(GLFWvidmode *list, int maxcount)
|
||||
// Get the desktop video mode
|
||||
//========================================================================
|
||||
|
||||
void _glfwPlatformGetDesktopMode(GLFWvidmode *mode)
|
||||
void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
|
||||
{
|
||||
Display *dpy;
|
||||
Display* dpy;
|
||||
int bpp, screen;
|
||||
#if defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeInfo **modelist;
|
||||
XF86VidModeModeInfo** modelist;
|
||||
int modecount;
|
||||
#endif
|
||||
|
||||
|
@ -31,9 +31,9 @@
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
void (*glXGetProcAddress(const GLubyte *procName))();
|
||||
void (*glXGetProcAddressARB(const GLubyte *procName))();
|
||||
void (*glXGetProcAddressEXT(const GLubyte *procName))();
|
||||
void (*glXGetProcAddress(const GLubyte* procName))();
|
||||
void (*glXGetProcAddressARB(const GLubyte* procName))();
|
||||
void (*glXGetProcAddressEXT(const GLubyte* procName))();
|
||||
|
||||
// We support four different ways for getting addresses for GL/GLX
|
||||
// extension functions: glXGetProcAddress, glXGetProcAddressARB,
|
||||
@ -60,9 +60,9 @@ void (*glXGetProcAddressEXT(const GLubyte *procName))();
|
||||
// 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
|
||||
extensions = (const GLubyte*) glXQueryExtensionsString(_glfwLibrary.display,
|
||||
@ -81,8 +81,8 @@ int _glfwPlatformExtensionSupported(const char *extension)
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ static void initLibraries(void)
|
||||
{
|
||||
#ifdef _GLFW_DLOPEN_LIBGL
|
||||
int i;
|
||||
char *libGL_names[ ] =
|
||||
char* libGL_names[ ] =
|
||||
{
|
||||
"libGL.so",
|
||||
"libGL.so.1",
|
||||
|
@ -81,7 +81,8 @@ void _glfwInitJoysticks(void)
|
||||
{
|
||||
#ifdef _GLFW_USE_LINUX_JOYSTICKS
|
||||
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;
|
||||
char ret_data;
|
||||
#endif // _GLFW_USE_LINUX_JOYSTICKS
|
||||
@ -139,7 +140,7 @@ void _glfwInitJoysticks(void)
|
||||
|
||||
// Allocate memory for joystick state
|
||||
_glfwJoy[joy_count].Axis =
|
||||
(float *) malloc(sizeof(float) *
|
||||
(float*) malloc(sizeof(float) *
|
||||
_glfwJoy[joy_count].NumAxes);
|
||||
if (_glfwJoy[joy_count].Axis == NULL)
|
||||
{
|
||||
@ -147,7 +148,7 @@ void _glfwInitJoysticks(void)
|
||||
continue;
|
||||
}
|
||||
_glfwJoy[joy_count].Button =
|
||||
(unsigned char *) malloc(sizeof(char) *
|
||||
(unsigned char*) malloc(sizeof(char) *
|
||||
_glfwJoy[joy_count].NumButtons);
|
||||
if (_glfwJoy[joy_count].Button == NULL)
|
||||
{
|
||||
@ -287,7 +288,7 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
|
||||
// Get joystick axis positions
|
||||
//========================================================================
|
||||
|
||||
int _glfwPlatformGetJoystickPos(int joy, float *pos, int numaxes)
|
||||
int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -313,7 +314,7 @@ int _glfwPlatformGetJoystickPos(int joy, float *pos, int numaxes)
|
||||
// Get joystick button states
|
||||
//========================================================================
|
||||
|
||||
int _glfwPlatformGetJoystickButtons(int joy, unsigned char *buttons,
|
||||
int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
|
||||
int numbuttons)
|
||||
{
|
||||
int i;
|
||||
|
@ -55,7 +55,7 @@
|
||||
// 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);
|
||||
}
|
||||
@ -125,8 +125,8 @@ static Atom getSupportedAtom(Atom* supportedAtoms,
|
||||
|
||||
static GLboolean checkForEWMH(void)
|
||||
{
|
||||
Window *windowFromRoot = NULL;
|
||||
Window *windowFromChild = NULL;
|
||||
Window* windowFromRoot = NULL;
|
||||
Window* windowFromChild = NULL;
|
||||
|
||||
// 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
|
||||
|
||||
Atom *supportedAtoms;
|
||||
Atom* supportedAtoms;
|
||||
unsigned long atomCount;
|
||||
|
||||
// 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
|
||||
//========================================================================
|
||||
|
||||
static int translateChar(XKeyEvent *event)
|
||||
static int translateChar(XKeyEvent* event)
|
||||
{
|
||||
KeySym keysym;
|
||||
|
||||
@ -354,7 +354,7 @@ static int translateChar(XKeyEvent *event)
|
||||
// Create a blank cursor (for locked mouse mode)
|
||||
//========================================================================
|
||||
|
||||
static Cursor createNULLCursor(Display *display, Window root)
|
||||
static Cursor createNULLCursor(Display* display, Window root)
|
||||
{
|
||||
Pixmap cursormask;
|
||||
XGCValues xgc;
|
||||
@ -403,10 +403,10 @@ static int getFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
|
||||
// Return a list of available and usable framebuffer configs
|
||||
//========================================================================
|
||||
|
||||
static _GLFWfbconfig *getFBConfigs(unsigned int *found)
|
||||
static _GLFWfbconfig* getFBConfigs(unsigned int* found)
|
||||
{
|
||||
GLXFBConfig *fbconfigs;
|
||||
_GLFWfbconfig *result;
|
||||
GLXFBConfig* fbconfigs;
|
||||
_GLFWfbconfig* result;
|
||||
int i, count = 0;
|
||||
|
||||
*found = 0;
|
||||
@ -510,11 +510,11 @@ static _GLFWfbconfig *getFBConfigs(unsigned int *found)
|
||||
attribs[index++] = attribName; \
|
||||
attribs[index++] = attribValue;
|
||||
|
||||
static int createContext(const _GLFWwndconfig *wndconfig, GLXFBConfigID fbconfigID)
|
||||
static int createContext(const _GLFWwndconfig* wndconfig, GLXFBConfigID fbconfigID)
|
||||
{
|
||||
int attribs[40];
|
||||
int flags, dummy, index;
|
||||
GLXFBConfig *fbconfig;
|
||||
GLXFBConfig* fbconfig;
|
||||
|
||||
// Retrieve the previously selected GLXFBConfig
|
||||
{
|
||||
@ -723,7 +723,7 @@ static void initGLXExtensions(void)
|
||||
//========================================================================
|
||||
|
||||
static GLboolean createWindow(int width, int height,
|
||||
const _GLFWwndconfig *wndconfig)
|
||||
const _GLFWwndconfig* wndconfig)
|
||||
{
|
||||
XEvent event;
|
||||
unsigned long wamask;
|
||||
@ -829,7 +829,7 @@ static GLboolean createWindow(int width, int height,
|
||||
|
||||
// Set ICCCM WM_HINTS property
|
||||
{
|
||||
XWMHints *hints = XAllocWMHints();
|
||||
XWMHints* hints = XAllocWMHints();
|
||||
if (!hints)
|
||||
{
|
||||
_glfwPlatformCloseWindow();
|
||||
@ -845,7 +845,7 @@ static GLboolean createWindow(int width, int height,
|
||||
|
||||
// Set ICCCM WM_NORMAL_HINTS property (even if no parts are set)
|
||||
{
|
||||
XSizeHints *hints = XAllocSizeHints();
|
||||
XSizeHints* hints = XAllocSizeHints();
|
||||
if (!hints)
|
||||
{
|
||||
_glfwPlatformCloseWindow();
|
||||
@ -1348,8 +1348,8 @@ int _glfwPlatformOpenWindow(int width, int height,
|
||||
// Choose the best available fbconfig
|
||||
{
|
||||
unsigned int fbcount;
|
||||
_GLFWfbconfig *fbconfigs;
|
||||
const _GLFWfbconfig *result;
|
||||
_GLFWfbconfig* fbconfigs;
|
||||
const _GLFWfbconfig* result;
|
||||
|
||||
fbconfigs = getFBConfigs(&fbcount);
|
||||
if (!fbconfigs)
|
||||
@ -1474,7 +1474,7 @@ void _glfwPlatformCloseWindow(void)
|
||||
// Set the window title
|
||||
//========================================================================
|
||||
|
||||
void _glfwPlatformSetWindowTitle(const char *title)
|
||||
void _glfwPlatformSetWindowTitle(const char* title)
|
||||
{
|
||||
// Set window & icon title
|
||||
XStoreName(_glfwLibrary.display, _glfwWin.window, title);
|
||||
@ -1489,7 +1489,7 @@ void _glfwPlatformSetWindowTitle(const char *title)
|
||||
void _glfwPlatformSetWindowSize(int width, int height)
|
||||
{
|
||||
int mode = 0, rate, sizeChanged = GL_FALSE;
|
||||
XSizeHints *sizehints;
|
||||
XSizeHints* sizehints;
|
||||
|
||||
rate = _glfwWin.refreshRate;
|
||||
|
||||
@ -1605,9 +1605,9 @@ void _glfwPlatformSwapInterval(int interval)
|
||||
void _glfwPlatformRefreshWindowParams(void)
|
||||
{
|
||||
int dummy;
|
||||
GLXFBConfig *fbconfig;
|
||||
GLXFBConfig* fbconfig;
|
||||
#if defined(_GLFW_HAS_XRANDR)
|
||||
XRRScreenConfiguration *sc;
|
||||
XRRScreenConfiguration* sc;
|
||||
#elif defined(_GLFW_HAS_XF86VIDMODE)
|
||||
XF86VidModeModeLine modeline;
|
||||
int dotclock;
|
||||
|
Loading…
Reference in New Issue
Block a user