Refactor dali key files 99/41099/19
authorYoonsang Lee <ysang114.lee@samsung.com>
Thu, 11 Jun 2015 07:48:24 +0000 (16:48 +0900)
committerYoonsang Lee <ysang114.lee@samsung.com>
Fri, 10 Jul 2015 08:04:33 +0000 (17:04 +0900)
- Change type of dali key definition from extern const KEY
  to enum Key to remove unnecessary exported symbols.
- Seperate platform-specfic key mapping table (key-mapping-xxx.cpp)
  and common key functions (key-impl.cpp)
- Add Dali::Internal::Adaptor::KeyLookup::GetKeyName()
- Definition macros for key names are deprecated in utilX,
  so use key name string instead of macro in key-mapping-xxx.cpp.
- Apply some changed key names (XF86Back, XF86Home, XF86Menu)
- Remove old-named key variables - DALI_KEY_SEND, END, SELECT
- Add key code mapping entries for wayland

Change-Id: Ic1939e11f2c775880a50d674686e3b1de6413aec

19 files changed:
adaptors/common/file.list
adaptors/common/key-impl.cpp [new file with mode: 0644]
adaptors/common/key-impl.h
adaptors/public-api/adaptor-framework/key.h
adaptors/tv/file.list
adaptors/tv/key-mapping-tv.cpp [new file with mode: 0644]
adaptors/tv/tv-key-impl.cpp [deleted file]
adaptors/ubuntu/file.list
adaptors/ubuntu/key-impl-ubuntu.cpp [deleted file]
adaptors/ubuntu/key-mapping-ubuntu.cpp [new file with mode: 0644]
adaptors/wayland/event-handler-wl.cpp
adaptors/wayland/file.list
adaptors/wayland/key-impl-wl.cpp [deleted file]
adaptors/wayland/key-mapping-wl.cpp [new file with mode: 0644]
adaptors/x11/ecore-x-event-handler.cpp
adaptors/x11/file.list
adaptors/x11/key-impl-x.cpp [deleted file]
adaptors/x11/key-mapping-x.cpp [new file with mode: 0644]
automated-tests/src/dali-adaptor/utc-Dali-Key.cpp

index 2560e25..c61bb7c 100644 (file)
@@ -30,6 +30,7 @@ adaptor_common_internal_src_files = \
   $(adaptor_common_dir)/trigger-event.cpp \
   $(adaptor_common_dir)/trigger-event-factory.cpp \
   $(adaptor_common_dir)/virtual-keyboard-impl.cpp \
+  $(adaptor_common_dir)/key-impl.cpp \
   \
   $(adaptor_common_dir)/events/gesture-manager.cpp \
   $(adaptor_common_dir)/events/long-press-gesture-detector.cpp \
@@ -38,7 +39,7 @@ adaptor_common_internal_src_files = \
   $(adaptor_common_dir)/events/pinch-gesture-detector.cpp \
   $(adaptor_common_dir)/events/tap-gesture-detector.cpp \
   \
- $(adaptor_common_dir)/networking/socket-impl.cpp \
 $(adaptor_common_dir)/networking/socket-impl.cpp \
   $(adaptor_common_dir)/networking/socket-factory.cpp \
   \
   $(adaptor_common_dir)/feedback/feedback-controller.cpp \
diff --git a/adaptors/common/key-impl.cpp b/adaptors/common/key-impl.cpp
new file mode 100644 (file)
index 0000000..285a94e
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "key-impl.h"
+
+// EXTERNAL INCLUDES
+#include <map>
+#include <string.h>
+#include <iostream>
+
+#include <dali/integration-api/debug.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace KeyLookup
+{
+
+namespace
+{
+
+class KeyMap
+{
+  public:
+
+  KeyMap():
+  mLookup( cmpString )
+  {
+    // create the lookup
+    for( size_t i = 0; i < KEY_LOOKUP_COUNT ; ++i )
+    {
+      const KeyLookup&  keyLookup( KeyLookupTable[i] );
+      mLookup[ keyLookup.keyName  ] = DaliKeyType( keyLookup.daliKeyCode, keyLookup.deviceButton );
+    }
+  }
+
+  int GetDaliKeyEnum( const char* keyName ) const
+  {
+    Lookup::const_iterator i = mLookup.find( keyName );
+    if( i == mLookup.end() )
+    {
+      return -1;
+    }
+    else
+    {
+      return (*i).second.first;
+    }
+  }
+
+  const char* GetKeyName( int daliKeyCode ) const
+  {
+    for( size_t i = 0; i < KEY_LOOKUP_COUNT ; ++i )
+    {
+      const KeyLookup& keyLookup( KeyLookupTable[i] );
+      if( keyLookup.daliKeyCode == daliKeyCode )
+      {
+        return keyLookup.keyName;
+      }
+    }
+    return NULL;
+  }
+
+  bool IsDeviceButton( const char* keyName ) const
+  {
+    Lookup::const_iterator i = mLookup.find( keyName );
+    if ( i != mLookup.end() )
+    {
+      return (*i).second.second;
+    }
+    return false;
+  }
+
+  private:
+
+  /**
+   * compare function, to compare string by pointer
+   */
+  static bool cmpString( const char* a, const char* b)
+  {
+    return strcmp(a, b) < 0;
+  }
+
+  typedef std::pair< int, bool > DaliKeyType;
+  typedef std::map<const char* /* key name */, DaliKeyType /* key code */, bool(*) ( char const* a, char const* b) > Lookup;
+  Lookup mLookup;
+
+};
+const KeyMap globalKeyLookup;
+
+} // un-named name space
+
+bool IsKey( const Dali::KeyEvent& keyEvent, Dali::KEY daliKey)
+{
+  int key = globalKeyLookup.GetDaliKeyEnum( keyEvent.keyPressedName.c_str() );
+  return daliKey == key;
+}
+
+bool IsDeviceButton( const char* keyName )
+{
+  return globalKeyLookup.IsDeviceButton( keyName );
+}
+
+const char* GetKeyName( Dali::KEY daliKey )
+{
+  return globalKeyLookup.GetKeyName( daliKey );
+}
+
+} // namespace KeyLookup
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index dc103d5..15d123d 100644 (file)
@@ -36,10 +36,20 @@ namespace Adaptor
 namespace KeyLookup
 {
 
+struct KeyLookup
+{
+  const char* keyName;          ///< XF86 key name
+  const Dali::KEY daliKeyCode;  ///< Dali key code
+  const bool  deviceButton;     ///< Whether the key is from a button on the device
+};
+
+extern KeyLookup KeyLookupTable[];
+extern const std::size_t KEY_LOOKUP_COUNT;
+
 /**
  * @copydoc Dali::IsKey()
  */
-bool IsKey( const Dali::KeyEvent& keyEvent, Dali::KEY daliKey);
+bool IsKey( const Dali::KeyEvent& keyEvent, Dali::KEY daliKey );
 
 /**
  * Check if a the given key name string is a button on the device itself.
@@ -48,6 +58,13 @@ bool IsKey( const Dali::KeyEvent& keyEvent, Dali::KEY daliKey);
  */
 bool IsDeviceButton( const char* keyName );
 
+/**
+ * Get a key name from a dali key code.
+ * @param daliKey The dali key code
+ * @return The key name. NULL if the daliKey does not exist in the supported key lookup table.
+ */
+const char* GetKeyName( Dali::KEY daliKey );
+
 } // namespace KeyLookup
 
 } // namespace Adaptor
index 5e6ffc4..4859928 100644 (file)
@@ -27,56 +27,51 @@ namespace Dali DALI_IMPORT_API
 
 /**
  * @brief Mapping of keyboard and mouse button event keycodes to platform specific codes.
- *
- * For tizen the X Server Keycode is used as reference, unless it's over ridden
- * in utilX.h in which case the values are based on utilX.h
  */
 
