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

Unified Diff: ui/base/clipboard/clipboard_aurax11.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 | « ui/aura/window_tree_host_x11_unittest.cc ('k') | ui/base/clipboard/clipboard_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/clipboard/clipboard_aurax11.cc
diff --git a/ui/base/clipboard/clipboard_aurax11.cc b/ui/base/clipboard/clipboard_aurax11.cc
index 70768444b0cc4dc5b0ec78746b86291f68950b1a..f86e4a2ffdc74b1692fe70003293e108dd6dee39 100644
--- a/ui/base/clipboard/clipboard_aurax11.cc
+++ b/ui/base/clipboard/clipboard_aurax11.cc
@@ -25,6 +25,8 @@
#include "ui/base/x/selection_requestor.h"
#include "ui/base/x/selection_utils.h"
#include "ui/base/x/x11_util.h"
+#include "ui/events/platform/platform_event_dispatcher.h"
+#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/size.h"
#include "ui/gfx/x/x11_atom_cache.h"
@@ -224,7 +226,7 @@ bool Clipboard::FormatType::Equals(const FormatType& other) const {
// Private implementation of our X11 integration. Keeps X11 headers out of the
// majority of chrome, which break badly.
-class Clipboard::AuraX11Details : public base::MessagePumpDispatcher {
+class Clipboard::AuraX11Details : public PlatformEventDispatcher {
public:
AuraX11Details();
virtual ~AuraX11Details();
@@ -282,8 +284,9 @@ class Clipboard::AuraX11Details : public base::MessagePumpDispatcher {
void Clear(ClipboardType type);
private:
- // Overridden from base::MessagePumpDispatcher:
- virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE;
+ // PlatformEventDispatcher:
+ virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE;
+ virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE;
// Our X11 state.
Display* x_display_;
@@ -332,11 +335,13 @@ Clipboard::AuraX11Details::AuraX11Details()
XStoreName(x_display_, x_window_, "Chromium clipboard");
XSelectInput(x_display_, x_window_, PropertyChangeMask);
- base::MessagePumpX11::Current()->AddDispatcherForWindow(this, x_window_);
+ if (PlatformEventSource::GetInstance())
+ PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
}
Clipboard::AuraX11Details::~AuraX11Details() {
- base::MessagePumpX11::Current()->RemoveDispatcherForWindow(x_window_);
+ if (PlatformEventSource::GetInstance())
+ PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
XDestroyWindow(x_display_, x_window_);
}
@@ -485,9 +490,11 @@ void Clipboard::AuraX11Details::Clear(ClipboardType type) {
primary_owner_.ClearSelectionOwner();
}
-uint32_t Clipboard::AuraX11Details::Dispatch(const base::NativeEvent& event) {
- XEvent* xev = event;
+bool Clipboard::AuraX11Details::CanDispatchEvent(const PlatformEvent& event) {
+ return event->xany.window == x_window_;
+}
+uint32_t Clipboard::AuraX11Details::DispatchEvent(const PlatformEvent& xev) {
switch (xev->type) {
case SelectionRequest: {
if (xev->xselectionrequest.selection == XA_PRIMARY)
« no previous file with comments | « ui/aura/window_tree_host_x11_unittest.cc ('k') | ui/base/clipboard/clipboard_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698