2 * Copyright (C) 2011-2013 Team XBMC
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)
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.
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/>.
20 #include <wayland-client.h>
22 #include "windowing/DllWaylandClient.h"
23 #include "windowing/WaylandProtocol.h"
24 #include "ShellSurface.h"
26 namespace xw = xbmc::wayland;
28 const wl_shell_surface_listener xw::ShellSurface::m_listener =
30 ShellSurface::HandlePingCallback,
31 ShellSurface::HandleConfigureCallback,
32 ShellSurface::HandlePopupDoneCallback
35 xw::ShellSurface::ShellSurface(IDllWaylandClient &clientLibrary,
36 struct wl_shell_surface *shell_surface) :
37 m_clientLibrary(clientLibrary),
38 m_shellSurface(shell_surface)
40 protocol::AddListenerOnWaylandObject(m_clientLibrary,
43 reinterpret_cast<void *>(this));
46 xw::ShellSurface::~ShellSurface()
48 protocol::DestroyWaylandObject(m_clientLibrary, m_shellSurface);
51 struct wl_shell_surface *
52 xw::ShellSurface::GetWlShellSurface()
54 return m_shellSurface;
58 xw::ShellSurface::SetFullscreen(enum wl_shell_surface_fullscreen_method method,
60 struct wl_output *output)
62 protocol::CallMethodOnWaylandObject(m_clientLibrary,
64 WL_SHELL_SURFACE_SET_FULLSCREEN,
71 xw::ShellSurface::HandlePingCallback(void *data,
72 struct wl_shell_surface *shell_surface,
75 return static_cast<ShellSurface *>(data)->HandlePing(serial);
79 xw::ShellSurface::HandleConfigureCallback(void *data,
80 struct wl_shell_surface *shell_surface,
85 return static_cast<ShellSurface *>(data)->HandleConfigure(edges,
91 xw::ShellSurface::HandlePopupDoneCallback(void *data,
92 struct wl_shell_surface *shell_surface)
94 return static_cast<ShellSurface *>(data)->HandlePopupDone();
98 xw::ShellSurface::HandlePing(uint32_t serial)
100 protocol::CallMethodOnWaylandObject(m_clientLibrary,
102 WL_SHELL_SURFACE_PONG,
107 xw::ShellSurface::HandleConfigure(uint32_t edges,
114 xw::ShellSurface::HandlePopupDone()