Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
index 620cfe00145d83c2759cdda27a97cba4b22dfd32..a731b37c0c563a84e9283e97b7a7bf1b6cd71544 100644 |
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
@@ -25,6 +25,8 @@ |
#include "ui/base/hit_test.h" |
#include "ui/base/x/x11_util.h" |
#include "ui/events/event_utils.h" |
+#include "ui/events/platform/platform_event_source.h" |
+#include "ui/events/platform/x11/x11_event_source.h" |
#include "ui/events/x/device_data_manager.h" |
#include "ui/events/x/device_list_cache_x.h" |
#include "ui/events/x/touch_factory_x11.h" |
@@ -311,7 +313,8 @@ void DesktopWindowTreeHostX11::CloseNow() { |
open_windows().remove(xwindow_); |
// Actually free our native resources. |
- base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_); |
+ if (ui::PlatformEventSource::GetInstance()) |
+ ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
XDestroyWindow(xdisplay_, xwindow_); |
xwindow_ = None; |
@@ -976,7 +979,8 @@ void DesktopWindowTreeHostX11::InitX11Window( |
CopyFromParent, // visual |
attribute_mask, |
&swa); |
- base::MessagePumpX11::Current()->AddDispatcherForWindow(this, xwindow_); |
+ if (ui::PlatformEventSource::GetInstance()) |
+ ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
open_windows().push_back(xwindow_); |
// TODO(erg): Maybe need to set a ViewProp here like in RWHL::RWHL(). |
@@ -1302,14 +1306,23 @@ void DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState show_state) { |
// We now block until our window is mapped. Some X11 APIs will crash and |
// burn if passed |xwindow_| before the window is mapped, and XMapWindow is |
// asynchronous. |
- base::MessagePumpX11::Current()->BlockUntilWindowMapped(xwindow_); |
+ if (ui::X11EventSource::GetInstance()) |
+ ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_); |
window_mapped_ = true; |
} |
//////////////////////////////////////////////////////////////////////////////// |
-// DesktopWindowTreeHostX11, MessagePumpDispatcher implementation: |
+// DesktopWindowTreeHostX11, ui::PlatformEventDispatcher implementation: |
-uint32_t DesktopWindowTreeHostX11::Dispatch(const base::NativeEvent& event) { |
+bool DesktopWindowTreeHostX11::CanDispatchEvent( |
+ const ui::PlatformEvent& event) { |
+ return event->xany.window == xwindow_ || |
+ (event->type == GenericEvent && |
+ static_cast<XIDeviceEvent*>(event->xcookie.data)->event == xwindow_); |
+} |
+ |
+uint32_t DesktopWindowTreeHostX11::DispatchEvent( |
+ const ui::PlatformEvent& event) { |
XEvent* xev = event; |
TRACE_EVENT1("views", "DesktopWindowTreeHostX11::Dispatch", |
@@ -1599,7 +1612,7 @@ uint32_t DesktopWindowTreeHostX11::Dispatch(const base::NativeEvent& event) { |
break; |
} |
} |
- return POST_DISPATCH_NONE; |
+ return ui::POST_DISPATCH_STOP_PROPAGATION; |
} |
//////////////////////////////////////////////////////////////////////////////// |