OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 COMPONENTS_EXO_WAYLAND_SERVER_H_ |
| 6 #define COMPONENTS_EXO_WAYLAND_SERVER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/time/time.h" |
| 13 #include "components/exo/exo_export.h" |
| 14 #include "components/exo/wayland/scoped_wl_types.h" |
| 15 |
| 16 namespace exo { |
| 17 class Display; |
| 18 |
| 19 namespace wayland { |
| 20 |
| 21 // This class is a thin wrapper around a Wayland display server. All Wayland |
| 22 // requests are dispatched into the given Exospere display. |
| 23 class EXO_EXPORT Server { |
| 24 public: |
| 25 explicit Server(Display* display); |
| 26 ~Server(); |
| 27 |
| 28 // Creates a Wayland display server that clients can connect to using the |
| 29 // default socket name. |
| 30 static scoped_ptr<Server> Create(Display* display); |
| 31 |
| 32 // This adds a Unix socket to the Wayland display server which can be used |
| 33 // by clients to connect to the display server. |
| 34 bool AddSocket(const std::string name); |
| 35 |
| 36 // Returns the file descriptor associated with the server. |
| 37 int GetFileDescriptor() const; |
| 38 |
| 39 // This function dispatches events. This must be called on a thread for |
| 40 // which it's safe to access the Exospere display that this server was |
| 41 // created for. The |timeout| argument specifies the amount of time that |
| 42 // Dispatch() should block waiting for the file descriptor to become ready. |
| 43 void Dispatch(base::TimeDelta timeout); |
| 44 |
| 45 // Send all buffered events to the clients. |
| 46 void Flush(); |
| 47 |
| 48 private: |
| 49 Display* const display_; |
| 50 ScopedWLDisplay wl_display_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(Server); |
| 53 }; |
| 54 |
| 55 } // namespace wayland |
| 56 } // namespace exo |
| 57 |
| 58 #endif // COMPONENTS_EXO_WAYLAND_SERVER_H_ |
OLD | NEW |