- add sources.
[platform/framework/web/crosswalk.git] / src / ozone / wayland / surface.h
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.
4
5 #ifndef OZONE_WAYLAND_SURFACE_H_
6 #define OZONE_WAYLAND_SURFACE_H_
7
8 #include <wayland-client.h>
9
10 namespace ozonewayland {
11
12 class WaylandDisplay;
13
14 class WaylandSurface {
15  public:
16   WaylandSurface();
17   virtual ~WaylandSurface();
18   struct wl_surface* wlSurface() const { return surface_; }
19
20   // FrameCallBack.
21   // Example usage to swap buffers
22   // if (m_surface->ensureFrameCallBackDone() == -1)
23   //    return;
24   // m_surface->addFrameCallBack();
25   // Swap buffers.
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();
36
37   // callback
38   static void SurfaceFrameCallback(void*, struct wl_callback*, uint32_t);
39
40  private:
41   void DestroyFrameCallBack();
42   struct wl_surface* surface_;
43   struct wl_callback* frameCallBack_;
44   struct wl_event_queue* m_queue;
45 };
46
47 }  // namespace ozonewayland
48
49 #endif  // OZONE_WAYLAND_DISPLAY_H_