-typedef int KEY;
-
-extern const KEY DALI_KEY_INVALID;
-extern const KEY DALI_KEY_ESCAPE;
-extern const KEY DALI_KEY_BACK;
-extern const KEY DALI_KEY_CAMERA;
-extern const KEY DALI_KEY_CONFIG;
-extern const KEY DALI_KEY_POWER;
-extern const KEY DALI_KEY_PAUSE;
-extern const KEY DALI_KEY_CANCEL;
-extern const KEY DALI_KEY_PLAY_CD;
-extern const KEY DALI_KEY_STOP_CD;
-extern const KEY DALI_KEY_PAUSE_CD;
-extern const KEY DALI_KEY_NEXT_SONG;
-extern const KEY DALI_KEY_PREVIOUS_SONG;
-extern const KEY DALI_KEY_REWIND;
-extern const KEY DALI_KEY_FASTFORWARD;
-extern const KEY DALI_KEY_MEDIA;
-extern const KEY DALI_KEY_PLAY_PAUSE;
-extern const KEY DALI_KEY_MUTE;
-extern const KEY DALI_KEY_SEND;
-extern const KEY DALI_KEY_SELECT;
-extern const KEY DALI_KEY_END;
-extern const KEY DALI_KEY_MENU;
-extern const KEY DALI_KEY_HOME;
-extern const KEY DALI_KEY_HOMEPAGE;
-extern const KEY DALI_KEY_WEBPAGE;
-extern const KEY DALI_KEY_MAIL;
-extern const KEY DALI_KEY_SCREENSAVER;
-extern const KEY DALI_KEY_BRIGHTNESS_UP;
-extern const KEY DALI_KEY_BRIGHTNESS_DOWN;
-extern const KEY DALI_KEY_SOFT_KBD;
-extern const KEY DALI_KEY_QUICK_PANEL;
-extern const KEY DALI_KEY_TASK_SWITCH;
-extern const KEY DALI_KEY_APPS;
-extern const KEY DALI_KEY_SEARCH;
-extern const KEY DALI_KEY_VOICE;
-extern const KEY DALI_KEY_LANGUAGE;
-extern const KEY DALI_KEY_VOLUME_UP;
-extern const KEY DALI_KEY_VOLUME_DOWN;
-extern const KEY DALI_KEY_BACKSPACE;
-extern const KEY DALI_KEY_CURSOR_LEFT;
-extern const KEY DALI_KEY_CURSOR_RIGHT;
-extern const KEY DALI_KEY_CURSOR_UP;
-extern const KEY DALI_KEY_CURSOR_DOWN;
+enum KEY
+{
+  DALI_KEY_INVALID          = -1,
+  DALI_KEY_ESCAPE           = 9,
+  DALI_KEY_BACKSPACE        = 22,
+  DALI_KEY_CURSOR_UP        = 111,
+  DALI_KEY_CURSOR_LEFT      = 113,
+  DALI_KEY_CURSOR_RIGHT     = 114,
+  DALI_KEY_CURSOR_DOWN      = 116,
+  DALI_KEY_BACK             = 166,
+  DALI_KEY_CAMERA           = 167,
+  DALI_KEY_CONFIG           = 168,
+  DALI_KEY_POWER            = 169,
+  DALI_KEY_PAUSE            = 170,
+  DALI_KEY_CANCEL           = 171,
+  DALI_KEY_PLAY_CD          = 172,
+  DALI_KEY_STOP_CD          = 173,
+  DALI_KEY_PAUSE_CD         = 174,
+  DALI_KEY_NEXT_SONG        = 175,
+  DALI_KEY_PREVIOUS_SONG    = 176,
+  DALI_KEY_REWIND           = 177,
+  DALI_KEY_FASTFORWARD      = 178,
+  DALI_KEY_MEDIA            = 179,
+  DALI_KEY_PLAY_PAUSE       = 180,
+  DALI_KEY_MUTE             = 181,
+  DALI_KEY_MENU             = 182,
+  DALI_KEY_HOME             = 183,
+  DALI_KEY_HOMEPAGE         = 187,
+  DALI_KEY_WEBPAGE          = 188,
+  DALI_KEY_MAIL             = 189,
+  DALI_KEY_SCREENSAVER      = 190,
+  DALI_KEY_BRIGHTNESS_UP    = 191,
+  DALI_KEY_BRIGHTNESS_DOWN  = 192,
+  DALI_KEY_SOFT_KBD         = 193,
+  DALI_KEY_QUICK_PANEL      = 194,
+  DALI_KEY_TASK_SWITCH      = 195,
+  DALI_KEY_APPS             = 196,
+  DALI_KEY_SEARCH           = 197,
+  DALI_KEY_VOICE            = 198,
+  DALI_KEY_LANGUAGE         = 199,
+  DALI_KEY_VOLUME_UP        = 200,
+  DALI_KEY_VOLUME_DOWN      = 201
+};
 
 /**
  * @brief Check if a key event is for a specific DALI KEY.
index f20d767..17f3e8d 100644 (file)
@@ -5,4 +5,4 @@ adaptor_common_internal_tv_profile_src_files = \
   $(adaptor_tv_dir)/tv-color-controller-impl.cpp
 
 adaptor_x11_internal_tv_profile_key_src_files = \
-  $(adaptor_tv_dir)/tv-key-impl.cpp
+  $(adaptor_tv_dir)/key-mapping-tv.cpp
diff --git a/adaptors/tv/key-mapping-tv.cpp b/adaptors/tv/key-mapping-tv.cpp
new file mode 100644 (file)
index 0000000..31c0a2a
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "key-impl.h"
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace KeyLookup
+{
+
+// matches a DALI_KEY enum, to key name
+KeyLookup KeyLookupTable[]=
+{
+  // more than one key name can be assigned to a single dali-key code
+  // e.g. "Menu" and "XF86Menu" are both assigned to  DALI_KEY_MENU
+
+  { "Escape",                DALI_KEY_ESCAPE,          false },
+  { "Menu",                  DALI_KEY_MENU,            false },
+
+  // Now literal strings are used as key names instead of defined symbols in utilX,
+  // since these definition in utilX.h is deprecated
+  { "XF86Camera",            DALI_KEY_CAMERA,          false },
+  { "XF86Camera_Full",       DALI_KEY_CONFIG,          false },
+  { "XF86PowerOff",          DALI_KEY_POWER,           true  },
+  { "XF86Standby",           DALI_KEY_PAUSE,           false },
+  { "Cancel",                DALI_KEY_CANCEL,          false },
+  { "XF86AudioPlay",         DALI_KEY_PLAY_CD,         false },
+  { "XF86AudioStop",         DALI_KEY_STOP_CD,         false },
+  { "XF86AudioPause",        DALI_KEY_PAUSE_CD,        false },
+  { "XF86AudioNext",         DALI_KEY_NEXT_SONG,       false },
+  { "XF86AudioPrev",         DALI_KEY_PREVIOUS_SONG,   false },
+  { "XF86AudioRewind",       DALI_KEY_REWIND,          false },
+  { "XF86AudioForward",      DALI_KEY_FASTFORWARD,     false },
+  { "XF86AudioMedia",        DALI_KEY_MEDIA,           false },
+  { "XF86AudioPlayPause",    DALI_KEY_PLAY_PAUSE,      false },
+  { "XF86AudioMute",         DALI_KEY_MUTE,            false },
+  { "XF86Menu",              DALI_KEY_MENU,            true  },
+  { "XF86Home",              DALI_KEY_HOME,            true  },
+  { "XF86Back",              DALI_KEY_BACK,            true  },
+  { "XF86HomePage",          DALI_KEY_HOMEPAGE,        false },
+  { "XF86WWW",               DALI_KEY_WEBPAGE,         false },
+  { "XF86Mail",              DALI_KEY_MAIL,            false },
+  { "XF86ScreenSaver",       DALI_KEY_SCREENSAVER,     false },
+  { "XF86MonBrightnessUp",   DALI_KEY_BRIGHTNESS_UP,   false },
+  { "XF86MonBrightnessDown", DALI_KEY_BRIGHTNESS_DOWN, false },
+  { "XF86SoftKBD",           DALI_KEY_SOFT_KBD,        false },
+  { "XF86QuickPanel",        DALI_KEY_QUICK_PANEL,     false },
+  { "XF86TaskPane",          DALI_KEY_TASK_SWITCH,     false },
+  { "XF86Apps",              DALI_KEY_APPS,            false },
+  { "XF86Search",            DALI_KEY_SEARCH,          false },
+  { "XF86Voice",             DALI_KEY_VOICE,           false },
+  { "Hangul",                DALI_KEY_LANGUAGE,        false },
+  { "XF86AudioRaiseVolume",  DALI_KEY_VOLUME_UP,       true  },
+  { "XF86AudioLowerVolume",  DALI_KEY_VOLUME_DOWN,     true  },
+};
+
+const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));
+
+} // namespace KeyLookup
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/adaptors/tv/tv-key-impl.cpp b/adaptors/tv/tv-key-impl.cpp
deleted file mode 100644 (file)
index a265bf6..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <key-impl.h>
-
-// EXTERNAL INCLUDES
-#include <utilX.h>
-#include <map>
-#include <string.h>
-#include <iostream>
-
-#include <dali/integration-api/debug.h>
-
-
-namespace Dali
-{
-
-const KEY DALI_KEY_INVALID          = -1;
-const KEY DALI_KEY_ESCAPE           = 9;
-const KEY DALI_KEY_BACKSPACE        = 22;
-const KEY DALI_KEY_CURSOR_UP        = 111;
-const KEY DALI_KEY_CURSOR_LEFT      = 113;
-const KEY DALI_KEY_CURSOR_RIGHT     = 114;
-const KEY DALI_KEY_CURSOR_DOWN      = 116;
-const KEY DALI_KEY_BACK             = 166;
-const KEY DALI_KEY_CAMERA           = 167;
-const KEY DALI_KEY_CONFIG           = 168;
-const KEY DALI_KEY_POWER            = 169;
-const KEY DALI_KEY_PAUSE            = 170;
-const KEY DALI_KEY_CANCEL           = 171;
-const KEY DALI_KEY_PLAY_CD          = 172;
-const KEY DALI_KEY_STOP_CD          = 173;
-const KEY DALI_KEY_PAUSE_CD         = 174;
-const KEY DALI_KEY_NEXT_SONG        = 175;
-const KEY DALI_KEY_PREVIOUS_SONG    = 176;
-const KEY DALI_KEY_REWIND           = 177;
-const KEY DALI_KEY_FASTFORWARD      = 178;
-const KEY DALI_KEY_MEDIA            = 179;
-const KEY DALI_KEY_PLAY_PAUSE       = 180;
-const KEY DALI_KEY_MUTE             = 181;
-const KEY DALI_KEY_SEND             = 182;
-const KEY DALI_KEY_SELECT           = 183;
-const KEY DALI_KEY_END              = DALI_KEY_BACK;
-const KEY DALI_KEY_MENU             = DALI_KEY_SEND;
-const KEY DALI_KEY_HOME             = DALI_KEY_SELECT;
-const KEY DALI_KEY_HOMEPAGE         = 187;
-const KEY DALI_KEY_WEBPAGE          = 188;
-const KEY DALI_KEY_MAIL             = 189;
-const KEY DALI_KEY_SCREENSAVER      = 190;
-const KEY DALI_KEY_BRIGHTNESS_UP    = 191;
-const KEY DALI_KEY_BRIGHTNESS_DOWN  = 192;
-const KEY DALI_KEY_SOFT_KBD         = 193;
-const KEY DALI_KEY_QUICK_PANEL      = 194;
-const KEY DALI_KEY_TASK_SWITCH      = 195;
-const KEY DALI_KEY_APPS             = 196;
-const KEY DALI_KEY_SEARCH           = 197;
-const KEY DALI_KEY_VOICE            = 198;
-const KEY DALI_KEY_LANGUAGE         = 199;
-const KEY DALI_KEY_VOLUME_UP        = 200;
-const KEY DALI_KEY_VOLUME_DOWN      = 201;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace KeyLookup
-{
-
-namespace
-{
-
-struct KeyLookup
-{
-  const char* keyName;      ///< X string representation
-  const int   daliKeyCode;  ///< Dali Enum Representation
-  const bool  deviceButton; ///< Whether the key is from a button on the device
-};
-
-// matches a DALI_KEY enum, to a X key name
-KeyLookup KeyLookupTable[]=
-{
-  // more than one key name can be assigned to a single dali-key code
-  // e.g. Menu and KEY_MENU("FS86KeyMenu") are both assigned to  DALI_KEY_MENU
-
-  { "Escape",               DALI_KEY_ESCAPE,          false },  // item not defined in utilX
-  { "Menu",                 DALI_KEY_MENU,            false },  // item not defined in utilX
-//  { KEY_CAMERA,             DALI_KEY_CAMERA,          false },
-//  { KEY_CONFIG,             DALI_KEY_CONFIG,          false },
-  { KEY_POWER,              DALI_KEY_POWER,           true  },
-  { KEY_PAUSE,              DALI_KEY_PAUSE,           false },
-  { KEY_CANCEL,             DALI_KEY_CANCEL,          false },
-//  { KEY_PLAYCD,             DALI_KEY_PLAY_CD,         false },
-//  { KEY_STOPCD,             DALI_KEY_STOP_CD,         false },
-//  { KEY_PAUSECD,            DALI_KEY_PAUSE_CD,        false },
-//  { KEY_NEXTSONG,           DALI_KEY_NEXT_SONG,       false },
-//  { KEY_PREVIOUSSONG,       DALI_KEY_PREVIOUS_SONG,   false },
-//  { KEY_REWIND,             DALI_KEY_REWIND,          false },
-//  { KEY_FASTFORWARD,        DALI_KEY_FASTFORWARD,     false },
-//  { KEY_MEDIA,              DALI_KEY_MEDIA,           false },
-//  { KEY_PLAYPAUSE,          DALI_KEY_PLAY_PAUSE,      false },
-  { KEY_MUTE,               DALI_KEY_MUTE,            false },
-//  { KEY_SEND,               DALI_KEY_SEND,            true  },
-//  { KEY_SELECT,             DALI_KEY_SELECT,          true  },
-//  { KEY_END,                DALI_KEY_END,             true  },
-  { KEY_MENU,               DALI_KEY_MENU,            true  },
-  { KEY_HOME,               DALI_KEY_HOME,            true  },
-  { KEY_BACK,               DALI_KEY_BACK,            true  },
-//  { KEY_HOMEPAGE,           DALI_KEY_HOMEPAGE,        false },
-//  { KEY_WEBPAGE,            DALI_KEY_WEBPAGE,         false },
-//  { KEY_MAIL,               DALI_KEY_MAIL,            false },
-//  { KEY_SCREENSAVER,        DALI_KEY_SCREENSAVER,     false },
-//  { KEY_BRIGHTNESSUP,       DALI_KEY_BRIGHTNESS_UP,   false },
-//  { KEY_BRIGHTNESSDOWN,     DALI_KEY_BRIGHTNESS_DOWN, false },
-//  { KEY_SOFTKBD,            DALI_KEY_SOFT_KBD,        false },
-//  { KEY_QUICKPANEL,         DALI_KEY_QUICK_PANEL,     false },
-//  { KEY_TASKSWITCH,         DALI_KEY_TASK_SWITCH,     false },
-//  { KEY_APPS,               DALI_KEY_APPS,            false },
-  { KEY_SEARCH,             DALI_KEY_SEARCH,          false },
-//  { KEY_VOICE,              DALI_KEY_VOICE,           false },
-//  { KEY_LANGUAGE,           DALI_KEY_LANGUAGE,        false },
-  { KEY_VOLUMEUP,           DALI_KEY_VOLUME_UP,       true  },
-  { KEY_VOLUMEDOWN,         DALI_KEY_VOLUME_DOWN,     true  },
-};
-
-const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));
-
-class KeyMap
-{
-  public:
-
-  KeyMap():
-  mLookup( cmpString )
-  {
-    // create the lookup
-    for( size_t i = 0; i < KEY_LOOKUP_COUNT ; ++i )
-    {
-      const KeyLookup&  keyLookup( KeyLookupTable[i] );
-      mLookup[ keyLookup.keyName  ] = DaliKeyType( keyLookup.daliKeyCode, keyLookup.deviceButton );
-    }
-  }
-
-  int GetDaliKeyEnum( const char* keyName ) const
-  {
-    Lookup::const_iterator i = mLookup.find( keyName );
-    if( i == mLookup.end() )
-    {
-      return -1;
-    }
-    else
-    {
-      return (*i).second.first;
-    }
-  }
-
-  bool IsDeviceButton( const char* keyName ) const
-  {
-    Lookup::const_iterator i = mLookup.find( keyName );
-    if ( i != mLookup.end() )
-    {
-      return (*i).second.second;
-    }
-    return false;
-  }
-
-  private:
-
-  /**
-   * compare function, to compare string by pointer
-   */
-  static bool cmpString( const char* a, const char* b)
-  {
-    return strcmp(a, b) < 0;
-  }
-
-  typedef std::pair< int, bool > DaliKeyType;
-  typedef std::map<const char* /* key name */, DaliKeyType /* key code */, bool(*) ( char const* a, char const* b) > Lookup;
-  Lookup mLookup;
-
-};
-const KeyMap globalKeyLookup;
-
-} // un-named name space
-
-bool IsKey( const Dali::KeyEvent& keyEvent, Dali::KEY daliKey)
-{
-  int key = globalKeyLookup.GetDaliKeyEnum( keyEvent.keyPressedName.c_str() );
-  return daliKey == key;
-}
-
-bool IsDeviceButton( const char* keyName )
-{
-  return globalKeyLookup.IsDeviceButton( keyName );
-}
-
-} // namespace KeyLookup
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
index 9e8ccc1..feee7e9 100644 (file)
@@ -7,4 +7,4 @@ adaptor_ubuntu_internal_src_files = \
   $(adaptor_ubuntu_dir)/vsync-monitor-ubuntu.cpp \
   $(adaptor_ubuntu_dir)/tilt-sensor-impl-ubuntu.cpp \
   $(adaptor_ubuntu_dir)/tts-player-impl-ubuntu.cpp \
