OLD | NEW |
(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 #ifndef UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_GLIB_H_ |
| 6 #define UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_GLIB_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "ui/events/events_export.h" |
| 13 #include "ui/events/platform/x11/x11_event_source.h" |
| 14 #include "ui/gfx/x/x11_types.h" |
| 15 |
| 16 typedef struct _GPollFD GPollFD; |
| 17 typedef struct _GSource GSource; |
| 18 |
| 19 namespace ui { |
| 20 |
| 21 // A PlatformEventSource implementation for X11. Dispatches XEvents and uses |
| 22 // Glib to be notified for incoming XEvents. |
| 23 class EVENTS_EXPORT X11EventSourceGlib : public X11EventSource { |
| 24 public: |
| 25 explicit X11EventSourceGlib(XDisplay* display); |
| 26 ~X11EventSourceGlib() override; |
| 27 |
| 28 // PlatformEventSource: |
| 29 uint32_t DispatchEvent(XEvent* xevent) override; |
| 30 |
| 31 private: |
| 32 void InitXSource(int fd); |
| 33 |
| 34 // The GLib event source for X events. |
| 35 GSource* x_source_ = nullptr; |
| 36 |
| 37 // The poll attached to |x_source_|. |
| 38 scoped_ptr<GPollFD> x_poll_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(X11EventSourceGlib); |
| 41 }; |
| 42 |
| 43 } // namespace ui |
| 44 |
| 45 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_GLIB_H_ |
OLD | NEW |