Browse Source

Merge branch 'next' of https://github.com/blackberry/GamePlay into next

Steve Grenier 13 years ago
parent
commit
ca0d6d6994
2 changed files with 17 additions and 2 deletions
  1. 1 1
      CMakeLists.txt
  2. 16 1
      gameplay/src/PlatformLinux.cpp

+ 1 - 1
CMakeLists.txt

@@ -6,7 +6,7 @@ set(GAMEPLAY_VERSION 1.5.0)
 
 
 # debug
 # debug
 message( "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" )
 message( "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" )
-if( ${CMAKE_BUILD_TYPE} STREQUAL "DEBUG" )
+if( "${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG" )
     add_definitions(-D_DEBUG)
     add_definitions(-D_DEBUG)
 endif()
 endif()
 
 

+ 16 - 1
gameplay/src/PlatformLinux.cpp

@@ -152,6 +152,7 @@ static Keyboard::Key getKey(KeySym sym)
     case XK_F12:
     case XK_F12:
         return Keyboard::KEY_F12;
         return Keyboard::KEY_F12;
     case XK_KP_Space:
     case XK_KP_Space:
+    case XK_space:
         return Keyboard::KEY_SPACE;
         return Keyboard::KEY_SPACE;
     case XK_parenright:
     case XK_parenright:
         return Keyboard::KEY_RIGHT_PARENTHESIS;
         return Keyboard::KEY_RIGHT_PARENTHESIS;
@@ -581,9 +582,23 @@ int Platform::enterMessagePump()
 
 
             case KeyRelease:
             case KeyRelease:
                 {
                 {
+                    //detect and drop repeating keystrokes (no other way to do this using the event interface)
+                    XEvent next;
+                    if( XPending(__display) )
+                    {
+                        XPeekEvent(__display,&next);
+                        if( next.type == KeyPress 
+                            && next.xkey.time == evt.xkey.time
+                            && next.xkey.keycode == evt.xkey.keycode )
+                        {
+                            XNextEvent(__display,&next);
+                            continue;
+                        }
+                    }
+                    
                     KeySym sym = XLookupKeysym(&evt.xkey, 0);
                     KeySym sym = XLookupKeysym(&evt.xkey, 0);
                     Keyboard::Key key = getKey(sym);
                     Keyboard::Key key = getKey(sym);
-                    gameplay::Platform::keyEventInternal(gameplay::Keyboard::KEY_PRESS, key);
+                    gameplay::Platform::keyEventInternal(gameplay::Keyboard::KEY_RELEASE, key);
                 }
                 }
                 break;
                 break;