| Index: ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
| diff --git a/ui/views/widget/desktop_aura/x11_desktop_handler.cc b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
| index 46aef1728fe522ff4a2fc898b01ceb8687a0c88f..170b5f790cc6527891f16783ffe2db33248f1aef 100644
|
| --- a/ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
| +++ b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
|
| @@ -12,12 +12,10 @@
|
| #include "ui/aura/window_event_dispatcher.h"
|
| #include "ui/base/x/x11_menu_list.h"
|
| #include "ui/base/x/x11_util.h"
|
| +#include "ui/events/platform/platform_event_source.h"
|
| #include "ui/gfx/x/x11_error_tracker.h"
|
| -
|
| -#if !defined(OS_CHROMEOS)
|
| #include "ui/views/ime/input_method.h"
|
| #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
| -#endif
|
|
|
| namespace {
|
|
|
| @@ -47,7 +45,8 @@ X11DesktopHandler::X11DesktopHandler()
|
| current_window_(None),
|
| atom_cache_(xdisplay_, kAtomsToCache),
|
| wm_supports_active_window_(false) {
|
| - base::MessagePumpX11::Current()->AddDispatcherForRootWindow(this);
|
| + if (ui::PlatformEventSource::GetInstance())
|
| + ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
| aura::Env::GetInstance()->AddObserver(this);
|
|
|
| XWindowAttributes attr;
|
| @@ -64,7 +63,8 @@ X11DesktopHandler::X11DesktopHandler()
|
|
|
| X11DesktopHandler::~X11DesktopHandler() {
|
| aura::Env::GetInstance()->RemoveObserver(this);
|
| - base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(this);
|
| + if (ui::PlatformEventSource::GetInstance())
|
| + ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
| }
|
|
|
| void X11DesktopHandler::ActivateWindow(::Window window) {
|
| @@ -102,7 +102,7 @@ bool X11DesktopHandler::IsActiveWindow(::Window window) const {
|
| return window == current_window_;
|
| }
|
|
|
| -void X11DesktopHandler::ProcessXEvent(const base::NativeEvent& event) {
|
| +void X11DesktopHandler::ProcessXEvent(XEvent* event) {
|
| switch (event->type) {
|
| case EnterNotify:
|
| if (event->xcrossing.focus == True &&
|
| @@ -124,14 +124,19 @@ void X11DesktopHandler::ProcessXEvent(const base::NativeEvent& event) {
|
| }
|
| }
|
|
|
| -uint32_t X11DesktopHandler::Dispatch(const base::NativeEvent& event) {
|
| - // Check for a change to the active window.
|
| +bool X11DesktopHandler::CanDispatchEvent(const ui::PlatformEvent& event) {
|
| + return event->type == CreateNotify || event->type == DestroyNotify ||
|
| + (event->type == PropertyNotify &&
|
| + event->xproperty.window == x_root_window_);
|
| +}
|
| +
|
| +uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) {
|
| switch (event->type) {
|
| case PropertyNotify: {
|
| + // Check for a change to the active window.
|
| + CHECK_EQ(x_root_window_, event->xproperty.window);
|
| ::Atom active_window_atom = atom_cache_.GetAtom("_NET_ACTIVE_WINDOW");
|
| -
|
| - if (event->xproperty.window == x_root_window_ &&
|
| - event->xproperty.atom == active_window_atom) {
|
| + if (event->xproperty.atom == active_window_atom) {
|
| ::Window window;
|
| if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) &&
|
| window) {
|
| @@ -140,6 +145,7 @@ uint32_t X11DesktopHandler::Dispatch(const base::NativeEvent& event) {
|
| }
|
| break;
|
| }
|
| +
|
| // Menus created by Chrome can be drag and drop targets. Since they are
|
| // direct children of the screen root window and have override_redirect
|
| // we cannot use regular _NET_CLIENT_LIST_STACKING property to find them
|
| @@ -160,9 +166,11 @@ uint32_t X11DesktopHandler::Dispatch(const base::NativeEvent& event) {
|
| ui::XMenuList::GetInstance()->MaybeUnregisterMenu(xdwe->window);
|
| break;
|
| }
|
| + default:
|
| + NOTREACHED();
|
| }
|
|
|
| - return POST_DISPATCH_NONE;
|
| + return ui::POST_DISPATCH_NONE;
|
| }
|
|
|
| void X11DesktopHandler::OnWindowInitialized(aura::Window* window) {
|
|
|