Fixed x11 and Wayland not using INVOKE_WCB
authorRcmaniac25 <rcmaniac25@hotmail.com>
Fri, 30 Jun 2017 23:22:45 +0000 (23:22 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Fri, 30 Jun 2017 23:22:45 +0000 (23:22 +0000)
...since INVOKE_WCB handled user data. Now they handle user data.

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1823 7f0cb862-5218-0410-a997-914c9d46530a

src/wayland/fg_input_devices_wl.c
src/x11/fg_main_x11.c

index 0aaa91e..bb32f98 100644 (file)
@@ -71,8 +71,10 @@ void fghKeyboardInterpretKeysym(  SFG_Window* window,
                                   xkb_keysym_t sym,
                                   uint32_t state )
 {
-    FGCBKeyboard keyboard_cb;
-    FGCBSpecial special_cb;
+    FGCBKeyboardUC keyboard_cb;
+    FGCBSpecialUC special_cb;
+    FGCBUserData keyboard_ud;
+    FGCBUserData special_ud;
     char string[16];
     int special = -1;
 
@@ -81,13 +83,17 @@ void fghKeyboardInterpretKeysym(  SFG_Window* window,
      * others, which need to be translated to GLUT_KEY_Xs... */
     if( state )
     {
-        keyboard_cb = (FGCBKeyboard)( FETCH_WCB( *window, Keyboard ));
-        special_cb  = (FGCBSpecial) ( FETCH_WCB( *window, Special  ));
+        keyboard_cb = (FGCBKeyboardUC)( FETCH_WCB( *window, Keyboard ));
+        special_cb  = (FGCBSpecialUC) ( FETCH_WCB( *window, Special  ));
+        keyboard_ud = FETCH_USER_DATA_WCB( *window, Keyboard );
+        special_ud  = FETCH_USER_DATA_WCB( *window, Special  );
     }
     else
     {
-        keyboard_cb = (FGCBKeyboard)( FETCH_WCB( *window, KeyboardUp ));
-        special_cb  = (FGCBSpecial) ( FETCH_WCB( *window, SpecialUp  ));
+        keyboard_cb = (FGCBKeyboardUC)( FETCH_WCB( *window, KeyboardUp ));
+        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 )
@@ -127,13 +133,13 @@ void fghKeyboardInterpretKeysym(  SFG_Window* window,
     if( special_cb && (special != -1) )
     {
         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) )
     {
         fgSetWindow( window );
         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 );
     }
 }
 
index 0e54253..80fd2c8 100644 (file)
@@ -890,8 +890,10 @@ void fgPlatformProcessSingleEvent ( void )
         case KeyRelease:
         case KeyPress:
         {
-            FGCBKeyboard keyboard_cb;
-            FGCBSpecial special_cb;
+            FGCBKeyboardUC keyboard_cb;
+            FGCBSpecialUC special_cb;
+            FGCBUserData keyboard_ud;
+            FGCBUserData special_ud;
 
             GETWINDOW( xkey );
             GETMOUSE( xkey );
@@ -932,13 +934,17 @@ void fgPlatformProcessSingleEvent ( void )
 
             if( event.type == KeyPress )
             {
-                keyboard_cb = (FGCBKeyboard)( FETCH_WCB( *window, Keyboard ));
-                special_cb  = (FGCBSpecial) ( FETCH_WCB( *window, Special  ));
+                keyboard_cb = (FGCBKeyboardUC)( FETCH_WCB( *window, Keyboard ));
+                special_cb  = (FGCBSpecialUC) ( FETCH_WCB( *window, Special  ));
+                keyboard_ud = FETCH_USER_DATA_WCB( *window, Keyboard );
+                special_ud  = FETCH_USER_DATA_WCB( *window, Special  );
             }
             else
             {
-                keyboard_cb = (FGCBKeyboard)( FETCH_WCB( *window, KeyboardUp ));
-                special_cb  = (FGCBSpecial) ( FETCH_WCB( *window, SpecialUp  ));
+                keyboard_cb = (FGCBKeyboardUC)( FETCH_WCB( *window, KeyboardUp ));
+                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? */
@@ -963,7 +969,8 @@ void fgPlatformProcessSingleEvent ( void )
                         fgSetWindow( window );
                         fgState.Modifiers = fgPlatformGetModifiers( event.xkey.state );
                         keyboard_cb( asciiCode[ 0 ],
-                                     event.xkey.x, event.xkey.y
+                                     event.xkey.x, event.xkey.y,
+                                     keyboard_ud
                         );
                         fgState.Modifiers = INVALID_MODIFIERS;
                     }
@@ -1031,7 +1038,7 @@ void fgPlatformProcessSingleEvent ( void )
                     {
                         fgSetWindow( window );
                         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;
                     }
                 }