1 #ifndef __DALI_WAYLAND_MANAGER_H__
2 #define __DALI_WAYLAND_MANAGER_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <wayland-extension/xdg-shell-client-protocol.h> // from wayland
26 #include <file-descriptor-monitor.h>
27 #include "input-manager.h"
28 #include "wayland-window.h"
29 #include "compositor-output-region/compositor-output.h"
42 class WindowEventInterface;
43 class PerformanceInterface;
46 * Client used to talk to Wayland server over a UNIX domain stream socket.
48 * Brief overview of Wayland:
50 * Transport mechanism = Socket
51 * Display = handles all the data sent from and to the compositor
52 * Display has a file descriptor that can be monitored for read / write events
54 * wl client function calls will place messages in a queue
55 * Calling wl_display_flush() will flush the messages to the server
57 * Incoming data is handled in two steps: queueing and dispatching.
58 * In the queue step, the data coming from the display fd is interpreted and
59 * added to a queue. On the dispatch step, the handler for the incoming event is called.
61 * This class uses the Wayland thread safe API's because the TPL (Tizen Platform Layer) will
62 * be communicating with the Wayland compositor at the same time in the DALi render thread.
82 * @brief Connect to Wayland server and setup internal data structures
87 * @brief Assign window event interface.
88 * @param[in] eventInterface window event interface
90 void AssignWindowEventInterface( WindowEventInterface* eventInterface);
93 * @brief create a surface for a window
94 * @param[in] window window object
96 void CreateSurface( Dali::Wayland::Window& window );
99 * @brief get the wayland surface
102 WlSurface* GetSurface();
104 private: // change to private
107 * @brief Install file descriptor monitor
109 void InstallFileDescriptorMonitor();
112 * @brief File descriptor callback function, triggered when wayland compositor
113 * sends an event to the client (us)
114 * @param[in] eventTypeMask
116 void FileDescriptorCallback( FileDescriptorMonitor::EventType eventTypeMask );
119 * @brief Reads and dispatches any events from the Wayland compositor
120 * We have a file descriptor monitor active to decide when to call this function
122 void ReadAndDispatchEvents();
125 * @brief helper to get wayland interfaces
127 void GetWaylandInterfaces();
132 InputManager mInputManager;
133 CompositorOutput mCompositorOutput; ///< handles monitor information and DPI
134 WlDisplay* mDisplay; ///< Wayland display, handles all the data sent from and to the compositor
135 WlShell* mShell; ///< shell
136 WlCompositor* mCompositor; ///< compositor
137 int mDisplayFileDescriptor; ///< File descriptor used by wayland client socket
138 FileDescriptorMonitor* mFileDescriptorMonitor; ///< File descriptor monitor
139 WlXdgShell* mXdgShell; ///< XDG Shell
140 WlSurface* mSurface; ///< Wayland surface
141 WlShellSurface* mShellSurface; ///< Shell surface
142 WlXdgShellSurface* mXdgSurface; ///< XDG Shell surface