| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chromeos/ime/xkeyboard.h" | 5 #include "chromeos/ime/xkeyboard.h" | 
| 6 | 6 | 
| 7 #include <cstdlib> | 7 #include <cstdlib> | 
| 8 #include <cstring> | 8 #include <cstring> | 
| 9 #include <queue> | 9 #include <queue> | 
| 10 #include <set> | 10 #include <set> | 
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 146 unsigned int XKeyboardImpl::GetNumLockMask() { | 146 unsigned int XKeyboardImpl::GetNumLockMask() { | 
| 147   DCHECK(thread_checker_.CalledOnValidThread()); | 147   DCHECK(thread_checker_.CalledOnValidThread()); | 
| 148   static const unsigned int kBadMask = 0; | 148   static const unsigned int kBadMask = 0; | 
| 149 | 149 | 
| 150   unsigned int real_mask = kBadMask; | 150   unsigned int real_mask = kBadMask; | 
| 151   XkbDescPtr xkb_desc = | 151   XkbDescPtr xkb_desc = | 
| 152       XkbGetKeyboard(GetXDisplay(), XkbAllComponentsMask, XkbUseCoreKbd); | 152       XkbGetKeyboard(GetXDisplay(), XkbAllComponentsMask, XkbUseCoreKbd); | 
| 153   if (!xkb_desc) | 153   if (!xkb_desc) | 
| 154     return kBadMask; | 154     return kBadMask; | 
| 155 | 155 | 
| 156   if (xkb_desc->dpy && xkb_desc->names /*TODO && xkb_desc->names->vmods*/) { | 156   if (xkb_desc->dpy && xkb_desc->names && xkb_desc->names->vmods) { | 
| 157     const std::string string_to_find(kNumLockVirtualModifierString); | 157     const std::string string_to_find(kNumLockVirtualModifierString); | 
| 158     for (size_t i = 0; i < XkbNumVirtualMods; ++i) { | 158     for (size_t i = 0; i < XkbNumVirtualMods; ++i) { | 
| 159       const unsigned int virtual_mod_mask = 1U << i; | 159       const unsigned int virtual_mod_mask = 1U << i; | 
| 160       char* virtual_mod_str_raw_ptr = | 160       char* virtual_mod_str_raw_ptr = | 
| 161           XGetAtomName(xkb_desc->dpy, xkb_desc->names->vmods[i]); | 161           XGetAtomName(xkb_desc->dpy, xkb_desc->names->vmods[i]); | 
| 162       if (!virtual_mod_str_raw_ptr) | 162       if (!virtual_mod_str_raw_ptr) | 
| 163         continue; | 163         continue; | 
| 164       const std::string virtual_mod_str = virtual_mod_str_raw_ptr; | 164       const std::string virtual_mod_str = virtual_mod_str_raw_ptr; | 
| 165       XFree(virtual_mod_str_raw_ptr); | 165       XFree(virtual_mod_str_raw_ptr); | 
| 166 | 166 | 
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 370   return CheckLayoutName(layout_name); | 370   return CheckLayoutName(layout_name); | 
| 371 } | 371 } | 
| 372 | 372 | 
| 373 // static | 373 // static | 
| 374 XKeyboard* XKeyboard::Create() { | 374 XKeyboard* XKeyboard::Create() { | 
| 375   return new XKeyboardImpl(); | 375   return new XKeyboardImpl(); | 
| 376 } | 376 } | 
| 377 | 377 | 
| 378 }  // namespace input_method | 378 }  // namespace input_method | 
| 379 }  // namespace chromeos | 379 }  // namespace chromeos | 
| OLD | NEW | 
|---|