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

Side by Side Diff: ui/events/x/events_x_utils.cc

Issue 1602173005: Add PlatformWindow/Event related code for Ozone X11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: XEventDispatcher added. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/x/events_x_utils.h" 5 #include "ui/events/x/events_x_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 #include <X11/extensions/XInput.h> 9 #include <X11/extensions/XInput.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
11 #include <X11/XKBlib.h> 11 #include <X11/XKBlib.h>
12 #include <X11/Xlib.h> 12 #include <X11/Xlib.h>
13 #include <X11/Xutil.h> 13 #include <X11/Xutil.h>
14 #include <cmath> 14 #include <cmath>
15 15
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/singleton.h" 18 #include "base/memory/singleton.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "ui/events/devices/x11/device_data_manager_x11.h" 20 #include "ui/events/devices/x11/device_data_manager_x11.h"
21 #include "ui/events/devices/x11/device_list_cache_x11.h" 21 #include "ui/events/devices/x11/device_list_cache_x11.h"
22 #include "ui/events/devices/x11/touch_factory_x11.h" 22 #include "ui/events/devices/x11/touch_factory_x11.h"
23 #include "ui/events/keycodes/keyboard_code_conversion_x.h" 23 #include "ui/events/keycodes/keyboard_code_conversion_x.h"
24 #include "ui/gfx/display.h" 24 #include "ui/gfx/display.h"
25 #include "ui/gfx/geometry/point.h" 25 #include "ui/gfx/geometry/point.h"
26 #include "ui/gfx/geometry/rect.h" 26 #include "ui/gfx/geometry/rect.h"
27 #include "ui/gfx/screen.h" 27 #include "ui/gfx/screen.h"
28 #include "ui/gfx/x/x11_atom_cache.h" 28 #include "ui/gfx/x/x11_atom_cache.h"
29 #include "ui/gfx/x/x11_types.h"
30 29
31 namespace { 30 namespace {
32 31
33 // Scroll amount for each wheelscroll event. 53 is also the value used for GTK+. 32 // Scroll amount for each wheelscroll event. 53 is also the value used for GTK+.
34 const int kWheelScrollAmount = 53; 33 const int kWheelScrollAmount = 53;
35 34
36 const int kMinWheelButton = 4; 35 const int kMinWheelButton = 4;
37 const int kMaxWheelButton = 7; 36 const int kMaxWheelButton = 7;
38 37
39 // A class to track current modifier state on master device. Only track ctrl, 38 // A class to track current modifier state on master device. Only track ctrl,
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 298
300 ui::DeviceDataManagerX11::GetInstance()->GetGestureTimes(xev, start_time, 299 ui::DeviceDataManagerX11::GetInstance()->GetGestureTimes(xev, start_time,
301 end_time); 300 end_time);
302 return true; 301 return true;
303 } 302 }
304 303
305 } // namespace 304 } // namespace
306 305
307 namespace ui { 306 namespace ui {
308 307
308 XID XWindowFromXEvent(const XEvent& xev) {
309 XID target = xev.xany.window;
310 if (xev.type == GenericEvent)
311 target = static_cast<XIDeviceEvent*>(xev.xcookie.data)->event;
312 return target;
313 }
314
309 EventType EventTypeFromXEvent(const XEvent& xev) { 315 EventType EventTypeFromXEvent(const XEvent& xev) {
310 // Allow the DeviceDataManager to block the event. If blocked return 316 // Allow the DeviceDataManager to block the event. If blocked return
311 // ET_UNKNOWN as the type so this event will not be further processed. 317 // ET_UNKNOWN as the type so this event will not be further processed.
312 // NOTE: During some events unittests there is no device data manager. 318 // NOTE: During some events unittests there is no device data manager.
313 if (DeviceDataManager::HasInstance() && 319 if (DeviceDataManager::HasInstance() &&
314 static_cast<DeviceDataManagerX11*>(DeviceDataManager::GetInstance()) 320 static_cast<DeviceDataManagerX11*>(DeviceDataManager::GetInstance())
315 ->IsEventBlocked(xev)) { 321 ->IsEventBlocked(xev)) {
316 return ET_UNKNOWN; 322 return ET_UNKNOWN;
317 } 323 }
318 324
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 vy_ordinal = &vy_ordinal_; 753 vy_ordinal = &vy_ordinal_;
748 if (!is_cancel) 754 if (!is_cancel)
749 is_cancel = &is_cancel_; 755 is_cancel = &is_cancel_;
750 756
751 DeviceDataManagerX11::GetInstance()->GetFlingData(xev, vx, vy, vx_ordinal, 757 DeviceDataManagerX11::GetInstance()->GetFlingData(xev, vx, vy, vx_ordinal,
752 vy_ordinal, is_cancel); 758 vy_ordinal, is_cancel);
753 return true; 759 return true;
754 } 760 }
755 761
756 } // namespace ui 762 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698