Fixed x11 and Wayland not using INVOKE_WCB
...since INVOKE_WCB handled user data. Now they handle user data.
This commit is contained in:
parent
4fe9d11e56
commit
47f69d8655
@ -71,8 +71,10 @@ void fghKeyboardInterpretKeysym( SFG_Window* window,
|
|||||||
xkb_keysym_t sym,
|
xkb_keysym_t sym,
|
||||||
uint32_t state )
|
uint32_t state )
|
||||||
{
|
{
|
||||||
FGCBKeyboard keyboard_cb;
|
FGCBKeyboardUC keyboard_cb;
|
||||||
FGCBSpecial special_cb;
|
FGCBSpecialUC special_cb;
|
||||||
|
FGCBUserData keyboard_ud;
|
||||||
|
FGCBUserData special_ud;
|
||||||
char string[16];
|
char string[16];
|
||||||
int special = -1;
|
int special = -1;
|
||||||
|
|
||||||
@ -81,13 +83,17 @@ void fghKeyboardInterpretKeysym( SFG_Window* window,
|
|||||||
* others, which need to be translated to GLUT_KEY_Xs... */
|
* others, which need to be translated to GLUT_KEY_Xs... */
|
||||||
if( state )
|
if( state )
|
||||||
{
|
{
|
||||||
keyboard_cb = (FGCBKeyboard)( FETCH_WCB( *window, Keyboard ));
|
keyboard_cb = (FGCBKeyboardUC)( FETCH_WCB( *window, Keyboard ));
|
||||||
special_cb = (FGCBSpecial) ( FETCH_WCB( *window, Special ));
|
special_cb = (FGCBSpecialUC) ( FETCH_WCB( *window, Special ));
|
||||||
|
keyboard_ud = FETCH_USER_DATA_WCB( *window, Keyboard );
|
||||||
|
special_ud = FETCH_USER_DATA_WCB( *window, Special );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
keyboard_cb = (FGCBKeyboard)( FETCH_WCB( *window, KeyboardUp ));
|
keyboard_cb = (FGCBKeyboardUC)( FETCH_WCB( *window, KeyboardUp ));
|
||||||
special_cb = (FGCBSpecial) ( FETCH_WCB( *window, SpecialUp ));
|
special_cb = (FGCBSpecialUC) ( FETCH_WCB( *window, SpecialUp ));
|
||||||
|
keyboard_ud = FETCH_USER_DATA_WCB( *window, KeyboardUp );
|
||||||
|
special_ud = FETCH_USER_DATA_WCB( *window, SpecialUp );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( sym )
|
switch( sym )
|
||||||
@ -127,13 +133,13 @@ void fghKeyboardInterpretKeysym( SFG_Window* window,
|
|||||||
if( special_cb && (special != -1) )
|
if( special_cb && (special != -1) )
|
||||||
{
|
{
|
||||||
fgSetWindow( window );
|
fgSetWindow( window );
|
||||||
special_cb( special, window->State.MouseX, window->State.MouseY );
|
special_cb( special, window->State.MouseX, window->State.MouseY, special_ud );
|
||||||
}
|
}
|
||||||
else if( keyboard_cb && (special == -1) )
|
else if( keyboard_cb && (special == -1) )
|
||||||
{
|
{
|
||||||
fgSetWindow( window );
|
fgSetWindow( window );
|
||||||
xkb_keysym_to_utf8( sym, string, sizeof( string ) );
|
xkb_keysym_to_utf8( sym, string, sizeof( string ) );
|
||||||
keyboard_cb( string[0], window->State.MouseX, window->State.MouseY );
|
keyboard_cb( string[0], window->State.MouseX, window->State.MouseY, keyboard_ud );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -890,8 +890,10 @@ void fgPlatformProcessSingleEvent ( void )
|
|||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
{
|
{
|
||||||
FGCBKeyboard keyboard_cb;
|
FGCBKeyboardUC keyboard_cb;
|
||||||
FGCBSpecial special_cb;
|
FGCBSpecialUC special_cb;
|
||||||
|
FGCBUserData keyboard_ud;
|
||||||
|
FGCBUserData special_ud;
|
||||||
|
|
||||||
GETWINDOW( xkey );
|
GETWINDOW( xkey );
|
||||||
GETMOUSE( xkey );
|
GETMOUSE( xkey );
|
||||||
@ -932,13 +934,17 @@ void fgPlatformProcessSingleEvent ( void )
|
|||||||
|
|
||||||
if( event.type == KeyPress )
|
if( event.type == KeyPress )
|
||||||
{
|
{
|
||||||
keyboard_cb = (FGCBKeyboard)( FETCH_WCB( *window, Keyboard ));
|
keyboard_cb = (FGCBKeyboardUC)( FETCH_WCB( *window, Keyboard ));
|
||||||
special_cb = (FGCBSpecial) ( FETCH_WCB( *window, Special ));
|
special_cb = (FGCBSpecialUC) ( FETCH_WCB( *window, Special ));
|
||||||
|
keyboard_ud = FETCH_USER_DATA_WCB( *window, Keyboard );
|
||||||
|
special_ud = FETCH_USER_DATA_WCB( *window, Special );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
keyboard_cb = (FGCBKeyboard)( FETCH_WCB( *window, KeyboardUp ));
|
keyboard_cb = (FGCBKeyboardUC)( FETCH_WCB( *window, KeyboardUp ));
|
||||||
special_cb = (FGCBSpecial) ( FETCH_WCB( *window, SpecialUp ));
|
special_cb = (FGCBSpecialUC) ( FETCH_WCB( *window, SpecialUp ));
|
||||||
|
keyboard_ud = FETCH_USER_DATA_WCB( *window, KeyboardUp );
|
||||||
|
special_ud = FETCH_USER_DATA_WCB( *window, SpecialUp );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is there a keyboard/special callback hooked for this window? */
|
/* Is there a keyboard/special callback hooked for this window? */
|
||||||
@ -963,7 +969,8 @@ void fgPlatformProcessSingleEvent ( void )
|
|||||||
fgSetWindow( window );
|
fgSetWindow( window );
|
||||||
fgState.Modifiers = fgPlatformGetModifiers( event.xkey.state );
|
fgState.Modifiers = fgPlatformGetModifiers( event.xkey.state );
|
||||||
keyboard_cb( asciiCode[ 0 ],
|
keyboard_cb( asciiCode[ 0 ],
|
||||||
event.xkey.x, event.xkey.y
|
event.xkey.x, event.xkey.y,
|
||||||
|
keyboard_ud
|
||||||
);
|
);
|
||||||
fgState.Modifiers = INVALID_MODIFIERS;
|
fgState.Modifiers = INVALID_MODIFIERS;
|
||||||
}
|
}
|
||||||
@ -1031,7 +1038,7 @@ void fgPlatformProcessSingleEvent ( void )
|
|||||||
{
|
{
|
||||||
fgSetWindow( window );
|
fgSetWindow( window );
|
||||||
fgState.Modifiers = fgPlatformGetModifiers( event.xkey.state );
|
fgState.Modifiers = fgPlatformGetModifiers( event.xkey.state );
|
||||||
special_cb( special, event.xkey.x, event.xkey.y );
|
special_cb( special, event.xkey.x, event.xkey.y, special_ud );
|
||||||
fgState.Modifiers = INVALID_MODIFIERS;
|
fgState.Modifiers = INVALID_MODIFIERS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user