| 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 <string.h> | 7 #include <string.h> |
| 8 #include <X11/extensions/XInput.h> | 8 #include <X11/extensions/XInput.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 const int kMinWheelButton = 4; | 35 const int kMinWheelButton = 4; |
| 36 const int kMaxWheelButton = 7; | 36 const int kMaxWheelButton = 7; |
| 37 | 37 |
| 38 // A class to track current modifier state on master device. Only track ctrl, | 38 // A class to track current modifier state on master device. Only track ctrl, |
| 39 // alt, shift and caps lock keys currently. The tracked state can then be used | 39 // alt, shift and caps lock keys currently. The tracked state can then be used |
| 40 // by floating device. | 40 // by floating device. |
| 41 class XModifierStateWatcher{ | 41 class XModifierStateWatcher{ |
| 42 public: | 42 public: |
| 43 static XModifierStateWatcher* GetInstance() { | 43 static XModifierStateWatcher* GetInstance() { |
| 44 return Singleton<XModifierStateWatcher>::get(); | 44 return base::Singleton<XModifierStateWatcher>::get(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 int StateFromKeyboardCode(ui::KeyboardCode keyboard_code) { | 47 int StateFromKeyboardCode(ui::KeyboardCode keyboard_code) { |
| 48 switch (keyboard_code) { | 48 switch (keyboard_code) { |
| 49 case ui::VKEY_CONTROL: | 49 case ui::VKEY_CONTROL: |
| 50 return ControlMask; | 50 return ControlMask; |
| 51 case ui::VKEY_SHIFT: | 51 case ui::VKEY_SHIFT: |
| 52 return ShiftMask; | 52 return ShiftMask; |
| 53 case ui::VKEY_MENU: | 53 case ui::VKEY_MENU: |
| 54 return Mod1Mask; | 54 return Mod1Mask; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 NOTREACHED(); | 93 NOTREACHED(); |
| 94 break; | 94 break; |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Returns the current modifer state in master device. It only contains the | 98 // Returns the current modifer state in master device. It only contains the |
| 99 // state of ctrl, shift, alt and caps lock keys. | 99 // state of ctrl, shift, alt and caps lock keys. |
| 100 unsigned int state() { return state_; } | 100 unsigned int state() { return state_; } |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 friend struct DefaultSingletonTraits<XModifierStateWatcher>; | 103 friend struct base::DefaultSingletonTraits<XModifierStateWatcher>; |
| 104 | 104 |
| 105 XModifierStateWatcher() : state_(0) { } | 105 XModifierStateWatcher() : state_(0) { } |
| 106 | 106 |
| 107 unsigned int state_; | 107 unsigned int state_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(XModifierStateWatcher); | 109 DISALLOW_COPY_AND_ASSIGN(XModifierStateWatcher); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 // Detects if a touch event is a driver-generated 'special event'. | 112 // Detects if a touch event is a driver-generated 'special event'. |
| 113 // A 'special event' is a touch event with maximum radius and pressure at | 113 // A 'special event' is a touch event with maximum radius and pressure at |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 xievent->detail = | 908 xievent->detail = |
| 909 UpdateX11EventButton(event->changed_button_flags(), xievent->detail); | 909 UpdateX11EventButton(event->changed_button_flags(), xievent->detail); |
| 910 break; | 910 break; |
| 911 } | 911 } |
| 912 default: | 912 default: |
| 913 break; | 913 break; |
| 914 } | 914 } |
| 915 } | 915 } |
| 916 | 916 |
| 917 } // namespace ui | 917 } // namespace ui |
| OLD | NEW |