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

Side by Side Diff: remoting/host/linux/unicode_to_keysym.cc

Issue 2346643003: [Remoting Host] Handle text event characters that are not presented on the keyboard (Closed)
Patch Set: Reviewer's Feedback Created 4 years, 2 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 #include "remoting/host/linux/unicode_to_keysym.h" 5 #include "remoting/host/linux/unicode_to_keysym.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #define XK_MISCELLANY 8 #define XK_MISCELLANY
9 #define XK_XKB_KEYS 9 #define XK_XKB_KEYS
10 #define XK_LATIN1 10 #define XK_LATIN1
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 { XK_Hangul_AraeA, 0x318d }, 814 { XK_Hangul_AraeA, 0x318d },
815 { XK_Hangul_AraeAE, 0x318e }, 815 { XK_Hangul_AraeAE, 0x318e },
816 }; 816 };
817 817
818 bool CompareCodePair(const CodePair& pair, uint32_t unicode) { 818 bool CompareCodePair(const CodePair& pair, uint32_t unicode) {
819 return pair.unicode < unicode; 819 return pair.unicode < unicode;
820 } 820 }
821 821
822 } // namespace 822 } // namespace
823 823
824 void GetKeySymsForUnicode(uint32_t unicode, std::vector<uint32_t>* keysyms) { 824 std::vector<uint32_t> GetKeySymsForUnicode(uint32_t unicode) {
825 keysyms->clear(); 825 std::vector<uint32_t> keysyms;
826 826
827 // Latin-1 characters have the same values in Unicode and KeySym. 827 // Latin-1 characters have the same values in Unicode and KeySym.
828 if ((unicode >= 0x0020 && unicode <= 0x007e) || 828 if ((unicode >= 0x0020 && unicode <= 0x007e) ||
829 (unicode >= 0x00a0 && unicode <= 0x00ff)) { 829 (unicode >= 0x00a0 && unicode <= 0x00ff)) {
830 keysyms->push_back(unicode); 830 keysyms.push_back(unicode);
831 } 831 }
832 832
833 const CodePair* map_end = kKeySymUnicodeMap + arraysize(kKeySymUnicodeMap); 833 const CodePair* map_end = kKeySymUnicodeMap + arraysize(kKeySymUnicodeMap);
834 const CodePair* pair = 834 const CodePair* pair =
835 std::lower_bound(kKeySymUnicodeMap, map_end, unicode, &CompareCodePair); 835 std::lower_bound(kKeySymUnicodeMap, map_end, unicode, &CompareCodePair);
836 while (pair != map_end && pair->unicode == unicode) { 836 while (pair != map_end && pair->unicode == unicode) {
837 keysyms->push_back(pair->keysym); 837 keysyms.push_back(pair->keysym);
838 ++pair; 838 ++pair;
839 } 839 }
840 840
841 keysyms->push_back(0x01000000 | unicode); 841 keysyms.push_back(0x01000000 | unicode);
842 return keysyms;
842 } 843 }
843 844
844 } // namespace remoting 845 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/linux/unicode_to_keysym.h ('k') | remoting/host/linux/unicode_to_keysym_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698