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

Unified Diff: ui/events/platform/x11/x11_event_source_libevent.cc

Issue 1913913004: Regularly poll the X11 event queue. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 4 years, 7 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/events/platform/x11/x11_event_source.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/platform/x11/x11_event_source_libevent.cc
diff --git a/ui/events/platform/x11/x11_event_source_libevent.cc b/ui/events/platform/x11/x11_event_source_libevent.cc
index ff01d2e13c5580c41cd871edf1a905fb9df30e44..c38cba400ff2072ad3fbb96a98dd3aff45326863 100644
--- a/ui/events/platform/x11/x11_event_source_libevent.cc
+++ b/ui/events/platform/x11/x11_event_source_libevent.cc
@@ -14,6 +14,7 @@ namespace ui {
namespace {
class X11EventSourceLibevent : public X11EventSource,
+ public base::MessagePumpLibevent::EventSource,
public base::MessagePumpLibevent::Watcher {
public:
explicit X11EventSourceLibevent(XDisplay* display)
@@ -23,6 +24,8 @@ class X11EventSourceLibevent : public X11EventSource,
}
~X11EventSourceLibevent() override {
+ if (initialized_)
+ base::MessageLoopForUI::current()->ClearEventSource();
}
private:
@@ -33,15 +36,18 @@ class X11EventSourceLibevent : public X11EventSource,
return;
int fd = ConnectionNumber(display());
- base::MessageLoopForUI::current()->WatchFileDescriptor(fd, true,
- base::MessagePumpLibevent::WATCH_READ, &watcher_controller_, this);
+ base::MessageLoopForUI::current()->WatchFileDescriptor(
+ fd, true, base::MessagePumpLibevent::WATCH_READ, &watcher_controller_,
+ this);
+ base::MessageLoopForUI::current()->SetEventSource(this);
initialized_ = true;
}
// PlatformEventSource:
- void OnDispatcherListChanged() override {
- AddEventWatcher();
- }
+ void OnDispatcherListChanged() override { AddEventWatcher(); }
+
+ // base::MessagePumpLibEvent::EventSource:
+ bool Poll() override { return DispatchXEvents(); }
// base::MessagePumpLibevent::Watcher:
void OnFileCanReadWithoutBlocking(int fd) override {
« no previous file with comments | « ui/events/platform/x11/x11_event_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698