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

Side by Side Diff: ash/sticky_keys/sticky_keys_controller.cc

Issue 164223002: Add missing x11 checks in StickyKeysHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 | « 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 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 "ash/sticky_keys/sticky_keys_controller.h" 5 #include "ash/sticky_keys/sticky_keys_controller.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #undef RootWindow 10 #undef RootWindow
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 // The action triggered above may have destroyed the event target, in which 410 // The action triggered above may have destroyed the event target, in which
411 // case we will dispatch the modifier up event to the root window instead. 411 // case we will dispatch the modifier up event to the root window instead.
412 aura::Window* modifier_up_target = 412 aura::Window* modifier_up_target =
413 window_tracker.Contains(target) ? target : root_window; 413 window_tracker.Contains(target) ? target : root_window;
414 delegate_->DispatchKeyEvent(modifier_up_event_.get(), modifier_up_target); 414 delegate_->DispatchKeyEvent(modifier_up_event_.get(), modifier_up_target);
415 event_from_myself_ = false; 415 event_from_myself_ = false;
416 } 416 }
417 417
418 void StickyKeysHandler::AppendNativeEventMask(unsigned int* state) { 418 void StickyKeysHandler::AppendNativeEventMask(unsigned int* state) {
419 #if defined(USE_X11)
419 unsigned int& state_ref = *state; 420 unsigned int& state_ref = *state;
420 switch (modifier_flag_) { 421 switch (modifier_flag_) {
421 case ui::EF_CONTROL_DOWN: 422 case ui::EF_CONTROL_DOWN:
422 state_ref |= ControlMask; 423 state_ref |= ControlMask;
423 break; 424 break;
424 case ui::EF_ALT_DOWN: 425 case ui::EF_ALT_DOWN:
425 state_ref |= Mod1Mask; 426 state_ref |= Mod1Mask;
426 break; 427 break;
427 case ui::EF_SHIFT_DOWN: 428 case ui::EF_SHIFT_DOWN:
428 state_ref |= ShiftMask; 429 state_ref |= ShiftMask;
429 break; 430 break;
430 default: 431 default:
431 NOTREACHED(); 432 NOTREACHED();
432 } 433 }
434 #endif
433 } 435 }
434 436
435 void StickyKeysHandler::AppendModifier(ui::KeyEvent* event) { 437 void StickyKeysHandler::AppendModifier(ui::KeyEvent* event) {
436 #if defined(USE_X11) 438 #if defined(USE_X11)
437 XEvent* xev = event->native_event(); 439 XEvent* xev = event->native_event();
438 if (xev) { 440 if (xev) {
439 XKeyEvent* xkey = &(xev->xkey); 441 XKeyEvent* xkey = &(xev->xkey);
440 AppendNativeEventMask(&xkey->state); 442 AppendNativeEventMask(&xkey->state);
441 } 443 }
442 #elif defined(USE_OZONE) 444 #elif defined(USE_OZONE)
(...skipping 29 matching lines...) Expand all
472 &xievent->mods.effective)); 474 &xievent->mods.effective));
473 } 475 }
474 } 476 }
475 #elif defined(USE_OZONE) 477 #elif defined(USE_OZONE)
476 NOTIMPLEMENTED() << "Modifier key is not handled"; 478 NOTIMPLEMENTED() << "Modifier key is not handled";
477 #endif 479 #endif
478 event->set_flags(event->flags() | modifier_flag_); 480 event->set_flags(event->flags() | modifier_flag_);
479 } 481 }
480 482
481 } // namespace ash 483 } // namespace ash
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