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

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

Issue 9958036: aura: Add RootWindowObserver::OnKeyboardMappingChanged(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 8 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 | ui/aura/root_window.h » ('j') | 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/aura/dispatcher_linux.h" 5 #include "ui/aura/dispatcher_linux.h"
6 6
7 #include <X11/extensions/XInput2.h> 7 #include <X11/extensions/XInput2.h>
8 8
9 #include "ui/base/events.h" 9 #include "ui/base/events.h"
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 base::MessagePumpDispatcher::DispatchStatus DispatcherLinux::Dispatch( 31 base::MessagePumpDispatcher::DispatchStatus DispatcherLinux::Dispatch(
32 XEvent* xev) { 32 XEvent* xev) {
33 // XI_HierarchyChanged events are special. There is no window associated with 33 // XI_HierarchyChanged events are special. There is no window associated with
34 // these events. So process them directly from here. 34 // these events. So process them directly from here.
35 if (xev->type == GenericEvent && 35 if (xev->type == GenericEvent &&
36 xev->xgeneric.evtype == XI_HierarchyChanged) { 36 xev->xgeneric.evtype == XI_HierarchyChanged) {
37 ui::UpdateDeviceList(); 37 ui::UpdateDeviceList();
38 return EVENT_PROCESSED; 38 return EVENT_PROCESSED;
39 } 39 }
40
41 // MappingNotify events (meaning that the keyboard or pointer buttons have
42 // been remapped) aren't associated with a window; send them to all
43 // dispatchers.
44 if (xev->type == MappingNotify) {
45 for (DispatchersMap::const_iterator it = dispatchers_.begin();
46 it != dispatchers_.end(); ++it) {
47 it->second->Dispatch(xev);
48 }
49 return EVENT_PROCESSED;
50 }
51
40 MessageLoop::Dispatcher* dispatcher = GetDispatcherForXEvent(xev); 52 MessageLoop::Dispatcher* dispatcher = GetDispatcherForXEvent(xev);
41 return dispatcher ? dispatcher->Dispatch(xev) : EVENT_IGNORED; 53 return dispatcher ? dispatcher->Dispatch(xev) : EVENT_IGNORED;
42 } 54 }
43 55
44 MessageLoop::Dispatcher* DispatcherLinux::GetDispatcherForXEvent( 56 MessageLoop::Dispatcher* DispatcherLinux::GetDispatcherForXEvent(
45 XEvent* xev) const { 57 XEvent* xev) const {
46 ::Window window = xev->xany.window; 58 ::Window window = xev->xany.window;
47 if (xev->type == GenericEvent) { 59 if (xev->type == GenericEvent) {
48 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); 60 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data);
49 window = xievent->event; 61 window = xievent->event;
50 } 62 }
51 DispatchersMap::const_iterator it = dispatchers_.find(window); 63 DispatchersMap::const_iterator it = dispatchers_.find(window);
52 return it != dispatchers_.end() ? it->second : NULL; 64 return it != dispatchers_.end() ? it->second : NULL;
53 } 65 }
54 66
55 MessageLoop::Dispatcher* CreateDispatcher() { 67 MessageLoop::Dispatcher* CreateDispatcher() {
56 return new DispatcherLinux; 68 return new DispatcherLinux;
57 } 69 }
58 70
59 } // namespace aura 71 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/aura/root_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698