Formatting pass (no code changes).

This commit is contained in:
Camilla Berglund 2010-09-08 15:51:25 +02:00
parent 8bc1a5da16
commit a04e041a6b
7 changed files with 769 additions and 790 deletions

View File

@ -54,9 +54,9 @@ void _glfwPlatformEnableSystemKeys( void )
void _glfwPlatformDisableSystemKeys(void)
{
if( XGrabKeyboard( _glfwLibrary.display, _glfwWin.window, True,
GrabModeAsync, GrabModeAsync, CurrentTime ) ==
GrabSuccess )
if (XGrabKeyboard(_glfwLibrary.display, _glfwWin.window,
True, GrabModeAsync, GrabModeAsync, CurrentTime)
== GrabSuccess)
{
_glfwWin.keyboardGrabbed = GL_TRUE;
}

View File

@ -534,8 +534,7 @@ void _glfwPlatformGetDesktopMode( GLFWvidmode *mode )
else
{
// Use the XF86VidMode extension to get list of video modes
XF86VidModeGetAllModeLines( dpy, screen, &modecount,
&modelist );
XF86VidModeGetAllModeLines(dpy, screen, &modecount, &modelist);
// The first mode in the list is the current (desktio) mode
mode->Width = modelist[0]->hdisplay;

View File

@ -53,10 +53,9 @@ static void initLibraries( void )
};
_glfwLibrary.Libs.libGL = NULL;
for( i = 0; !libGL_names[ i ] != NULL; i ++ )
for (i = 0; libGL_names[i] != NULL; i++)
{
_glfwLibrary.Libs.libGL = dlopen( libGL_names[ i ],
RTLD_LAZY | RTLD_GLOBAL );
_glfwLibrary.Libs.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
if (_glfwLibrary.Libs.libGL)
break;
}

View File

@ -88,14 +88,14 @@ void _glfwInitJoysticks( void )
int i;
// Start by saying that there are no sticks
for( i = 0; i <= GLFW_JOYSTICK_LAST; ++ i )
for (i = 0; i <= GLFW_JOYSTICK_LAST; i++)
_glfwJoy[i].Present = GL_FALSE;
#ifdef _GLFW_USE_LINUX_JOYSTICKS
// Try to open joysticks (nonblocking)
joy_count = 0;
for( k = 0; k <= 1 && joy_count <= GLFW_JOYSTICK_LAST; ++ k )
for (k = 0; k <= 1 && joy_count <= GLFW_JOYSTICK_LAST; k++)
{
// Pick joystick base name
switch (k)
@ -111,7 +111,7 @@ void _glfwInitJoysticks( void )
}
// Try to open a few of these sticks
for( i = 0; i <= 50 && joy_count <= GLFW_JOYSTICK_LAST; ++ i )
for (i = 0; i <= 50 && joy_count <= GLFW_JOYSTICK_LAST; i++)
{
sprintf(joy_dev_name, "%s%d", joy_base_name, i);
fd = open(joy_dev_name, O_NONBLOCK);
@ -157,10 +157,10 @@ void _glfwInitJoysticks( void )
}
// Clear joystick state
for( n = 0; n < _glfwJoy[ joy_count ].NumAxes; ++ n )
for (n = 0; n < _glfwJoy[joy_count].NumAxes; n++)
_glfwJoy[joy_count].Axis[n] = 0.0f;
for( n = 0; n < _glfwJoy[ joy_count ].NumButtons; ++ n )
for (n = 0; n < _glfwJoy[joy_count].NumButtons; n++)
_glfwJoy[joy_count].Button[n] = GLFW_RELEASE;
// The joystick is supported and connected
@ -169,9 +169,7 @@ void _glfwInitJoysticks( void )
}
}
}
#endif // _GLFW_USE_LINUX_JOYSTICKS
}
@ -187,13 +185,14 @@ void _glfwTerminateJoysticks( void )
int i;
// Close any opened joysticks
for( i = 0; i <= GLFW_JOYSTICK_LAST; ++ i )
for (i = 0; i <= GLFW_JOYSTICK_LAST; i++)
{
if (_glfwJoy[i].Present)
{
close(_glfwJoy[i].fd);
free(_glfwJoy[i].Axis);
free(_glfwJoy[i].Button);
_glfwJoy[i].Present = GL_FALSE;
}
}
@ -209,14 +208,13 @@ void _glfwTerminateJoysticks( void )
static void pollJoystickEvents(void)
{
#ifdef _GLFW_USE_LINUX_JOYSTICKS
struct js_event e;
int i;
// Get joystick events for all GLFW joysticks
for( i = 0; i <= GLFW_JOYSTICK_LAST; ++ i )
for (i = 0; i <= GLFW_JOYSTICK_LAST; i++)
{
// Is the stick present?
if (_glfwJoy[i].Present)
@ -231,15 +229,11 @@ static void pollJoystickEvents( void )
switch (e.type)
{
case JS_EVENT_AXIS:
_glfwJoy[ i ].Axis[ e.number ] = (float) e.value /
32767.0f;
_glfwJoy[i].Axis[e.number] = (float) e.value / 32767.0f;
// We need to change the sign for the Y axes, so that
// positive = up/forward, according to the GLFW spec.
if (e.number & 1)
{
_glfwJoy[ i ].Axis[ e.number ] =
-_glfwJoy[ i ].Axis[ e.number ];
}
_glfwJoy[i].Axis[e.number] = -_glfwJoy[i].Axis[e.number];
break;
case JS_EVENT_BUTTON:
@ -253,9 +247,7 @@ static void pollJoystickEvents( void )
}
}
}
#endif // _GLFW_USE_LINUX_JOYSTICKS
}
@ -310,7 +302,7 @@ int _glfwPlatformGetJoystickPos( int joy, float *pos, int numaxes )
numaxes = _glfwJoy[joy].NumAxes;
// Copy axis positions from internal state
for( i = 0; i < numaxes; ++ i )
for (i = 0; i < numaxes; i++)
pos[i] = _glfwJoy[joy].Axis[i];
return numaxes;
@ -337,7 +329,7 @@ int _glfwPlatformGetJoystickButtons( int joy, unsigned char *buttons,
numbuttons = _glfwJoy[joy].NumButtons;
// Copy button states from internal state
for( i = 0; i < numbuttons; ++ i )
for (i = 0; i < numbuttons; i++)
buttons[i] = _glfwJoy[joy].Button[i];
return numbuttons;

View File

@ -678,10 +678,8 @@ static void initGLXExtensions( void )
_glfwPlatformGetProcAddress("glXSwapIntervalSGI");
if (_glfwWin.SwapIntervalSGI)
{
_glfwWin.has_GLX_SGI_swap_control = GL_TRUE;
}
}
if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig"))
{
@ -704,9 +702,7 @@ static void initGLXExtensions( void )
}
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
{
_glfwWin.has_GLX_ARB_multisample = GL_TRUE;
}
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context"))
{
@ -714,16 +710,12 @@ static void initGLXExtensions( void )
_glfwPlatformGetProcAddress("glXCreateContextAttribsARB");
if (_glfwWin.CreateContextAttribsARB)
{
_glfwWin.has_GLX_ARB_create_context = GL_TRUE;
}
}
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context_profile"))
{
_glfwWin.has_GLX_ARB_create_context_profile = GL_TRUE;
}
}
//========================================================================
@ -820,9 +812,7 @@ static GLboolean createWindow( int width, int height,
// The WM_DELETE_WINDOW ICCCM protocol
// Basic window close notification protocol
if (_glfwWin.wmDeleteWindow != None)
{
protocols[count++] = _glfwWin.wmDeleteWindow;
}
// The _NET_WM_PING EWMH protocol
// Tells the WM to ping our window and flag us as unresponsive if we
@ -1055,9 +1045,8 @@ static GLboolean processSingleEvent( void )
// Translate and report character input
if (_glfwWin.charCallback)
{
_glfwInputChar(translateChar(&event.xkey), GLFW_PRESS);
}
break;
}