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

Unified Diff: views/focus/accelerator_handler_touch.cc

Issue 6300007: touch: Allow grabbing/ungrabbing touch devices for XInput2. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: gyp blackmagic Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/menu/menu_host_gtk.cc ('k') | views/touchui/touch_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/focus/accelerator_handler_touch.cc
diff --git a/views/focus/accelerator_handler_touch.cc b/views/focus/accelerator_handler_touch.cc
index 84c042df6e784caa2806133664af29e08303c86c..b24d8f09c33022f22096fe06d0344fa35107ce3c 100644
--- a/views/focus/accelerator_handler_touch.cc
+++ b/views/focus/accelerator_handler_touch.cc
@@ -15,41 +15,12 @@
#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) {
@@ -78,7 +49,7 @@ bool X2EventIsTouchEvent(XEvent* xev) {
case XI_ButtonRelease:
case XI_Motion: {
// Is the event coming from a touch device?
- return TouchFactory::IsTouchDevice(
+ return TouchFactory::GetInstance()->IsTouchDevice(
static_cast<XIDeviceEvent*>(cookie->data)->sourceid);
}
default:
@@ -200,7 +171,7 @@ bool DispatchXEvent(XEvent* xev) {
#if defined(HAVE_XINPUT2)
void SetTouchDeviceList(std::vector<unsigned int>& devices) {
- TouchFactory::SetTouchDeviceListInternal(devices);
+ TouchFactory::GetInstance()->SetTouchDeviceList(devices);
}
#endif
« no previous file with comments | « views/controls/menu/menu_host_gtk.cc ('k') | views/touchui/touch_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698