-  $(adaptor_ubuntu_dir)/key-impl-ubuntu.cpp
+  $(adaptor_ubuntu_dir)/key-mapping-ubuntu.cpp
diff --git a/adaptors/ubuntu/key-impl-ubuntu.cpp b/adaptors/ubuntu/key-impl-ubuntu.cpp
deleted file mode 100644 (file)
index 6585d66..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "key-impl.h"
-
-// EXTERNAL INCLUDES
-#define KEY_VOLUMEUP            "XF86AudioRaiseVolume"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Up' key */
-#define KEY_VOLUMEDOWN          "XF86AudioLowerVolume"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Down' key */
-
-#define KEY_CAMERA              "XF86WebCam"    /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Half-Press of Camera' key */
-#define KEY_CONFIG              "XF86Pictures"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Full-Press of Camera' key */
-
-#define KEY_POWER               "XF86PowerOff"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Power' key */
-#define KEY_PAUSE               "XF86Standby"   /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause' key */
-#define KEY_CANCEL              "Cancel"        /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Cancel' key */
-
-// Earjack/BT Headset/Multimedia keys
-#define KEY_PLAYCD              "XF86AudioPlay" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Play Audio' key */
-#define KEY_STOPCD              "XF86AudioStop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Stop Audio' key */
-#define KEY_PAUSECD             "XF86AudioPause"        /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause Audio' key */
-#define KEY_NEXTSONG            "XF86AudioNext" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Next Song' key */
-#define KEY_PREVIOUSSONG        "XF86AudioPrev" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Previous Song' key */
-#define KEY_REWIND              "XF86AudioRewind"       /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Rewind Song' key */
-#define KEY_FASTFORWARD         "XF86AudioForward"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Forward Song' key */
-#define KEY_MEDIA               "XF86AudioMedia"        /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Media' key */
-#define KEY_PLAYPAUSE           "XF86AudioPlayPause"    /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'PlayPause' key */
-#define KEY_MUTE                        "XF86AudioMute" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Mute' key */
-
-// 3-Touch key
-#define KEY_SEND                "XF86Send"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
-#define KEY_SELECT              "XF86Phone"     /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
-#define KEY_END                 "XF86Stop"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
-
-// Renamed 3-Touch key
-#define KEY_MENU                "XF86Send"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
-#define KEY_HOME                "XF86Phone"     /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
-#define KEY_BACK                "XF86Stop"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
-
-//Other functions keys
-#define KEY_HOMEPAGE            "XF86HomePage"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'HomePage' key */
-#define KEY_WEBPAGE             "XF86WWW"       /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'WWW' key */
-#define KEY_MAIL                        "XF86Mail"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Mail' key */
-#define KEY_SCREENSAVER "XF86ScreenSaver"       /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'ScreenSaver' key */
-#define KEY_BRIGHTNESSUP        "XF86MonBrightnessUp"   /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'BrightnessUp' key */
-#define KEY_BRIGHTNESSDOWN      "XF86MonBrightnessDown" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'BrightnessDown' key */
-#define KEY_SOFTKBD                     "XF86MenuKB"    /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Soft keyboard(toggle)' key */
-#define KEY_QUICKPANEL          "XF86Tools"     /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Quick panel(toggle)' key */
-#define KEY_TASKSWITCH          "XF86TaskPane"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Task switcher(toggle)' key */
-#define KEY_APPS                "XF86Launch0"   /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Apptray(toggle)' key */
-#define KEY_SEARCH              "XF86Search"            /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Search(toggle)' key */
-#define KEY_VOICE               "XF86Launch2"           /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Voice(toggle)' key */
-#define KEY_LANGUAGE            "Hangul"                /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Language(toggle)' key */
-
-#include <map>
-#include <string.h>
-#include <iostream>
-
-
-#include <dali/integration-api/debug.h>
-
-
-namespace Dali
-{
-
-const KEY DALI_KEY_INVALID          = -1;
-const KEY DALI_KEY_ESCAPE           = 9;
-const KEY DALI_KEY_BACKSPACE        = 22;
-const KEY DALI_KEY_CURSOR_UP        = 111;
-const KEY DALI_KEY_CURSOR_LEFT      = 113;
-const KEY DALI_KEY_CURSOR_RIGHT     = 114;
-const KEY DALI_KEY_CURSOR_DOWN      = 116;
-const KEY DALI_KEY_BACK             = 166;
-const KEY DALI_KEY_CAMERA           = 167;
-const KEY DALI_KEY_CONFIG           = 168;
-const KEY DALI_KEY_POWER            = 169;
-const KEY DALI_KEY_PAUSE            = 170;
-const KEY DALI_KEY_CANCEL           = 171;
-const KEY DALI_KEY_PLAY_CD          = 172;
-const KEY DALI_KEY_STOP_CD          = 173;
-const KEY DALI_KEY_PAUSE_CD         = 174;
-const KEY DALI_KEY_NEXT_SONG        = 175;
-const KEY DALI_KEY_PREVIOUS_SONG    = 176;
-const KEY DALI_KEY_REWIND           = 177;
-const KEY DALI_KEY_FASTFORWARD      = 178;
-const KEY DALI_KEY_MEDIA            = 179;
-const KEY DALI_KEY_PLAY_PAUSE       = 180;
-const KEY DALI_KEY_MUTE             = 181;
-const KEY DALI_KEY_SEND             = 182;
-const KEY DALI_KEY_SELECT           = 183;
-const KEY DALI_KEY_END              = DALI_KEY_BACK;
-const KEY DALI_KEY_MENU             = DALI_KEY_SEND;
-const KEY DALI_KEY_HOME             = DALI_KEY_SELECT;
-const KEY DALI_KEY_HOMEPAGE         = 187;
-const KEY DALI_KEY_WEBPAGE          = 188;
-const KEY DALI_KEY_MAIL             = 189;
-const KEY DALI_KEY_SCREENSAVER      = 190;
-const KEY DALI_KEY_BRIGHTNESS_UP    = 191;
-const KEY DALI_KEY_BRIGHTNESS_DOWN  = 192;
-const KEY DALI_KEY_SOFT_KBD         = 193;
-const KEY DALI_KEY_QUICK_PANEL      = 194;
-const KEY DALI_KEY_TASK_SWITCH      = 195;
-const KEY DALI_KEY_APPS             = 196;
-const KEY DALI_KEY_SEARCH           = 197;
-const KEY DALI_KEY_VOICE            = 198;
-const KEY DALI_KEY_LANGUAGE         = 199;
-const KEY DALI_KEY_VOLUME_UP        = 200;
-const KEY DALI_KEY_VOLUME_DOWN      = 201;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace KeyLookup
-{
-
-namespace
-{
-
-struct KeyLookup
-{
-  const char* keyName;      ///< X string representation
-  const int   daliKeyCode;  ///< Dali Enum Representation
-  const bool  deviceButton; ///< Whether the key is from a button on the device
-};
-
-// matches a DALI_KEY enum, to a X key name
-KeyLookup KeyLookupTable[]=
-{
-  // more than one key name can be assigned to a single dali-key code
-  // e.g. Menu and KEY_MENU("FS86KeyMenu") are both assigned to  DALI_KEY_MENU
-
-  { "Escape",               DALI_KEY_ESCAPE,          false },  // item not defined in utilX
-  { "Menu",                 DALI_KEY_MENU,            false },  // item not defined in utilX
-  { KEY_CAMERA,             DALI_KEY_CAMERA,          false },
-  { KEY_CONFIG,             DALI_KEY_CONFIG,          false },
-  { KEY_POWER,              DALI_KEY_POWER,           true  },
-  { KEY_PAUSE,              DALI_KEY_PAUSE,           false },
-  { KEY_CANCEL,             DALI_KEY_CANCEL,          false },
-  { KEY_PLAYCD,             DALI_KEY_PLAY_CD,         false },
-  { KEY_STOPCD,             DALI_KEY_STOP_CD,         false },
-  { KEY_PAUSECD,            DALI_KEY_PAUSE_CD,        false },
-  { KEY_NEXTSONG,           DALI_KEY_NEXT_SONG,       false },
-  { KEY_PREVIOUSSONG,       DALI_KEY_PREVIOUS_SONG,   false },
-  { KEY_REWIND,             DALI_KEY_REWIND,          false },
-  { KEY_FASTFORWARD,        DALI_KEY_FASTFORWARD,     false },
-  { KEY_MEDIA,              DALI_KEY_MEDIA,           false },
-  { KEY_PLAYPAUSE,          DALI_KEY_PLAY_PAUSE,      false },
-  { KEY_MUTE,               DALI_KEY_MUTE,            false },
-  { KEY_SEND,               DALI_KEY_SEND,            true  },
-  { KEY_SELECT,             DALI_KEY_SELECT,          true  },
-  { KEY_END,                DALI_KEY_END,             true  },
-  { KEY_MENU,               DALI_KEY_MENU,            true  },
-  { KEY_HOME,               DALI_KEY_HOME,            true  },
-  { KEY_BACK,               DALI_KEY_BACK,            true  },
-  { KEY_HOMEPAGE,           DALI_KEY_HOMEPAGE,        false },
-  { KEY_WEBPAGE,            DALI_KEY_WEBPAGE,         false },
-  { KEY_MAIL,               DALI_KEY_MAIL,            false },
-  { KEY_SCREENSAVER,        DALI_KEY_SCREENSAVER,     false },
-  { KEY_BRIGHTNESSUP,       DALI_KEY_BRIGHTNESS_UP,   false },
-  { KEY_BRIGHTNESSDOWN,     DALI_KEY_BRIGHTNESS_DOWN, false },
-  { KEY_SOFTKBD,            DALI_KEY_SOFT_KBD,        false },
-  { KEY_QUICKPANEL,         DALI_KEY_QUICK_PANEL,     false },
-  { KEY_TASKSWITCH,         DALI_KEY_TASK_SWITCH,     false },
-  { KEY_APPS,               DALI_KEY_APPS,            false },
-  { KEY_SEARCH,             DALI_KEY_SEARCH,          false },
-  { KEY_VOICE,              DALI_KEY_VOICE,           false },
-  { KEY_LANGUAGE,           DALI_KEY_LANGUAGE,        false },
-  { KEY_VOLUMEUP,           DALI_KEY_VOLUME_UP,       true  },
-  { KEY_VOLUMEDOWN,         DALI_KEY_VOLUME_DOWN,     true  },
-};
-
-const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));
-
-class KeyMap
-{
-  public:
-
-  KeyMap():
-  mLookup( cmpString )
-  {
-    // create the lookup
-    for( size_t i = 0; i < KEY_LOOKUP_COUNT ; ++i )
-    {
-      const KeyLookup&  keyLookup( KeyLookupTable[i] );
-      mLookup[ keyLookup.keyName  ] = DaliKeyType( keyLookup.daliKeyCode, keyLookup.deviceButton );
-    }
-  }
-
-  int GetDaliKeyEnum( const char* keyName ) const
-  {
-    Lookup::const_iterator i = mLookup.find( keyName );
-    if( i == mLookup.end() )
-    {
-      return -1;
-    }
-    else
-    {
-      return (*i).second.first;
-    }
-  }
-
-  bool IsDeviceButton( const char* keyName ) const
-  {
-    Lookup::const_iterator i = mLookup.find( keyName );
-    if ( i != mLookup.end() )
-    {
-      return (*i).second.second;
-    }
-    return false;
-  }
-
-  private:
-
-  /**
-   * compare function, to compare string by pointer
-   */
-  static bool cmpString( const char* a, const char* b)
-  {
-    return strcmp(a, b) < 0;
-  }
-
-  typedef std::pair< int, bool > DaliKeyType;
-  typedef std::map<const char* /* key name */, DaliKeyType /* key code */, bool(*) ( char const* a, char const* b) > Lookup;
-  Lookup mLookup;
-
-};
-const KeyMap globalKeyLookup;
-
-} // un-named name space
-
-bool IsKey( const Dali::KeyEvent& keyEvent, Dali::KEY daliKey)
-{
-  int key = globalKeyLookup.GetDaliKeyEnum( keyEvent.keyPressedName.c_str() );
-  return daliKey == key;
-}
-
-bool IsDeviceButton( const char* keyName )
-{
-  return globalKeyLookup.IsDeviceButton( keyName );
-}
-
-} // namespace KeyLookup
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/adaptors/ubuntu/key-mapping-ubuntu.cpp b/adaptors/ubuntu/key-mapping-ubuntu.cpp
new file mode 100644 (file)
index 0000000..fb0f55e
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "key-impl.h"
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace KeyLookup
+{
+
+// matches a DALI_KEY enum, to a key name
+KeyLookup KeyLookupTable[]=
+{
+  // more than one key name can be assigned to a single dali-key code
+  // e.g. "Menu" and "XF86Menu" are both assigned to  DALI_KEY_MENU
+
+  { "Escape",                DALI_KEY_ESCAPE,          false },
+  { "Menu",                  DALI_KEY_MENU,            false },
+
+  // Now literal strings are used as key names instead of defined symbols in utilX,
+  // since these definition in utilX.h is deprecated
+  { "XF86Camera",            DALI_KEY_CAMERA,          false },
+  { "XF86Camera_Full",       DALI_KEY_CONFIG,          false },
+  { "XF86PowerOff",          DALI_KEY_POWER,           true  },
+  { "XF86Standby",           DALI_KEY_PAUSE,           false },
+  { "Cancel",                DALI_KEY_CANCEL,          false },
+  { "XF86AudioPlay",         DALI_KEY_PLAY_CD,         false },
+  { "XF86AudioStop",         DALI_KEY_STOP_CD,         false },
+  { "XF86AudioPause",        DALI_KEY_PAUSE_CD,        false },
+  { "XF86AudioNext",         DALI_KEY_NEXT_SONG,       false },
+  { "XF86AudioPrev",         DALI_KEY_PREVIOUS_SONG,   false },
+  { "XF86AudioRewind",       DALI_KEY_REWIND,          false },
+  { "XF86AudioForward",      DALI_KEY_FASTFORWARD,     false },
+  { "XF86AudioMedia",        DALI_KEY_MEDIA,           false },
+  { "XF86AudioPlayPause",    DALI_KEY_PLAY_PAUSE,      false },
+  { "XF86AudioMute",         DALI_KEY_MUTE,            false },
+  { "XF86Menu",              DALI_KEY_MENU,            true  },
+  { "XF86Home",              DALI_KEY_HOME,            true  },
+  { "XF86Back",              DALI_KEY_BACK,            true  },
+  { "XF86HomePage",          DALI_KEY_HOMEPAGE,        false },
+  { "XF86WWW",               DALI_KEY_WEBPAGE,         false },
+  { "XF86Mail",              DALI_KEY_MAIL,            false },
+  { "XF86ScreenSaver",       DALI_KEY_SCREENSAVER,     false },
+  { "XF86MonBrightnessUp",   DALI_KEY_BRIGHTNESS_UP,   false },
+  { "XF86MonBrightnessDown", DALI_KEY_BRIGHTNESS_DOWN, false },
+  { "XF86SoftKBD",           DALI_KEY_SOFT_KBD,        false },
+  { "XF86QuickPanel",        DALI_KEY_QUICK_PANEL,     false },
+  { "XF86TaskPane",          DALI_KEY_TASK_SWITCH,     false },
+  { "XF86Apps",              DALI_KEY_APPS,            false },
+  { "XF86Search",            DALI_KEY_SEARCH,          false },
+  { "XF86Voice",             DALI_KEY_VOICE,           false },
+  { "Hangul",                DALI_KEY_LANGUAGE,        false },
+  { "XF86AudioRaiseVolume",  DALI_KEY_VOLUME_UP,       true  },
+  { "XF86AudioLowerVolume",  DALI_KEY_VOLUME_DOWN,     true  },
+};
+
+const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable ))/ (sizeof( KeyLookup ));
+
+} // namespace KeyLookup
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index baa9631..bdabcdd 100644 (file)
@@ -390,10 +390,13 @@ struct EventHandler::Impl
     Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
     bool eventHandled( false );
 
