| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/ozone/platform/caca/caca_event_source.h" | 5 #include "ui/ozone/platform/caca/caca_event_source.h" |
| 6 | 6 |
| 7 #include <caca.h> | 7 #include <caca.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
| 12 #include "ui/events/event_utils.h" |
| 12 #include "ui/events/keycodes/keyboard_codes.h" | 13 #include "ui/events/keycodes/keyboard_codes.h" |
| 13 #include "ui/ozone/platform/caca/caca_window.h" | 14 #include "ui/ozone/platform/caca/caca_window.h" |
| 14 | 15 |
| 15 namespace ui { | 16 namespace ui { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 ui::KeyboardCode GetKeyboardCode(const caca_event_t& event) { | 20 ui::KeyboardCode GetKeyboardCode(const caca_event_t& event) { |
| 20 // List of special mappings the Caca provides. | 21 // List of special mappings the Caca provides. |
| 21 static const ui::KeyboardCode kCacaKeyMap[] = { | 22 static const ui::KeyboardCode kCacaKeyMap[] = { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 changed_flags = ModifierFromButton(*event); | 209 changed_flags = ModifierFromButton(*event); |
| 209 modifier_flags_ |= changed_flags; | 210 modifier_flags_ |= changed_flags; |
| 210 } else { | 211 } else { |
| 211 modifier_flags_ &= ~changed_flags; | 212 modifier_flags_ &= ~changed_flags; |
| 212 } | 213 } |
| 213 // On release the button pressed is removed from |modifier_flags_|, | 214 // On release the button pressed is removed from |modifier_flags_|, |
| 214 // but sending the event needs it set. | 215 // but sending the event needs it set. |
| 215 flags = modifier_flags_ | changed_flags; | 216 flags = modifier_flags_ | changed_flags; |
| 216 } | 217 } |
| 217 gfx::PointF location = TranslateLocation(last_cursor_location_, window); | 218 gfx::PointF location = TranslateLocation(last_cursor_location_, window); |
| 218 ui::MouseEvent mouse_event( | 219 ui::MouseEvent mouse_event(type, location, location, EventTimeForNow(), |
| 219 type, location, location, flags, changed_flags); | 220 flags, changed_flags); |
| 220 window->OnCacaEvent(&mouse_event); | 221 window->OnCacaEvent(&mouse_event); |
| 221 break; | 222 break; |
| 222 } | 223 } |
| 223 default: | 224 default: |
| 224 NOTIMPLEMENTED(); | 225 NOTIMPLEMENTED(); |
| 225 break; | 226 break; |
| 226 } | 227 } |
| 227 } | 228 } |
| 228 | 229 |
| 229 } // namespace ui | 230 } // namespace ui |
| OLD | NEW |