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

Side by Side Diff: ui/events/platform/x11/x11_event_source_libevent.cc

Issue 244093002: x11: Make the event-source work with both glib and libevent message-pumps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/events/platform/x11/x11_event_source_glib.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/events/platform/x11/x11_event_source.h"
6
7 #include <X11/Xlib.h>
8
9 #include "base/message_loop/message_loop.h"
10 #include "base/message_loop/message_pump_libevent.h"
11
12 namespace ui {
13
14 namespace {
15
16 class X11EventSourceLibevent : public X11EventSource,
17 public base::MessagePumpLibevent::Watcher {
18 public:
19 explicit X11EventSourceLibevent(XDisplay* display)
20 : X11EventSource(display) {
21 int fd = ConnectionNumber(display);
22 base::MessageLoopForUI::current()->WatchFileDescriptor(fd, true,
23 base::MessagePumpLibevent::WATCH_READ, &watcher_controller_, this);
24 }
25
26 virtual ~X11EventSourceLibevent() {
27 }
28
29 private:
30 // base::MessagePumpLibevent::Watcher:
31 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE {
32 DispatchXEvents();
33 }
34
35 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE {
36 NOTREACHED();
37 }
38
39 base::MessagePumpLibevent::FileDescriptorWatcher watcher_controller_;
40
41 DISALLOW_COPY_AND_ASSIGN(X11EventSourceLibevent);
42 };
43
44 } // namespace
45
46 scoped_ptr<PlatformEventSource> PlatformEventSource::CreateDefault() {
47 return scoped_ptr<PlatformEventSource>(
48 new X11EventSourceLibevent(gfx::GetXDisplay()));
49 }
50
51 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/platform/x11/x11_event_source_glib.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698