| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. | 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 typedef struct _GdkEventKey GdkEventKey; | 42 typedef struct _GdkEventKey GdkEventKey; |
| 43 #include "CompositionResults.h" | 43 #include "CompositionResults.h" |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 #if PLATFORM(QT) | 46 #if PLATFORM(QT) |
| 47 QT_BEGIN_NAMESPACE | 47 QT_BEGIN_NAMESPACE |
| 48 class QKeyEvent; | 48 class QKeyEvent; |
| 49 QT_END_NAMESPACE | 49 QT_END_NAMESPACE |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 #if PLATFORM(BLACKBERRY) | |
| 53 namespace BlackBerry { | |
| 54 namespace Platform { | |
| 55 class KeyboardEvent; | |
| 56 } | |
| 57 } | |
| 58 #endif | |
| 59 | |
| 60 namespace WebCore { | 52 namespace WebCore { |
| 61 | 53 |
| 62 class PlatformKeyboardEvent : public PlatformEvent { | 54 class PlatformKeyboardEvent : public PlatformEvent { |
| 63 WTF_MAKE_FAST_ALLOCATED; | 55 WTF_MAKE_FAST_ALLOCATED; |
| 64 public: | 56 public: |
| 65 PlatformKeyboardEvent() | 57 PlatformKeyboardEvent() |
| 66 : PlatformEvent(PlatformEvent::KeyDown) | 58 : PlatformEvent(PlatformEvent::KeyDown) |
| 67 , m_windowsVirtualKeyCode(0) | 59 , m_windowsVirtualKeyCode(0) |
| 68 , m_nativeVirtualKeyCode(0) | 60 , m_nativeVirtualKeyCode(0) |
| 69 , m_macCharCode(0) | 61 , m_macCharCode(0) |
| 70 , m_autoRepeat(false) | 62 , m_autoRepeat(false) |
| 71 , m_isKeypad(false) | 63 , m_isKeypad(false) |
| 72 , m_isSystemKey(false) | 64 , m_isSystemKey(false) |
| 73 #if PLATFORM(BLACKBERRY) | |
| 74 , m_unmodifiedCharacter(0) | |
| 75 #endif | |
| 76 #if PLATFORM(GTK) | 65 #if PLATFORM(GTK) |
| 77 , m_gdkEventKey(0) | 66 , m_gdkEventKey(0) |
| 78 #endif | 67 #endif |
| 79 #if PLATFORM(QT) | 68 #if PLATFORM(QT) |
| 80 , m_qtEvent(0) | 69 , m_qtEvent(0) |
| 81 #endif | 70 #endif |
| 82 { | 71 { |
| 83 } | 72 } |
| 84 | 73 |
| 85 PlatformKeyboardEvent(Type type, const String& text, const String& unmod
ifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVir
tualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey
, Modifiers modifiers, double timestamp) | 74 PlatformKeyboardEvent(Type type, const String& text, const String& unmod
ifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVir
tualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey
, Modifiers modifiers, double timestamp) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; } | 110 int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; } |
| 122 int macCharCode() const { return m_macCharCode; } | 111 int macCharCode() const { return m_macCharCode; } |
| 123 | 112 |
| 124 bool isAutoRepeat() const { return m_autoRepeat; } | 113 bool isAutoRepeat() const { return m_autoRepeat; } |
| 125 bool isKeypad() const { return m_isKeypad; } | 114 bool isKeypad() const { return m_isKeypad; } |
| 126 bool isSystemKey() const { return m_isSystemKey; } | 115 bool isSystemKey() const { return m_isSystemKey; } |
| 127 | 116 |
| 128 static bool currentCapsLockState(); | 117 static bool currentCapsLockState(); |
| 129 static void getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool&
altKey, bool& metaKey); | 118 static void getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool&
altKey, bool& metaKey); |
| 130 | 119 |
| 131 #if PLATFORM(BLACKBERRY) | |
| 132 unsigned unmodifiedCharacter() const { return m_unmodifiedCharacter; } | |
| 133 #endif | |
| 134 | |
| 135 #if PLATFORM(MAC) | 120 #if PLATFORM(MAC) |
| 136 NSEvent* macEvent() const { return m_macEvent.get(); } | 121 NSEvent* macEvent() const { return m_macEvent.get(); } |
| 137 #endif | 122 #endif |
| 138 | 123 |
| 139 #if PLATFORM(WIN) | 124 #if PLATFORM(WIN) |
| 140 PlatformKeyboardEvent(HWND, WPARAM, LPARAM, Type, bool); | 125 PlatformKeyboardEvent(HWND, WPARAM, LPARAM, Type, bool); |
| 141 #endif | 126 #endif |
| 142 | 127 |
| 143 #if PLATFORM(GTK) | 128 #if PLATFORM(GTK) |
| 144 PlatformKeyboardEvent(GdkEventKey*, const CompositionResults&); | 129 PlatformKeyboardEvent(GdkEventKey*, const CompositionResults&); |
| 145 GdkEventKey* gdkEventKey() const { return m_gdkEventKey; } | 130 GdkEventKey* gdkEventKey() const { return m_gdkEventKey; } |
| 146 const CompositionResults& compositionResults() const { return m_composit
ionResults; } | 131 const CompositionResults& compositionResults() const { return m_composit
ionResults; } |
| 147 | 132 |
| 148 // Used by WebKit2 | 133 // Used by WebKit2 |
| 149 static String keyIdentifierForGdkKeyCode(unsigned); | 134 static String keyIdentifierForGdkKeyCode(unsigned); |
| 150 static int windowsKeyCodeForGdkKeyCode(unsigned); | 135 static int windowsKeyCodeForGdkKeyCode(unsigned); |
| 151 static String singleCharacterString(unsigned); | 136 static String singleCharacterString(unsigned); |
| 152 #endif | 137 #endif |
| 153 | 138 |
| 154 #if PLATFORM(QT) | 139 #if PLATFORM(QT) |
| 155 PlatformKeyboardEvent(QKeyEvent*); | 140 PlatformKeyboardEvent(QKeyEvent*); |
| 156 QKeyEvent* qtEvent() const { return m_qtEvent; } | 141 QKeyEvent* qtEvent() const { return m_qtEvent; } |
| 157 uint32_t nativeModifiers() const; | 142 uint32_t nativeModifiers() const; |
| 158 uint32_t nativeScanCode() const; | 143 uint32_t nativeScanCode() const; |
| 159 #endif | 144 #endif |
| 160 | 145 |
| 161 #if PLATFORM(BLACKBERRY) | |
| 162 PlatformKeyboardEvent(const BlackBerry::Platform::KeyboardEvent&); | |
| 163 #endif | |
| 164 | |
| 165 protected: | 146 protected: |
| 166 String m_text; | 147 String m_text; |
| 167 String m_unmodifiedText; | 148 String m_unmodifiedText; |
| 168 String m_keyIdentifier; | 149 String m_keyIdentifier; |
| 169 int m_windowsVirtualKeyCode; | 150 int m_windowsVirtualKeyCode; |
| 170 int m_nativeVirtualKeyCode; | 151 int m_nativeVirtualKeyCode; |
| 171 int m_macCharCode; | 152 int m_macCharCode; |
| 172 bool m_autoRepeat; | 153 bool m_autoRepeat; |
| 173 bool m_isKeypad; | 154 bool m_isKeypad; |
| 174 bool m_isSystemKey; | 155 bool m_isSystemKey; |
| 175 | 156 |
| 176 #if PLATFORM(BLACKBERRY) | |
| 177 unsigned m_unmodifiedCharacter; | |
| 178 #endif | |
| 179 | |
| 180 #if PLATFORM(MAC) | 157 #if PLATFORM(MAC) |
| 181 RetainPtr<NSEvent> m_macEvent; | 158 RetainPtr<NSEvent> m_macEvent; |
| 182 #endif | 159 #endif |
| 183 #if PLATFORM(GTK) | 160 #if PLATFORM(GTK) |
| 184 GdkEventKey* m_gdkEventKey; | 161 GdkEventKey* m_gdkEventKey; |
| 185 CompositionResults m_compositionResults; | 162 CompositionResults m_compositionResults; |
| 186 #endif | 163 #endif |
| 187 #if PLATFORM(QT) | 164 #if PLATFORM(QT) |
| 188 QKeyEvent* m_qtEvent; | 165 QKeyEvent* m_qtEvent; |
| 189 #endif | 166 #endif |
| 190 }; | 167 }; |
| 191 | 168 |
| 192 #if PLATFORM(QT) | 169 #if PLATFORM(QT) |
| 193 // Used by WebKit2. | 170 // Used by WebKit2. |
| 194 String keyIdentifierForQtKeyCode(int keyCode); | 171 String keyIdentifierForQtKeyCode(int keyCode); |
| 195 int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad = false); | 172 int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad = false); |
| 196 #endif | 173 #endif |
| 197 | 174 |
| 198 } // namespace WebCore | 175 } // namespace WebCore |
| 199 | 176 |
| 200 #endif // PlatformKeyboardEvent_h | 177 #endif // PlatformKeyboardEvent_h |
| OLD | NEW |