diff options
-rw-r--r-- | ui/aura/dispatcher_linux.cc | 13 | ||||
-rw-r--r-- | ui/aura/dispatcher_linux.h | 6 | ||||
-rw-r--r-- | ui/aura/root_window_host_linux.cc | 11 |
3 files changed, 18 insertions, 12 deletions
diff --git a/ui/aura/dispatcher_linux.cc b/ui/aura/dispatcher_linux.cc index dc84bd99..9603d11 100644 --- a/ui/aura/dispatcher_linux.cc +++ b/ui/aura/dispatcher_linux.cc @@ -7,6 +7,7 @@ #include <X11/extensions/XInput2.h> #include "ui/aura/root_window_host_linux.h" +#include "ui/base/events.h" namespace aura { @@ -19,16 +20,26 @@ DispatcherLinux::~DispatcherLinux() { } void DispatcherLinux::RootWindowHostCreated(::Window window, + ::Window root, RootWindowHostLinux* host) { hosts_.insert(std::make_pair(window, host)); + hosts_.insert(std::make_pair(root, host)); } -void DispatcherLinux::RootWindowHostDestroying(::Window window) { +void DispatcherLinux::RootWindowHostDestroying(::Window window, ::Window root) { hosts_.erase(window); + hosts_.erase(root); } base::MessagePumpDispatcher::DispatchStatus DispatcherLinux::Dispatch( XEvent* xev) { + // XI_HierarchyChanged events are special. There is no window associated with + // these events. So process them directly from here. + if (xev->type == GenericEvent && + xev->xgeneric.evtype == XI_HierarchyChanged) { + ui::UpdateDeviceList(); + return EVENT_PROCESSED; + } RootWindowHostLinux* host = GetRootWindowHostForXEvent(xev); return host ? host->Dispatch(xev) : EVENT_IGNORED; } diff --git a/ui/aura/dispatcher_linux.h b/ui/aura/dispatcher_linux.h index 11c9084..2be4dec 100644 --- a/ui/aura/dispatcher_linux.h +++ b/ui/aura/dispatcher_linux.h @@ -25,8 +25,10 @@ class DispatcherLinux : public Dispatcher { DispatcherLinux(); virtual ~DispatcherLinux(); - void RootWindowHostCreated(::Window window, RootWindowHostLinux* host); - void RootWindowHostDestroying(::Window window); + void RootWindowHostCreated(::Window window, + ::Window root, + RootWindowHostLinux* host); + void RootWindowHostDestroying(::Window window, ::Window root); // Overridden from MessageLoop::Dispatcher: virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc index b3b32c5..342e114 100644 --- a/ui/aura/root_window_host_linux.cc +++ b/ui/aura/root_window_host_linux.cc @@ -290,7 +290,7 @@ RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds) CWBackPixmap, &swa); static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> - RootWindowHostCreated(xwindow_, this); + RootWindowHostCreated(xwindow_, x_root_window_, this); long event_mask = ButtonPressMask | ButtonReleaseMask | FocusChangeMask | KeyPressMask | KeyReleaseMask | @@ -321,7 +321,7 @@ RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds) RootWindowHostLinux::~RootWindowHostLinux() { static_cast<DispatcherLinux*>(Env::GetInstance()->GetDispatcher())-> - RootWindowHostDestroying(xwindow_); + RootWindowHostDestroying(xwindow_, x_root_window_); XDestroyWindow(xdisplay_, xwindow_); // Clears XCursorCache. @@ -392,13 +392,6 @@ base::MessagePumpDispatcher::DispatchStatus RootWindowHostLinux::Dispatch( if (!factory->ShouldProcessXI2Event(xev)) break; - // Update the device list if necessary. - if (xev->xgeneric.evtype == XI_HierarchyChanged) { - ui::UpdateDeviceList(); - handled = true; - break; - } - ui::EventType type = ui::EventTypeFromNative(xev); // If this is a motion event we want to coalesce all pending motion // events that are at the top of the queue. |