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

Unified Diff: ui/events/x/device_data_manager.cc

Issue 24482004: events: Make platform specific events code into ui/events/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 3 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 | « ui/events/x/device_data_manager.h ('k') | ui/events/x/device_list_cache_x.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/x/device_data_manager.cc
diff --git a/ui/base/x/device_data_manager.cc b/ui/events/x/device_data_manager.cc
similarity index 96%
rename from ui/base/x/device_data_manager.cc
rename to ui/events/x/device_data_manager.cc
index 784819f6b0812923f8231deda7273fa6cf4ce92b..e6a422261bf8dc4deca88ce2668781240f2d3bf4 100644
--- a/ui/base/x/device_data_manager.cc
+++ b/ui/events/x/device_data_manager.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/base/x/device_data_manager.h"
+#include "ui/events/x/device_data_manager.h"
#include <X11/extensions/XInput.h>
#include <X11/extensions/XInput2.h>
@@ -11,10 +11,10 @@
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "ui/base/touch/touch_factory_x11.h"
-#include "ui/base/x/device_list_cache_x.h"
-#include "ui/base/x/x11_util.h"
#include "ui/events/event_constants.h"
#include "ui/events/event_utils.h"
+#include "ui/events/x/device_list_cache_x.h"
+#include "ui/gfx/x/x11_types.h"
// XIScrollClass was introduced in XI 2.1 so we need to define it here
// for backward-compatibility with older versions of XInput.
@@ -116,12 +116,14 @@ DeviceDataManager* DeviceDataManager::GetInstance() {
DeviceDataManager::DeviceDataManager()
: natural_scroll_enabled_(false),
- atom_cache_(gfx::GetXDisplay(), kCachedAtoms) {
+ atom_cache_(gfx::GetXDisplay(), kCachedAtoms),
+ button_map_count_(0) {
InitializeXInputInternal();
// Make sure the sizes of enum and kCachedAtoms are aligned.
CHECK(arraysize(kCachedAtoms) == static_cast<size_t>(DT_LAST_ENTRY) + 1);
UpdateDeviceList(gfx::GetXDisplay());
+ UpdateButtonMap();
}
DeviceDataManager::~DeviceDataManager() {
@@ -509,6 +511,17 @@ void DeviceDataManager::GetMetricsData(const base::NativeEvent& native_event,
*data2 = data[DT_CMT_METRICS_DATA2];
}
+int DeviceDataManager::GetMappedButton(int button) {
+ return button > 0 && button <= button_map_count_ ? button_map_[button - 1] :
+ button;
+}
+
+void DeviceDataManager::UpdateButtonMap() {
+ button_map_count_ = XGetPointerMapping(gfx::GetXDisplay(),
+ button_map_,
+ arraysize(button_map_));
+}
+
void DeviceDataManager::GetGestureTimes(const base::NativeEvent& native_event,
double* start_time,
double* end_time) {
« no previous file with comments | « ui/events/x/device_data_manager.h ('k') | ui/events/x/device_list_cache_x.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698