-    // XF86Stop and XF86Send must skip ecore_imf_context_filter_event.
-    if ( strcmp( keyEvent->keyname, "XF86Send" )  &&
-         strcmp( keyEvent->keyname, "XF86Phone" ) &&
-         strcmp( keyEvent->keyname, "XF86Stop" ) )
+    // Menu, home, back button must skip ecore_imf_context_filter_event.
+    static const char* menuKeyName = KeyLookup::GetKeyName( DALI_KEY_MENU );
+    static const char* homeKeyName = KeyLookup::GetKeyName( DALI_KEY_HOME );
+    static const char* backKeyName = KeyLookup::GetKeyName( DALI_KEY_BACK );
+    if ( ( menuKeyName && strcmp( keyEvent->keyname, menuKeyName ) != 0 ) &&
+         ( homeKeyName && strcmp( keyEvent->keyname, homeKeyName ) != 0 ) &&
+         ( backKeyName && strcmp( keyEvent->keyname, backKeyName ) != 0 ) )
     {
       Ecore_IMF_Context* imfContext = NULL;
       Dali::ImfManager imfManager( ImfManager::Get() );
index 5f7a8e2..b44598b 100644 (file)
@@ -15,7 +15,7 @@ adaptor_wayland_tizen_internal_src_files = \
   $(adaptor_wayland_dir)/pixmap-render-surface-wl.cpp \
   $(adaptor_wayland_dir)/ecore-wl-render-surface.cpp \
   $(adaptor_wayland_dir)/window-render-surface-wl.cpp \
-  $(adaptor_wayland_dir)/key-impl-wl.cpp
+  $(adaptor_wayland_dir)/key-mapping-wl.cpp
 
 adaptor_wayland_tizen_common_internal_default_profile_src_files = \
   $(adaptor_wayland_dir)/ecore-wl-render-surface-factory.cpp \
diff --git a/adaptors/wayland/key-impl-wl.cpp b/adaptors/wayland/key-impl-wl.cpp
deleted file mode 100644 (file)
index b13b85a..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "key-impl.h"
-
-// EXTERNAL INCLUDES
-#include <map>
-#include <string.h>
-#include <iostream>
-
-#include <dali/integration-api/debug.h>
-
-
-namespace Dali
-{
-
-const KEY DALI_KEY_INVALID          = -1;
-const KEY DALI_KEY_ESCAPE           = 9;
-const KEY DALI_KEY_BACKSPACE        = 22;
-const KEY DALI_KEY_CURSOR_UP        = 111;
-const KEY DALI_KEY_CURSOR_LEFT      = 113;
-const KEY DALI_KEY_CURSOR_RIGHT     = 114;
-const KEY DALI_KEY_CURSOR_DOWN      = 116;
-const KEY DALI_KEY_BACK             = 166;
-const KEY DALI_KEY_CAMERA           = 167;
-const KEY DALI_KEY_CONFIG           = 168;
-const KEY DALI_KEY_POWER            = 169;
-const KEY DALI_KEY_PAUSE            = 170;
-const KEY DALI_KEY_CANCEL           = 171;
-const KEY DALI_KEY_PLAY_CD          = 172;
-const KEY DALI_KEY_STOP_CD          = 173;
-const KEY DALI_KEY_PAUSE_CD         = 174;
-const KEY DALI_KEY_NEXT_SONG        = 175;
-const KEY DALI_KEY_PREVIOUS_SONG    = 176;
-const KEY DALI_KEY_REWIND           = 177;
-const KEY DALI_KEY_FASTFORWARD      = 178;
-const KEY DALI_KEY_MEDIA            = 179;
-const KEY DALI_KEY_PLAY_PAUSE       = 180;
-const KEY DALI_KEY_MUTE             = 181;
-const KEY DALI_KEY_SEND             = 182;
-const KEY DALI_KEY_SELECT           = 183;
-const KEY DALI_KEY_END              = DALI_KEY_BACK;
-const KEY DALI_KEY_MENU             = DALI_KEY_SEND;
-const KEY DALI_KEY_HOME             = DALI_KEY_SELECT;
-const KEY DALI_KEY_HOMEPAGE         = 187;
-const KEY DALI_KEY_WEBPAGE          = 188;
-const KEY DALI_KEY_MAIL             = 189;
-const KEY DALI_KEY_SCREENSAVER      = 190;
-const KEY DALI_KEY_BRIGHTNESS_UP    = 191;
-const KEY DALI_KEY_BRIGHTNESS_DOWN  = 192;
-const KEY DALI_KEY_SOFT_KBD         = 193;
-const KEY DALI_KEY_QUICK_PANEL      = 194;
-const KEY DALI_KEY_TASK_SWITCH      = 195;
-const KEY DALI_KEY_APPS             = 196;
-const KEY DALI_KEY_SEARCH           = 197;
-const KEY DALI_KEY_VOICE            = 198;
-const KEY DALI_KEY_LANGUAGE         = 199;
-const KEY DALI_KEY_VOLUME_UP        = 200;
-const KEY DALI_KEY_VOLUME_DOWN      = 201;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace KeyLookup
-{
-
-namespace
-{
-
-struct KeyLookup
-{
-  const char* keyName;      ///< X string representation
-  const int   daliKeyCode;  ///< Dali Enum Representation
-  const bool  deviceButton; ///< Whether the key is from a button on the device
-};
-
-// matches a DALI_KEY enum, to a X key name
-KeyLookup KeyLookupTable[]=
-{
-  // more than one key name can be assigned to a single dali-key code
-  // e.g. Menu and KEY_MENU("FS86KeyMenu") are both assigned to  DALI_KEY_MENU
-
-  { "Escape",               DALI_KEY_ESCAPE,          false },  // item not defined in utilX
-  { "Menu",                 DALI_KEY_MENU,            false },  // item not defined in utilX
-};
-
-const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));
-
-class KeyMap
-{
-  public:
-
-  KeyMap():
-  mLookup( cmpString )
-  {
-    // create the lookup
-    for( size_t i = 0; i < KEY_LOOKUP_COUNT ; ++i )
-    {
-      const KeyLookup&  keyLookup( KeyLookupTable[i] );
-      mLookup[ keyLookup.keyName  ] = DaliKeyType( keyLookup.daliKeyCode, keyLookup.deviceButton );
-    }
-  }
-
-  int GetDaliKeyEnum( const char* keyName ) const
-  {
-    Lookup::const_iterator i = mLookup.find( keyName );
-    if( i == mLookup.end() )
-    {
-      return -1;
-    }
-    else
-    {
-      return (*i).second.first;
-    }
-  }
-
-  bool IsDeviceButton( const char* keyName ) const
-  {
-    Lookup::const_iterator i = mLookup.find( keyName );
-    if ( i != mLookup.end() )
-    {
-      return (*i).second.second;
-    }
-    return false;
-  }
-
-  private:
-
-  /**
-   * compare function, to compare string by pointer
-   */
-  static bool cmpString( const char* a, const char* b)
-  {
-    return strcmp(a, b) < 0;
-  }
-
-  typedef std::pair< int, bool > DaliKeyType;
-  typedef std::map<const char* /* key name */, DaliKeyType /* key code */, bool(*) ( char const* a, char const* b) > Lookup;
-  Lookup mLookup;
-
-};
-const KeyMap globalKeyLookup;
-
-} // un-named name space
-
-bool IsKey( const Dali::KeyEvent& keyEvent, Dali::KEY daliKey)
-{
-  int key = globalKeyLookup.GetDaliKeyEnum( keyEvent.keyPressedName.c_str() );
-  return daliKey == key;
-}
-
-bool IsDeviceButton( const char* keyName )
-{
-  return globalKeyLookup.IsDeviceButton( keyName );
-}
-
-} // namespace KeyLookup
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/adaptors/wayland/key-mapping-wl.cpp b/adaptors/wayland/key-mapping-wl.cpp
new file mode 100644 (file)
index 0000000..dfafcba
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "key-impl.h"
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace KeyLookup
+{
+
+// matches a DALI_KEY enum, to a key name
+KeyLookup KeyLookupTable[]=
+{
+  // more than one key name can be assigned to a single dali-key code
+  // e.g. "Menu" and "XF86Menu" are both assigned to  DALI_KEY_MENU
+
+  { "Escape",                DALI_KEY_ESCAPE,          false },
+  { "Menu",                  DALI_KEY_MENU,            false },
+
+  // Now literal strings are used as key names instead of defined symbols in utilX,
+  // since these definition in utilX.h is deprecated
+  { "XF86Camera",            DALI_KEY_CAMERA,          false },
+  { "XF86Camera_Full",       DALI_KEY_CONFIG,          false },
+  { "XF86PowerOff",          DALI_KEY_POWER,           true  },
+  { "XF86Standby",           DALI_KEY_PAUSE,           false },
+  { "Cancel",                DALI_KEY_CANCEL,          false },
+  { "XF86AudioPlay",         DALI_KEY_PLAY_CD,         false },
+  { "XF86AudioStop",         DALI_KEY_STOP_CD,         false },
+  { "XF86AudioPause",        DALI_KEY_PAUSE_CD,        false },
+  { "XF86AudioNext",         DALI_KEY_NEXT_SONG,       false },
+  { "XF86AudioPrev",         DALI_KEY_PREVIOUS_SONG,   false },
+  { "XF86AudioRewind",       DALI_KEY_REWIND,          false },
+  { "XF86AudioForward",      DALI_KEY_FASTFORWARD,     false },
+  { "XF86AudioMedia",        DALI_KEY_MEDIA,           false },
+  { "XF86AudioPlayPause",    DALI_KEY_PLAY_PAUSE,      false },
+  { "XF86AudioMute",         DALI_KEY_MUTE,            false },
+  { "XF86Menu",              DALI_KEY_MENU,            true  },
+  { "XF86Home",              DALI_KEY_HOME,            true  },
+  { "XF86Back",              DALI_KEY_BACK,            true  },
+  { "XF86HomePage",          DALI_KEY_HOMEPAGE,        false },
+  { "XF86WWW",               DALI_KEY_WEBPAGE,         false },
+  { "XF86Mail",              DALI_KEY_MAIL,            false },
+  { "XF86ScreenSaver",       DALI_KEY_SCREENSAVER,     false },
+  { "XF86MonBrightnessUp",   DALI_KEY_BRIGHTNESS_UP,   false },
+  { "XF86MonBrightnessDown", DALI_KEY_BRIGHTNESS_DOWN, false },
+  { "XF86SoftKBD",           DALI_KEY_SOFT_KBD,        false },
+  { "XF86QuickPanel",        DALI_KEY_QUICK_PANEL,     false },
+  { "XF86TaskPane",          DALI_KEY_TASK_SWITCH,     false },
+  { "XF86Apps",              DALI_KEY_APPS,            false },
+  { "XF86Search",            DALI_KEY_SEARCH,          false },
+  { "XF86Voice",             DALI_KEY_VOICE,           false },
+  { "Hangul",                DALI_KEY_LANGUAGE,        false },
+  { "XF86AudioRaiseVolume",  DALI_KEY_VOLUME_UP,       true  },
+  { "XF86AudioLowerVolume",  DALI_KEY_VOLUME_DOWN,     true  },
+
+  { "BackSpace",             DALI_KEY_BACKSPACE,       false },
+  { "Left",                  DALI_KEY_CURSOR_LEFT,     false },
+  { "Right",                 DALI_KEY_CURSOR_RIGHT,    false }
+};
+
+const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));
+
+} // namespace KeyLookup
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index bd31ebf..6acd1a3 100644 (file)
@@ -688,10 +688,13 @@ struct EventHandler::Impl
     Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
     bool eventHandled( false );
 
