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

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

Issue 394553002: Add EF_FINAL_MODIFIERS to suppress remapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore guard on rewriting extended and function keys. Created 6 years, 5 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
« no previous file with comments | « ui/events/event_constants.h ('k') | 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // handle the character compositions. 182 // handle the character compositions.
183 const unsigned int shift_lock_mask = ShiftMask | LockMask; 183 const unsigned int shift_lock_mask = ShiftMask | LockMask;
184 const bool fabricated_by_xim = 184 const bool fabricated_by_xim =
185 xevent->xkey.keycode == 0 && 185 xevent->xkey.keycode == 0 &&
186 (xevent->xkey.state & ~shift_lock_mask) == 0; 186 (xevent->xkey.state & ~shift_lock_mask) == 0;
187 const int ime_fabricated_flag = 187 const int ime_fabricated_flag =
188 fabricated_by_xim ? ui::EF_IME_FABRICATED_KEY : 0; 188 fabricated_by_xim ? ui::EF_IME_FABRICATED_KEY : 0;
189 #endif 189 #endif
190 190
191 return GetEventFlagsFromXState(xevent->xkey.state) | 191 return GetEventFlagsFromXState(xevent->xkey.state) |
192 (xevent->xkey.send_event ? ui::EF_FINAL : 0) |
192 (IsKeypadKey(XLookupKeysym(&xevent->xkey, 0)) ? ui::EF_NUMPAD_KEY : 0) | 193 (IsKeypadKey(XLookupKeysym(&xevent->xkey, 0)) ? ui::EF_NUMPAD_KEY : 0) |
193 (IsFunctionKey(XLookupKeysym(&xevent->xkey, 0)) ? 194 (IsFunctionKey(XLookupKeysym(&xevent->xkey, 0)) ?
194 ui::EF_FUNCTION_KEY : 0) | 195 ui::EF_FUNCTION_KEY : 0) |
195 ime_fabricated_flag; 196 ime_fabricated_flag;
196 } 197 }
197 198
198 int GetEventFlagsFromXGenericEvent(XEvent* xevent) { 199 int GetEventFlagsFromXGenericEvent(XEvent* xevent) {
199 DCHECK(xevent->type == GenericEvent); 200 DCHECK(xevent->type == GenericEvent);
200 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xevent->xcookie.data); 201 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xevent->xcookie.data);
201 DCHECK((xievent->evtype == XI_KeyPress) || 202 DCHECK((xievent->evtype == XI_KeyPress) ||
202 (xievent->evtype == XI_KeyRelease)); 203 (xievent->evtype == XI_KeyRelease));
203 return GetEventFlagsFromXState(xievent->mods.effective) | 204 return GetEventFlagsFromXState(xievent->mods.effective) |
205 (xevent->xkey.send_event ? ui::EF_FINAL : 0) |
204 (IsKeypadKey( 206 (IsKeypadKey(
205 XkbKeycodeToKeysym(xievent->display, xievent->detail, 0, 0)) 207 XkbKeycodeToKeysym(xievent->display, xievent->detail, 0, 0))
206 ? ui::EF_NUMPAD_KEY 208 ? ui::EF_NUMPAD_KEY
207 : 0); 209 : 0);
208 } 210 }
209 211
210 // Get the event flag for the button in XButtonEvent. During a ButtonPress 212 // Get the event flag for the button in XButtonEvent. During a ButtonPress
211 // event, |state| in XButtonEvent does not include the button that has just been 213 // event, |state| in XButtonEvent does not include the button that has just been
212 // pressed. Instead |state| contains flags for the buttons (if any) that had 214 // pressed. Instead |state| contains flags for the buttons (if any) that had
213 // already been pressed before the current button, and |button| stores the most 215 // already been pressed before the current button, and |button| stores the most
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 DeviceDataManagerX11::GetInstance()->GetGestureTimes( 777 DeviceDataManagerX11::GetInstance()->GetGestureTimes(
776 native_event, start_time, end_time); 778 native_event, start_time, end_time);
777 return true; 779 return true;
778 } 780 }
779 781
780 bool IsTouchpadEvent(const base::NativeEvent& event) { 782 bool IsTouchpadEvent(const base::NativeEvent& event) {
781 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event); 783 return DeviceDataManagerX11::GetInstance()->IsTouchpadXInputEvent(event);
782 } 784 }
783 785
784 } // namespace ui 786 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event_constants.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698