diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-23 04:52:28 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-23 04:52:28 +0000 |
commit | ad4d54e931fe3b556cdd9e859a8654e4e6caed68 (patch) | |
tree | 21c52ff5eb99a9307cb8fb69d619ac9367581bef /views | |
parent | ffa3e486354ee6492eca27852a168506d285a8ad (diff) | |
download | chromium_src-ad4d54e931fe3b556cdd9e859a8654e4e6caed68.zip chromium_src-ad4d54e931fe3b556cdd9e859a8654e4e6caed68.tar.gz chromium_src-ad4d54e931fe3b556cdd9e859a8654e4e6caed68.tar.bz2 |
check xinput2 capability so that it runs on the system that doesn't support xinput2
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7495013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/touchui/touch_factory.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/views/touchui/touch_factory.cc b/views/touchui/touch_factory.cc index 2f3506f..6580228 100644 --- a/views/touchui/touch_factory.cc +++ b/views/touchui/touch_factory.cc @@ -14,6 +14,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/message_loop.h" #include "ui/base/x/x11_util.h" namespace { @@ -128,6 +129,11 @@ TouchFactory::TouchFactory() pointer_device_lookup_(), touch_device_list_(), slots_used_() { +#if defined(TOUCH_UI) + if (!base::MessagePumpForUI::HasXInput2()) + return; +#endif + char nodata[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; XColor black; black.red = black.green = black.blue = 0; @@ -161,6 +167,11 @@ TouchFactory::TouchFactory() } TouchFactory::~TouchFactory() { +#if defined(TOUCH_UI) + if (!base::MessagePumpForUI::HasXInput2()) + return; +#endif + SetCursorVisible(true, false); Display* display = ui::GetXDisplay(); XFreeCursor(display, invisible_cursor_); @@ -286,8 +297,11 @@ void TouchFactory::SetSlotUsed(int slot, bool used) { } bool TouchFactory::GrabTouchDevices(Display* display, ::Window window) { - if (touch_device_list_.empty()) +#if defined(TOUCH_UI) + if (!base::MessagePumpForUI::HasXInput2() || + touch_device_list_.empty()) return true; +#endif unsigned char mask[XIMaskLen(XI_LASTEVENT)]; bool success = true; @@ -313,6 +327,11 @@ bool TouchFactory::GrabTouchDevices(Display* display, ::Window window) { } bool TouchFactory::UngrabTouchDevices(Display* display) { +#if defined(TOUCH_UI) + if (!base::MessagePumpForUI::HasXInput2()) + return true; +#endif + bool success = true; for (std::vector<int>::const_iterator iter = touch_device_list_.begin(); @@ -324,6 +343,11 @@ bool TouchFactory::UngrabTouchDevices(Display* display) { } void TouchFactory::SetCursorVisible(bool show, bool start_timer) { +#if defined(TOUCH_UI) + if (!base::MessagePumpForUI::HasXInput2()) + return; +#endif + // The cursor is going to be shown. Reset the timer for hiding it. if (show && start_timer) { cursor_timer_.Stop(); |