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

Side by Side Diff: ui/base/x/scroll_factory.h

Issue 8907005: Add support for new scroll valuators coming from CMT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup and comments Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 UI_BASE_X_SCROLL_FACTORY_H_
6 #define UI_BASE_X_SCROLL_FACTORY_H_
7 #pragma once
8
9 #include <bitset>
10 #include <map>
11
12 #include "base/memory/singleton.h"
13 #include "ui/base/ui_export.h"
14
15 typedef struct _XDisplay Display;
16 typedef union _XEvent XEvent;
17
18 namespace ui {
19
20 // A class to support the detection of scroll events, using X11 valuators.
21 class UI_EXPORT ScrollFactory {
22 public:
23 // Returns the ScrollFactory singleton.
24 static ScrollFactory* GetInstance();
25
26 // Updates the list of devices.
27 void UpdateDeviceList(Display* display);
28
29 // Returns true if this is a scroll event (a motion event with the necessary
30 // valuators. Also returns the offsets. |x_offset| and |y_offset| can be
31 // NULL.
32 bool GetScrollOffsets(const XEvent& xev, float* x_offset, float* y_offset);
33
34 private:
35 ScrollFactory();
36 ~ScrollFactory();
37 // Requirement for Signleton
Ben Goodger (Google) 2011/12/14 19:01:39 nit: I believe your type definitions have to go be
DaveMoore 2011/12/14 21:26:04 Done.
38 friend struct DefaultSingletonTraits<ScrollFactory>;
39 struct Valuators {
40 int x_scroll;
41 int y_scroll;
42 };
43
44 // A quick lookup table for determining if events from the pointer device
45 // should be processed.
46 static const int kMaxDeviceNum = 128;
47 std::bitset<kMaxDeviceNum> scroll_devices_;
48 std::map<int, Valuators> device_to_valuators_;
49 };
50
51 } // namespace ui
52
53 #endif // UI_BASE_X_SCROLL_FACTORY_H_
OLDNEW
« ui/base/events.h ('K') | « ui/base/x/events_x.cc ('k') | ui/base/x/scroll_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698