Chromium Code Reviews| Index: views/touchui/touch_factory.h |
| diff --git a/views/touchui/touch_factory.h b/views/touchui/touch_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..36ba6540ef13350cbe70e297847deef8b9380eb3 |
| --- /dev/null |
| +++ b/views/touchui/touch_factory.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef VIEWS_TOUCHUI_TOUCH_FACTORY_H_ |
| +#define VIEWS_TOUCHUI_TOUCH_FACTORY_H_ |
| +#pragma once |
| + |
| +#include <bitset> |
| +#include <vector> |
| +#include <X11/Xlib.h> |
|
sky
2011/01/19 19:34:54
Is it possible to forward declare the types you ne
sadrul
2011/01/19 20:10:17
Indeed! I wasn't sure if we wanted to typedef Wind
|
| + |
| +#include "base/singleton.h" |
| + |
| +namespace views { |
| + |
| +// Functions related to determining touch devices. |
| +class TouchFactory { |
| + public: |
| + // Returns the TouchFactory singleton. |
| + static TouchFactory* GetInstance(); |
|
sky
2011/01/19 19:34:54
you've got an extra space here.
sadrul
2011/01/19 20:10:17
Done.
|
| + |
| + // 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. |
| + void SetTouchDeviceList(const std::vector<unsigned int>& devices); |
| + |
| + // Is the device a touch-device? |
| + bool IsTouchDevice(unsigned int deviceid); |
| + |
| + // Grab the touch devices for the specified window on the specified display. |
| + // Returns if grab was successful for all touch devices. |
| + bool GrabTouchDevices(Display* display, ::Window window); |
| + |
| + // Ungrab the touch devices. Returns if ungrab was successful for all touch |
| + // devices. |
| + bool UngrabTouchDevices(Display* display); |
| + |
| + private: |
| + TouchFactory(); |
|
sky
2011/01/19 19:34:54
I think you forget an implementation of this.
sadrul
2011/01/19 20:10:17
It is there in touch_factory.cc
|
| + |
| + // Requirement for Signleton |
| + friend struct DefaultSingletonTraits<TouchFactory>; |
| + |
| + // A quick lookup table for determining if a device is a touch device. |
| + std::bitset<128> touch_device_lookup_; |
|
sky
2011/01/19 19:34:54
Are you sure you want to use both a bitset and vec
sadrul
2011/01/19 20:10:17
The lookup table is used for each pointer event (i
sky
2011/01/19 23:15:31
Sounds good.
|
| + |
| + // The list of touch devices. |
| + std::vector<int> touch_device_list_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TouchFactory); |
| +}; |
| + |
| +} // namespace views |
| + |
| +#endif // VIEWS_TOUCHUI_TOUCH_FACTORY_H_ |