Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: ui/aura/root_window_host_x11.cc

Issue 18043004: Set CrOS touchpad Tap Paused property to false during initialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src@git-svn
Patch Set: Address mazda@'s comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/aura/root_window_host_x11.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/root_window_host_x11.h" 5 #include "ui/aura/root_window_host_x11.h"
6 6
7 #include <strings.h> 7 #include <strings.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/Xfixes.h> 9 #include <X11/extensions/Xfixes.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[1]); 764 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[1]);
765 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[2]); 765 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[2]);
766 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[3]); 766 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[3]);
767 pointer_barriers_.reset(); 767 pointer_barriers_.reset();
768 } 768 }
769 #endif 769 #endif
770 } 770 }
771 771
772 void RootWindowHostX11::OnCursorVisibilityChanged(bool show) { 772 void RootWindowHostX11::OnCursorVisibilityChanged(bool show) {
773 #if defined(OS_CHROMEOS) 773 #if defined(OS_CHROMEOS)
774 // Temporarily pause tap-to-click when the cursor is hidden. 774 SetCrOSTapPaused(!show);
775 Atom prop = atom_cache_.GetAtom("Tap Paused");
776 unsigned char value = !show;
777 XIDeviceList dev_list =
778 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_);
779
780 // Only slave pointer devices could possibly have tap-paused property.
781 for (int i = 0; i < dev_list.count; i++) {
782 if (dev_list[i].use == XISlavePointer) {
783 Atom old_type;
784 int old_format;
785 unsigned long old_nvalues, bytes;
786 unsigned char* data;
787 int result = XIGetProperty(xdisplay_, dev_list[i].deviceid, prop, 0, 0,
788 False, AnyPropertyType, &old_type, &old_format,
789 &old_nvalues, &bytes, &data);
790 if (result != Success)
791 continue;
792 XFree(data);
793 XIChangeProperty(xdisplay_, dev_list[i].deviceid, prop, XA_INTEGER, 8,
794 PropModeReplace, &value, 1);
795 }
796 }
797 #endif 775 #endif
798 } 776 }
799 777
800 void RootWindowHostX11::MoveCursorTo(const gfx::Point& location) { 778 void RootWindowHostX11::MoveCursorTo(const gfx::Point& location) {
801 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, 779 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0,
802 bounds_.x() + location.x(), 780 bounds_.x() + location.x(),
803 bounds_.y() + location.y()); 781 bounds_.y() + location.y());
804 } 782 }
805 783
806 void RootWindowHostX11::SetFocusWhenShown(bool focus_when_shown) { 784 void RootWindowHostX11::SetFocusWhenShown(bool focus_when_shown) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 void RootWindowHostX11::OnRootWindowInitialized(RootWindow* root_window) { 880 void RootWindowHostX11::OnRootWindowInitialized(RootWindow* root_window) {
903 // UpdateIsInternalDisplay relies on: 881 // UpdateIsInternalDisplay relies on:
904 // 1. delegate_ pointing to RootWindow - available after SetDelegate. 882 // 1. delegate_ pointing to RootWindow - available after SetDelegate.
905 // 2. RootWindow's kDisplayIdKey property set - available by the time 883 // 2. RootWindow's kDisplayIdKey property set - available by the time
906 // RootWindow::Init is called. 884 // RootWindow::Init is called.
907 // (set in DisplayManager::CreateRootWindowForDisplay) 885 // (set in DisplayManager::CreateRootWindowForDisplay)
908 // Ready when NotifyRootWindowInitialized is called from RootWindow::Init. 886 // Ready when NotifyRootWindowInitialized is called from RootWindow::Init.
909 if (!delegate_ || root_window != GetRootWindow()) 887 if (!delegate_ || root_window != GetRootWindow())
910 return; 888 return;
911 UpdateIsInternalDisplay(); 889 UpdateIsInternalDisplay();
890
891 #if defined(OS_CHROMEOS)
892 // We have to enable Tap-to-click by default because the cursor is set to
893 // visible in Shell::InitRootWindowController.
894 SetCrOSTapPaused(false);
895 #endif
912 } 896 }
913 897
914 bool RootWindowHostX11::DispatchEventForRootWindow( 898 bool RootWindowHostX11::DispatchEventForRootWindow(
915 const base::NativeEvent& event) { 899 const base::NativeEvent& event) {
916 switch (event->type) { 900 switch (event->type) {
917 case ConfigureNotify: 901 case ConfigureNotify:
918 DCHECK_EQ(x_root_window_, event->xconfigure.event); 902 DCHECK_EQ(x_root_window_, event->xconfigure.event);
919 x_root_bounds_.SetRect(event->xconfigure.x, event->xconfigure.y, 903 x_root_bounds_.SetRect(event->xconfigure.x, event->xconfigure.y,
920 event->xconfigure.width, event->xconfigure.height); 904 event->xconfigure.width, event->xconfigure.height);
921 break; 905 break;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 return image.Pass(); 1066 return image.Pass();
1083 } 1067 }
1084 1068
1085 void RootWindowHostX11::UpdateIsInternalDisplay() { 1069 void RootWindowHostX11::UpdateIsInternalDisplay() {
1086 RootWindow* root_window = GetRootWindow(); 1070 RootWindow* root_window = GetRootWindow();
1087 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window); 1071 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window);
1088 gfx::Display display = screen->GetDisplayNearestWindow(root_window); 1072 gfx::Display display = screen->GetDisplayNearestWindow(root_window);
1089 is_internal_display_ = display.IsInternal(); 1073 is_internal_display_ = display.IsInternal();
1090 } 1074 }
1091 1075
1076 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.
1077 // Temporarily pause tap-to-click when the cursor is hidden.
1078 Atom prop = atom_cache_.GetAtom("Tap Paused");
1079 unsigned char value = state;
1080 XIDeviceList dev_list =
1081 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_);
1082
1083 // Only slave pointer devices could possibly have tap-paused property.
1084 for (int i = 0; i < dev_list.count; i++) {
1085 if (dev_list[i].use == XISlavePointer) {
1086 Atom old_type;
1087 int old_format;
1088 unsigned long old_nvalues, bytes;
1089 unsigned char* data;
1090 int result = XIGetProperty(xdisplay_, dev_list[i].deviceid, prop, 0, 0,
1091 False, AnyPropertyType, &old_type, &old_format,
1092 &old_nvalues, &bytes, &data);
1093 if (result != Success)
1094 continue;
1095 XFree(data);
1096 XIChangeProperty(xdisplay_, dev_list[i].deviceid, prop, XA_INTEGER, 8,
1097 PropModeReplace, &value, 1);
1098 }
1099 }
1100 }
1101
1092 // static 1102 // static
1093 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) { 1103 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
1094 return new RootWindowHostX11(bounds); 1104 return new RootWindowHostX11(bounds);
1095 } 1105 }
1096 1106
1097 // static 1107 // static
1098 gfx::Size RootWindowHost::GetNativeScreenSize() { 1108 gfx::Size RootWindowHost::GetNativeScreenSize() {
1099 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); 1109 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay();
1100 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); 1110 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
1101 } 1111 }
1102 1112
1103 namespace test { 1113 namespace test {
1104 1114
1105 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { 1115 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) {
1106 default_override_redirect = override_redirect; 1116 default_override_redirect = override_redirect;
1107 } 1117 }
1108 1118
1109 } // namespace test 1119 } // namespace test
1110 } // namespace aura 1120 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window_host_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698