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