OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_LINUX_X11_KEYBOARD_H_ |
| 6 #define REMOTING_HOST_LINUX_X11_KEYBOARD_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <vector> |
| 11 |
| 12 #include "base/macros.h" |
| 13 |
| 14 namespace remoting { |
| 15 |
| 16 // An interface for accessing the keyboard and changing the keyboard layout. |
| 17 // An implementation is allowed to delay processing a request until Flush() or |
| 18 // Sync() is called. |
| 19 class X11Keyboard { |
| 20 public: |
| 21 virtual ~X11Keyboard() {} |
| 22 |
| 23 // Returns a vector of key codes that are not being mapped to a code point. |
| 24 virtual std::vector<uint32_t> GetUnusedKeycodes() = 0; |
| 25 |
| 26 // Simulates a key press with the given |keycode| and |modifiers|. Note that |
| 27 // the application receiving the key press can decide whether or how the key |
| 28 // press is interpreted into a character. |
| 29 virtual void PressKey(uint32_t keycode, uint32_t modifiers) = 0; |
| 30 |
| 31 // Finds a keycode and set of modifiers that generate character with the |
| 32 // specified |code_point|. Returns true if the key code is successfully found. |
| 33 // If the keycode is not found, |keycode| and |modifiers| will not be |
| 34 // affected. |
| 35 virtual bool FindKeycode(uint32_t code_point, |
| 36 uint32_t* keycode, |
| 37 uint32_t* modifiers) = 0; |
| 38 |
| 39 // Change the key mapping such that pressing |keycode| will output the |
| 40 // character of |code_point|. |
| 41 virtual bool ChangeKeyMapping(uint32_t keycode, uint32_t code_point) = 0; |
| 42 |
| 43 // Flushes all requests but don't wait for processing the requests. |
| 44 virtual void Flush() = 0; |
| 45 |
| 46 // Flushes all requests and wait until all requests are processed. |
| 47 virtual void Sync() = 0; |
| 48 |
| 49 protected: |
| 50 X11Keyboard() {} |
| 51 }; |
| 52 |
| 53 } // namespace remoting |
| 54 |
| 55 #endif // REMOTING_HOST_LINUX_X11_KEYBOARD_H_ |
OLD | NEW |