| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 flags |= ui::EF_LEFT_MOUSE_BUTTON; | 143 flags |= ui::EF_LEFT_MOUSE_BUTTON; |
| 144 if (state & Button2Mask) | 144 if (state & Button2Mask) |
| 145 flags |= ui::EF_MIDDLE_MOUSE_BUTTON; | 145 flags |= ui::EF_MIDDLE_MOUSE_BUTTON; |
| 146 if (state & Button3Mask) | 146 if (state & Button3Mask) |
| 147 flags |= ui::EF_RIGHT_MOUSE_BUTTON; | 147 flags |= ui::EF_RIGHT_MOUSE_BUTTON; |
| 148 return flags; | 148 return flags; |
| 149 } | 149 } |
| 150 | 150 |
| 151 int GetEventFlagsFromXKeyEvent(XEvent* xevent) { | 151 int GetEventFlagsFromXKeyEvent(XEvent* xevent) { |
| 152 return GetEventFlagsFromXState(xevent->xkey.state) | | 152 return GetEventFlagsFromXState(xevent->xkey.state) | |
| 153 (IsKeypadKey(XLookupKeysym(&xevent->xkey, 0)) ? ui::EF_NUMPAD_KEY : 0); | 153 (IsKeypadKey(XLookupKeysym(&xevent->xkey, 0)) ? ui::EF_NUMPAD_KEY : 0) | |
| 154 (ui::IsXKeyEventFabricatedByIme(xevent) ? ui::EF_IME_FABRICATED_KEY : 0); |
| 154 } | 155 } |
| 155 | 156 |
| 156 // Get the event flag for the button in XButtonEvent. During a ButtonPress | 157 // Get the event flag for the button in XButtonEvent. During a ButtonPress |
| 157 // event, |state| in XButtonEvent does not include the button that has just been | 158 // event, |state| in XButtonEvent does not include the button that has just been |
| 158 // pressed. Instead |state| contains flags for the buttons (if any) that had | 159 // pressed. Instead |state| contains flags for the buttons (if any) that had |
| 159 // already been pressed before the current button, and |button| stores the most | 160 // already been pressed before the current button, and |button| stores the most |
| 160 // current pressed button. So, if you press down left mouse button, and while | 161 // current pressed button. So, if you press down left mouse button, and while |
| 161 // pressing it down, press down the right mouse button, then for the latter | 162 // pressing it down, press down the right mouse button, then for the latter |
| 162 // event, |state| would have Button1Mask set but not Button3Mask, and |button| | 163 // event, |state| would have Button1Mask set but not Button3Mask, and |button| |
| 163 // would be 3. | 164 // would be 3. |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 DeviceDataManager::GetInstance()->GetGestureTimes( | 671 DeviceDataManager::GetInstance()->GetGestureTimes( |
| 671 native_event, start_time, end_time); | 672 native_event, start_time, end_time); |
| 672 return true; | 673 return true; |
| 673 } | 674 } |
| 674 | 675 |
| 675 bool IsTouchpadEvent(const base::NativeEvent& event) { | 676 bool IsTouchpadEvent(const base::NativeEvent& event) { |
| 676 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); | 677 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); |
| 677 } | 678 } |
| 678 | 679 |
| 679 } // namespace ui | 680 } // namespace ui |
| OLD | NEW |