-    // XF86Stop and XF86Send must skip ecore_imf_context_filter_event.
-    if ( strcmp( keyEvent->keyname, "XF86Send"  ) &&
-         strcmp( keyEvent->keyname, "XF86Phone" ) &&
-         strcmp( keyEvent->keyname, "XF86Stop"  ) )
+    // Menu, home, back button must skip ecore_imf_context_filter_event.
+    static const char* menuKeyName = KeyLookup::GetKeyName( DALI_KEY_MENU );
+    static const char* homeKeyName = KeyLookup::GetKeyName( DALI_KEY_HOME );
+    static const char* backKeyName = KeyLookup::GetKeyName( DALI_KEY_BACK );
+    if ( ( menuKeyName && strcmp( keyEvent->keyname, menuKeyName ) != 0 ) &&
+         ( homeKeyName && strcmp( keyEvent->keyname, homeKeyName ) != 0 ) &&
+         ( backKeyName && strcmp( keyEvent->keyname, backKeyName ) != 0 ) )
     {
       Ecore_IMF_Context* imfContext = NULL;
       Dali::ImfManager imfManager( ImfManager::Get() );
index 469fb2f..81a71b9 100644 (file)
@@ -31,7 +31,7 @@ adaptor_x11_tizen_internal_src_files = \
   $(_adaptor_x11_internal_src_files) \
   $(adaptor_x11_dir)/accessibility-adaptor-impl-x.cpp \
   $(adaptor_x11_dir)/framework-x.cpp \
-  $(adaptor_x11_dir)/key-impl-x.cpp \
+  $(adaptor_x11_dir)/key-mapping-x.cpp \
   $(adaptor_x11_dir)/window-extensions.cpp
 
 adaptor_x11_tv_internal_src_files = \
@@ -44,4 +44,4 @@ adaptor_x11_internal_default_profile_src_files = \
   $(adaptor_x11_dir)/system-settings-x.cpp
 
 devel_api_adaptor_tizen_x11_header_files = \
-  $(adaptor_x11_dir)/window-extensions.h
\ No newline at end of file
+  $(adaptor_x11_dir)/window-extensions.h
diff --git a/adaptors/x11/key-impl-x.cpp b/adaptors/x11/key-impl-x.cpp
deleted file mode 100644 (file)
index eccfcc7..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "key-impl.h"
-
-// EXTERNAL INCLUDES
-#include <utilX.h>
-#include <map>
-#include <string.h>
-#include <iostream>
-
-#include <dali/integration-api/debug.h>
-
-
-namespace Dali
-{
-
-const KEY DALI_KEY_INVALID          = -1;
-const KEY DALI_KEY_ESCAPE           = 9;
-const KEY DALI_KEY_BACKSPACE        = 22;
-const KEY DALI_KEY_CURSOR_UP        = 111;
-const KEY DALI_KEY_CURSOR_LEFT      = 113;
-const KEY DALI_KEY_CURSOR_RIGHT     = 114;
-const KEY DALI_KEY_CURSOR_DOWN      = 116;
-const KEY DALI_KEY_BACK             = 166;
-const KEY DALI_KEY_CAMERA           = 167;
-const KEY DALI_KEY_CONFIG           = 168;
-const KEY DALI_KEY_POWER            = 169;
-const KEY DALI_KEY_PAUSE            = 170;
-const KEY DALI_KEY_CANCEL           = 171;
-const KEY DALI_KEY_PLAY_CD          = 172;
-const KEY DALI_KEY_STOP_CD          = 173;
-const KEY DALI_KEY_PAUSE_CD         = 174;
-const KEY DALI_KEY_NEXT_SONG        = 175;
-const KEY DALI_KEY_PREVIOUS_SONG    = 176;
-const KEY DALI_KEY_REWIND           = 177;
-const KEY DALI_KEY_FASTFORWARD      = 178;
-const KEY DALI_KEY_MEDIA            = 179;
-const KEY DALI_KEY_PLAY_PAUSE       = 180;
-const KEY DALI_KEY_MUTE             = 181;
-const KEY DALI_KEY_SEND             = 182;
-const KEY DALI_KEY_SELECT           = 183;
-const KEY DALI_KEY_END              = DALI_KEY_BACK;
-const KEY DALI_KEY_MENU             = DALI_KEY_SEND;
-const KEY DALI_KEY_HOME             = DALI_KEY_SELECT;
-const KEY DALI_KEY_HOMEPAGE         = 187;
-const KEY DALI_KEY_WEBPAGE          = 188;
-const KEY DALI_KEY_MAIL             = 189;
-const KEY DALI_KEY_SCREENSAVER      = 190;
-const KEY DALI_KEY_BRIGHTNESS_UP    = 191;
-const KEY DALI_KEY_BRIGHTNESS_DOWN  = 192;
-const KEY DALI_KEY_SOFT_KBD         = 193;
-const KEY DALI_KEY_QUICK_PANEL      = 194;
-const KEY DALI_KEY_TASK_SWITCH      = 195;
-const KEY DALI_KEY_APPS             = 196;
-const KEY DALI_KEY_SEARCH           = 197;
-const KEY DALI_KEY_VOICE            = 198;
-const KEY DALI_KEY_LANGUAGE         = 199;
-const KEY DALI_KEY_VOLUME_UP        = 200;
-const KEY DALI_KEY_VOLUME_DOWN      = 201;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace KeyLookup
-{
-
-namespace
-{
-
-struct KeyLookup
-{
-  const char* keyName;      ///< X string representation
-  const int   daliKeyCode;  ///< Dali Enum Representation
-  const bool  deviceButton; ///< Whether the key is from a button on the device
-};
-
-// matches a DALI_KEY enum, to a X key name
-KeyLookup KeyLookupTable[]=
-{
-  // more than one key name can be assigned to a single dali-key code
-  // e.g. Menu and KEY_MENU("FS86KeyMenu") are both assigned to  DALI_KEY_MENU
-
-  { "Escape",               DALI_KEY_ESCAPE,          false },  // item not defined in utilX
-  { "Menu",                 DALI_KEY_MENU,            false },  // item not defined in utilX
-  { KEY_CAMERA,             DALI_KEY_CAMERA,          false },
-  { KEY_CONFIG,             DALI_KEY_CONFIG,          false },
-  { KEY_POWER,              DALI_KEY_POWER,           true  },
-  { KEY_PAUSE,              DALI_KEY_PAUSE,           false },
-  { KEY_CANCEL,             DALI_KEY_CANCEL,          false },
-  { KEY_PLAYCD,             DALI_KEY_PLAY_CD,         false },
-  { KEY_STOPCD,             DALI_KEY_STOP_CD,         false },
-  { KEY_PAUSECD,            DALI_KEY_PAUSE_CD,        false },
-  { KEY_NEXTSONG,           DALI_KEY_NEXT_SONG,       false },
-  { KEY_PREVIOUSSONG,       DALI_KEY_PREVIOUS_SONG,   false },
-  { KEY_REWIND,             DALI_KEY_REWIND,          false },
-  { KEY_FASTFORWARD,        DALI_KEY_FASTFORWARD,     false },
-  { KEY_MEDIA,              DALI_KEY_MEDIA,           false },
-  { KEY_PLAYPAUSE,          DALI_KEY_PLAY_PAUSE,      false },
-  { KEY_MUTE,               DALI_KEY_MUTE,            false },
-  { KEY_SEND,               DALI_KEY_SEND,            true  },
-  { KEY_SELECT,             DALI_KEY_SELECT,          true  },
-  { KEY_END,                DALI_KEY_END,             true  },
-  { KEY_MENU,               DALI_KEY_MENU,            true  },
-  { KEY_HOME,               DALI_KEY_HOME,            true  },
-  { KEY_BACK,               DALI_KEY_BACK,            true  },
-  { KEY_HOMEPAGE,           DALI_KEY_HOMEPAGE,        false },
-  { KEY_WEBPAGE,            DALI_KEY_WEBPAGE,         false },
-  { KEY_MAIL,               DALI_KEY_MAIL,            false },
-  { KEY_SCREENSAVER,        DALI_KEY_SCREENSAVER,     false },
-  { KEY_BRIGHTNESSUP,       DALI_KEY_BRIGHTNESS_UP,   false },
-  { KEY_BRIGHTNESSDOWN,     DALI_KEY_BRIGHTNESS_DOWN, false },
-  { KEY_SOFTKBD,            DALI_KEY_SOFT_KBD,        false },
-  { KEY_QUICKPANEL,         DALI_KEY_QUICK_PANEL,     false },
-  { KEY_TASKSWITCH,         DALI_KEY_TASK_SWITCH,     false },
-  { KEY_APPS,               DALI_KEY_APPS,            false },
-  { KEY_SEARCH,             DALI_KEY_SEARCH,          false },
-  { KEY_VOICE,              DALI_KEY_VOICE,           false },
-  { KEY_LANGUAGE,           DALI_KEY_LANGUAGE,        false },
-  { KEY_VOLUMEUP,           DALI_KEY_VOLUME_UP,       true  },
-  { KEY_VOLUMEDOWN,         DALI_KEY_VOLUME_DOWN,     true  },
-  { "BackSpace",            DALI_KEY_BACKSPACE,       false },
-  { "Left",                 DALI_KEY_CURSOR_LEFT,     false },
-  { "Right",                DALI_KEY_CURSOR_RIGHT,    false }
-};
-
-const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));
-
-class KeyMap
-{
-  public:
-
-  KeyMap():
-  mLookup( cmpString )
-  {
-    // create the lookup
-    for( size_t i = 0; i < KEY_LOOKUP_COUNT ; ++i )
-    {
-      const KeyLookup&  keyLookup( KeyLookupTable[i] );
-      mLookup[ keyLookup.keyName  ] = DaliKeyType( keyLookup.daliKeyCode, keyLookup.deviceButton );
-    }
-  }
-
-  int GetDaliKeyEnum( const char* keyName ) const
-  {
-    Lookup::const_iterator i = mLookup.find( keyName );
-    if( i == mLookup.end() )
-    {
-      return -1;
-    }
-    else
-    {
-      return (*i).second.first;
-    }
-  }
-
-  bool IsDeviceButton( const char* keyName ) const
-  {
-    Lookup::const_iterator i = mLookup.find( keyName );
-    if ( i != mLookup.end() )
-    {
-      return (*i).second.second;
-    }
-    return false;
-  }
-
-  private:
-
-  /**
-   * compare function, to compare string by pointer
-   */
-  static bool cmpString( const char* a, const char* b)
-  {
-    return strcmp(a, b) < 0;
-  }
-
-  typedef std::pair< int, bool > DaliKeyType;
-  typedef std::map<const char* /* key name */, DaliKeyType /* key code */, bool(*) ( char const* a, char const* b) > Lookup;
-  Lookup mLookup;
-
-};
-const KeyMap globalKeyLookup;
-
-} // un-named name space
-
-bool IsKey( const Dali::KeyEvent& keyEvent, Dali::KEY daliKey)
-{
-  int key = globalKeyLookup.GetDaliKeyEnum( keyEvent.keyPressedName.c_str() );
-  return daliKey == key;
-}
-
-bool IsDeviceButton( const char* keyName )
-{
-  return globalKeyLookup.IsDeviceButton( keyName );
-}
-
-} // namespace KeyLookup
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/adaptors/x11/key-mapping-x.cpp b/adaptors/x11/key-mapping-x.cpp
new file mode 100644 (file)
index 0000000..dfafcba
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "key-impl.h"
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace KeyLookup
+{
+
+// matches a DALI_KEY enum, to a key name
+KeyLookup KeyLookupTable[]=
+{
+  // more than one key name can be assigned to a single dali-key code
+  // e.g. "Menu" and "XF86Menu" are both assigned to  DALI_KEY_MENU
+
+  { "Escape",                DALI_KEY_ESCAPE,          false },
+  { "Menu",                  DALI_KEY_MENU,            false },
+
+  // Now literal strings are used as key names instead of defined symbols in utilX,
+  // since these definition in utilX.h is deprecated
+  { "XF86Camera",            DALI_KEY_CAMERA,          false },
+  { "XF86Camera_Full",       DALI_KEY_CONFIG,          false },
+  { "XF86PowerOff",          DALI_KEY_POWER,           true  },
+  { "XF86Standby",           DALI_KEY_PAUSE,           false },
+  { "Cancel",                DALI_KEY_CANCEL,          false },
+  { "XF86AudioPlay",         DALI_KEY_PLAY_CD,         false },
+  { "XF86AudioStop",         DALI_KEY_STOP_CD,         false },
+  { "XF86AudioPause",        DALI_KEY_PAUSE_CD,        false },
+  { "XF86AudioNext",         DALI_KEY_NEXT_SONG,       false },
+  { "XF86AudioPrev",         DALI_KEY_PREVIOUS_SONG,   false },
+  { "XF86AudioRewind",       DALI_KEY_REWIND,          false },
+  { "XF86AudioForward",      DALI_KEY_FASTFORWARD,     false },
+  { "XF86AudioMedia",        DALI_KEY_MEDIA,           false },
+  { "XF86AudioPlayPause",    DALI_KEY_PLAY_PAUSE,      false },
+  { "XF86AudioMute",         DALI_KEY_MUTE,            false },
+  { "XF86Menu",              DALI_KEY_MENU,            true  },
+  { "XF86Home",              DALI_KEY_HOME,            true  },
+  { "XF86Back",              DALI_KEY_BACK,            true  },
+  { "XF86HomePage",          DALI_KEY_HOMEPAGE,        false },
+  { "XF86WWW",               DALI_KEY_WEBPAGE,         false },
+  { "XF86Mail",              DALI_KEY_MAIL,            false },
+  { "XF86ScreenSaver",       DALI_KEY_SCREENSAVER,     false },
+  { "XF86MonBrightnessUp",   DALI_KEY_BRIGHTNESS_UP,   false },
+  { "XF86MonBrightnessDown", DALI_KEY_BRIGHTNESS_DOWN, false },
+  { "XF86SoftKBD",           DALI_KEY_SOFT_KBD,        false },
+  { "XF86QuickPanel",        DALI_KEY_QUICK_PANEL,     false },
+  { "XF86TaskPane",          DALI_KEY_TASK_SWITCH,     false },
+  { "XF86Apps",              DALI_KEY_APPS,            false },
+  { "XF86Search",            DALI_KEY_SEARCH,          false },
+  { "XF86Voice",             DALI_KEY_VOICE,           false },
+  { "Hangul",                DALI_KEY_LANGUAGE,        false },
+  { "XF86AudioRaiseVolume",  DALI_KEY_VOLUME_UP,       true  },
+  { "XF86AudioLowerVolume",  DALI_KEY_VOLUME_DOWN,     true  },
+
+  { "BackSpace",             DALI_KEY_BACKSPACE,       false },
+  { "Left",                  DALI_KEY_CURSOR_LEFT,     false },
+  { "Right",                 DALI_KEY_CURSOR_RIGHT,    false }
+};
+
+const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));
+
+} // namespace KeyLookup
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index 6cd2a9d..51d7bc0 100644 (file)
@@ -38,104 +38,55 @@ void utc_dali_adaptor_key_cleanup(void)
   test_return_value = TET_PASS;
 }
 
