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

Unified Diff: mojo/services/native_viewport/native_viewport_x11.cc

Issue 219743002: x11: Move X event handling out of the message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r261267 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
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_context_menu_unittest.cc ('k') | ui/aura/window_tree_host_x11.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_viewport/native_viewport_x11.cc
diff --git a/mojo/services/native_viewport/native_viewport_x11.cc b/mojo/services/native_viewport/native_viewport_x11.cc
index 1808da620463f99d5b16a75069dc1aacd6d1bb73..d98431d5edb490a115d0fa36a9c895ef581f045b 100644
--- a/mojo/services/native_viewport/native_viewport_x11.cc
+++ b/mojo/services/native_viewport/native_viewport_x11.cc
@@ -7,7 +7,8 @@
#include <X11/Xlib.h>
#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_pump_x11.h"
+#include "ui/events/platform/platform_event_dispatcher.h"
+#include "ui/events/platform/platform_event_source.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/x/x11_types.h"
@@ -15,15 +16,14 @@ namespace mojo {
namespace services {
class NativeViewportX11 : public NativeViewport,
- public base::MessagePumpDispatcher {
+ public ui::PlatformEventDispatcher {
public:
NativeViewportX11(NativeViewportDelegate* delegate)
: delegate_(delegate) {
}
virtual ~NativeViewportX11() {
- base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(this);
- base::MessagePumpX11::Current()->RemoveDispatcherForWindow(window_);
+ ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
XDestroyWindow(gfx::GetXDisplay(), window_);
}
@@ -53,8 +53,7 @@ class NativeViewportX11 : public NativeViewport,
atom_wm_delete_window_ = XInternAtom(display, "WM_DELETE_WINDOW", 1);
XSetWMProtocols(display, window_, &atom_wm_delete_window_, 1);
- base::MessagePumpX11::Current()->AddDispatcherForWindow(this, window_);
- base::MessagePumpX11::Current()->AddDispatcherForRootWindow(this);
+ ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
delegate_->OnAcceleratedWidgetAvailable(window_);
}
@@ -90,19 +89,17 @@ class NativeViewportX11 : public NativeViewport,
NOTIMPLEMENTED();
}
- // Overridden from base::MessagePumpDispatcher:
- virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE {
- switch (event->type) {
- case ClientMessage: {
- if (event->xclient.message_type == atom_wm_protocols_) {
- Atom protocol = static_cast<Atom>(event->xclient.data.l[0]);
- if (protocol == atom_wm_delete_window_)
- delegate_->OnDestroyed();
- }
- break;
- }
- }
- return POST_DISPATCH_NONE;
+ // ui::PlatformEventDispatcher:
+ virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE {
+ return event->type == ClientMessage &&
+ event->xclient.message_type == atom_wm_protocols_;
+ }
+
+ virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE {
+ Atom protocol = static_cast<Atom>(event->xclient.data.l[0]);
+ if (protocol == atom_wm_delete_window_)
+ delegate_->OnDestroyed();
+ return ui::POST_DISPATCH_NONE;
}
NativeViewportDelegate* delegate_;
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_context_menu_unittest.cc ('k') | ui/aura/window_tree_host_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698