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

Side by Side Diff: ui/events/ozone/evdev/touch_event_converter_evdev.cc

Issue 2235933002: Add POINTER_TYPE_ERASER to EventPointerType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
« no previous file with comments | « ui/events/ozone/evdev/tablet_event_converter_evdev.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/touch_event_converter_evdev.h" 5 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <linux/input.h> 9 #include <linux/input.h>
10 #include <poll.h> 10 #include <poll.h>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 } 79 }
80 80
81 ui::PointerDetails GetEventPointerDetails( 81 ui::PointerDetails GetEventPointerDetails(
82 const ui::InProgressTouchEvdev& event) { 82 const ui::InProgressTouchEvdev& event) {
83 ui::EventPointerType type; 83 ui::EventPointerType type;
84 switch (event.tool_code) { 84 switch (event.tool_code) {
85 case BTN_TOOL_PEN: 85 case BTN_TOOL_PEN:
86 type = ui::EventPointerType::POINTER_TYPE_PEN; 86 type = ui::EventPointerType::POINTER_TYPE_PEN;
87 break; 87 break;
88 case BTN_TOOL_RUBBER:
89 type = ui::EventPointerType::POINTER_TYPE_ERASER;
90 break;
88 default: 91 default:
89 type = ui::EventPointerType::POINTER_TYPE_TOUCH; 92 type = ui::EventPointerType::POINTER_TYPE_TOUCH;
90 } 93 }
91 return ui::PointerDetails(type, event.radius_x, event.radius_y, 94 return ui::PointerDetails(type, event.radius_x, event.radius_y,
92 event.pressure, 95 event.pressure,
93 /* tilt_x */ 0.0f, 96 /* tilt_x */ 0.0f,
94 /* tilt_y */ 0.0f); 97 /* tilt_y */ 0.0f);
95 } 98 }
96 99
97 const int kTrackingIdForUnusedSlot = -1; 100 const int kTrackingIdForUnusedSlot = -1;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 event.value ? NextTrackingId() : kTrackingIdForUnusedSlot; 326 event.value ? NextTrackingId() : kTrackingIdForUnusedSlot;
324 ProcessMultitouchEvent(emulated_event); 327 ProcessMultitouchEvent(emulated_event);
325 } 328 }
326 } 329 }
327 } 330 }
328 331
329 void TouchEventConverterEvdev::ProcessKey(const input_event& input) { 332 void TouchEventConverterEvdev::ProcessKey(const input_event& input) {
330 switch (input.code) { 333 switch (input.code) {
331 case BTN_TOUCH: 334 case BTN_TOUCH:
332 case BTN_LEFT: 335 case BTN_LEFT:
336 case BTN_0:
333 events_[current_slot_].btn_left.down = input.value; 337 events_[current_slot_].btn_left.down = input.value;
334 events_[current_slot_].btn_left.changed = true; 338 events_[current_slot_].btn_left.changed = true;
335 break; 339 break;
336 case BTN_STYLUS: 340 case BTN_STYLUS:
337 events_[current_slot_].btn_right.down = input.value; 341 events_[current_slot_].btn_right.down = input.value;
338 events_[current_slot_].btn_right.changed = true; 342 events_[current_slot_].btn_right.changed = true;
339 break; 343 break;
340 case BTN_STYLUS2: 344 case BTN_STYLUS2:
341 events_[current_slot_].btn_middle.down = input.value; 345 events_[current_slot_].btn_middle.down = input.value;
342 events_[current_slot_].btn_middle.changed = true; 346 events_[current_slot_].btn_middle.changed = true;
343 break; 347 break;
344 case BTN_TOOL_PEN: 348 case BTN_TOOL_PEN:
349 case BTN_TOOL_RUBBER:
345 // Do not change tool types while touching to prevent inconsistencies 350 // Do not change tool types while touching to prevent inconsistencies
346 // from switching between Mouse and TouchEvents. 351 // from switching between Mouse and TouchEvents.
347 if (events_[current_slot_].was_touching) 352 if (events_[current_slot_].was_touching)
348 break; 353 break;
349 354
350 if (input.value > 0) { 355 if (input.value > 0) {
351 events_[current_slot_].tool_code = input.code; 356 events_[current_slot_].tool_code = input.code;
352 } else { 357 } else {
353 events_[current_slot_].tool_code = 0; 358 events_[current_slot_].tool_code = 0;
354 } 359 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 if (pressure_max_ - pressure_min_) 546 if (pressure_max_ - pressure_min_)
542 pressure /= pressure_max_ - pressure_min_; 547 pressure /= pressure_max_ - pressure_min_;
543 return pressure; 548 return pressure;
544 } 549 }
545 550
546 int TouchEventConverterEvdev::NextTrackingId() { 551 int TouchEventConverterEvdev::NextTrackingId() {
547 return next_tracking_id_++ & kMaxTrackingId; 552 return next_tracking_id_++ & kMaxTrackingId;
548 } 553 }
549 554
550 } // namespace ui 555 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/tablet_event_converter_evdev.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698