Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef VIEWS_TOUCHUI_TOUCH_FACTORY_H_ | |
| 6 #define VIEWS_TOUCHUI_TOUCH_FACTORY_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <bitset> | |
| 10 #include <vector> | |
| 11 #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
| |
| 12 | |
| 13 #include "base/singleton.h" | |
| 14 | |
| 15 namespace views { | |
| 16 | |
| 17 // Functions related to determining touch devices. | |
| 18 class TouchFactory { | |
| 19 public: | |
| 20 // Returns the TouchFactory singleton. | |
| 21 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.
| |
| 22 | |
| 23 // Keep a list of touch devices so that it is possible to determine if a | |
| 24 // pointer event is a touch-event or a mouse-event. | |
| 25 void SetTouchDeviceList(const std::vector<unsigned int>& devices); | |
| 26 | |
| 27 // Is the device a touch-device? | |
| 28 bool IsTouchDevice(unsigned int deviceid); | |
| 29 | |
| 30 // Grab the touch devices for the specified window on the specified display. | |
| 31 // Returns if grab was successful for all touch devices. | |
| 32 bool GrabTouchDevices(Display* display, ::Window window); | |
| 33 | |
| 34 // Ungrab the touch devices. Returns if ungrab was successful for all touch | |
| 35 // devices. | |
| 36 bool UngrabTouchDevices(Display* display); | |
| 37 | |
| 38 private: | |
| 39 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
| |
| 40 | |
| 41 // Requirement for Signleton | |
| 42 friend struct DefaultSingletonTraits<TouchFactory>; | |
| 43 | |
| 44 // A quick lookup table for determining if a device is a touch device. | |
| 45 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.
| |
| 46 | |
| 47 // The list of touch devices. | |
| 48 std::vector<int> touch_device_list_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(TouchFactory); | |
| 51 }; | |
| 52 | |
| 53 } // namespace views | |
| 54 | |
| 55 #endif // VIEWS_TOUCHUI_TOUCH_FACTORY_H_ | |
| OLD | NEW |