OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/events/keycodes/keyboard_code_conversion_x.h" | 5 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
6 | 6 |
7 #define XK_3270 // for XK_3270_BackTab | 7 #define XK_3270 // for XK_3270_BackTab |
8 #include <X11/keysym.h> | 8 #include <X11/keysym.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/Xutil.h> | 10 #include <X11/Xutil.h> |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 return XF86XK_KbdBrightnessDown; | 803 return XF86XK_KbdBrightnessDown; |
804 case VKEY_KBD_BRIGHTNESS_UP: | 804 case VKEY_KBD_BRIGHTNESS_UP: |
805 return XF86XK_KbdBrightnessUp; | 805 return XF86XK_KbdBrightnessUp; |
806 | 806 |
807 default: | 807 default: |
808 LOG(WARNING) << "Unknown keycode:" << keycode; | 808 LOG(WARNING) << "Unknown keycode:" << keycode; |
809 return 0; | 809 return 0; |
810 } | 810 } |
811 } | 811 } |
812 | 812 |
| 813 bool IsXKeyEventFabricatedByIme(XEvent* xev) { |
| 814 // XIM fabricates key events for the character compositions by XK_Multi_key. |
| 815 // For example, when a user hits XK_Multi_key, XK_apostrophe, and XK_e in |
| 816 // order to input "é", then XIM generates a key event with keycode=0 and |
| 817 // state=0 for the composition, and the sequence of X11 key events will be |
| 818 // XK_Multi_key, XK_apostrophe, **NoSymbol**, and XK_e. |
| 819 // |
| 820 // We have to send these fabricated key events to XIM so it can correctly |
| 821 // handle the character compositions. |
| 822 const bool fabricated_by_xim = xev->xkey.keycode == 0 && xev->xkey.state == 0; |
| 823 |
| 824 return fabricated_by_xim; |
| 825 } |
| 826 |
813 } // namespace ui | 827 } // namespace ui |
OLD | NEW |