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

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: Handle the problem in RootWindowHostX11 instead 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[1]); 763 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[1]);
764 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[2]); 764 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[2]);
765 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[3]); 765 XFixesDestroyPointerBarrier(xdisplay_, pointer_barriers_[3]);
766 pointer_barriers_.reset(); 766 pointer_barriers_.reset();
767 } 767 }
768 #endif 768 #endif
769 } 769 }
770 770
771 void RootWindowHostX11::OnCursorVisibilityChanged(bool show) { 771 void RootWindowHostX11::OnCursorVisibilityChanged(bool show) {
772 #if defined(OS_CHROMEOS) 772 #if defined(OS_CHROMEOS)
773 // Temporarily pause tap-to-click when the cursor is hidden. 773 SetCrOSTapPaused(!show);
774 Atom prop = atom_cache_.GetAtom("Tap Paused");
775 unsigned char value = !show;
776 XIDeviceList dev_list =
777 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_);
778
779 // Only slave pointer devices could possibly have tap-paused property.
780 for (int i = 0; i < dev_list.count; i++) {
781 if (dev_list[i].use == XISlavePointer) {
782 Atom old_type;
783 int old_format;
784 unsigned long old_nvalues, bytes;
785 unsigned char* data;
786 int result = XIGetProperty(xdisplay_, dev_list[i].deviceid, prop, 0, 0,
787 False, AnyPropertyType, &old_type, &old_format,
788 &old_nvalues, &bytes, &data);
789 if (result != Success)
790 continue;
791 XFree(data);
792 XIChangeProperty(xdisplay_, dev_list[i].deviceid, prop, XA_INTEGER, 8,
793 PropModeReplace, &value, 1);
794 }
795 }
796 #endif 774 #endif
797 } 775 }
798 776
799 void RootWindowHostX11::MoveCursorTo(const gfx::Point& location) { 777 void RootWindowHostX11::MoveCursorTo(const gfx::Point& location) {
800 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, 778 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0,
801 bounds_.x() + location.x(), 779 bounds_.x() + location.x(),
802 bounds_.y() + location.y()); 780 bounds_.y() + location.y());
803 } 781 }
804 782
805 void RootWindowHostX11::SetFocusWhenShown(bool focus_when_shown) { 783 void RootWindowHostX11::SetFocusWhenShown(bool focus_when_shown) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 void RootWindowHostX11::OnRootWindowInitialized(RootWindow* root_window) { 879 void RootWindowHostX11::OnRootWindowInitialized(RootWindow* root_window) {
902 // UpdateIsInternalDisplay relies on: 880 // UpdateIsInternalDisplay relies on:
903 // 1. delegate_ pointing to RootWindow - available after SetDelegate. 881 // 1. delegate_ pointing to RootWindow - available after SetDelegate.
904 // 2. RootWindow's kDisplayIdKey property set - available by the time 882 // 2. RootWindow's kDisplayIdKey property set - available by the time
905 // RootWindow::Init is called. 883 // RootWindow::Init is called.
906 // (set in DisplayManager::CreateRootWindowForDisplay) 884 // (set in DisplayManager::CreateRootWindowForDisplay)
907 // Ready when NotifyRootWindowInitialized is called from RootWindow::Init. 885 // Ready when NotifyRootWindowInitialized is called from RootWindow::Init.
908 if (!delegate_ || root_window != GetRootWindow()) 886 if (!delegate_ || root_window != GetRootWindow())
909 return; 887 return;
910 UpdateIsInternalDisplay(); 888 UpdateIsInternalDisplay();
889
890 // We have to enable Tap-to-click by default because the cursor is set to
891 // visible in Shell::InitRootWindowController.
mazda 2013/06/28 16:08:43 Should this be inside #if defined(OS_CHROMEOS)?
Shecky Lin 2013/07/01 04:34:36 Done.
892 SetCrOSTapPaused(false);
911 } 893 }
912 894
913 bool RootWindowHostX11::DispatchEventForRootWindow( 895 bool RootWindowHostX11::DispatchEventForRootWindow(
914 const base::NativeEvent& event) { 896 const base::NativeEvent& event) {
915 switch (event->type) { 897 switch (event->type) {
916 case ConfigureNotify: 898 case ConfigureNotify:
917 DCHECK_EQ(x_root_window_, event->xconfigure.event); 899 DCHECK_EQ(x_root_window_, event->xconfigure.event);
918 x_root_bounds_.SetRect(event->xconfigure.x, event->xconfigure.y, 900 x_root_bounds_.SetRect(event->xconfigure.x, event->xconfigure.y,
919 event->xconfigure.width, event->xconfigure.height); 901 event->xconfigure.width, event->xconfigure.height);
920 break; 902 break;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 return image.Pass(); 1063 return image.Pass();
1082 } 1064 }
1083 1065
1084 void RootWindowHostX11::UpdateIsInternalDisplay() { 1066 void RootWindowHostX11::UpdateIsInternalDisplay() {
1085 RootWindow* root_window = GetRootWindow(); 1067 RootWindow* root_window = GetRootWindow();
1086 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window); 1068 gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window);
1087 gfx::Display display = screen->GetDisplayNearestWindow(root_window); 1069 gfx::Display display = screen->GetDisplayNearestWindow(root_window);
1088 is_internal_display_ = display.IsInternal(); 1070 is_internal_display_ = display.IsInternal();
1089 } 1071 }
1090 1072
1073 void RootWindowHostX11::SetCrOSTapPaused(bool state) {
1074 LOG(ERROR) << "RootWindowHostX11::SetCrOSTapPaused";
mazda 2013/06/28 16:08:43 Is this debug code?
Shecky Lin 2013/07/01 04:34:36 Oops, sorry. Done.
1075 // Temporarily pause tap-to-click when the cursor is hidden.
1076 Atom prop = atom_cache_.GetAtom("Tap Paused");
1077 unsigned char value = state;
1078 XIDeviceList dev_list =
1079 ui::DeviceListCacheX::GetInstance()->GetXI2DeviceList(xdisplay_);
1080
1081 // Only slave pointer devices could possibly have tap-paused property.
1082 for (int i = 0; i < dev_list.count; i++) {
1083 if (dev_list[i].use == XISlavePointer) {
1084 Atom old_type;
1085 int old_format;
1086 unsigned long old_nvalues, bytes;
1087 unsigned char* data;
1088 int result = XIGetProperty(xdisplay_, dev_list[i].deviceid, prop, 0, 0,
1089 False, AnyPropertyType, &old_type, &old_format,
1090 &old_nvalues, &bytes, &data);
1091 if (result != Success)
1092 continue;
1093 XFree(data);
1094 XIChangeProperty(xdisplay_, dev_list[i].deviceid, prop, XA_INTEGER, 8,
1095 PropModeReplace, &value, 1);
1096 }
1097 }
1098 }
1099
1091 // static 1100 // static
1092 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) { 1101 RootWindowHost* RootWindowHost::Create(const gfx::Rect& bounds) {
1093 return new RootWindowHostX11(bounds); 1102 return new RootWindowHostX11(bounds);
1094 } 1103 }
1095 1104
1096 // static 1105 // static
1097 gfx::Size RootWindowHost::GetNativeScreenSize() { 1106 gfx::Size RootWindowHost::GetNativeScreenSize() {
1098 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); 1107 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay();
1099 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); 1108 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
1100 } 1109 }
1101 1110
1102 namespace test { 1111 namespace test {
1103 1112
1104 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { 1113 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) {
1105 default_override_redirect = override_redirect; 1114 default_override_redirect = override_redirect;
1106 } 1115 }
1107 1116
1108 } // namespace test 1117 } // namespace test
1109 } // namespace aura 1118 } // 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