mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Formatting pass (no code changes).
This commit is contained in:
parent
8bc1a5da16
commit
a04e041a6b
@ -54,9 +54,9 @@ void _glfwPlatformEnableSystemKeys( void )
|
|||||||
|
|
||||||
void _glfwPlatformDisableSystemKeys(void)
|
void _glfwPlatformDisableSystemKeys(void)
|
||||||
{
|
{
|
||||||
if( XGrabKeyboard( _glfwLibrary.display, _glfwWin.window, True,
|
if (XGrabKeyboard(_glfwLibrary.display, _glfwWin.window,
|
||||||
GrabModeAsync, GrabModeAsync, CurrentTime ) ==
|
True, GrabModeAsync, GrabModeAsync, CurrentTime)
|
||||||
GrabSuccess )
|
== GrabSuccess)
|
||||||
{
|
{
|
||||||
_glfwWin.keyboardGrabbed = GL_TRUE;
|
_glfwWin.keyboardGrabbed = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -534,8 +534,7 @@ void _glfwPlatformGetDesktopMode( GLFWvidmode *mode )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Use the XF86VidMode extension to get list of video modes
|
// Use the XF86VidMode extension to get list of video modes
|
||||||
XF86VidModeGetAllModeLines( dpy, screen, &modecount,
|
XF86VidModeGetAllModeLines(dpy, screen, &modecount, &modelist);
|
||||||
&modelist );
|
|
||||||
|
|
||||||
// The first mode in the list is the current (desktio) mode
|
// The first mode in the list is the current (desktio) mode
|
||||||
mode->Width = modelist[0]->hdisplay;
|
mode->Width = modelist[0]->hdisplay;
|
||||||
|
@ -53,10 +53,9 @@ static void initLibraries( void )
|
|||||||
};
|
};
|
||||||
|
|
||||||
_glfwLibrary.Libs.libGL = NULL;
|
_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 ],
|
_glfwLibrary.Libs.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
|
||||||
RTLD_LAZY | RTLD_GLOBAL );
|
|
||||||
if (_glfwLibrary.Libs.libGL)
|
if (_glfwLibrary.Libs.libGL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -88,14 +88,14 @@ void _glfwInitJoysticks( void )
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Start by saying that there are no sticks
|
// 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;
|
_glfwJoy[i].Present = GL_FALSE;
|
||||||
|
|
||||||
#ifdef _GLFW_USE_LINUX_JOYSTICKS
|
#ifdef _GLFW_USE_LINUX_JOYSTICKS
|
||||||
|
|
||||||
// Try to open joysticks (nonblocking)
|
// Try to open joysticks (nonblocking)
|
||||||
joy_count = 0;
|
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
|
// Pick joystick base name
|
||||||
switch (k)
|
switch (k)
|
||||||
@ -111,7 +111,7 @@ void _glfwInitJoysticks( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to open a few of these sticks
|
// 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);
|
sprintf(joy_dev_name, "%s%d", joy_base_name, i);
|
||||||
fd = open(joy_dev_name, O_NONBLOCK);
|
fd = open(joy_dev_name, O_NONBLOCK);
|
||||||
@ -157,10 +157,10 @@ void _glfwInitJoysticks( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear joystick state
|
// 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;
|
_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;
|
_glfwJoy[joy_count].Button[n] = GLFW_RELEASE;
|
||||||
|
|
||||||
// The joystick is supported and connected
|
// The joystick is supported and connected
|
||||||
@ -169,9 +169,7 @@ void _glfwInitJoysticks( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _GLFW_USE_LINUX_JOYSTICKS
|
#endif // _GLFW_USE_LINUX_JOYSTICKS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,13 +185,14 @@ void _glfwTerminateJoysticks( void )
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Close any opened joysticks
|
// Close any opened joysticks
|
||||||
for( i = 0; i <= GLFW_JOYSTICK_LAST; ++ i )
|
for (i = 0; i <= GLFW_JOYSTICK_LAST; i++)
|
||||||
{
|
{
|
||||||
if (_glfwJoy[i].Present)
|
if (_glfwJoy[i].Present)
|
||||||
{
|
{
|
||||||
close(_glfwJoy[i].fd);
|
close(_glfwJoy[i].fd);
|
||||||
free(_glfwJoy[i].Axis);
|
free(_glfwJoy[i].Axis);
|
||||||
free(_glfwJoy[i].Button);
|
free(_glfwJoy[i].Button);
|
||||||
|
|
||||||
_glfwJoy[i].Present = GL_FALSE;
|
_glfwJoy[i].Present = GL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,14 +208,13 @@ void _glfwTerminateJoysticks( void )
|
|||||||
|
|
||||||
static void pollJoystickEvents(void)
|
static void pollJoystickEvents(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef _GLFW_USE_LINUX_JOYSTICKS
|
#ifdef _GLFW_USE_LINUX_JOYSTICKS
|
||||||
|
|
||||||
struct js_event e;
|
struct js_event e;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Get joystick events for all GLFW joysticks
|
// 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?
|
// Is the stick present?
|
||||||
if (_glfwJoy[i].Present)
|
if (_glfwJoy[i].Present)
|
||||||
@ -231,15 +229,11 @@ static void pollJoystickEvents( void )
|
|||||||
switch (e.type)
|
switch (e.type)
|
||||||
{
|
{
|
||||||
case JS_EVENT_AXIS:
|
case JS_EVENT_AXIS:
|
||||||
_glfwJoy[ i ].Axis[ e.number ] = (float) e.value /
|
_glfwJoy[i].Axis[e.number] = (float) e.value / 32767.0f;
|
||||||
32767.0f;
|
|
||||||
// We need to change the sign for the Y axes, so that
|
// We need to change the sign for the Y axes, so that
|
||||||
// positive = up/forward, according to the GLFW spec.
|
// positive = up/forward, according to the GLFW spec.
|
||||||
if (e.number & 1)
|
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;
|
break;
|
||||||
|
|
||||||
case JS_EVENT_BUTTON:
|
case JS_EVENT_BUTTON:
|
||||||
@ -253,9 +247,7 @@ static void pollJoystickEvents( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _GLFW_USE_LINUX_JOYSTICKS
|
#endif // _GLFW_USE_LINUX_JOYSTICKS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -310,7 +302,7 @@ int _glfwPlatformGetJoystickPos( int joy, float *pos, int numaxes )
|
|||||||
numaxes = _glfwJoy[joy].NumAxes;
|
numaxes = _glfwJoy[joy].NumAxes;
|
||||||
|
|
||||||
// Copy axis positions from internal state
|
// Copy axis positions from internal state
|
||||||
for( i = 0; i < numaxes; ++ i )
|
for (i = 0; i < numaxes; i++)
|
||||||
pos[i] = _glfwJoy[joy].Axis[i];
|
pos[i] = _glfwJoy[joy].Axis[i];
|
||||||
|
|
||||||
return numaxes;
|
return numaxes;
|
||||||
@ -337,7 +329,7 @@ int _glfwPlatformGetJoystickButtons( int joy, unsigned char *buttons,
|
|||||||
numbuttons = _glfwJoy[joy].NumButtons;
|
numbuttons = _glfwJoy[joy].NumButtons;
|
||||||
|
|
||||||
// Copy button states from internal state
|
// Copy button states from internal state
|
||||||
for( i = 0; i < numbuttons; ++ i )
|
for (i = 0; i < numbuttons; i++)
|
||||||
buttons[i] = _glfwJoy[joy].Button[i];
|
buttons[i] = _glfwJoy[joy].Button[i];
|
||||||
|
|
||||||
return numbuttons;
|
return numbuttons;
|
||||||
|
@ -678,10 +678,8 @@ static void initGLXExtensions( void )
|
|||||||
_glfwPlatformGetProcAddress("glXSwapIntervalSGI");
|
_glfwPlatformGetProcAddress("glXSwapIntervalSGI");
|
||||||
|
|
||||||
if (_glfwWin.SwapIntervalSGI)
|
if (_glfwWin.SwapIntervalSGI)
|
||||||
{
|
|
||||||
_glfwWin.has_GLX_SGI_swap_control = GL_TRUE;
|
_glfwWin.has_GLX_SGI_swap_control = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig"))
|
if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig"))
|
||||||
{
|
{
|
||||||
@ -704,9 +702,7 @@ static void initGLXExtensions( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
|
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
|
||||||
{
|
|
||||||
_glfwWin.has_GLX_ARB_multisample = GL_TRUE;
|
_glfwWin.has_GLX_ARB_multisample = GL_TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context"))
|
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context"))
|
||||||
{
|
{
|
||||||
@ -714,16 +710,12 @@ static void initGLXExtensions( void )
|
|||||||
_glfwPlatformGetProcAddress("glXCreateContextAttribsARB");
|
_glfwPlatformGetProcAddress("glXCreateContextAttribsARB");
|
||||||
|
|
||||||
if (_glfwWin.CreateContextAttribsARB)
|
if (_glfwWin.CreateContextAttribsARB)
|
||||||
{
|
|
||||||
_glfwWin.has_GLX_ARB_create_context = GL_TRUE;
|
_glfwWin.has_GLX_ARB_create_context = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context_profile"))
|
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context_profile"))
|
||||||
{
|
|
||||||
_glfwWin.has_GLX_ARB_create_context_profile = GL_TRUE;
|
_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
|
// The WM_DELETE_WINDOW ICCCM protocol
|
||||||
// Basic window close notification protocol
|
// Basic window close notification protocol
|
||||||
if (_glfwWin.wmDeleteWindow != None)
|
if (_glfwWin.wmDeleteWindow != None)
|
||||||
{
|
|
||||||
protocols[count++] = _glfwWin.wmDeleteWindow;
|
protocols[count++] = _glfwWin.wmDeleteWindow;
|
||||||
}
|
|
||||||
|
|
||||||
// The _NET_WM_PING EWMH protocol
|
// The _NET_WM_PING EWMH protocol
|
||||||
// Tells the WM to ping our window and flag us as unresponsive if we
|
// 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
|
// Translate and report character input
|
||||||
if (_glfwWin.charCallback)
|
if (_glfwWin.charCallback)
|
||||||
{
|
|
||||||
_glfwInputChar(translateChar(&event.xkey), GLFW_PRESS);
|
_glfwInputChar(translateChar(&event.xkey), GLFW_PRESS);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user