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

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 205253003: [master] x11: Move X event handling out of the message-pump. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix-merge Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
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 716fbb95b37d637f3d70eff880cad6863cd72b96..65ad99937c15296448f24f72a99924808f08167e 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;
@@ -974,7 +977,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().
@@ -1300,14 +1304,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",
@@ -1597,7 +1610,7 @@ uint32_t DesktopWindowTreeHostX11::Dispatch(const base::NativeEvent& event) {
break;
}
}
- return POST_DISPATCH_NONE;
+ return ui::POST_DISPATCH_STOP_PROPAGATION;
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | ui/views/widget/desktop_aura/x11_desktop_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698