[cosmetic] cleanup copyright headers
[vuplus_xbmc] / xbmc / windowing / egl / wayland / ShellSurface.cpp
1 /*
2  *      Copyright (C) 2011-2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20 #include <wayland-client.h>
21
22 #include "windowing/DllWaylandClient.h"
23 #include "windowing/WaylandProtocol.h"
24 #include "ShellSurface.h"
25
26 namespace xw = xbmc::wayland;
27
28 const wl_shell_surface_listener xw::ShellSurface::m_listener =
29 {
30   ShellSurface::HandlePingCallback,
31   ShellSurface::HandleConfigureCallback,
32   ShellSurface::HandlePopupDoneCallback
33 };
34
35 xw::ShellSurface::ShellSurface(IDllWaylandClient &clientLibrary,
36                                struct wl_shell_surface *shell_surface) :
37   m_clientLibrary(clientLibrary),
38   m_shellSurface(shell_surface)
39 {
40   protocol::AddListenerOnWaylandObject(m_clientLibrary,
41                                        m_shellSurface,
42                                        &m_listener,
43                                        reinterpret_cast<void *>(this));
44 }
45
46 xw::ShellSurface::~ShellSurface()
47 {
48   protocol::DestroyWaylandObject(m_clientLibrary, m_shellSurface);
49 }
50
51 struct wl_shell_surface *
52 xw::ShellSurface::GetWlShellSurface()
53 {
54   return m_shellSurface;
55 }
56
57 void
58 xw::ShellSurface::SetFullscreen(enum wl_shell_surface_fullscreen_method method,
59                                 uint32_t framerate,
60                                 struct wl_output *output)
61 {
62   protocol::CallMethodOnWaylandObject(m_clientLibrary,
63                                       m_shellSurface,
64                                       WL_SHELL_SURFACE_SET_FULLSCREEN,
65                                       method,
66                                       framerate,
67                                       output);
68 }
69
70 void
71 xw::ShellSurface::HandlePingCallback(void *data,
72                                      struct wl_shell_surface *shell_surface,
73                                      uint32_t serial)
74 {
75   return static_cast<ShellSurface *>(data)->HandlePing(serial);
76 }
77
78 void
79 xw::ShellSurface::HandleConfigureCallback(void *data,
80                                           struct wl_shell_surface *shell_surface,
81                                           uint32_t edges,
82                                           int32_t width,
83                                           int32_t height)
84 {
85   return static_cast<ShellSurface *>(data)->HandleConfigure(edges,
86                                                             width,
87                                                             height);
88 }
89
90 void
91 xw::ShellSurface::HandlePopupDoneCallback(void *data,
92                                           struct wl_shell_surface *shell_surface)
93 {
94   return static_cast<ShellSurface *>(data)->HandlePopupDone();
95 }
96
97 void
98 xw::ShellSurface::HandlePing(uint32_t serial)
99 {
100   protocol::CallMethodOnWaylandObject(m_clientLibrary,
101                                       m_shellSurface,
102                                       WL_SHELL_SURFACE_PONG,
103                                       serial);
104 }
105
106 void
107 xw::ShellSurface::HandleConfigure(uint32_t edges,
108                                   int32_t width,
109                                   int32_t height)
110 {
111 }
112
113 void
114 xw::ShellSurface::HandlePopupDone()
115 {
116 }