Chromium Code Reviews| Index: ui/aura/root_window_host_x11.cc |
| diff --git a/ui/aura/root_window_host_x11.cc b/ui/aura/root_window_host_x11.cc |
| index 49b6d62ade70f5a3ca4e95ac317568f67ee78040..b8b174f90fbd01f51725bde7cf503af58252aa9c 100644 |
| --- a/ui/aura/root_window_host_x11.cc |
| +++ b/ui/aura/root_window_host_x11.cc |
| @@ -771,29 +771,7 @@ void RootWindowHostX11::UnConfineCursor() { |
| void RootWindowHostX11::OnCursorVisibilityChanged(bool show) { |
| #if defined(OS_CHROMEOS) |
| - // Temporarily pause tap-to-click when the cursor is hidden. |
| - Atom prop = atom_cache_.GetAtom("Tap Paused"); |
| - unsigned char value = !show; |
| - XIDeviceList dev_list = |
| - ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_); |
| - |
| - // Only slave pointer devices could possibly have tap-paused property. |
| - for (int i = 0; i < dev_list.count; i++) { |
| - if (dev_list[i].use == XISlavePointer) { |
| - Atom old_type; |
| - int old_format; |
| - unsigned long old_nvalues, bytes; |
| - unsigned char* data; |
| - int result = XIGetProperty(xdisplay_, dev_list[i].deviceid, prop, 0, 0, |
| - False, AnyPropertyType, &old_type, &old_format, |
| - &old_nvalues, &bytes, &data); |
| - if (result != Success) |
| - continue; |
| - XFree(data); |
| - XIChangeProperty(xdisplay_, dev_list[i].deviceid, prop, XA_INTEGER, 8, |
| - PropModeReplace, &value, 1); |
| - } |
| - } |
| + SetCrOSTapPaused(!show); |
| #endif |
| } |
| @@ -909,6 +887,12 @@ void RootWindowHostX11::OnRootWindowInitialized(RootWindow* root_window) { |
| if (!delegate_ || root_window != GetRootWindow()) |
| return; |
| UpdateIsInternalDisplay(); |
| + |
| +#if defined(OS_CHROMEOS) |
| + // We have to enable Tap-to-click by default because the cursor is set to |
| + // visible in Shell::InitRootWindowController. |
| + SetCrOSTapPaused(false); |
| +#endif |
| } |
| bool RootWindowHostX11::DispatchEventForRootWindow( |
| @@ -1089,6 +1073,32 @@ void RootWindowHostX11::UpdateIsInternalDisplay() { |
| is_internal_display_ = display.IsInternal(); |
| } |
| +void RootWindowHostX11::SetCrOSTapPaused(bool state) { |
|
sky
2013/07/01 14:04:26
Can you put the ifdef in this method (similar to O
Shecky Lin
2013/07/02 03:50:30
Done.
|
| + // Temporarily pause tap-to-click when the cursor is hidden. |
| + Atom prop = atom_cache_.GetAtom("Tap Paused"); |
| + unsigned char value = state; |
| + XIDeviceList dev_list = |
| + ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_); |
| + |
| + // Only slave pointer devices could possibly have tap-paused property. |
| + for (int i = 0; i < dev_list.count; i++) { |
| + if (dev_list[i].use == XISlavePointer) { |
| + Atom old_type; |
| + int old_format; |
| + unsigned long old_nvalues, bytes; |
| + unsigned char* data; |
| + int result = XIGetProperty(xdisplay_, dev_list[i].deviceid, prop, 0, 0, |
| + False, AnyPropertyType, &old_type, &old_format, |
| + &old_nvalues, &bytes, &data); |
| + if (result != Success) |
| + continue; |
| + XFree(data); |
| + XIChangeProperty(xdisplay_, dev_list[i].deviceid, prop, XA_INTEGER, 8, |
| + PropModeReplace, &value, 1); |
| + } |
| + } |
| +} |
| + |
| // static |
| RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) { |
| return new RootWindowHostX11(bounds); |