OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/views/event.h" | 5 #include "chrome/views/event.h" |
6 | 6 |
| 7 #include <gdk/gdk.h> |
| 8 |
7 namespace views { | 9 namespace views { |
8 | 10 |
9 KeyEvent::KeyEvent(GdkEventKey* event) | 11 KeyEvent::KeyEvent(GdkEventKey* event) |
10 : Event(event->type == GDK_KEY_PRESS ? | 12 : Event(event->type == GDK_KEY_PRESS ? |
11 Event::ET_KEY_PRESSED : Event::ET_KEY_RELEASED, | 13 Event::ET_KEY_PRESSED : Event::ET_KEY_RELEASED, |
12 GetFlagsFromGdkState(event->state)), | 14 GetFlagsFromGdkState(event->state)), |
13 // TODO(erg): All these values are iffy. | 15 // TODO(erg): All these values are iffy. |
14 character_(event->keyval), | 16 character_(event->keyval), |
15 repeat_count_(0), | 17 repeat_count_(0), |
16 message_flags_(0) { | 18 message_flags_(0) { |
(...skipping 10 matching lines...) Expand all Loading... |
27 if (state & GDK_BUTTON1_MASK) | 29 if (state & GDK_BUTTON1_MASK) |
28 flags |= Event::EF_LEFT_BUTTON_DOWN; | 30 flags |= Event::EF_LEFT_BUTTON_DOWN; |
29 if (state & GDK_BUTTON2_MASK) | 31 if (state & GDK_BUTTON2_MASK) |
30 flags |= Event::EF_MIDDLE_BUTTON_DOWN; | 32 flags |= Event::EF_MIDDLE_BUTTON_DOWN; |
31 if (state & GDK_BUTTON3_MASK) | 33 if (state & GDK_BUTTON3_MASK) |
32 flags |= Event::EF_RIGHT_BUTTON_DOWN; | 34 flags |= Event::EF_RIGHT_BUTTON_DOWN; |
33 return flags; | 35 return flags; |
34 } | 36 } |
35 | 37 |
36 } // namespace views | 38 } // namespace views |
OLD | NEW |