summaryrefslogtreecommitdiff
path: root/chromium/ui/gfx/x/keyboard_state.h
blob: d28fe595f396af16ea7ab3a440f82e1440d2a3fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GFX_X_KEYBOARD_STATE_H_
#define UI_GFX_X_KEYBOARD_STATE_H_

#include <memory>

#include "ui/gfx/x/xproto.h"

namespace x11 {

class Connection;

// This is an interface used by Connection to manage conversion between keycodes
// (8 bit values) and keysyms (32 bit values).
class KeyboardState {
 public:
  KeyboardState();
  virtual ~KeyboardState();

  virtual KeyCode KeysymToKeycode(uint32_t keysym) const = 0;
  virtual uint32_t KeycodeToKeysym(KeyCode keycode,
                                   uint32_t modifiers) const = 0;

 private:
  friend class Connection;

  virtual void UpdateMapping() = 0;
};

std::unique_ptr<KeyboardState> CreateKeyboardState(Connection* connection);

}  // namespace x11

#endif  // UI_GFX_X_KEYBOARD_STATE_H_