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

Side by Side Diff: ui/events/x/events_x.cc

Issue 321963003: aura-linux: Supports deadkey + shift + alphabet for XIM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/event_constants.h" 5 #include "ui/events/event_constants.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string.h> 8 #include <string.h>
9 #include <X11/extensions/XInput.h> 9 #include <X11/extensions/XInput.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 int GetEventFlagsFromXKeyEvent(XEvent* xevent) { 155 int GetEventFlagsFromXKeyEvent(XEvent* xevent) {
156 DCHECK(xevent->type == KeyPress || xevent->type == KeyRelease); 156 DCHECK(xevent->type == KeyPress || xevent->type == KeyRelease);
157 157
158 #if defined(OS_CHROMEOS) 158 #if defined(OS_CHROMEOS)
159 const int ime_fabricated_flag = 0; 159 const int ime_fabricated_flag = 0;
160 #else 160 #else
161 // XIM fabricates key events for the character compositions by XK_Multi_key. 161 // XIM fabricates key events for the character compositions by XK_Multi_key.
162 // For example, when a user hits XK_Multi_key, XK_apostrophe, and XK_e in 162 // For example, when a user hits XK_Multi_key, XK_apostrophe, and XK_e in
163 // order to input "é", then XIM generates a key event with keycode=0 and 163 // order to input "é", then XIM generates a key event with keycode=0 and
164 // state=0 for the composition, and the sequence of X11 key events will be 164 // state=0 for the composition, and the sequence of X11 key events will be
sadrul 2014/06/12 10:49:32 Should you update this comment too?
Yuki 2014/06/12 13:13:24 Done.
165 // XK_Multi_key, XK_apostrophe, **NoSymbol**, and XK_e. 165 // XK_Multi_key, XK_apostrophe, **NoSymbol**, and XK_e.
166 // 166 //
167 // We have to send these fabricated key events to XIM so it can correctly 167 // We have to send these fabricated key events to XIM so it can correctly
168 // handle the character compositions. 168 // handle the character compositions.
169 const unsigned int shift_lock_mask = ShiftMask | LockMask;
169 const bool fabricated_by_xim = 170 const bool fabricated_by_xim =
170 xevent->xkey.keycode == 0 && xevent->xkey.state == 0; 171 xevent->xkey.keycode == 0 &&
172 (xevent->xkey.state & ~shift_lock_mask) == 0;
171 const int ime_fabricated_flag = 173 const int ime_fabricated_flag =
172 fabricated_by_xim ? ui::EF_IME_FABRICATED_KEY : 0; 174 fabricated_by_xim ? ui::EF_IME_FABRICATED_KEY : 0;
173 #endif 175 #endif
174 176
175 return GetEventFlagsFromXState(xevent->xkey.state) | 177 return GetEventFlagsFromXState(xevent->xkey.state) |
176 (IsKeypadKey(XLookupKeysym(&xevent->xkey, 0)) ? ui::EF_NUMPAD_KEY : 0) | 178 (IsKeypadKey(XLookupKeysym(&xevent->xkey, 0)) ? ui::EF_NUMPAD_KEY : 0) |
177 (IsFunctionKey(XLookupKeysym(&xevent->xkey, 0)) ? 179 (IsFunctionKey(XLookupKeysym(&xevent->xkey, 0)) ?
178 ui::EF_FUNCTION_KEY : 0) | 180 ui::EF_FUNCTION_KEY : 0) |
179 ime_fabricated_flag; 181 ime_fabricated_flag;
180 } 182 }
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 DeviceDataManager::GetInstance()->GetGestureTimes( 723 DeviceDataManager::GetInstance()->GetGestureTimes(
722 native_event, start_time, end_time); 724 native_event, start_time, end_time);
723 return true; 725 return true;
724 } 726 }
725 727
726 bool IsTouchpadEvent(const base::NativeEvent& event) { 728 bool IsTouchpadEvent(const base::NativeEvent& event) {
727 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); 729 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event);
728 } 730 }
729 731
730 } // namespace ui 732 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698