OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "webkit/glue/webinputevent.h" | 7 #include "webkit/glue/webinputevent.h" |
8 | 8 |
9 #include "KeyboardCodes.h" | 9 #include "KeyboardCodes.h" |
10 #include "KeyCodeConversion.h" | 10 #include "KeyCodeConversion.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 delta_x = -kWheelDelta; | 132 delta_x = -kWheelDelta; |
133 break; | 133 break; |
134 case GDK_SCROLL_RIGHT: | 134 case GDK_SCROLL_RIGHT: |
135 delta_x = kWheelDelta; | 135 delta_x = kWheelDelta; |
136 break; | 136 break; |
137 default: | 137 default: |
138 break; | 138 break; |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 WebKeyboardEvent::WebKeyboardEvent(const GdkEventKey* event) { | 142 WebKeyboardEvent::WebKeyboardEvent(const GdkEventKey* event) |
| 143 : gdk_keyval(event->keyval), |
| 144 gdk_modifier(event->state) { |
143 modifiers = GdkStateToWebEventModifiers(event->state); | 145 modifiers = GdkStateToWebEventModifiers(event->state); |
144 | 146 |
145 // GDK only exposes key press and release events. By contrast, | 147 // GDK only exposes key press and release events. By contrast, |
146 // WebKeyboardEvent matches Windows and wants key down/up events along with a | 148 // WebKeyboardEvent matches Windows and wants key down/up events along with a |
147 // separate CHAR event. | 149 // separate CHAR event. |
148 // We require the caller to simulate the CHAR event manually. See | 150 // We require the caller to simulate the CHAR event manually. See |
149 // test_shell's webwidget_host for an example. | 151 // test_shell's webwidget_host for an example. |
150 switch (event->type) { | 152 switch (event->type) { |
151 case GDK_KEY_RELEASE: | 153 case GDK_KEY_RELEASE: |
152 type = KEY_UP; | 154 type = KEY_UP; |
(...skipping 20 matching lines...) Expand all Loading... |
173 text = '\r'; | 175 text = '\r'; |
174 break; | 176 break; |
175 default: | 177 default: |
176 // This should set text to 0 when it's not a real character. | 178 // This should set text to 0 when it's not a real character. |
177 text = gdk_keyval_to_unicode(event->keyval); | 179 text = gdk_keyval_to_unicode(event->keyval); |
178 break; | 180 break; |
179 } | 181 } |
180 | 182 |
181 // TODO(tc): Do we need to set IS_AUTO_REPEAT or IS_KEYPAD? | 183 // TODO(tc): Do we need to set IS_AUTO_REPEAT or IS_KEYPAD? |
182 } | 184 } |
OLD | NEW |