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

Side by Side Diff: ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cros.cc

Issue 545063006: ozone: evdev: Add gesture property provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add INFO_SEVERITY to log property activities. Useful for debugging before a property value setting … Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr os.h" 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr os.h"
6 6
7 #include <gestures/gestures.h> 7 #include <gestures/gestures.h>
8 #include <libevdev/libevdev.h> 8 #include <libevdev/libevdev.h>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 18 matching lines...) Expand all
29 case EvdevClassTouchpad: 29 case EvdevClassTouchpad:
30 return GESTURES_DEVCLASS_TOUCHPAD; 30 return GESTURES_DEVCLASS_TOUCHPAD;
31 case EvdevClassTouchscreen: 31 case EvdevClassTouchscreen:
32 return GESTURES_DEVCLASS_TOUCHSCREEN; 32 return GESTURES_DEVCLASS_TOUCHSCREEN;
33 default: 33 default:
34 return GESTURES_DEVCLASS_UNKNOWN; 34 return GESTURES_DEVCLASS_UNKNOWN;
35 } 35 }
36 } 36 }
37 37
38 // Convert libevdev state to libgestures hardware properties. 38 // Convert libevdev state to libgestures hardware properties.
39 HardwareProperties GestureHardwareProperties(Evdev* evdev) { 39 HardwareProperties GestureHardwareProperties(
40 Evdev* evdev,
41 const GesturePropertyProvider::DeviceProperty& props) {
40 HardwareProperties hwprops; 42 HardwareProperties hwprops;
41 hwprops.left = Event_Get_Left(evdev); 43 hwprops.left = props.area_left;
42 hwprops.top = Event_Get_Top(evdev); 44 hwprops.top = props.area_top;
43 hwprops.right = Event_Get_Right(evdev); 45 hwprops.right = props.area_right;
44 hwprops.bottom = Event_Get_Bottom(evdev); 46 hwprops.bottom = props.area_bottom;
45 hwprops.res_x = Event_Get_Res_X(evdev); 47 hwprops.res_x = props.res_x;
46 hwprops.res_y = Event_Get_Res_Y(evdev); 48 hwprops.res_y = props.res_y;
47 hwprops.screen_x_dpi = 133; 49 hwprops.screen_x_dpi = 133;
48 hwprops.screen_y_dpi = 133; 50 hwprops.screen_y_dpi = 133;
49 hwprops.orientation_minimum = Event_Get_Orientation_Minimum(evdev); 51 hwprops.orientation_minimum = props.orientation_minimum;
50 hwprops.orientation_maximum = Event_Get_Orientation_Maximum(evdev); 52 hwprops.orientation_maximum = props.orientation_maximum;
51 hwprops.max_finger_cnt = Event_Get_Slot_Count(evdev); 53 hwprops.max_finger_cnt = Event_Get_Slot_Count(evdev);
52 hwprops.max_touch_cnt = Event_Get_Touch_Count_Max(evdev); 54 hwprops.max_touch_cnt = Event_Get_Touch_Count_Max(evdev);
53 hwprops.supports_t5r2 = Event_Get_T5R2(evdev); 55 hwprops.supports_t5r2 = Event_Get_T5R2(evdev);
54 hwprops.support_semi_mt = Event_Get_Semi_MT(evdev); 56 hwprops.support_semi_mt = Event_Get_Semi_MT(evdev);
55 /* buttonpad means a physical button under the touch surface */ 57 /* buttonpad means a physical button under the touch surface */
56 hwprops.is_button_pad = Event_Get_Button_Pad(evdev); 58 hwprops.is_button_pad = Event_Get_Button_Pad(evdev);
57 return hwprops; 59 return hwprops;
58 } 60 }
59 61
60 // Callback from libgestures when a gesture is ready. 62 // Callback from libgestures when a gesture is ready.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 interpreter_ = NULL; 95 interpreter_ = NULL;
94 } 96 }
95 } 97 }
96 98
97 void GestureInterpreterLibevdevCros::OnLibEvdevCrosOpen( 99 void GestureInterpreterLibevdevCros::OnLibEvdevCrosOpen(
98 Evdev* evdev, 100 Evdev* evdev,
99 EventStateRec* evstate) { 101 EventStateRec* evstate) {
100 DCHECK(evdev->info.is_monotonic) << "libevdev must use monotonic timestamps"; 102 DCHECK(evdev->info.is_monotonic) << "libevdev must use monotonic timestamps";
101 VLOG(9) << "HACK DO NOT REMOVE OR LINK WILL FAIL" << (void*)gestures_log; 103 VLOG(9) << "HACK DO NOT REMOVE OR LINK WILL FAIL" << (void*)gestures_log;
102 104
103 HardwareProperties hwprops = GestureHardwareProperties(evdev); 105 GesturesPropFunctionsWrapper::InitializeDeviceProperties(evdev,
106 &device_props_);
107 HardwareProperties hwprops = GestureHardwareProperties(evdev, device_props_);
104 GestureInterpreterDeviceClass devclass = GestureDeviceClass(evdev); 108 GestureInterpreterDeviceClass devclass = GestureDeviceClass(evdev);
105 109
106 // Create & initialize GestureInterpreter. 110 // Create & initialize GestureInterpreter.
107 DCHECK(!interpreter_); 111 DCHECK(!interpreter_);
108 interpreter_ = NewGestureInterpreter(); 112 interpreter_ = NewGestureInterpreter();
113 GestureInterpreterSetPropProvider(
114 interpreter_,
115 const_cast<GesturesPropProvider*>(&kGesturePropProvider),
116 evdev);
109 GestureInterpreterInitialize(interpreter_, devclass); 117 GestureInterpreterInitialize(interpreter_, devclass);
110 GestureInterpreterSetHardwareProperties(interpreter_, &hwprops); 118 GestureInterpreterSetHardwareProperties(interpreter_, &hwprops);
111 GestureInterpreterSetTimerProvider( 119 GestureInterpreterSetTimerProvider(
112 interpreter_, 120 interpreter_,
113 const_cast<GesturesTimerProvider*>(&kGestureTimerProvider), 121 const_cast<GesturesTimerProvider*>(&kGestureTimerProvider),
114 this); 122 this);
115 GestureInterpreterSetCallback(interpreter_, OnGestureReadyHelper, this); 123 GestureInterpreterSetCallback(interpreter_, OnGestureReadyHelper, this);
116 } 124 }
117 125
118 void GestureInterpreterLibevdevCros::OnLibEvdevCrosEvent(Evdev* evdev, 126 void GestureInterpreterLibevdevCros::OnLibEvdevCrosEvent(Evdev* evdev,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 bool down) { 397 bool down) {
390 const gfx::PointF& loc = cursor_->location(); 398 const gfx::PointF& loc = cursor_->location();
391 int flag = modifiers_->GetEventFlagFromModifier(modifier); 399 int flag = modifiers_->GetEventFlagFromModifier(modifier);
392 EventType type = (down ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED); 400 EventType type = (down ? ET_MOUSE_PRESSED : ET_MOUSE_RELEASED);
393 modifiers_->UpdateModifier(modifier, down); 401 modifiers_->UpdateModifier(modifier, down);
394 MouseEvent event(type, loc, loc, modifiers_->GetModifierFlags() | flag, flag); 402 MouseEvent event(type, loc, loc, modifiers_->GetModifierFlags() | flag, flag);
395 Dispatch(&event); 403 Dispatch(&event);
396 } 404 }
397 405
398 } // namespace ui 406 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698