PlatformKeyboardEventEfl.cpp [plain text]
#include "config.h"
#include "PlatformKeyboardEvent.h"
#include "EflKeyboardUtilities.h"
#include "NotImplemented.h"
#include "TextEncoding.h"
#include <Evas.h>
#include <wtf/CurrentTime.h>
namespace WebCore {
PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Down* event)
: PlatformEvent(PlatformEvent::KeyDown, evas_key_modifier_is_set(event->modifiers, "Shift"), evas_key_modifier_is_set(event->modifiers, "Control"), evas_key_modifier_is_set(event->modifiers, "Alt"), evas_key_modifier_is_set(event->modifiers, "Meta"), currentTime())
, m_text(String::fromUTF8(event->string))
, m_unmodifiedText(String::fromUTF8(event->string))
, m_keyIdentifier(keyIdentifierForEvasKeyName(String(event->key)))
, m_windowsVirtualKeyCode(windowsKeyCodeForEvasKeyName(String(event->key)))
, m_nativeVirtualKeyCode(0)
, m_macCharCode(0)
, m_autoRepeat(false)
, m_isKeypad(String(event->key).startsWith("KP_"))
, m_isSystemKey(false)
{
}
PlatformKeyboardEvent::PlatformKeyboardEvent(const Evas_Event_Key_Up* event)
: PlatformEvent(PlatformEvent::KeyUp, evas_key_modifier_is_set(event->modifiers, "Shift"), evas_key_modifier_is_set(event->modifiers, "Control"), evas_key_modifier_is_set(event->modifiers, "Alt"), evas_key_modifier_is_set(event->modifiers, "Meta"), currentTime())
, m_text(String::fromUTF8(event->string))
, m_unmodifiedText(String::fromUTF8(event->string))
, m_keyIdentifier(keyIdentifierForEvasKeyName(String(event->key)))
, m_windowsVirtualKeyCode(windowsKeyCodeForEvasKeyName(String(event->key)))
, m_nativeVirtualKeyCode(0)
, m_macCharCode(0)
, m_autoRepeat(false)
, m_isKeypad(String(event->key).startsWith("KP_"))
, m_isSystemKey(false)
{
}
void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool)
{
ASSERT(m_type == KeyDown);
m_type = type;
if (type == PlatformEvent::RawKeyDown) {
m_text = String();
m_unmodifiedText = String();
} else {
m_keyIdentifier = String();
m_windowsVirtualKeyCode = 0;
}
}
bool PlatformKeyboardEvent::currentCapsLockState()
{
notImplemented();
return false;
}
void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)
{
notImplemented();
shiftKey = false;
ctrlKey = false;
altKey = false;
metaKey = false;
}
}