| 1 | // Hand-edited to resolve conflicts with xdg-shell stable |
| 2 | /* |
| 3 | * Copyright © 2008-2013 Kristian Høgsberg |
| 4 | * Copyright © 2013 Rafael Antognolli |
| 5 | * Copyright © 2013 Jasper St. Pierre |
| 6 | * Copyright © 2010-2013 Intel Corporation |
| 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 9 | * copy of this software and associated documentation files (the "Software"), |
| 10 | * to deal in the Software without restriction, including without limitation |
| 11 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 12 | * and/or sell copies of the Software, and to permit persons to whom the |
| 13 | * Software is furnished to do so, subject to the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice (including the next |
| 16 | * paragraph) shall be included in all copies or substantial portions of the |
| 17 | * Software. |
| 18 | * |
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 22 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 25 | * DEALINGS IN THE SOFTWARE. |
| 26 | */ |
| 27 | #include "qwayland-xdg-shell-unstable-v5_p.h" |
| 28 | #include <QtWaylandClient/private/wayland-wayland-client-protocol.h> |
| 29 | |
| 30 | QT_BEGIN_NAMESPACE |
| 31 | QT_WARNING_PUSH |
| 32 | QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers" ) |
| 33 | |
| 34 | namespace QtWayland { |
| 35 | xdg_shell_v5::xdg_shell_v5(struct ::wl_registry *registry, int id, int version) |
| 36 | { |
| 37 | init(registry, id, version); |
| 38 | } |
| 39 | |
| 40 | xdg_shell_v5::xdg_shell_v5(struct ::xdg_shell_v5 *obj) |
| 41 | : m_xdg_shell(obj) |
| 42 | { |
| 43 | init_listener(); |
| 44 | } |
| 45 | |
| 46 | xdg_shell_v5::xdg_shell_v5() |
| 47 | : m_xdg_shell(nullptr) |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | xdg_shell_v5::~xdg_shell_v5() |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | void xdg_shell_v5::init(struct ::wl_registry *registry, int id, int version) |
| 56 | { |
| 57 | m_xdg_shell = static_cast<struct ::xdg_shell_v5 *>(wl_registry_bind(registry, id, &xdg_shell_v5_interface, version)); |
| 58 | init_listener(); |
| 59 | } |
| 60 | |
| 61 | void xdg_shell_v5::init(struct ::xdg_shell_v5 *obj) |
| 62 | { |
| 63 | m_xdg_shell = obj; |
| 64 | init_listener(); |
| 65 | } |
| 66 | |
| 67 | bool xdg_shell_v5::isInitialized() const |
| 68 | { |
| 69 | return m_xdg_shell != nullptr; |
| 70 | } |
| 71 | |
| 72 | const struct wl_interface *xdg_shell_v5::interface() |
| 73 | { |
| 74 | return &::xdg_shell_v5_interface; |
| 75 | } |
| 76 | |
| 77 | void xdg_shell_v5::destroy() |
| 78 | { |
| 79 | xdg_shell_destroy( |
| 80 | xdg_shell: m_xdg_shell); |
| 81 | m_xdg_shell = nullptr; |
| 82 | } |
| 83 | |
| 84 | void xdg_shell_v5::use_unstable_version(int32_t version) |
| 85 | { |
| 86 | xdg_shell_use_unstable_version( |
| 87 | xdg_shell: m_xdg_shell, |
| 88 | version); |
| 89 | } |
| 90 | |
| 91 | struct ::xdg_surface_v5 *xdg_shell_v5::get_xdg_surface(struct ::wl_surface *surface) |
| 92 | { |
| 93 | return xdg_shell_get_xdg_surface( |
| 94 | xdg_shell: m_xdg_shell, |
| 95 | surface); |
| 96 | } |
| 97 | |
| 98 | struct ::xdg_popup_v5 *xdg_shell_v5::get_xdg_popup(struct ::wl_surface *surface, struct ::wl_surface *parent, struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y) |
| 99 | { |
| 100 | return xdg_shell_get_xdg_popup( |
| 101 | xdg_shell: m_xdg_shell, |
| 102 | surface, |
| 103 | parent, |
| 104 | seat, |
| 105 | serial, |
| 106 | x, |
| 107 | y); |
| 108 | } |
| 109 | |
| 110 | void xdg_shell_v5::pong(uint32_t serial) |
| 111 | { |
| 112 | xdg_shell_pong( |
| 113 | xdg_shell: m_xdg_shell, |
| 114 | serial); |
| 115 | } |
| 116 | |
| 117 | void xdg_shell_v5::xdg_shell_ping(uint32_t ) |
| 118 | { |
| 119 | } |
| 120 | |
| 121 | void xdg_shell_v5::handle_ping( |
| 122 | void *data, |
| 123 | struct ::xdg_shell_v5 *object, |
| 124 | uint32_t serial) |
| 125 | { |
| 126 | Q_UNUSED(object); |
| 127 | static_cast<xdg_shell_v5 *>(data)->xdg_shell_ping( |
| 128 | serial); |
| 129 | } |
| 130 | |
| 131 | const struct xdg_shell_listener xdg_shell_v5::m_xdg_shell_listener = { |
| 132 | .ping: xdg_shell_v5::handle_ping |
| 133 | }; |
| 134 | |
| 135 | void xdg_shell_v5::init_listener() |
| 136 | { |
| 137 | xdg_shell_add_listener(xdg_shell: m_xdg_shell, listener: &m_xdg_shell_listener, data: this); |
| 138 | } |
| 139 | |
| 140 | xdg_surface_v5::xdg_surface_v5(struct ::wl_registry *registry, int id, int version) |
| 141 | { |
| 142 | init(registry, id, version); |
| 143 | } |
| 144 | |
| 145 | xdg_surface_v5::xdg_surface_v5(struct ::xdg_surface_v5 *obj) |
| 146 | : m_xdg_surface(obj) |
| 147 | { |
| 148 | init_listener(); |
| 149 | } |
| 150 | |
| 151 | xdg_surface_v5::xdg_surface_v5() |
| 152 | : m_xdg_surface(nullptr) |
| 153 | { |
| 154 | } |
| 155 | |
| 156 | xdg_surface_v5::~xdg_surface_v5() |
| 157 | { |
| 158 | } |
| 159 | |
| 160 | void xdg_surface_v5::init(struct ::wl_registry *registry, int id, int version) |
| 161 | { |
| 162 | m_xdg_surface = static_cast<struct ::xdg_surface_v5 *>(wl_registry_bind(registry, id, &xdg_surface_v5_interface, version)); |
| 163 | init_listener(); |
| 164 | } |
| 165 | |
| 166 | void xdg_surface_v5::init(struct ::xdg_surface_v5 *obj) |
| 167 | { |
| 168 | m_xdg_surface = obj; |
| 169 | init_listener(); |
| 170 | } |
| 171 | |
| 172 | bool xdg_surface_v5::isInitialized() const |
| 173 | { |
| 174 | return m_xdg_surface != nullptr; |
| 175 | } |
| 176 | |
| 177 | const struct wl_interface *xdg_surface_v5::interface() |
| 178 | { |
| 179 | return &::xdg_surface_v5_interface; |
| 180 | } |
| 181 | |
| 182 | void xdg_surface_v5::destroy() |
| 183 | { |
| 184 | xdg_surface_destroy( |
| 185 | xdg_surface: m_xdg_surface); |
| 186 | m_xdg_surface = nullptr; |
| 187 | } |
| 188 | |
| 189 | void xdg_surface_v5::set_parent(struct ::xdg_surface_v5 *parent) |
| 190 | { |
| 191 | xdg_surface_set_parent( |
| 192 | xdg_surface: m_xdg_surface, |
| 193 | parent); |
| 194 | } |
| 195 | |
| 196 | void xdg_surface_v5::set_title(const QString &title) |
| 197 | { |
| 198 | xdg_surface_set_title( |
| 199 | xdg_surface: m_xdg_surface, |
| 200 | title: title.toUtf8().constData()); |
| 201 | } |
| 202 | |
| 203 | void xdg_surface_v5::set_app_id(const QString &app_id) |
| 204 | { |
| 205 | xdg_surface_set_app_id( |
| 206 | xdg_surface: m_xdg_surface, |
| 207 | app_id: app_id.toUtf8().constData()); |
| 208 | } |
| 209 | |
| 210 | void xdg_surface_v5::show_window_menu(struct ::wl_seat *seat, uint32_t serial, int32_t x, int32_t y) |
| 211 | { |
| 212 | xdg_surface_show_window_menu( |
| 213 | xdg_surface: m_xdg_surface, |
| 214 | seat, |
| 215 | serial, |
| 216 | x, |
| 217 | y); |
| 218 | } |
| 219 | |
| 220 | void xdg_surface_v5::move(struct ::wl_seat *seat, uint32_t serial) |
| 221 | { |
| 222 | xdg_surface_move( |
| 223 | xdg_surface: m_xdg_surface, |
| 224 | seat, |
| 225 | serial); |
| 226 | } |
| 227 | |
| 228 | void xdg_surface_v5::resize(struct ::wl_seat *seat, uint32_t serial, uint32_t edges) |
| 229 | { |
| 230 | xdg_surface_resize( |
| 231 | xdg_surface: m_xdg_surface, |
| 232 | seat, |
| 233 | serial, |
| 234 | edges); |
| 235 | } |
| 236 | |
| 237 | void xdg_surface_v5::ack_configure(uint32_t serial) |
| 238 | { |
| 239 | xdg_surface_ack_configure( |
| 240 | xdg_surface: m_xdg_surface, |
| 241 | serial); |
| 242 | } |
| 243 | |
| 244 | void xdg_surface_v5::set_window_geometry(int32_t x, int32_t y, int32_t width, int32_t height) |
| 245 | { |
| 246 | xdg_surface_set_window_geometry( |
| 247 | xdg_surface: m_xdg_surface, |
| 248 | x, |
| 249 | y, |
| 250 | width, |
| 251 | height); |
| 252 | } |
| 253 | |
| 254 | void xdg_surface_v5::set_maximized() |
| 255 | { |
| 256 | xdg_surface_set_maximized( |
| 257 | xdg_surface: m_xdg_surface); |
| 258 | } |
| 259 | |
| 260 | void xdg_surface_v5::unset_maximized() |
| 261 | { |
| 262 | xdg_surface_unset_maximized( |
| 263 | xdg_surface: m_xdg_surface); |
| 264 | } |
| 265 | |
| 266 | void xdg_surface_v5::set_fullscreen(struct ::wl_output *output) |
| 267 | { |
| 268 | xdg_surface_set_fullscreen( |
| 269 | xdg_surface: m_xdg_surface, |
| 270 | output); |
| 271 | } |
| 272 | |
| 273 | void xdg_surface_v5::unset_fullscreen() |
| 274 | { |
| 275 | xdg_surface_unset_fullscreen( |
| 276 | xdg_surface: m_xdg_surface); |
| 277 | } |
| 278 | |
| 279 | void xdg_surface_v5::set_minimized() |
| 280 | { |
| 281 | xdg_surface_set_minimized( |
| 282 | xdg_surface: m_xdg_surface); |
| 283 | } |
| 284 | |
| 285 | void xdg_surface_v5::xdg_surface_configure(int32_t , int32_t , wl_array *, uint32_t ) |
| 286 | { |
| 287 | } |
| 288 | |
| 289 | void xdg_surface_v5::handle_configure( |
| 290 | void *data, |
| 291 | struct ::xdg_surface_v5 *object, |
| 292 | int32_t width, |
| 293 | int32_t height, |
| 294 | wl_array *states, |
| 295 | uint32_t serial) |
| 296 | { |
| 297 | Q_UNUSED(object); |
| 298 | static_cast<xdg_surface_v5 *>(data)->xdg_surface_configure( |
| 299 | width, |
| 300 | height, |
| 301 | states, |
| 302 | serial); |
| 303 | } |
| 304 | |
| 305 | void xdg_surface_v5::xdg_surface_close() |
| 306 | { |
| 307 | } |
| 308 | |
| 309 | void xdg_surface_v5::handle_close( |
| 310 | void *data, |
| 311 | struct ::xdg_surface_v5 *object) |
| 312 | { |
| 313 | Q_UNUSED(object); |
| 314 | static_cast<xdg_surface_v5 *>(data)->xdg_surface_close(); |
| 315 | } |
| 316 | |
| 317 | const struct xdg_surface_listener xdg_surface_v5::m_xdg_surface_listener = { |
| 318 | .configure: xdg_surface_v5::handle_configure, |
| 319 | .close: xdg_surface_v5::handle_close |
| 320 | }; |
| 321 | |
| 322 | void xdg_surface_v5::init_listener() |
| 323 | { |
| 324 | xdg_surface_add_listener(xdg_surface: m_xdg_surface, listener: &m_xdg_surface_listener, data: this); |
| 325 | } |
| 326 | |
| 327 | xdg_popup_v5::xdg_popup_v5(struct ::wl_registry *registry, int id, int version) |
| 328 | { |
| 329 | init(registry, id, version); |
| 330 | } |
| 331 | |
| 332 | xdg_popup_v5::xdg_popup_v5(struct ::xdg_popup_v5 *obj) |
| 333 | : m_xdg_popup(obj) |
| 334 | { |
| 335 | init_listener(); |
| 336 | } |
| 337 | |
| 338 | xdg_popup_v5::xdg_popup_v5() |
| 339 | : m_xdg_popup(nullptr) |
| 340 | { |
| 341 | } |
| 342 | |
| 343 | xdg_popup_v5::~xdg_popup_v5() |
| 344 | { |
| 345 | } |
| 346 | |
| 347 | void xdg_popup_v5::init(struct ::wl_registry *registry, int id, int version) |
| 348 | { |
| 349 | m_xdg_popup = static_cast<struct ::xdg_popup_v5 *>(wl_registry_bind(registry, id, &xdg_popup_v5_interface, version)); |
| 350 | init_listener(); |
| 351 | } |
| 352 | |
| 353 | void xdg_popup_v5::init(struct ::xdg_popup_v5 *obj) |
| 354 | { |
| 355 | m_xdg_popup = obj; |
| 356 | init_listener(); |
| 357 | } |
| 358 | |
| 359 | bool xdg_popup_v5::isInitialized() const |
| 360 | { |
| 361 | return m_xdg_popup != nullptr; |
| 362 | } |
| 363 | |
| 364 | const struct wl_interface *xdg_popup_v5::interface() |
| 365 | { |
| 366 | return &::xdg_popup_v5_interface; |
| 367 | } |
| 368 | |
| 369 | void xdg_popup_v5::destroy() |
| 370 | { |
| 371 | xdg_popup_destroy( |
| 372 | xdg_popup: m_xdg_popup); |
| 373 | m_xdg_popup = nullptr; |
| 374 | } |
| 375 | |
| 376 | void xdg_popup_v5::xdg_popup_popup_done() |
| 377 | { |
| 378 | } |
| 379 | |
| 380 | void xdg_popup_v5::handle_popup_done( |
| 381 | void *data, |
| 382 | struct ::xdg_popup_v5 *object) |
| 383 | { |
| 384 | Q_UNUSED(object); |
| 385 | static_cast<xdg_popup_v5 *>(data)->xdg_popup_popup_done(); |
| 386 | } |
| 387 | |
| 388 | const struct xdg_popup_listener xdg_popup_v5::m_xdg_popup_listener = { |
| 389 | .popup_done: xdg_popup_v5::handle_popup_done |
| 390 | }; |
| 391 | |
| 392 | void xdg_popup_v5::init_listener() |
| 393 | { |
| 394 | xdg_popup_add_listener(xdg_popup: m_xdg_popup, listener: &m_xdg_popup_listener, data: this); |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | QT_WARNING_POP |
| 399 | QT_END_NAMESPACE |
| 400 | |