| Index: views/focus/accelerator_handler_touch.cc
|
| ===================================================================
|
| --- views/focus/accelerator_handler_touch.cc (revision 71884)
|
| +++ views/focus/accelerator_handler_touch.cc (working copy)
|
| @@ -15,12 +15,41 @@
|
| #include "views/accelerator.h"
|
| #include "views/event.h"
|
| #include "views/focus/focus_manager.h"
|
| -#include "views/touchui/touch_factory.h"
|
| #include "views/widget/root_view.h"
|
| #include "views/widget/widget_gtk.h"
|
|
|
| namespace views {
|
|
|
| +#if defined(HAVE_XINPUT2)
|
| +// Functions related to determining touch devices.
|
| +class TouchFactory {
|
| + public:
|
| + // Keep a list of touch devices so that it is possible to determine if a
|
| + // pointer event is a touch-event or a mouse-event.
|
| + static void SetTouchDeviceListInternal(
|
| + const std::vector<unsigned int>& devices) {
|
| + for (std::vector<unsigned int>::const_iterator iter = devices.begin();
|
| + iter != devices.end(); ++iter) {
|
| + DCHECK(*iter < touch_devices.size());
|
| + touch_devices[*iter] = true;
|
| + }
|
| + }
|
| +
|
| + // Is the device a touch-device?
|
| + static bool IsTouchDevice(unsigned int deviceid) {
|
| + return deviceid < touch_devices.size() ? touch_devices[deviceid] : false;
|
| + }
|
| +
|
| + private:
|
| + // A quick lookup table for determining if a device is a touch device.
|
| + static std::bitset<128> touch_devices;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(TouchFactory);
|
| +};
|
| +
|
| +std::bitset<128> TouchFactory::touch_devices;
|
| +#endif
|
| +
|
| namespace {
|
|
|
| RootView* FindRootViewForGdkWindow(GdkWindow* gdk_window) {
|
| @@ -49,7 +78,7 @@
|
| case XI_ButtonRelease:
|
| case XI_Motion: {
|
| // Is the event coming from a touch device?
|
| - return TouchFactory::GetInstance()->IsTouchDevice(
|
| + return TouchFactory::IsTouchDevice(
|
| static_cast<XIDeviceEvent*>(cookie->data)->sourceid);
|
| }
|
| default:
|
| @@ -171,7 +200,7 @@
|
|
|
| #if defined(HAVE_XINPUT2)
|
| void SetTouchDeviceList(std::vector<unsigned int>& devices) {
|
| - TouchFactory::GetInstance()->SetTouchDeviceList(devices);
|
| + TouchFactory::SetTouchDeviceListInternal(devices);
|
| }
|
| #endif
|
|
|
|
|