OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/event_constants.h" | 5 #include "ui/events/event_constants.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
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> |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 break; | 392 break; |
393 } | 393 } |
394 return ET_UNKNOWN; | 394 return ET_UNKNOWN; |
395 } | 395 } |
396 | 396 |
397 int EventFlagsFromNative(const base::NativeEvent& native_event) { | 397 int EventFlagsFromNative(const base::NativeEvent& native_event) { |
398 switch (native_event->type) { | 398 switch (native_event->type) { |
399 case KeyPress: | 399 case KeyPress: |
400 case KeyRelease: { | 400 case KeyRelease: { |
401 XModifierStateWatcher::GetInstance()->UpdateStateFromXEvent(native_event); | 401 XModifierStateWatcher::GetInstance()->UpdateStateFromXEvent(native_event); |
402 return GetEventFlagsFromXKeyEvent(native_event); | 402 int flags = GetEventFlagsFromXKeyEvent(native_event); |
403 if (native_event->xkey.send_event) | |
404 flags |= EF_FINAL_MODIFIERS; | |
405 return flags; | |
403 } | 406 } |
404 case ButtonPress: | 407 case ButtonPress: |
405 case ButtonRelease: { | 408 case ButtonRelease: { |
406 int flags = GetEventFlagsFromXState(native_event->xbutton.state); | 409 int flags = GetEventFlagsFromXState(native_event->xbutton.state); |
407 const EventType type = EventTypeFromNative(native_event); | 410 const EventType type = EventTypeFromNative(native_event); |
408 if (type == ET_MOUSE_PRESSED || type == ET_MOUSE_RELEASED) | 411 if (type == ET_MOUSE_PRESSED || type == ET_MOUSE_RELEASED) |
409 flags |= GetEventFlagsForButton(native_event->xbutton.button); | 412 flags |= GetEventFlagsForButton(native_event->xbutton.button); |
410 return flags; | 413 return flags; |
411 } | 414 } |
412 case EnterNotify: | 415 case EnterNotify: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 flags |= GetEventFlagsForButton(button); | 449 flags |= GetEventFlagsForButton(button); |
447 return flags; | 450 return flags; |
448 } | 451 } |
449 case XI_Motion: | 452 case XI_Motion: |
450 return GetButtonMaskForX2Event(xievent) | | 453 return GetButtonMaskForX2Event(xievent) | |
451 GetEventFlagsFromXState(xievent->mods.effective); | 454 GetEventFlagsFromXState(xievent->mods.effective); |
452 case XI_KeyPress: | 455 case XI_KeyPress: |
453 case XI_KeyRelease: { | 456 case XI_KeyRelease: { |
454 XModifierStateWatcher::GetInstance()->UpdateStateFromXEvent( | 457 XModifierStateWatcher::GetInstance()->UpdateStateFromXEvent( |
455 native_event); | 458 native_event); |
456 return GetEventFlagsFromXGenericEvent(native_event); | 459 int flags = GetEventFlagsFromXGenericEvent(native_event); |
sadrul
2014/07/15 04:48:07
Update GetEventFlagsFromXKeyEvent() and GetEventFl
kpschoedel
2014/07/15 14:27:46
Done.
| |
460 if (native_event->xkey.send_event) | |
461 flags |= EF_FINAL_MODIFIERS; | |
462 return flags; | |
457 } | 463 } |
458 } | 464 } |
459 } | 465 } |
460 } | 466 } |
461 return 0; | 467 return 0; |
462 } | 468 } |
463 | 469 |
464 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { | 470 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { |
465 switch(native_event->type) { | 471 switch(native_event->type) { |
466 case KeyPress: | 472 case KeyPress: |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
775 DeviceDataManagerX11::GetInstance()->GetGestureTimes( | 781 DeviceDataManagerX11::GetInstance()->GetGestureTimes( |
776 native_event, start_time, end_time); | 782 native_event, start_time, end_time); |
777 return true; | 783 return true; |
778 } | 784 } |
779 | 785 |
780 bool IsTouchpadEvent(const base::NativeEvent& event) { | 786 bool IsTouchpadEvent(const base::NativeEvent& event) { |
781 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); | 787 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); |
782 } | 788 } |
783 | 789 |
784 } // namespace ui | 790 } // namespace ui |
OLD | NEW |