Added initial support for displaying on Wayland compositors.
[vuplus_xbmc] / xbmc / windowing / egl / wayland / Registry.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2011-2013 Team XBMC
5  *      http://www.xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22 #include <string>
23
24 #include <boost/noncopyable.hpp>
25
26 #include <wayland-client.h>
27
28 class IDllWaylandClient;
29
30 namespace xbmc
31 {
32 namespace wayland
33 {
34 class IWaylandRegistration
35 {
36 public:
37
38   virtual ~IWaylandRegistration() {};
39
40   virtual bool OnCompositorAvailable(struct wl_compositor *) = 0;
41   virtual bool OnShellAvailable(struct wl_shell *) = 0;
42   virtual bool OnSeatAvailable(struct wl_seat *) = 0;
43 };
44
45 class Registry :
46   boost::noncopyable
47 {
48 public:
49
50   Registry(IDllWaylandClient &clientLibrary,
51            struct wl_display   *display,
52            IWaylandRegistration &registration);
53   ~Registry();
54
55   struct wl_registry * GetWlRegistry();
56
57   static void HandleGlobalCallback(void *, struct wl_registry *,
58                                    uint32_t, const char *, uint32_t);
59   static void HandleRemoveGlobalCallback(void *, struct wl_registry *,
60                                          uint32_t name);
61
62 private:
63
64   static const struct wl_registry_listener m_listener;
65
66   IDllWaylandClient &m_clientLibrary;
67   struct wl_registry *m_registry;
68   IWaylandRegistration &m_registration;
69
70   void HandleGlobal(uint32_t, const char *, uint32_t);
71   void HandleRemoveGlobal(uint32_t);
72 };
73 }
74 }