-// Copied from key-impl.cpp
+// Copied from key-impl.h
 struct KeyLookup
 {
-  const char* keyName;      ///< X string representation
-  const int   daliKeyCode;  ///< Dali Enum Representation
-  const bool  deviceButton; ///< Whether the key is from a button on the device
+  const char* keyName;          ///< XF86 key name
+  const Dali::KEY daliKeyCode;  ///< Dali key code
+  const bool  deviceButton;     ///< Whether the key is from a button on the device
 };
 
-// Taken from utilX.h
-#define KEY_VOLUMEUP           "XF86AudioRaiseVolume"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Up' key */
-#define KEY_VOLUMEDOWN         "XF86AudioLowerVolume"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Down' key */
-
-#define KEY_CAMERA             "XF86WebCam"    /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Half-Press of Camera' key */
-#define KEY_CONFIG             "XF86Pictures"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Full-Press of Camera' key */
-
-#define KEY_POWER              "XF86PowerOff"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Power' key */
-#define KEY_PAUSE              "XF86Standby"   /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause' key */
-#define KEY_CANCEL              "Cancel"        /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Cancel' key */
-
-// Earjack/BT Headset/Multimedia keys
-#define KEY_PLAYCD             "XF86AudioPlay" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Play Audio' key */
-#define KEY_STOPCD             "XF86AudioStop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Stop Audio' key */
-#define KEY_PAUSECD            "XF86AudioPause"        /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause Audio' key */
-#define KEY_NEXTSONG           "XF86AudioNext" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Next Song' key */
-#define KEY_PREVIOUSSONG       "XF86AudioPrev" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Previous Song' key */
-#define KEY_REWIND             "XF86AudioRewind"       /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Rewind Song' key */
-#define KEY_FASTFORWARD                "XF86AudioForward"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Forward Song' key */
-#define KEY_MEDIA              "XF86AudioMedia"        /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Media' key */
-#define KEY_PLAYPAUSE          "XF86AudioPlayPause"    /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'PlayPause' key */
-#define KEY_MUTE                       "XF86AudioMute" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Mute' key */
-
-// 3-Touch key
-#define KEY_SEND               "XF86Send"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
-#define KEY_SELECT             "XF86Phone"     /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
-#define KEY_END                        "XF86Stop"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
-
-// Renamed 3-Touch key
-#define KEY_MENU               "XF86Send"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
-#define KEY_HOME               "XF86Phone"     /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
-#define KEY_BACK               "XF86Stop"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
-
-//Other functions keys
-#define KEY_HOMEPAGE           "XF86HomePage"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'HomePage' key */
-#define KEY_WEBPAGE            "XF86WWW"       /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'WWW' key */
-#define KEY_MAIL                       "XF86Mail"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Mail' key */
-#define KEY_SCREENSAVER        "XF86ScreenSaver"       /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'ScreenSaver' key */
-#define KEY_BRIGHTNESSUP       "XF86MonBrightnessUp"   /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'BrightnessUp' key */
-#define KEY_BRIGHTNESSDOWN     "XF86MonBrightnessDown" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'BrightnessDown' key */
-#define KEY_SOFTKBD                    "XF86MenuKB"    /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Soft keyboard(toggle)' key */
-#define KEY_QUICKPANEL         "XF86Tools"     /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Quick panel(toggle)' key */
-#define KEY_TASKSWITCH         "XF86TaskPane"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Task switcher(toggle)' key */
-#define KEY_APPS               "XF86Launch0"   /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Apptray(toggle)' key */
-#define KEY_SEARCH             "XF86Search"            /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Search(toggle)' key */
-#define KEY_VOICE              "XF86Launch2"           /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Voice(toggle)' key */
-#define KEY_LANGUAGE           "Hangul"                /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Language(toggle)' key */
-
-// Taken from key-impl.cpp
+// Common keys for all platforms
 KeyLookup KeyLookupTable[]=
 {
-  // KeyName                DALi Equivalent           true if device key
-  { "Escape",               DALI_KEY_ESCAPE,          false },
-  { "Menu",                 DALI_KEY_MENU,            false },
-  { KEY_CAMERA,             DALI_KEY_CAMERA,          false },
-  { KEY_CONFIG,             DALI_KEY_CONFIG,          false },
-  { KEY_POWER,              DALI_KEY_POWER,           true  },
-  { KEY_PAUSE,              DALI_KEY_PAUSE,           false },
-  { KEY_CANCEL,             DALI_KEY_CANCEL,          false },
-  { KEY_PLAYCD,             DALI_KEY_PLAY_CD,         false },
-  { KEY_STOPCD,             DALI_KEY_STOP_CD,         false },
-  { KEY_PAUSECD,            DALI_KEY_PAUSE_CD,        false },
-  { KEY_NEXTSONG,           DALI_KEY_NEXT_SONG,       false },
-  { KEY_PREVIOUSSONG,       DALI_KEY_PREVIOUS_SONG,   false },
-  { KEY_REWIND,             DALI_KEY_REWIND,          false },
-  { KEY_FASTFORWARD,        DALI_KEY_FASTFORWARD,     false },
-  { KEY_MEDIA,              DALI_KEY_MEDIA,           false },
-  { KEY_PLAYPAUSE,          DALI_KEY_PLAY_PAUSE,      false },
-  { KEY_MUTE,               DALI_KEY_MUTE,            false },
-  { KEY_SEND,               DALI_KEY_SEND,            true  },
-  { KEY_SELECT,             DALI_KEY_SELECT,          true  },
-  { KEY_END,                DALI_KEY_END,             true  },
-  { KEY_MENU,               DALI_KEY_MENU,            true  },
-  { KEY_HOME,               DALI_KEY_HOME,            true  },
-  { KEY_BACK,               DALI_KEY_BACK,            true  },
-  { KEY_HOMEPAGE,           DALI_KEY_HOMEPAGE,        false },
-  { KEY_WEBPAGE,            DALI_KEY_WEBPAGE,         false },
-  { KEY_MAIL,               DALI_KEY_MAIL,            false },
-  { KEY_SCREENSAVER,        DALI_KEY_SCREENSAVER,     false },
-  { KEY_BRIGHTNESSUP,       DALI_KEY_BRIGHTNESS_UP,   false },
-  { KEY_BRIGHTNESSDOWN,     DALI_KEY_BRIGHTNESS_DOWN, false },
-  { KEY_SOFTKBD,            DALI_KEY_SOFT_KBD,        false },
-  { KEY_QUICKPANEL,         DALI_KEY_QUICK_PANEL,     false },
-  { KEY_TASKSWITCH,         DALI_KEY_TASK_SWITCH,     false },
-  { KEY_APPS,               DALI_KEY_APPS,            false },
-  { KEY_SEARCH,             DALI_KEY_SEARCH,          false },
-  { KEY_VOICE,              DALI_KEY_VOICE,           false },
-  { KEY_LANGUAGE,           DALI_KEY_LANGUAGE,        false },
-  { KEY_VOLUMEUP,           DALI_KEY_VOLUME_UP,       true  },
-  { KEY_VOLUMEDOWN,         DALI_KEY_VOLUME_DOWN,     true  },
+  { "Escape",                DALI_KEY_ESCAPE,          false },  // item not defined in utilX
+  { "Menu",                  DALI_KEY_MENU,            false },  // item not defined in utilX
+
+  // Now the key names are used as literal string not defined symbols,
+  // since these definition in utilX.h is deprecated and we're guided not to use them
+  { "XF86Camera",            DALI_KEY_CAMERA,          false },
+  { "XF86Camera_Full",       DALI_KEY_CONFIG,          false },
+  { "XF86PowerOff",          DALI_KEY_POWER,           true  },
+  { "XF86Standby",           DALI_KEY_PAUSE,           false },
+  { "Cancel",                DALI_KEY_CANCEL,          false },
+  { "XF86AudioPlay",         DALI_KEY_PLAY_CD,         false },
+  { "XF86AudioStop",         DALI_KEY_STOP_CD,         false },
+  { "XF86AudioPause",        DALI_KEY_PAUSE_CD,        false },
+  { "XF86AudioNext",         DALI_KEY_NEXT_SONG,       false },
+  { "XF86AudioPrev",         DALI_KEY_PREVIOUS_SONG,   false },
+  { "XF86AudioRewind",       DALI_KEY_REWIND,          false },
+  { "XF86AudioForward",      DALI_KEY_FASTFORWARD,     false },
+  { "XF86AudioMedia",        DALI_KEY_MEDIA,           false },
+  { "XF86AudioPlayPause",    DALI_KEY_PLAY_PAUSE,      false },
+  { "XF86AudioMute",         DALI_KEY_MUTE,            false },
+  { "XF86Menu",              DALI_KEY_MENU,            true  },
+  { "XF86Home",              DALI_KEY_HOME,            true  },
+  { "XF86Back",              DALI_KEY_BACK,            true  },
+  { "XF86HomePage",          DALI_KEY_HOMEPAGE,        false },
+  { "XF86WWW",               DALI_KEY_WEBPAGE,         false },
+  { "XF86Mail",              DALI_KEY_MAIL,            false },
+  { "XF86ScreenSaver",       DALI_KEY_SCREENSAVER,     false },
+  { "XF86MonBrightnessUp",   DALI_KEY_BRIGHTNESS_UP,   false },
+  { "XF86MonBrightnessDown", DALI_KEY_BRIGHTNESS_DOWN, false },
+  { "XF86SoftKBD",           DALI_KEY_SOFT_KBD,        false },
+  { "XF86QuickPanel",        DALI_KEY_QUICK_PANEL,     false },
+  { "XF86TaskPane",          DALI_KEY_TASK_SWITCH,     false },
+  { "XF86Apps",              DALI_KEY_APPS,            false },
+  { "XF86Search",            DALI_KEY_SEARCH,          false },
+  { "XF86Voice",             DALI_KEY_VOICE,           false },
+  { "Hangul",                DALI_KEY_LANGUAGE,        false },
+  { "XF86AudioRaiseVolume",  DALI_KEY_VOLUME_UP,       true  },
+  { "XF86AudioLowerVolume",  DALI_KEY_VOLUME_DOWN,     true  },
 };
 const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));