Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
- index e068604..933b6ce 100644
- --- a/ui/base/BUILD.gn
- +++ b/ui/base/BUILD.gn
- @@ -251,6 +251,7 @@ component("base") {
- "theme_provider.cc",
- "theme_provider.h",
- "touch/touch_device.h",
- + "touch/touch_device_util.cc",
- "touch/touch_editing_controller.cc",
- "touch/touch_editing_controller.h",
- "ui_base_export.h",
- @@ -357,6 +358,7 @@ component("base") {
- sources += [ "touch/touch_device_win.cc" ]
- } else if (is_android) {
- sources += [ "touch/touch_device_android.cc" ]
- + sources -= [ "touch/touch_device_util.cc" ]
- } else if (is_ios) {
- sources += [ "touch/touch_device_ios.cc" ]
- } else if (is_linux) {
- diff --git a/ui/base/touch/touch_device.h b/ui/base/touch/touch_device.h
- index 7b1b65f..18daecb 100644
- --- a/ui/base/touch/touch_device.h
- +++ b/ui/base/touch/touch_device.h
- @@ -61,6 +61,8 @@ enum HoverType {
- HOVER_TYPE_LAST = HOVER_TYPE_HOVER
- };
- +int GetAvailablePointerTypes();
- +int GetAvailableHoverTypes();
- UI_BASE_EXPORT std::pair<int, int> GetAvailablePointerAndHoverTypes();
- UI_BASE_EXPORT void SetAvailablePointerAndHoverTypesForTesting(
- int available_pointer_types,
- diff --git a/ui/base/touch/touch_device_linux.cc b/ui/base/touch/touch_device_linux.cc
- index b555a3c..3452aa3 100644
- --- a/ui/base/touch/touch_device_linux.cc
- +++ b/ui/base/touch/touch_device_linux.cc
- @@ -29,6 +29,8 @@ bool isMouseOrTouchpadPresent() {
- return false;
- }
- +} // namespace
- +
- int GetAvailablePointerTypes() {
- int available_pointer_types = 0;
- if (isMouseOrTouchpadPresent())
- @@ -45,11 +47,12 @@ int GetAvailablePointerTypes() {
- }
- int GetAvailableHoverTypes() {
- - return isMouseOrTouchpadPresent() ? HOVER_TYPE_HOVER : HOVER_TYPE_NONE;
- + int available_hover_types = HOVER_TYPE_HOVER;
- + if (isMouseOrTouchpadPresent())
- + available_hover_types |= HOVER_TYPE_HOVER;
- + return available_hover_types;
- }
- -} // namespace
- -
- TouchScreensAvailability GetTouchScreensAvailability() {
- if (!IsTouchDevicePresent())
- return TouchScreensAvailability::NONE;
- @@ -70,24 +73,6 @@ int MaxTouchPoints() {
- return max_touch;
- }
- -bool return_available_pointer_and_hover_types_for_testing = false;
- -int available_pointer_types_for_testing = POINTER_TYPE_NONE;
- -int available_hover_types_for_testing = HOVER_TYPE_NONE;
- -
- -void SetAvailablePointerAndHoverTypesForTesting(int available_pointer_types,
- - int available_hover_types) {
- - return_available_pointer_and_hover_types_for_testing = true;
- - available_pointer_types_for_testing = available_pointer_types;
- - available_hover_types_for_testing = available_hover_types;
- -}
- -
- -std::pair<int, int> GetAvailablePointerAndHoverTypes() {
- - if (return_available_pointer_and_hover_types_for_testing)
- - return std::make_pair(available_pointer_types_for_testing,
- - available_hover_types_for_testing);
- - return std::make_pair(GetAvailablePointerTypes(), GetAvailableHoverTypes());
- -}
- -
- PointerType GetPrimaryPointerType(int available_pointer_types) {
- if (available_pointer_types & POINTER_TYPE_FINE)
- return POINTER_TYPE_FINE;
- diff --git a/ui/base/touch/touch_device_win.cc b/ui/base/touch/touch_device_win.cc
- index 3ccbb1b..3ff8b53 100644
- --- a/ui/base/touch/touch_device_win.cc
- +++ b/ui/base/touch/touch_device_win.cc
- @@ -17,6 +17,8 @@ bool IsTouchDevicePresent() {
- ((value & NID_INTEGRATED_TOUCH) || (value & NID_EXTERNAL_TOUCH));
- }
- +} // namespace
- +
- // The following method logic is as follow :
- // - On versions prior to Windows 8 it will always return POINTER_TYPE_FINE
- // and/or POINTER_TYPE_COARSE (if the device has a touch screen).
- @@ -65,8 +67,6 @@ int GetAvailableHoverTypes() {
- return available_hover_types;
- }
- -} // namespace
- -
- TouchScreensAvailability GetTouchScreensAvailability() {
- if (!IsTouchDevicePresent())
- return TouchScreensAvailability::NONE;
- @@ -97,22 +97,4 @@ HoverType GetPrimaryHoverType(int available_hover_types) {
- return HOVER_TYPE_NONE;
- }
- -bool return_available_pointer_and_hover_types_for_testing = false;
- -int available_pointer_types_for_testing = POINTER_TYPE_NONE;
- -int available_hover_types_for_testing = HOVER_TYPE_NONE;
- -
- -void SetAvailablePointerAndHoverTypesForTesting(int available_pointer_types,
- - int available_hover_types) {
- - return_available_pointer_and_hover_types_for_testing = true;
- - available_pointer_types_for_testing = available_pointer_types;
- - available_hover_types_for_testing = available_hover_types;
- -}
- -
- -std::pair<int, int> GetAvailablePointerAndHoverTypes() {
- - if (return_available_pointer_and_hover_types_for_testing)
- - return std::make_pair(available_pointer_types_for_testing,
- - available_hover_types_for_testing);
- - return std::make_pair(GetAvailablePointerTypes(), GetAvailableHoverTypes());
- -}
- -
- } // namespace ui
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement