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

Side by Side Diff: ui/aura/window_tree_host_x11.cc

Issue 336403005: Use XInput2 events for keyboard events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments (derat), the sequel. 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
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/aura/window_tree_host_x11.h" 5 #include "ui/aura/window_tree_host_x11.h"
6 6
7 #include <strings.h> 7 #include <strings.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #include <X11/extensions/Xrandr.h> 10 #include <X11/extensions/Xrandr.h>
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 ui::MouseEvent mouse_event(xev); 365 ui::MouseEvent mouse_event(xev);
366 TranslateAndDispatchLocatedEvent(&mouse_event); 366 TranslateAndDispatchLocatedEvent(&mouse_event);
367 break; 367 break;
368 } 368 }
369 case Expose: { 369 case Expose: {
370 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y, 370 gfx::Rect damage_rect(xev->xexpose.x, xev->xexpose.y,
371 xev->xexpose.width, xev->xexpose.height); 371 xev->xexpose.width, xev->xexpose.height);
372 compositor()->ScheduleRedrawRect(damage_rect); 372 compositor()->ScheduleRedrawRect(damage_rect);
373 break; 373 break;
374 } 374 }
375 case KeyPress: { 375 case KeyPress:
376 ui::KeyEvent keydown_event(xev, false);
377 SendEventToProcessor(&keydown_event);
378 break;
379 }
380 case KeyRelease: { 376 case KeyRelease: {
381 ui::KeyEvent keyup_event(xev, false); 377 #if defined(OS_CHROMEOS)
382 SendEventToProcessor(&keyup_event); 378 // Chrome OS uses XI2 key events instead.
379 if (base::SysInfo::IsRunningOnChromeOS())
sadrul 2014/06/26 12:34:20 We should avoid using this, because it makes it ve
kpschoedel 2014/06/26 17:24:10 I don't follow how that helps. We still have to ch
sadrul 2014/06/26 17:28:07 We don't have to make such decisions for mouse eve
kpschoedel 2014/06/26 19:10:58 OK... I see that no core ButtonPress events arrive
kpschoedel 2014/06/26 21:50:40 Never mind, got it now.
380 break;
381 #endif
382 ui::KeyEvent key_event(xev, false);
383 SendEventToProcessor(&key_event);
383 break; 384 break;
384 } 385 }
385 case ButtonPress: 386 case ButtonPress:
386 case ButtonRelease: { 387 case ButtonRelease: {
387 switch (ui::EventTypeFromNative(xev)) { 388 switch (ui::EventTypeFromNative(xev)) {
388 case ui::ET_MOUSEWHEEL: { 389 case ui::ET_MOUSEWHEEL: {
389 ui::MouseWheelEvent mouseev(xev); 390 ui::MouseWheelEvent mouseev(xev);
390 TranslateAndDispatchLocatedEvent(&mouseev); 391 TranslateAndDispatchLocatedEvent(&mouseev);
391 break; 392 break;
392 } 393 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 TranslateAndDispatchLocatedEvent(&mouseev); 693 TranslateAndDispatchLocatedEvent(&mouseev);
693 break; 694 break;
694 } 695 }
695 case ui::ET_SCROLL_FLING_START: 696 case ui::ET_SCROLL_FLING_START:
696 case ui::ET_SCROLL_FLING_CANCEL: 697 case ui::ET_SCROLL_FLING_CANCEL:
697 case ui::ET_SCROLL: { 698 case ui::ET_SCROLL: {
698 ui::ScrollEvent scrollev(xev); 699 ui::ScrollEvent scrollev(xev);
699 SendEventToProcessor(&scrollev); 700 SendEventToProcessor(&scrollev);
700 break; 701 break;
701 } 702 }
703 case ui::ET_KEY_PRESSED:
704 case ui::ET_KEY_RELEASED: {
705 #if defined(OS_CHROMEOS)
706 if (base::SysInfo::IsRunningOnChromeOS()) {
707 ui::KeyEvent key_event(xev, false);
708 SendEventToProcessor(&key_event);
709 }
710 #endif
711 break;
712 }
702 case ui::ET_UMA_DATA: 713 case ui::ET_UMA_DATA:
703 break; 714 break;
704 case ui::ET_UNKNOWN: 715 case ui::ET_UNKNOWN:
705 break; 716 break;
706 default: 717 default:
707 NOTREACHED(); 718 NOTREACHED();
708 } 719 }
709 720
710 // If we coalesced an event we need to free its cookie. 721 // If we coalesced an event we need to free its cookie.
711 if (num_coalesced > 0) 722 if (num_coalesced > 0)
(...skipping 23 matching lines...) Expand all
735 } 746 }
736 747
737 namespace test { 748 namespace test {
738 749
739 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { 750 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) {
740 default_override_redirect = override_redirect; 751 default_override_redirect = override_redirect;
741 } 752 }
742 753
743 } // namespace test 754 } // namespace test
744 } // namespace aura 755 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698