Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h

Issue 2639053002: [ozone/wayland] Implement basic keyboard handling support (Closed)
Patch Set: Implement basic keyboard handling support Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ 5 #ifndef UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_
6 #define UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ 6 #define UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <xkbcommon/xkbcommon.h> 9 #include <xkbcommon/xkbcommon.h>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 bool Lookup(DomCode dom_code, 44 bool Lookup(DomCode dom_code,
45 int flags, 45 int flags,
46 DomKey* dom_key, 46 DomKey* dom_key,
47 KeyboardCode* key_code) const override; 47 KeyboardCode* key_code) const override;
48 48
49 static void ParseLayoutName(const std::string& layout_name, 49 static void ParseLayoutName(const std::string& layout_name,
50 std::string* layout_id, 50 std::string* layout_id,
51 std::string* layout_variant); 51 std::string* layout_variant);
52 52
53 // Used to sync up client side 'xkb_state' instance with modifiers status
54 // update
55 // from the server.
56 int UpdateModifiers(uint32_t depressed_mods,
57 uint32_t latched_mods,
58 uint32_t locked_mods,
59 uint32_t group);
60
53 protected: 61 protected:
54 // Table for EventFlagsToXkbFlags(). 62 // Table for EventFlagsToXkbFlags().
55 struct XkbFlagMapEntry { 63 struct XkbFlagMapEntry {
56 int ui_flag; 64 int ui_flag;
57 xkb_mod_mask_t xkb_flag; 65 xkb_mod_mask_t xkb_flag;
58 }; 66 };
59 std::vector<XkbFlagMapEntry> xkb_flag_map_; 67 std::vector<XkbFlagMapEntry> xkb_flag_map_;
60 68
61 // Flag mask for num lock, which is always considered enabled. 69 // Flag mask for num lock, which is always considered enabled.
62 xkb_mod_mask_t num_lock_mod_mask_ = 0; 70 xkb_mod_mask_t num_lock_mod_mask_ = 0;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void OnKeymapLoaded(const std::string& layout_name, 115 void OnKeymapLoaded(const std::string& layout_name,
108 std::unique_ptr<char, base::FreeDeleter> keymap_str); 116 std::unique_ptr<char, base::FreeDeleter> keymap_str);
109 117
110 // libxkbcommon uses explicit reference counting for its structures, 118 // libxkbcommon uses explicit reference counting for its structures,
111 // so we need to trigger its cleanup. 119 // so we need to trigger its cleanup.
112 std::unique_ptr<xkb_context, XkbContextDeleter> xkb_context_; 120 std::unique_ptr<xkb_context, XkbContextDeleter> xkb_context_;
113 std::unique_ptr<xkb_state, XkbStateDeleter> xkb_state_; 121 std::unique_ptr<xkb_state, XkbStateDeleter> xkb_state_;
114 122
115 std::string current_layout_name_; 123 std::string current_layout_name_;
116 124
125 struct {
126 xkb_mod_index_t control;
127 xkb_mod_index_t alt;
128 xkb_mod_index_t shift;
129 } xkb_mod_indexes_{0, 0, 0};
spang 2017/01/24 20:41:50 = {0, 0, 0}; Actually, probably even better to ju
tonikitoo 2017/01/24 21:51:10 Done.
130
117 // Support weak pointers for attach & detach callbacks. 131 // Support weak pointers for attach & detach callbacks.
118 base::WeakPtrFactory<XkbKeyboardLayoutEngine> weak_ptr_factory_; 132 base::WeakPtrFactory<XkbKeyboardLayoutEngine> weak_ptr_factory_;
119 }; 133 };
120 134
121 } // namespace ui 135 } // namespace ui
122 136
123 #endif // UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ 137 #endif // UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_
OLDNEW
« no previous file with comments | « no previous file | ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc » ('j') | ui/ozone/platform/wayland/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698