mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 06:04:34 +00:00
Shallow formatting pass (no code changes).
This commit is contained in:
parent
c5af4c4324
commit
a0351391d1
@ -53,13 +53,10 @@ static void BPP2RGB( int bpp, int *r, int *g, int *b )
|
|||||||
*r = *g = *b = bpp / 3;
|
*r = *g = *b = bpp / 3;
|
||||||
delta = bpp - (*r * 3);
|
delta = bpp - (*r * 3);
|
||||||
if( delta >= 1 )
|
if( delta >= 1 )
|
||||||
{
|
|
||||||
*g = *g + 1;
|
*g = *g + 1;
|
||||||
}
|
|
||||||
if( delta == 2 )
|
if( delta == 2 )
|
||||||
{
|
|
||||||
*r = *r + 1;
|
*r = *r + 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,19 +120,15 @@ int _glfwGetClosestVideoMode( int screen, int *width, int *height, int *rate )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( bestrate != -1 )
|
if( bestrate != -1 )
|
||||||
{
|
|
||||||
*rate = bestrate;
|
*rate = bestrate;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free modelist
|
// Free modelist
|
||||||
XRRFreeScreenConfigInfo( sc );
|
XRRFreeScreenConfigInfo( sc );
|
||||||
|
|
||||||
if( bestsize != -1 )
|
if( bestsize != -1 )
|
||||||
{
|
|
||||||
return bestsize;
|
return bestsize;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#elif defined( _GLFW_HAS_XF86VIDMODE )
|
#elif defined( _GLFW_HAS_XF86VIDMODE )
|
||||||
XF86VidModeModeInfo **modelist;
|
XF86VidModeModeInfo **modelist;
|
||||||
@ -175,9 +168,7 @@ int _glfwGetClosestVideoMode( int screen, int *width, int *height, int *rate )
|
|||||||
XFree( modelist );
|
XFree( modelist );
|
||||||
|
|
||||||
if( bestmode != -1 )
|
if( bestmode != -1 )
|
||||||
{
|
|
||||||
return bestmode;
|
return bestmode;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -251,9 +242,7 @@ void _glfwSetVideoModeMODE( int screen, int mode, int rate )
|
|||||||
|
|
||||||
// Unlock mode switch if necessary
|
// Unlock mode switch if necessary
|
||||||
if( _glfwWin.FS.modeChanged )
|
if( _glfwWin.FS.modeChanged )
|
||||||
{
|
|
||||||
XF86VidModeLockModeSwitch( _glfwLibrary.display, screen, 0 );
|
XF86VidModeLockModeSwitch( _glfwLibrary.display, screen, 0 );
|
||||||
}
|
|
||||||
|
|
||||||
// Change the video mode to the desired mode
|
// Change the video mode to the desired mode
|
||||||
XF86VidModeSwitchToMode( _glfwLibrary.display, screen,
|
XF86VidModeSwitchToMode( _glfwLibrary.display, screen,
|
||||||
@ -285,7 +274,7 @@ void _glfwSetVideoModeMODE( int screen, int mode, int rate )
|
|||||||
|
|
||||||
void _glfwSetVideoMode( int screen, int *width, int *height, int *rate )
|
void _glfwSetVideoMode( int screen, int *width, int *height, int *rate )
|
||||||
{
|
{
|
||||||
int bestmode;
|
int bestmode;
|
||||||
|
|
||||||
// Find a best match mode
|
// Find a best match mode
|
||||||
bestmode = _glfwGetClosestVideoMode( screen, width, height, rate );
|
bestmode = _glfwGetClosestVideoMode( screen, width, height, rate );
|
||||||
@ -379,9 +368,7 @@ int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
|
|||||||
// Get list of visuals
|
// Get list of visuals
|
||||||
vislist = XGetVisualInfo( dpy, 0, &dummy, &viscount );
|
vislist = XGetVisualInfo( dpy, 0, &dummy, &viscount );
|
||||||
if( vislist == NULL )
|
if( vislist == NULL )
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
rgbarray = (int*) malloc( sizeof(int) * viscount );
|
rgbarray = (int*) malloc( sizeof(int) * viscount );
|
||||||
rgbcount = 0;
|
rgbcount = 0;
|
||||||
@ -405,10 +392,9 @@ int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
|
|||||||
for( l = 0; l < rgbcount; l++ )
|
for( l = 0; l < rgbcount; l++ )
|
||||||
{
|
{
|
||||||
if( depth == rgbarray[ l ] )
|
if( depth == rgbarray[ l ] )
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( l >= rgbcount )
|
if( l >= rgbcount )
|
||||||
{
|
{
|
||||||
rgbarray[ rgbcount ] = depth;
|
rgbarray[ rgbcount ] = depth;
|
||||||
@ -454,9 +440,7 @@ int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
|
|||||||
for( l = 0; l < rescount; l++ )
|
for( l = 0; l < rescount; l++ )
|
||||||
{
|
{
|
||||||
if( width == resarray[ l ].width && height == resarray[ l ].height )
|
if( width == resarray[ l ].width && height == resarray[ l ].height )
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( l >= rescount )
|
if( l >= rescount )
|
||||||
|
@ -70,9 +70,7 @@ int _glfwPlatformExtensionSupported( const char *extension )
|
|||||||
if( extensions != NULL )
|
if( extensions != NULL )
|
||||||
{
|
{
|
||||||
if( _glfwStringInExtensionString( extension, extensions ) )
|
if( _glfwStringInExtensionString( extension, extensions ) )
|
||||||
{
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//************************************************************************
|
//************************************************************************
|
||||||
//**** GLFW internal functions ****
|
//**** GLFW internal functions ****
|
||||||
//************************************************************************
|
//************************************************************************
|
||||||
@ -155,11 +154,8 @@ static void terminateDisplay( void )
|
|||||||
|
|
||||||
int _glfwPlatformInit( void )
|
int _glfwPlatformInit( void )
|
||||||
{
|
{
|
||||||
// Initialize display
|
|
||||||
if( !initDisplay() )
|
if( !initDisplay() )
|
||||||
{
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
// Try to load libGL.so if necessary
|
// Try to load libGL.so if necessary
|
||||||
initLibraries();
|
initLibraries();
|
||||||
|
@ -74,7 +74,7 @@ struct js_event {
|
|||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// _glfwInitJoysticks() - Initialize joystick interface
|
// Initialize joystick interface
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void _glfwInitJoysticks( void )
|
void _glfwInitJoysticks( void )
|
||||||
@ -89,9 +89,7 @@ void _glfwInitJoysticks( void )
|
|||||||
|
|
||||||
// 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
|
||||||
|
|
||||||
@ -160,13 +158,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
|
||||||
_glfwJoy[ joy_count ].Present = GL_TRUE;
|
_glfwJoy[ joy_count ].Present = GL_TRUE;
|
||||||
@ -181,7 +176,7 @@ void _glfwInitJoysticks( void )
|
|||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// _glfwTerminateJoysticks() - Close all opened joystick handles
|
// Close all opened joystick handles
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void _glfwTerminateJoysticks( void )
|
void _glfwTerminateJoysticks( void )
|
||||||
@ -269,16 +264,13 @@ static void pollJoystickEvents( void )
|
|||||||
//************************************************************************
|
//************************************************************************
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// _glfwPlatformGetJoystickParam() - Determine joystick capabilities
|
// Determine joystick capabilities
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
int _glfwPlatformGetJoystickParam( int joy, int param )
|
int _glfwPlatformGetJoystickParam( int joy, int param )
|
||||||
{
|
{
|
||||||
// Is joystick present?
|
|
||||||
if( !_glfwJoy[ joy ].Present )
|
if( !_glfwJoy[ joy ].Present )
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
switch( param )
|
switch( param )
|
||||||
{
|
{
|
||||||
@ -300,67 +292,53 @@ int _glfwPlatformGetJoystickParam( int joy, int param )
|
|||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// _glfwPlatformGetJoystickPos() - 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;
|
||||||
|
|
||||||
// Is joystick present?
|
|
||||||
if( !_glfwJoy[ joy ].Present )
|
if( !_glfwJoy[ joy ].Present )
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
// Update joystick state
|
// Update joystick state
|
||||||
pollJoystickEvents();
|
pollJoystickEvents();
|
||||||
|
|
||||||
// Does the joystick support less axes than requested?
|
// Does the joystick support less axes than requested?
|
||||||
if( _glfwJoy[ joy ].NumAxes < numaxes )
|
if( _glfwJoy[ joy ].NumAxes < 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// _glfwPlatformGetJoystickButtons() - 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;
|
||||||
|
|
||||||
// Is joystick present?
|
|
||||||
if( !_glfwJoy[ joy ].Present )
|
if( !_glfwJoy[ joy ].Present )
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
// Update joystick state
|
// Update joystick state
|
||||||
pollJoystickEvents();
|
pollJoystickEvents();
|
||||||
|
|
||||||
// Does the joystick support less buttons than requested?
|
// Does the joystick support less buttons than requested?
|
||||||
if( _glfwJoy[ joy ].NumButtons < numbuttons )
|
if( _glfwJoy[ joy ].NumButtons < numbuttons )
|
||||||
{
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -873,22 +873,16 @@ long _glfwKeySym2Unicode( KeySym keysym )
|
|||||||
|
|
||||||
/* Also check for directly encoded 24-bit UCS characters */
|
/* Also check for directly encoded 24-bit UCS characters */
|
||||||
if( (keysym & 0xff000000) == 0x01000000 )
|
if( (keysym & 0xff000000) == 0x01000000 )
|
||||||
{
|
|
||||||
return keysym & 0x00ffffff;
|
return keysym & 0x00ffffff;
|
||||||
}
|
|
||||||
|
|
||||||
/* Binary search in table */
|
/* Binary search in table */
|
||||||
while( max >= min )
|
while( max >= min )
|
||||||
{
|
{
|
||||||
mid = (min + max) / 2;
|
mid = (min + max) / 2;
|
||||||
if( keysymtab[mid].keysym < keysym )
|
if( keysymtab[mid].keysym < keysym )
|
||||||
{
|
|
||||||
min = mid + 1;
|
min = mid + 1;
|
||||||
}
|
|
||||||
else if( keysymtab[mid].keysym > keysym )
|
else if( keysymtab[mid].keysym > keysym )
|
||||||
{
|
|
||||||
max = mid - 1;
|
max = mid - 1;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Found it! */
|
/* Found it! */
|
||||||
|
@ -89,9 +89,7 @@ static unsigned long getWindowProperty( Window window,
|
|||||||
value );
|
value );
|
||||||
|
|
||||||
if( actualType != type )
|
if( actualType != type )
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
return itemCount;
|
return itemCount;
|
||||||
}
|
}
|
||||||
@ -113,9 +111,7 @@ static Atom getSupportedAtom( Atom* supportedAtoms,
|
|||||||
for( i = 0; i < atomCount; i++ )
|
for( i = 0; i < atomCount; i++ )
|
||||||
{
|
{
|
||||||
if( supportedAtoms[i] == atom )
|
if( supportedAtoms[i] == atom )
|
||||||
{
|
|
||||||
return atom;
|
return atom;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,9 +138,7 @@ static GLboolean checkForEWMH( void )
|
|||||||
"_NET_SUPPORTED",
|
"_NET_SUPPORTED",
|
||||||
True );
|
True );
|
||||||
if( supportingWmCheck == None || wmSupported == None )
|
if( supportingWmCheck == None || wmSupported == None )
|
||||||
{
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
// Then we look for the _NET_SUPPORTING_WM_CHECK property of the root window
|
// Then we look for the _NET_SUPPORTING_WM_CHECK property of the root window
|
||||||
if( getWindowProperty( _glfwWin.root,
|
if( getWindowProperty( _glfwWin.root,
|
||||||
@ -332,11 +326,9 @@ static int translateKey( int keycode )
|
|||||||
key = key_uc;
|
key = key_uc;
|
||||||
|
|
||||||
// Valid ISO 8859-1 character?
|
// Valid ISO 8859-1 character?
|
||||||
if( (key >= 32 && key <= 126) ||
|
if( (key >= 32 && key <= 126) || (key >= 160 && key <= 255) )
|
||||||
(key >= 160 && key <= 255) )
|
|
||||||
{
|
|
||||||
return (int) key;
|
return (int) key;
|
||||||
}
|
|
||||||
return GLFW_KEY_UNKNOWN;
|
return GLFW_KEY_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,12 +389,11 @@ static int getFBConfigAttrib( GLXFBConfig fbconfig, int attrib )
|
|||||||
|
|
||||||
if( _glfwWin.has_GLX_SGIX_fbconfig )
|
if( _glfwWin.has_GLX_SGIX_fbconfig )
|
||||||
{
|
{
|
||||||
_glfwWin.GetFBConfigAttribSGIX( _glfwLibrary.display, fbconfig, attrib, &value );
|
_glfwWin.GetFBConfigAttribSGIX( _glfwLibrary.display,
|
||||||
|
fbconfig, attrib, &value );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
glXGetFBConfigAttrib( _glfwLibrary.display, fbconfig, attrib, &value );
|
glXGetFBConfigAttrib( _glfwLibrary.display, fbconfig, attrib, &value );
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -496,13 +487,9 @@ static _GLFWfbconfig *getFBConfigs( unsigned int *found )
|
|||||||
result[*found].stereo = getFBConfigAttrib( fbconfigs[i], GLX_STEREO );
|
result[*found].stereo = getFBConfigAttrib( fbconfigs[i], GLX_STEREO );
|
||||||
|
|
||||||
if( _glfwWin.has_GLX_ARB_multisample )
|
if( _glfwWin.has_GLX_ARB_multisample )
|
||||||
{
|
|
||||||
result[*found].samples = getFBConfigAttrib( fbconfigs[i], GLX_SAMPLES );
|
result[*found].samples = getFBConfigAttrib( fbconfigs[i], GLX_SAMPLES );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
result[*found].samples = 0;
|
result[*found].samples = 0;
|
||||||
}
|
|
||||||
|
|
||||||
result[*found].platformID = (GLFWintptr) getFBConfigAttrib( fbconfigs[i], GLX_FBCONFIG_ID );
|
result[*found].platformID = (GLFWintptr) getFBConfigAttrib( fbconfigs[i], GLX_FBCONFIG_ID );
|
||||||
|
|
||||||
@ -566,7 +553,8 @@ static int createContext( const _GLFWwndconfig *wndconfig, GLXFBConfigID fbconfi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_glfwWin.visual = glXGetVisualFromFBConfig( _glfwLibrary.display, *fbconfig );
|
_glfwWin.visual = glXGetVisualFromFBConfig( _glfwLibrary.display,
|
||||||
|
*fbconfig );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( _glfwWin.visual == NULL )
|
if( _glfwWin.visual == NULL )
|
||||||
@ -594,14 +582,10 @@ static int createContext( const _GLFWwndconfig *wndconfig, GLXFBConfigID fbconfi
|
|||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
if( wndconfig->glForward )
|
if( wndconfig->glForward )
|
||||||
{
|
|
||||||
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||||
}
|
|
||||||
|
|
||||||
if( wndconfig->glDebug )
|
if( wndconfig->glDebug )
|
||||||
{
|
|
||||||
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
|
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
|
||||||
}
|
|
||||||
|
|
||||||
setGLXattrib( attribs, index, GLX_CONTEXT_FLAGS_ARB, flags );
|
setGLXattrib( attribs, index, GLX_CONTEXT_FLAGS_ARB, flags );
|
||||||
}
|
}
|
||||||
@ -616,13 +600,9 @@ static int createContext( const _GLFWwndconfig *wndconfig, GLXFBConfigID fbconfi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE )
|
if( wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE )
|
||||||
{
|
|
||||||
flags = GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
flags = GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
flags = GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
flags = GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||||
}
|
|
||||||
|
|
||||||
setGLXattrib( attribs, index, GLX_CONTEXT_PROFILE_MASK_ARB, flags );
|
setGLXattrib( attribs, index, GLX_CONTEXT_PROFILE_MASK_ARB, flags );
|
||||||
}
|
}
|
||||||
@ -796,6 +776,7 @@ static GLboolean createWindow( int width, int height,
|
|||||||
wamask,
|
wamask,
|
||||||
&wa
|
&wa
|
||||||
);
|
);
|
||||||
|
|
||||||
if( !_glfwWin.window )
|
if( !_glfwWin.window )
|
||||||
{
|
{
|
||||||
_glfwPlatformCloseWindow();
|
_glfwPlatformCloseWindow();
|
||||||
@ -847,9 +828,7 @@ static GLboolean createWindow( int width, int height,
|
|||||||
// 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
|
||||||
// don't reply within a few seconds
|
// don't reply within a few seconds
|
||||||
if( _glfwWin.wmPing != None )
|
if( _glfwWin.wmPing != None )
|
||||||
{
|
|
||||||
protocols[count++] = _glfwWin.wmPing;
|
protocols[count++] = _glfwWin.wmPing;
|
||||||
}
|
|
||||||
|
|
||||||
if( count > 0 )
|
if( count > 0 )
|
||||||
{
|
{
|
||||||
@ -994,9 +973,7 @@ static void enterFullscreenMode( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( _glfwWin.mouseLock )
|
if( _glfwWin.mouseLock )
|
||||||
{
|
|
||||||
_glfwPlatformHideMouseCursor();
|
_glfwPlatformHideMouseCursor();
|
||||||
}
|
|
||||||
|
|
||||||
// HACK: Try to get window inside viewport (for virtual displays) by moving
|
// HACK: Try to get window inside viewport (for virtual displays) by moving
|
||||||
// the mouse cursor to the upper left corner (and then to the center)
|
// the mouse cursor to the upper left corner (and then to the center)
|
||||||
@ -1054,9 +1031,7 @@ static void leaveFullscreenMode( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( _glfwWin.mouseLock )
|
if( _glfwWin.mouseLock )
|
||||||
{
|
|
||||||
_glfwPlatformShowMouseCursor();
|
_glfwPlatformShowMouseCursor();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -1121,9 +1096,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_RELEASE );
|
_glfwInputChar( translateChar( &event.xkey ), GLFW_RELEASE );
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1132,17 +1106,11 @@ static GLboolean processSingleEvent( void )
|
|||||||
// A mouse button was pressed or a scrolling event occurred
|
// A mouse button was pressed or a scrolling event occurred
|
||||||
|
|
||||||
if( event.xbutton.button == Button1 )
|
if( event.xbutton.button == Button1 )
|
||||||
{
|
|
||||||
_glfwInputMouseClick( GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS );
|
_glfwInputMouseClick( GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS );
|
||||||
}
|
|
||||||
else if( event.xbutton.button == Button2 )
|
else if( event.xbutton.button == Button2 )
|
||||||
{
|
|
||||||
_glfwInputMouseClick( GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS );
|
_glfwInputMouseClick( GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS );
|
||||||
}
|
|
||||||
else if( event.xbutton.button == Button3 )
|
else if( event.xbutton.button == Button3 )
|
||||||
{
|
|
||||||
_glfwInputMouseClick( GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS );
|
_glfwInputMouseClick( GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS );
|
||||||
}
|
|
||||||
|
|
||||||
// XFree86 3.3.2 and later translates mouse wheel up/down into
|
// XFree86 3.3.2 and later translates mouse wheel up/down into
|
||||||
// mouse button 4 & 5 presses
|
// mouse button 4 & 5 presses
|
||||||
@ -1150,17 +1118,13 @@ static GLboolean processSingleEvent( void )
|
|||||||
{
|
{
|
||||||
_glfwInput.WheelPos++; // To verify: is this up or down?
|
_glfwInput.WheelPos++; // To verify: is this up or down?
|
||||||
if( _glfwWin.mouseWheelCallback )
|
if( _glfwWin.mouseWheelCallback )
|
||||||
{
|
|
||||||
_glfwWin.mouseWheelCallback( _glfwInput.WheelPos );
|
_glfwWin.mouseWheelCallback( _glfwInput.WheelPos );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if( event.xbutton.button == Button5 )
|
else if( event.xbutton.button == Button5 )
|
||||||
{
|
{
|
||||||
_glfwInput.WheelPos--;
|
_glfwInput.WheelPos--;
|
||||||
if( _glfwWin.mouseWheelCallback )
|
if( _glfwWin.mouseWheelCallback )
|
||||||
{
|
|
||||||
_glfwWin.mouseWheelCallback( _glfwInput.WheelPos );
|
_glfwWin.mouseWheelCallback( _glfwInput.WheelPos );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1292,9 +1256,7 @@ static GLboolean processSingleEvent( void )
|
|||||||
_glfwWin.active = GL_TRUE;
|
_glfwWin.active = GL_TRUE;
|
||||||
|
|
||||||
if( _glfwWin.mouseLock )
|
if( _glfwWin.mouseLock )
|
||||||
{
|
|
||||||
_glfwPlatformHideMouseCursor();
|
_glfwPlatformHideMouseCursor();
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1307,9 +1269,7 @@ static GLboolean processSingleEvent( void )
|
|||||||
_glfwInputDeactivation();
|
_glfwInputDeactivation();
|
||||||
|
|
||||||
if( _glfwWin.mouseLock )
|
if( _glfwWin.mouseLock )
|
||||||
{
|
|
||||||
_glfwPlatformShowMouseCursor();
|
_glfwPlatformShowMouseCursor();
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1319,9 +1279,8 @@ static GLboolean processSingleEvent( void )
|
|||||||
// The window's contents was damaged
|
// The window's contents was damaged
|
||||||
|
|
||||||
if( _glfwWin.windowRefreshCallback )
|
if( _glfwWin.windowRefreshCallback )
|
||||||
{
|
|
||||||
_glfwWin.windowRefreshCallback();
|
_glfwWin.windowRefreshCallback();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1485,9 +1444,7 @@ int _glfwPlatformOpenWindow( int width, int height,
|
|||||||
void _glfwPlatformCloseWindow( void )
|
void _glfwPlatformCloseWindow( void )
|
||||||
{
|
{
|
||||||
if( _glfwWin.fullscreen )
|
if( _glfwWin.fullscreen )
|
||||||
{
|
|
||||||
leaveFullscreenMode();
|
leaveFullscreenMode();
|
||||||
}
|
|
||||||
|
|
||||||
if( _glfwWin.context )
|
if( _glfwWin.context )
|
||||||
{
|
{
|
||||||
@ -1542,7 +1499,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;
|
||||||
@ -1582,9 +1539,7 @@ void _glfwPlatformSetWindowSize( int width, int height )
|
|||||||
|
|
||||||
// Set window size (if not already changed)
|
// Set window size (if not already changed)
|
||||||
if( !sizeChanged )
|
if( !sizeChanged )
|
||||||
{
|
|
||||||
XResizeWindow( _glfwLibrary.display, _glfwWin.window, width, height );
|
XResizeWindow( _glfwLibrary.display, _glfwWin.window, width, height );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1650,9 +1605,7 @@ void _glfwPlatformSwapBuffers( void )
|
|||||||
void _glfwPlatformSwapInterval( int interval )
|
void _glfwPlatformSwapInterval( int interval )
|
||||||
{
|
{
|
||||||
if( _glfwWin.has_GLX_SGI_swap_control )
|
if( _glfwWin.has_GLX_SGI_swap_control )
|
||||||
{
|
|
||||||
_glfwWin.SwapIntervalSGI( interval );
|
_glfwWin.SwapIntervalSGI( interval );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1719,13 +1672,9 @@ void _glfwPlatformRefreshWindowParams( void )
|
|||||||
|
|
||||||
// Get FSAA buffer sample count
|
// Get FSAA buffer sample count
|
||||||
if( _glfwWin.has_GLX_ARB_multisample )
|
if( _glfwWin.has_GLX_ARB_multisample )
|
||||||
{
|
|
||||||
_glfwWin.samples = getFBConfigAttrib( *fbconfig, GLX_SAMPLES );
|
_glfwWin.samples = getFBConfigAttrib( *fbconfig, GLX_SAMPLES );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
_glfwWin.samples = 0;
|
_glfwWin.samples = 0;
|
||||||
}
|
|
||||||
|
|
||||||
// Default to refresh rate unknown (=0 according to GLFW spec)
|
// Default to refresh rate unknown (=0 according to GLFW spec)
|
||||||
_glfwWin.refreshRate = 0;
|
_glfwWin.refreshRate = 0;
|
||||||
@ -1769,9 +1718,7 @@ void _glfwPlatformPollEvents( void )
|
|||||||
while( XPending( _glfwLibrary.display ) )
|
while( XPending( _glfwLibrary.display ) )
|
||||||
{
|
{
|
||||||
if( processSingleEvent() )
|
if( processSingleEvent() )
|
||||||
{
|
|
||||||
closeRequested = GL_TRUE;
|
closeRequested = GL_TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Did we get mouse movement in fully enabled hidden cursor mode?
|
// Did we get mouse movement in fully enabled hidden cursor mode?
|
||||||
@ -1782,13 +1729,10 @@ void _glfwPlatformPollEvents( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( closeRequested && _glfwWin.windowCloseCallback )
|
if( closeRequested && _glfwWin.windowCloseCallback )
|
||||||
{
|
|
||||||
closeRequested = _glfwWin.windowCloseCallback();
|
closeRequested = _glfwWin.windowCloseCallback();
|
||||||
}
|
|
||||||
if( closeRequested )
|
if( closeRequested )
|
||||||
{
|
|
||||||
glfwCloseWindow();
|
glfwCloseWindow();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user