| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // We have to send these fabricated key events to XIM so it can correctly | 167 // We have to send these fabricated key events to XIM so it can correctly |
| 168 // handle the character compositions. | 168 // handle the character compositions. |
| 169 const bool fabricated_by_xim = | 169 const bool fabricated_by_xim = |
| 170 xevent->xkey.keycode == 0 && xevent->xkey.state == 0; | 170 xevent->xkey.keycode == 0 && xevent->xkey.state == 0; |
| 171 const int ime_fabricated_flag = | 171 const int ime_fabricated_flag = |
| 172 fabricated_by_xim ? ui::EF_IME_FABRICATED_KEY : 0; | 172 fabricated_by_xim ? ui::EF_IME_FABRICATED_KEY : 0; |
| 173 #endif | 173 #endif |
| 174 | 174 |
| 175 return GetEventFlagsFromXState(xevent->xkey.state) | | 175 return GetEventFlagsFromXState(xevent->xkey.state) | |
| 176 (IsKeypadKey(XLookupKeysym(&xevent->xkey, 0)) ? ui::EF_NUMPAD_KEY : 0) | | 176 (IsKeypadKey(XLookupKeysym(&xevent->xkey, 0)) ? ui::EF_NUMPAD_KEY : 0) | |
| 177 (IsFunctionKey(XLookupKeysym(&xevent->xkey, 0)) ? |
| 178 ui::EF_FUNCTION_KEY : 0) | |
| 177 ime_fabricated_flag; | 179 ime_fabricated_flag; |
| 178 } | 180 } |
| 179 | 181 |
| 180 // Get the event flag for the button in XButtonEvent. During a ButtonPress | 182 // Get the event flag for the button in XButtonEvent. During a ButtonPress |
| 181 // event, |state| in XButtonEvent does not include the button that has just been | 183 // event, |state| in XButtonEvent does not include the button that has just been |
| 182 // pressed. Instead |state| contains flags for the buttons (if any) that had | 184 // pressed. Instead |state| contains flags for the buttons (if any) that had |
| 183 // already been pressed before the current button, and |button| stores the most | 185 // already been pressed before the current button, and |button| stores the most |
| 184 // current pressed button. So, if you press down left mouse button, and while | 186 // current pressed button. So, if you press down left mouse button, and while |
| 185 // pressing it down, press down the right mouse button, then for the latter | 187 // pressing it down, press down the right mouse button, then for the latter |
| 186 // event, |state| would have Button1Mask set but not Button3Mask, and |button| | 188 // event, |state| would have Button1Mask set but not Button3Mask, and |button| |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 DeviceDataManager::GetInstance()->GetGestureTimes( | 721 DeviceDataManager::GetInstance()->GetGestureTimes( |
| 720 native_event, start_time, end_time); | 722 native_event, start_time, end_time); |
| 721 return true; | 723 return true; |
| 722 } | 724 } |
| 723 | 725 |
| 724 bool IsTouchpadEvent(const base::NativeEvent& event) { | 726 bool IsTouchpadEvent(const base::NativeEvent& event) { |
| 725 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); | 727 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); |
| 726 } | 728 } |
| 727 | 729 |
| 728 } // namespace ui | 730 } // namespace ui |
| OLD | NEW |