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"
41 class WindowEventInterface;
42 class PerformanceInterface;
45 * Client used to talk to Wayland server over a UNIX domain stream socket.
47 * Brief overview of Wayland:
49 * Transport mechanism = Socket
50 * Display = handles all the data sent from and to the compositor
51 * Display has a file descriptor that can be monitored for read / write events
53 * wl client function calls will place messages in a queue
54 * Calling wl_display_flush() will flush the messages to the server
56 * Incoming data is handled in two steps: queueing and dispatching.
57 * In the queue step, the data coming from the display fd is interpreted and
58 * added to a queue. On the dispatch step, the handler for the incoming event is called.
60 * default queue is dispatched by calling wl_display_dispatch().
62 * The compositor sends out the frame event every time it draws a frame.
63 * wl_display_frame_callback() to schedule a callback per frame.
66 * wl_display_dispatch(). This will dispatch any events queued on the default queue and
67 * attempt to read from the display fd if it's empty.
68 * Events read are then queued on the appropriate queues according to the proxy assignment.
88 * @brief Connect to Wayland server and setup internal data structures
93 * @brief Assign window event interface.
94 * @param[in] eventInterface window event interface
96 void AssignWindowEventInterface( WindowEventInterface* eventInterface);
99 * @brief create a surface for a window
100 * @param[in] window window object
102 void CreateSurface( Dali::Wayland::Window& window );
105 * @brief get the wayland surface
108 WlSurface* GetSurface();
110 private: // change to private
113 * @brief Install file descriptor monitor
115 void InstallFileDescriptorMonitor();
118 * @brief File descriptor callback function, triggered when wayland compositor
119 * sends an event to the client (us)
120 * @param[in] eventTypeMask
122 void FileDescriptorCallback( FileDescriptorMonitor::EventType eventTypeMask );
125 * @brief helper to get wayland interfaces
127 void GetWaylandInterfaces();
132 InputManager mInputManager;
133 WlDisplay* mDisplay; ///< Wayland display, handles all the data sent from and to the compositor
134 WlShell* mShell; ///< shell
135 WlCompositor* mCompositor; ///< compositor
136 int mDisplayFileDescriptor; ///< File descriptor used by wayland client socket
137 FileDescriptorMonitor* mFileDescriptorMonitor; ///< File descriptor monitor
138 WlXdgShell* mXdgShell; ///< XDG Shell
139 WlSurface* mSurface; ///< Wayland surface
140 WlShellSurface* mShellSurface; ///< Shell surface
141 WlXdgShellSurface* mXdgSurface; ///< XDG Shell surface