| 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> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/display/screen.h" | 23 #include "ui/display/screen.h" |
| 24 #include "ui/display/types/display_constants.h" | 24 #include "ui/display/types/display_constants.h" |
| 25 #include "ui/events/devices/device_data_manager.h" | 25 #include "ui/events/devices/device_data_manager.h" |
| 26 #include "ui/events/devices/x11/device_list_cache_x11.h" | 26 #include "ui/events/devices/x11/device_list_cache_x11.h" |
| 27 #include "ui/events/devices/x11/touch_factory_x11.h" | 27 #include "ui/events/devices/x11/touch_factory_x11.h" |
| 28 #include "ui/events/event.h" | 28 #include "ui/events/event.h" |
| 29 #include "ui/events/event_utils.h" | 29 #include "ui/events/event_utils.h" |
| 30 #include "ui/events/null_event_targeter.h" | 30 #include "ui/events/null_event_targeter.h" |
| 31 #include "ui/events/platform/platform_event_source.h" | 31 #include "ui/events/platform/platform_event_source.h" |
| 32 #include "ui/gfx/geometry/rect.h" | 32 #include "ui/gfx/geometry/rect.h" |
| 33 #include "ui/gfx/x/x11_atom_cache.h" |
| 33 | 34 |
| 34 namespace ash { | 35 namespace ash { |
| 35 | 36 |
| 36 AshWindowTreeHostX11::AshWindowTreeHostX11(const gfx::Rect& initial_bounds) | 37 AshWindowTreeHostX11::AshWindowTreeHostX11(const gfx::Rect& initial_bounds) |
| 37 : WindowTreeHostX11(initial_bounds), transformer_helper_(this) { | 38 : WindowTreeHostX11(initial_bounds), transformer_helper_(this) { |
| 38 transformer_helper_.Init(); | 39 transformer_helper_.Init(); |
| 39 aura::Env::GetInstance()->AddObserver(this); | 40 aura::Env::GetInstance()->AddObserver(this); |
| 40 } | 41 } |
| 41 | 42 |
| 42 AshWindowTreeHostX11::~AshWindowTreeHostX11() { | 43 AshWindowTreeHostX11::~AshWindowTreeHostX11() { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 void AshWindowTreeHostX11::TranslateAndDispatchLocatedEvent( | 210 void AshWindowTreeHostX11::TranslateAndDispatchLocatedEvent( |
| 210 ui::LocatedEvent* event) { | 211 ui::LocatedEvent* event) { |
| 211 TranslateLocatedEvent(event); | 212 TranslateLocatedEvent(event); |
| 212 SendEventToSink(event); | 213 SendEventToSink(event); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void AshWindowTreeHostX11::SetCrOSTapPaused(bool state) { | 216 void AshWindowTreeHostX11::SetCrOSTapPaused(bool state) { |
| 216 if (!ui::IsXInput2Available()) | 217 if (!ui::IsXInput2Available()) |
| 217 return; | 218 return; |
| 218 // Temporarily pause tap-to-click when the cursor is hidden. | 219 // Temporarily pause tap-to-click when the cursor is hidden. |
| 219 Atom prop = atom_cache()->GetAtom("Tap Paused"); | 220 Atom prop = ui::X11AtomCache::GetInstance()->GetAtom("Tap Paused"); |
| 220 unsigned char value = state; | 221 unsigned char value = state; |
| 221 const XIDeviceList& dev_list = | 222 const XIDeviceList& dev_list = |
| 222 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(xdisplay()); | 223 ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(xdisplay()); |
| 223 | 224 |
| 224 // Only slave pointer devices could possibly have tap-paused property. | 225 // Only slave pointer devices could possibly have tap-paused property. |
| 225 for (int i = 0; i < dev_list.count; i++) { | 226 for (int i = 0; i < dev_list.count; i++) { |
| 226 if (dev_list[i].use == XISlavePointer) { | 227 if (dev_list[i].use == XISlavePointer) { |
| 227 Atom old_type; | 228 Atom old_type; |
| 228 int old_format; | 229 int old_format; |
| 229 unsigned long old_nvalues, bytes; | 230 unsigned long old_nvalues, bytes; |
| 230 unsigned char* data; | 231 unsigned char* data; |
| 231 int result = XIGetProperty(xdisplay(), dev_list[i].deviceid, prop, 0, 0, | 232 int result = XIGetProperty(xdisplay(), dev_list[i].deviceid, prop, 0, 0, |
| 232 False, AnyPropertyType, &old_type, &old_format, | 233 False, AnyPropertyType, &old_type, &old_format, |
| 233 &old_nvalues, &bytes, &data); | 234 &old_nvalues, &bytes, &data); |
| 234 if (result != Success) | 235 if (result != Success) |
| 235 continue; | 236 continue; |
| 236 XFree(data); | 237 XFree(data); |
| 237 XIChangeProperty(xdisplay(), dev_list[i].deviceid, prop, XA_INTEGER, 8, | 238 XIChangeProperty(xdisplay(), dev_list[i].deviceid, prop, XA_INTEGER, 8, |
| 238 PropModeReplace, &value, 1); | 239 PropModeReplace, &value, 1); |
| 239 } | 240 } |
| 240 } | 241 } |
| 241 } | 242 } |
| 242 | 243 |
| 243 } // namespace ash | 244 } // namespace ash |
| OLD | NEW |