Merge branch 'svn/trunk'
This commit is contained in:
commit
2ac0974cf6
@ -238,7 +238,7 @@ IF(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||||
IF(NOT(ANDROID OR BLACKBERRY))
|
IF(NOT(ANDROID OR BLACKBERRY))
|
||||||
# not setting -ansi as EGL/KHR headers doesn't support it
|
# not setting -ansi as EGL/KHR headers doesn't support it
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
||||||
|
@ -16,13 +16,13 @@ static int sequence_number = 0 ;
|
|||||||
int windows[CALLBACKMAKER_N_WINDOWS] = {0};
|
int windows[CALLBACKMAKER_N_WINDOWS] = {0};
|
||||||
|
|
||||||
/* define status vars showing whether given callback has been called for given window */
|
/* define status vars showing whether given callback has been called for given window */
|
||||||
#define CALLBACK_CALLED_VAR(name) int name##_called[CALLBACKMAKER_N_WINDOWS] = {0};
|
#define CALLBACK_CALLED_VAR(name) int name##_called[CALLBACKMAKER_N_WINDOWS] = {0}
|
||||||
#define CALLBACK_0V(name) int name##_seq[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_CALLED_VAR(name);
|
#define CALLBACK_0V(name) int name##_seq[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_CALLED_VAR(name)
|
||||||
#define CALLBACK_1V(name,field) int name##_##field[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_0V(name);
|
#define CALLBACK_1V(name,field) int name##_##field[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_0V(name)
|
||||||
#define CALLBACK_2V(name,field1,field2) int name##_##field2[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_1V(name,field1);
|
#define CALLBACK_2V(name,field1,field2) int name##_##field2[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_1V(name,field1)
|
||||||
#define CALLBACK_3V(name,field1,field2,field3) int name##_##field3[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_2V(name,field1,field2);
|
#define CALLBACK_3V(name,field1,field2,field3) int name##_##field3[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_2V(name,field1,field2)
|
||||||
#define CALLBACK_4V(name,field1,field2,field3,field4) int name##_##field4[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_3V(name,field1,field2,field3);
|
#define CALLBACK_4V(name,field1,field2,field3,field4) int name##_##field4[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_3V(name,field1,field2,field3)
|
||||||
#define CALLBACK_5V(name,field1,field2,field3,field4,field5) int name##_##field5[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_4V(name,field1,field2,field3,field4);
|
#define CALLBACK_5V(name,field1,field2,field3,field4,field5) int name##_##field5[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_4V(name,field1,field2,field3,field4)
|
||||||
CALLBACK_2V(reshape,width,height);
|
CALLBACK_2V(reshape,width,height);
|
||||||
CALLBACK_2V(position,top,left);
|
CALLBACK_2V(position,top,left);
|
||||||
CALLBACK_1V(visibility,vis);
|
CALLBACK_1V(visibility,vis);
|
||||||
|
@ -122,31 +122,31 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
|
|||||||
#define IMPLEMENT_CALLBACK_FUNC(a) IMPLEMENT_CALLBACK_FUNC_2NAME(a,a)
|
#define IMPLEMENT_CALLBACK_FUNC(a) IMPLEMENT_CALLBACK_FUNC_2NAME(a,a)
|
||||||
|
|
||||||
/* Implement all these callback setter functions... */
|
/* Implement all these callback setter functions... */
|
||||||
IMPLEMENT_CALLBACK_FUNC(Position);
|
IMPLEMENT_CALLBACK_FUNC(Position)
|
||||||
IMPLEMENT_CALLBACK_FUNC(Keyboard);
|
IMPLEMENT_CALLBACK_FUNC(Keyboard)
|
||||||
IMPLEMENT_CALLBACK_FUNC(KeyboardUp);
|
IMPLEMENT_CALLBACK_FUNC(KeyboardUp)
|
||||||
IMPLEMENT_CALLBACK_FUNC(Special);
|
IMPLEMENT_CALLBACK_FUNC(Special)
|
||||||
IMPLEMENT_CALLBACK_FUNC(SpecialUp);
|
IMPLEMENT_CALLBACK_FUNC(SpecialUp)
|
||||||
IMPLEMENT_CALLBACK_FUNC(Mouse);
|
IMPLEMENT_CALLBACK_FUNC(Mouse)
|
||||||
IMPLEMENT_CALLBACK_FUNC(MouseWheel);
|
IMPLEMENT_CALLBACK_FUNC(MouseWheel)
|
||||||
IMPLEMENT_CALLBACK_FUNC(Motion);
|
IMPLEMENT_CALLBACK_FUNC(Motion)
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME(PassiveMotion,Passive);
|
IMPLEMENT_CALLBACK_FUNC_2NAME(PassiveMotion,Passive)
|
||||||
IMPLEMENT_CALLBACK_FUNC(Entry);
|
IMPLEMENT_CALLBACK_FUNC(Entry)
|
||||||
/* glutWMCloseFunc is an alias for glutCloseFunc; both set the window's Destroy callback */
|
/* glutWMCloseFunc is an alias for glutCloseFunc; both set the window's Destroy callback */
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME(Close,Destroy);
|
IMPLEMENT_CALLBACK_FUNC_2NAME(Close,Destroy)
|
||||||
IMPLEMENT_CALLBACK_FUNC_2NAME(WMClose,Destroy);
|
IMPLEMENT_CALLBACK_FUNC_2NAME(WMClose,Destroy)
|
||||||
IMPLEMENT_CALLBACK_FUNC(OverlayDisplay);
|
IMPLEMENT_CALLBACK_FUNC(OverlayDisplay)
|
||||||
IMPLEMENT_CALLBACK_FUNC(WindowStatus);
|
IMPLEMENT_CALLBACK_FUNC(WindowStatus)
|
||||||
IMPLEMENT_CALLBACK_FUNC(ButtonBox);
|
IMPLEMENT_CALLBACK_FUNC(ButtonBox)
|
||||||
IMPLEMENT_CALLBACK_FUNC(Dials);
|
IMPLEMENT_CALLBACK_FUNC(Dials)
|
||||||
IMPLEMENT_CALLBACK_FUNC(TabletMotion);
|
IMPLEMENT_CALLBACK_FUNC(TabletMotion)
|
||||||
IMPLEMENT_CALLBACK_FUNC(TabletButton);
|
IMPLEMENT_CALLBACK_FUNC(TabletButton)
|
||||||
IMPLEMENT_CALLBACK_FUNC(MultiEntry);
|
IMPLEMENT_CALLBACK_FUNC(MultiEntry)
|
||||||
IMPLEMENT_CALLBACK_FUNC(MultiButton);
|
IMPLEMENT_CALLBACK_FUNC(MultiButton)
|
||||||
IMPLEMENT_CALLBACK_FUNC(MultiMotion);
|
IMPLEMENT_CALLBACK_FUNC(MultiMotion)
|
||||||
IMPLEMENT_CALLBACK_FUNC(MultiPassive);
|
IMPLEMENT_CALLBACK_FUNC(MultiPassive)
|
||||||
IMPLEMENT_CALLBACK_FUNC(InitContext);
|
IMPLEMENT_CALLBACK_FUNC(InitContext)
|
||||||
IMPLEMENT_CALLBACK_FUNC(AppStatus);
|
IMPLEMENT_CALLBACK_FUNC(AppStatus)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -606,37 +606,37 @@ static LRESULT fghWindowProcKeyPress(SFG_Window *window, UINT uMsg, GLboolean ke
|
|||||||
fgState.Modifiers = fgPlatformGetModifiers( );
|
fgState.Modifiers = fgPlatformGetModifiers( );
|
||||||
|
|
||||||
/* Convert the Win32 keystroke codes to GLUTtish way */
|
/* Convert the Win32 keystroke codes to GLUTtish way */
|
||||||
# define KEY(a,b) case a: keypress = b; break;
|
# define FG_KEY(a,b) case a: keypress = b; break;
|
||||||
|
|
||||||
switch( wParam )
|
switch( wParam )
|
||||||
{
|
{
|
||||||
KEY( VK_F1, GLUT_KEY_F1 );
|
FG_KEY( VK_F1, GLUT_KEY_F1 );
|
||||||
KEY( VK_F2, GLUT_KEY_F2 );
|
FG_KEY( VK_F2, GLUT_KEY_F2 );
|
||||||
KEY( VK_F3, GLUT_KEY_F3 );
|
FG_KEY( VK_F3, GLUT_KEY_F3 );
|
||||||
KEY( VK_F4, GLUT_KEY_F4 );
|
FG_KEY( VK_F4, GLUT_KEY_F4 );
|
||||||
KEY( VK_F5, GLUT_KEY_F5 );
|
FG_KEY( VK_F5, GLUT_KEY_F5 );
|
||||||
KEY( VK_F6, GLUT_KEY_F6 );
|
FG_KEY( VK_F6, GLUT_KEY_F6 );
|
||||||
KEY( VK_F7, GLUT_KEY_F7 );
|
FG_KEY( VK_F7, GLUT_KEY_F7 );
|
||||||
KEY( VK_F8, GLUT_KEY_F8 );
|
FG_KEY( VK_F8, GLUT_KEY_F8 );
|
||||||
KEY( VK_F9, GLUT_KEY_F9 );
|
FG_KEY( VK_F9, GLUT_KEY_F9 );
|
||||||
KEY( VK_F10, GLUT_KEY_F10 );
|
FG_KEY( VK_F10, GLUT_KEY_F10 );
|
||||||
KEY( VK_F11, GLUT_KEY_F11 );
|
FG_KEY( VK_F11, GLUT_KEY_F11 );
|
||||||
KEY( VK_F12, GLUT_KEY_F12 );
|
FG_KEY( VK_F12, GLUT_KEY_F12 );
|
||||||
KEY( VK_PRIOR, GLUT_KEY_PAGE_UP );
|
FG_KEY( VK_PRIOR, GLUT_KEY_PAGE_UP );
|
||||||
KEY( VK_NEXT, GLUT_KEY_PAGE_DOWN );
|
FG_KEY( VK_NEXT, GLUT_KEY_PAGE_DOWN );
|
||||||
KEY( VK_HOME, GLUT_KEY_HOME );
|
FG_KEY( VK_HOME, GLUT_KEY_HOME );
|
||||||
KEY( VK_END, GLUT_KEY_END );
|
FG_KEY( VK_END, GLUT_KEY_END );
|
||||||
KEY( VK_LEFT, GLUT_KEY_LEFT );
|
FG_KEY( VK_LEFT, GLUT_KEY_LEFT );
|
||||||
KEY( VK_UP, GLUT_KEY_UP );
|
FG_KEY( VK_UP, GLUT_KEY_UP );
|
||||||
KEY( VK_RIGHT, GLUT_KEY_RIGHT );
|
FG_KEY( VK_RIGHT, GLUT_KEY_RIGHT );
|
||||||
KEY( VK_DOWN, GLUT_KEY_DOWN );
|
FG_KEY( VK_DOWN, GLUT_KEY_DOWN );
|
||||||
KEY( VK_INSERT, GLUT_KEY_INSERT );
|
FG_KEY( VK_INSERT, GLUT_KEY_INSERT );
|
||||||
|
|
||||||
/* handle control, alt and shift. For GLUT, we want to distinguish between left and right presses.
|
/* handle control, alt and shift. For GLUT, we want to distinguish between left and right presses.
|
||||||
* The VK_L* & VK_R* left and right Alt, Ctrl and Shift virtual keys are however only used as parameters to GetAsyncKeyState() and GetKeyState()
|
* The VK_L* & VK_R* left and right Alt, Ctrl and Shift virtual keys are however only used as parameters to GetAsyncKeyState() and GetKeyState()
|
||||||
* so when we get an alt, shift or control keypress here, we manually check whether it was the left or the right
|
* so when we get an alt, shift or control keypress here, we manually check whether it was the left or the right
|
||||||
*/
|
*/
|
||||||
#define KEY_EVENT(winKey,glutKey,keyStateVar)\
|
#define FG_KEY_EVENT(winKey,glutKey,keyStateVar)\
|
||||||
if (!keyStateVar && fgGetKeyState ( winKey ))\
|
if (!keyStateVar && fgGetKeyState ( winKey ))\
|
||||||
{\
|
{\
|
||||||
keypress = glutKey;\
|
keypress = glutKey;\
|
||||||
@ -648,16 +648,16 @@ static LRESULT fghWindowProcKeyPress(SFG_Window *window, UINT uMsg, GLboolean ke
|
|||||||
keyStateVar = 0;\
|
keyStateVar = 0;\
|
||||||
}
|
}
|
||||||
case VK_CONTROL:
|
case VK_CONTROL:
|
||||||
KEY_EVENT(VK_LCONTROL,GLUT_KEY_CTRL_L,lControl);
|
FG_KEY_EVENT(VK_LCONTROL,GLUT_KEY_CTRL_L,lControl);
|
||||||
KEY_EVENT(VK_RCONTROL,GLUT_KEY_CTRL_R,rControl);
|
FG_KEY_EVENT(VK_RCONTROL,GLUT_KEY_CTRL_R,rControl);
|
||||||
break;
|
break;
|
||||||
case VK_SHIFT:
|
case VK_SHIFT:
|
||||||
KEY_EVENT(VK_LSHIFT,GLUT_KEY_SHIFT_L,lShift);
|
FG_KEY_EVENT(VK_LSHIFT,GLUT_KEY_SHIFT_L,lShift);
|
||||||
KEY_EVENT(VK_RSHIFT,GLUT_KEY_SHIFT_R,rShift);
|
FG_KEY_EVENT(VK_RSHIFT,GLUT_KEY_SHIFT_R,rShift);
|
||||||
break;
|
break;
|
||||||
case VK_MENU:
|
case VK_MENU:
|
||||||
KEY_EVENT(VK_LMENU,GLUT_KEY_ALT_L,lAlt);
|
FG_KEY_EVENT(VK_LMENU,GLUT_KEY_ALT_L,lAlt);
|
||||||
KEY_EVENT(VK_RMENU,GLUT_KEY_ALT_R,rAlt);
|
FG_KEY_EVENT(VK_RMENU,GLUT_KEY_ALT_R,rAlt);
|
||||||
break;
|
break;
|
||||||
#undef KEY_EVENT
|
#undef KEY_EVENT
|
||||||
|
|
||||||
|
@ -155,6 +155,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
XVisualInfo * visualInfo;
|
XVisualInfo * visualInfo;
|
||||||
|
int result;
|
||||||
#ifdef EGL_VERSION_1_0
|
#ifdef EGL_VERSION_1_0
|
||||||
EGLint vid = 0;
|
EGLint vid = 0;
|
||||||
XVisualInfo visualTemplate;
|
XVisualInfo visualTemplate;
|
||||||
@ -166,13 +167,15 @@ int fgPlatformGlutGet ( GLenum eWhat )
|
|||||||
visualTemplate.visualid = vid;
|
visualTemplate.visualid = vid;
|
||||||
visualInfo = XGetVisualInfo(fgDisplay.pDisplay.Display, VisualIDMask, &visualTemplate, &num_visuals);
|
visualInfo = XGetVisualInfo(fgDisplay.pDisplay.Display, VisualIDMask, &visualTemplate, &num_visuals);
|
||||||
#else
|
#else
|
||||||
|
{
|
||||||
const GLXFBConfig fbconfig =
|
const GLXFBConfig fbconfig =
|
||||||
fgStructure.CurrentWindow->Window.pContext.FBConfig;
|
fgStructure.CurrentWindow->Window.pContext.FBConfig;
|
||||||
|
|
||||||
visualInfo =
|
visualInfo =
|
||||||
glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, fbconfig );
|
glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, fbconfig );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
const int result = visualInfo->visual->map_entries;
|
result = visualInfo->visual->map_entries;
|
||||||
|
|
||||||
XFree(visualInfo);
|
XFree(visualInfo);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user