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 "ash/host/ash_window_tree_host_x11.h" | 5 #include "ash/host/ash_window_tree_host_x11.h" |
6 | 6 |
7 #include <X11/extensions/Xfixes.h> | 7 #include <X11/extensions/Xfixes.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "ash/host/ash_window_tree_host_init_params.h" | 15 #include "ash/host/ash_window_tree_host_init_params.h" |
16 #include "ash/host/ash_window_tree_host_unified.h" | 16 #include "ash/host/ash_window_tree_host_unified.h" |
17 #include "ash/host/root_window_transformer.h" | 17 #include "ash/host/root_window_transformer.h" |
| 18 #include "ash/ime/input_method_event_handler.h" |
18 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
19 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
20 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
22 #include "ui/aura/window_event_dispatcher.h" | 23 #include "ui/aura/window_event_dispatcher.h" |
23 #include "ui/base/x/x11_util.h" | 24 #include "ui/base/x/x11_util.h" |
24 #include "ui/events/devices/device_data_manager.h" | 25 #include "ui/events/devices/device_data_manager.h" |
25 #include "ui/events/devices/x11/device_list_cache_x11.h" | 26 #include "ui/events/devices/x11/device_list_cache_x11.h" |
26 #include "ui/events/devices/x11/touch_factory_x11.h" | 27 #include "ui/events/devices/x11/touch_factory_x11.h" |
27 #include "ui/events/event.h" | 28 #include "ui/events/event.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 default: | 229 default: |
229 return true; | 230 return true; |
230 } | 231 } |
231 } | 232 } |
232 void AshWindowTreeHostX11::TranslateAndDispatchLocatedEvent( | 233 void AshWindowTreeHostX11::TranslateAndDispatchLocatedEvent( |
233 ui::LocatedEvent* event) { | 234 ui::LocatedEvent* event) { |
234 TranslateLocatedEvent(event); | 235 TranslateLocatedEvent(event); |
235 SendEventToProcessor(event); | 236 SendEventToProcessor(event); |
236 } | 237 } |
237 | 238 |
| 239 bool AshWindowTreeHostX11::DispatchKeyEventPostIME(const ui::KeyEvent& event) { |
| 240 ui::KeyEvent event_copy(event); |
| 241 input_method_handler()->SetPostIME(true); |
| 242 ui::EventSource::DeliverEventToProcessor(&event_copy); |
| 243 input_method_handler()->SetPostIME(false); |
| 244 return event_copy.handled(); |
| 245 } |
| 246 |
| 247 ui::EventDispatchDetails AshWindowTreeHostX11::DeliverEventToProcessor( |
| 248 ui::Event* event) { |
| 249 return ui::EventSource::DeliverEventToProcessor(event); |
| 250 } |
| 251 |
238 #if defined(OS_CHROMEOS) | 252 #if defined(OS_CHROMEOS) |
239 void AshWindowTreeHostX11::SetCrOSTapPaused(bool state) { | 253 void AshWindowTreeHostX11::SetCrOSTapPaused(bool state) { |
240 if (!ui::IsXInput2Available()) | 254 if (!ui::IsXInput2Available()) |
241 return; | 255 return; |
242 // Temporarily pause tap-to-click when the cursor is hidden. | 256 // Temporarily pause tap-to-click when the cursor is hidden. |
243 Atom prop = atom_cache()->GetAtom("Tap Paused"); | 257 Atom prop = atom_cache()->GetAtom("Tap Paused"); |
244 unsigned char value = state; | 258 unsigned char value = state; |
245 const XIDeviceList& dev_list = | 259 const XIDeviceList& dev_list = |
246 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(xdisplay()); | 260 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(xdisplay()); |
247 | 261 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 #endif | 295 #endif |
282 | 296 |
283 AshWindowTreeHost* AshWindowTreeHost::Create( | 297 AshWindowTreeHost* AshWindowTreeHost::Create( |
284 const AshWindowTreeHostInitParams& init_params) { | 298 const AshWindowTreeHostInitParams& init_params) { |
285 if (init_params.offscreen) | 299 if (init_params.offscreen) |
286 return new AshWindowTreeHostUnified(init_params.initial_bounds); | 300 return new AshWindowTreeHostUnified(init_params.initial_bounds); |
287 return new AshWindowTreeHostX11(init_params.initial_bounds); | 301 return new AshWindowTreeHostX11(init_params.initial_bounds); |
288 } | 302 } |
289 | 303 |
290 } // namespace ash | 304 } // namespace ash |
OLD | NEW |