[cosmetic] cleanup copyright headers
[vuplus_xbmc] / xbmc / windowing / tests / wayland / XBMCWayland.cpp
1 /*
2  *      Copyright (C) 2005-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 "system.h"
21
22 #if defined(HAVE_WAYLAND_XBMC_PROTO)
23
24 #include <wayland-client.h>
25 #include <wayland-client-protocol.h>
26 #include "xbmc_wayland_test_client_protocol.h"
27
28 #include "XBMCWayland.h"
29
30 namespace xtw = xbmc::test::wayland;
31
32 xtw::XBMCWayland::XBMCWayland(struct xbmc_wayland *xbmcWayland) :
33   m_xbmcWayland(xbmcWayland)
34 {
35 }
36
37 xtw::XBMCWayland::~XBMCWayland()
38 {
39   xbmc_wayland_destroy(m_xbmcWayland);
40 }
41
42 void
43 xtw::XBMCWayland::AddMode(int width,
44                           int height,
45                           uint32_t refresh,
46                           enum wl_output_mode flags)
47 {
48   xbmc_wayland_add_mode(m_xbmcWayland,
49                         width,
50                         height,
51                         refresh,
52                         static_cast<uint32_t>(flags));
53 }
54
55 void
56 xtw::XBMCWayland::MovePointerTo(struct wl_surface *surface,
57                                 wl_fixed_t x,
58                                 wl_fixed_t y)
59 {
60   xbmc_wayland_move_pointer_to_on_surface(m_xbmcWayland,
61                                           surface,
62                                           x,
63                                           y);
64 }
65
66 void
67 xtw::XBMCWayland::SendButtonTo(struct wl_surface *surface,
68                                uint32_t button,
69                                uint32_t state)
70 {
71   xbmc_wayland_send_button_to_surface(m_xbmcWayland,
72                                       surface,
73                                       button,
74                                       state);
75 }
76
77 void
78 xtw::XBMCWayland::SendAxisTo(struct wl_surface *surface,
79                              uint32_t axis,
80                              wl_fixed_t value)
81 {
82   xbmc_wayland_send_axis_to_surface(m_xbmcWayland,
83                                     surface,
84                                     axis,
85                                     value);
86 }
87
88 void
89 xtw::XBMCWayland::SendKeyToKeyboard(struct wl_surface *surface,
90                                     uint32_t key,
91                                     enum wl_keyboard_key_state state)
92 {
93   xbmc_wayland_send_key_to_keyboard(m_xbmcWayland,
94                                     surface,
95                                     key,
96                                     state);
97 }
98
99 void
100 xtw::XBMCWayland::SendModifiersToKeyboard(struct wl_surface *surface,
101                                           uint32_t depressed,
102                                           uint32_t latched,
103                                           uint32_t locked,
104                                           uint32_t group)
105 {
106   xbmc_wayland_send_modifiers_to_keyboard(m_xbmcWayland,
107                                           surface,
108                                           depressed,
109                                           latched,
110                                           locked,
111                                           group);
112 }
113
114 void
115 xtw::XBMCWayland::GiveSurfaceKeyboardFocus(struct wl_surface *surface)
116 {
117   xbmc_wayland_give_surface_keyboard_focus(m_xbmcWayland,
118                                            surface);
119 }
120
121 void
122 xtw::XBMCWayland::PingSurface(struct wl_surface *surface,
123                               uint32_t serial)
124 {
125   xbmc_wayland_ping_surface(m_xbmcWayland, surface, serial);
126 }
127
128 #endif