1 // Copyright 2013 Intel Corporation. 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.
5 #ifndef OZONE_WAYLAND_SURFACE_H_
6 #define OZONE_WAYLAND_SURFACE_H_
8 #include <wayland-client.h>
10 namespace ozonewayland {
14 class WaylandSurface {
17 virtual ~WaylandSurface();
18 struct wl_surface* wlSurface() const { return surface_; }
21 // Example usage to swap buffers
22 // if (m_surface->ensureFrameCallBackDone() == -1)
24 // m_surface->addFrameCallBack();
26 void AddFrameCallBack();
27 // Ensure deleteFrameCallBack(in case a framecallback is requested)
28 // is called before destroying any EGL resources associated with the
29 // surface. Example usage:
30 // deleteFrameCallBack();
31 // destroy egl window etc
32 // m_surface = nullptr; i.e destroy WaylandSurface.
33 void DeleteFrameCallBack();
34 // see addFrameCallBack.
35 int EnsureFrameCallBackDone();
38 static void SurfaceFrameCallback(void*, struct wl_callback*, uint32_t);
41 void DestroyFrameCallBack();
42 struct wl_surface* surface_;
43 struct wl_callback* frameCallBack_;
44 struct wl_event_queue* m_queue;
47 } // namespace ozonewayland
49 #endif // OZONE_WAYLAND_DISPLAY_H_