| 1 | /* |
| 2 | * Copyright © 2008-2013 Kristian Høgsberg |
| 3 | * Copyright © 2013 Rafael Antognolli |
| 4 | * Copyright © 2013 Jasper St. Pierre |
| 5 | * Copyright © 2010-2013 Intel Corporation |
| 6 | * |
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | * copy of this software and associated documentation files (the "Software"), |
| 9 | * to deal in the Software without restriction, including without limitation |
| 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 | * and/or sell copies of the Software, and to permit persons to whom the |
| 12 | * Software is furnished to do so, subject to the following conditions: |
| 13 | * |
| 14 | * The above copyright notice and this permission notice (including the next |
| 15 | * paragraph) shall be included in all copies or substantial portions of the |
| 16 | * Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 24 | * DEALINGS IN THE SOFTWARE. |
| 25 | */ |
| 26 | |
| 27 | #include <QtWaylandCompositor/private/qwayland-server-xdg-shell-unstable-v5_p.h> |
| 28 | |
| 29 | QT_BEGIN_NAMESPACE |
| 30 | QT_WARNING_PUSH |
| 31 | QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers" ) |
| 32 | |
| 33 | namespace QtWaylandServer { |
| 34 | xdg_shell_v5::xdg_shell_v5(struct ::wl_client *client, int id, int version) |
| 35 | : m_resource_map() |
| 36 | , m_resource(nullptr) |
| 37 | , m_global(nullptr) |
| 38 | { |
| 39 | init(client, id, version); |
| 40 | } |
| 41 | |
| 42 | xdg_shell_v5::xdg_shell_v5(struct ::wl_display *display, int version) |
| 43 | : m_resource_map() |
| 44 | , m_resource(nullptr) |
| 45 | , m_global(nullptr) |
| 46 | { |
| 47 | init(display, version); |
| 48 | } |
| 49 | |
| 50 | xdg_shell_v5::xdg_shell_v5(struct ::wl_resource *resource) |
| 51 | : m_resource_map() |
| 52 | , m_resource(nullptr) |
| 53 | , m_global(nullptr) |
| 54 | { |
| 55 | init(resource); |
| 56 | } |
| 57 | |
| 58 | xdg_shell_v5::xdg_shell_v5() |
| 59 | : m_resource_map() |
| 60 | , m_resource(nullptr) |
| 61 | , m_global(nullptr) |
| 62 | { |
| 63 | } |
| 64 | |
| 65 | xdg_shell_v5::~xdg_shell_v5() |
| 66 | { |
| 67 | for (auto resource : qAsConst(t&: m_resource_map)) |
| 68 | wl_resource_set_implementation(resource: resource->handle, implementation: nullptr, data: nullptr, destroy: nullptr); |
| 69 | |
| 70 | if (m_global) { |
| 71 | wl_global_destroy(global: m_global); |
| 72 | wl_list_remove(elm: &m_displayDestroyedListener.link); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | void xdg_shell_v5::init(struct ::wl_client *client, int id, int version) |
| 77 | { |
| 78 | m_resource = bind(client, id, version); |
| 79 | } |
| 80 | |
| 81 | void xdg_shell_v5::init(struct ::wl_resource *resource) |
| 82 | { |
| 83 | m_resource = bind(handle: resource); |
| 84 | } |
| 85 | |
| 86 | xdg_shell_v5::Resource *xdg_shell_v5::add(struct ::wl_client *client, int version) |
| 87 | { |
| 88 | Resource *resource = bind(client, id: 0, version); |
| 89 | m_resource_map.insert(akey: client, avalue: resource); |
| 90 | return resource; |
| 91 | } |
| 92 | |
| 93 | xdg_shell_v5::Resource *xdg_shell_v5::add(struct ::wl_client *client, int id, int version) |
| 94 | { |
| 95 | Resource *resource = bind(client, id, version); |
| 96 | m_resource_map.insert(akey: client, avalue: resource); |
| 97 | return resource; |
| 98 | } |
| 99 | |
| 100 | void xdg_shell_v5::init(struct ::wl_display *display, int version) |
| 101 | { |
| 102 | m_global = wl_global_create(display, interface: &::xdg_shell_v5_interface, version, data: this, bind: bind_func); |
| 103 | m_globalVersion = version; |
| 104 | m_displayDestroyedListener.notify = xdg_shell_v5::display_destroy_func; |
| 105 | m_displayDestroyedListener.parent = this; |
| 106 | wl_display_add_destroy_listener(display, listener: &m_displayDestroyedListener); |
| 107 | } |
| 108 | |
| 109 | const struct wl_interface *xdg_shell_v5::interface() |
| 110 | { |
| 111 | return &::xdg_shell_v5_interface; |
| 112 | } |
| 113 | |
| 114 | xdg_shell_v5::Resource *xdg_shell_v5::xdg_shell_allocate() |
| 115 | { |
| 116 | return new Resource; |
| 117 | } |
| 118 | |
| 119 | void xdg_shell_v5::xdg_shell_bind_resource(Resource *) |
| 120 | { |
| 121 | } |
| 122 | |
| 123 | void xdg_shell_v5::xdg_shell_destroy_resource(Resource *) |
| 124 | { |
| 125 | } |
| 126 | |
| 127 | void xdg_shell_v5::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) |
| 128 | { |
| 129 | xdg_shell_v5 *that = static_cast<xdg_shell_v5 *>(data); |
| 130 | that->add(client, id, version: qMin(a: that->m_globalVersion, b: version)); |
| 131 | } |
| 132 | |
| 133 | void xdg_shell_v5::display_destroy_func(struct ::wl_listener *listener, void *data) |
| 134 | { |
| 135 | Q_UNUSED(data); |
| 136 | xdg_shell_v5 *that = static_cast<xdg_shell_v5::DisplayDestroyedListener *>(listener)->parent; |
| 137 | that->m_global = nullptr; |
| 138 | } |
| 139 | |
| 140 | void xdg_shell_v5::destroy_func(struct ::wl_resource *client_resource) |
| 141 | { |
| 142 | Resource *resource = Resource::fromResource(resource: client_resource); |
| 143 | xdg_shell_v5 *that = resource->xdg_shell_object; |
| 144 | that->m_resource_map.remove(key: resource->client(), value: resource); |
| 145 | that->xdg_shell_destroy_resource(resource); |
| 146 | delete resource; |
| 147 | } |
| 148 | |
| 149 | xdg_shell_v5::Resource *xdg_shell_v5::bind(struct ::wl_client *client, uint32_t id, int version) |
| 150 | { |
| 151 | Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind" , QStringLiteral("binding to object %1 more than once" ).arg(id).toLocal8Bit().constData()); |
| 152 | struct ::wl_resource *handle = wl_resource_create(client, interface: &::xdg_shell_v5_interface, version, id); |
| 153 | return bind(handle); |
| 154 | } |
| 155 | |
| 156 | xdg_shell_v5::Resource *xdg_shell_v5::bind(struct ::wl_resource *handle) |
| 157 | { |
| 158 | Resource *resource = xdg_shell_allocate(); |
| 159 | resource->xdg_shell_object = this; |
| 160 | |
| 161 | wl_resource_set_implementation(resource: handle, implementation: &m_xdg_shell_interface, data: resource, destroy: destroy_func); |
| 162 | resource->handle = handle; |
| 163 | xdg_shell_bind_resource(resource); |
| 164 | return resource; |
| 165 | } |
| 166 | xdg_shell_v5::Resource *xdg_shell_v5::Resource::fromResource(struct ::wl_resource *resource) |
| 167 | { |
| 168 | if (wl_resource_instance_of(resource, interface: &::xdg_shell_v5_interface, implementation: &m_xdg_shell_interface)) |
| 169 | return static_cast<Resource *>(resource->data); |
| 170 | return nullptr; |
| 171 | } |
| 172 | |
| 173 | const struct ::xdg_shell_v5_interface xdg_shell_v5::m_xdg_shell_interface = { |
| 174 | .destroy: xdg_shell_v5::handle_destroy, |
| 175 | .use_unstable_version: xdg_shell_v5::handle_use_unstable_version, |
| 176 | .get_xdg_surface: xdg_shell_v5::handle_get_xdg_surface, |
| 177 | .get_xdg_popup: xdg_shell_v5::handle_get_xdg_popup, |
| 178 | .pong: xdg_shell_v5::handle_pong |
| 179 | }; |
| 180 | |
| 181 | void xdg_shell_v5::xdg_shell_destroy(Resource *) |
| 182 | { |
| 183 | } |
| 184 | |
| 185 | void xdg_shell_v5::xdg_shell_use_unstable_version(Resource *, int32_t ) |
| 186 | { |
| 187 | } |
| 188 | |
| 189 | void xdg_shell_v5::xdg_shell_get_xdg_surface(Resource *, uint32_t, struct ::wl_resource *) |
| 190 | { |
| 191 | } |
| 192 | |
| 193 | void xdg_shell_v5::xdg_shell_get_xdg_popup(Resource *, uint32_t, struct ::wl_resource *, struct ::wl_resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t ) |
| 194 | { |
| 195 | } |
| 196 | |
| 197 | void xdg_shell_v5::xdg_shell_pong(Resource *, uint32_t ) |
| 198 | { |
| 199 | } |
| 200 | |
| 201 | |
| 202 | void xdg_shell_v5::handle_destroy( |
| 203 | ::wl_client *client, |
| 204 | struct wl_resource *resource) |
| 205 | { |
| 206 | Q_UNUSED(client); |
| 207 | Resource *r = Resource::fromResource(resource); |
| 208 | static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_destroy( |
| 209 | r); |
| 210 | } |
| 211 | |
| 212 | void xdg_shell_v5::handle_use_unstable_version( |
| 213 | ::wl_client *client, |
| 214 | struct wl_resource *resource, |
| 215 | int32_t version) |
| 216 | { |
| 217 | Q_UNUSED(client); |
| 218 | Resource *r = Resource::fromResource(resource); |
| 219 | static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_use_unstable_version( |
| 220 | r, |
| 221 | version); |
| 222 | } |
| 223 | |
| 224 | void xdg_shell_v5::handle_get_xdg_surface( |
| 225 | ::wl_client *client, |
| 226 | struct wl_resource *resource, |
| 227 | uint32_t id, |
| 228 | struct ::wl_resource *surface) |
| 229 | { |
| 230 | Q_UNUSED(client); |
| 231 | Resource *r = Resource::fromResource(resource); |
| 232 | static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_get_xdg_surface( |
| 233 | r, |
| 234 | id, |
| 235 | surface); |
| 236 | } |
| 237 | |
| 238 | void xdg_shell_v5::handle_get_xdg_popup( |
| 239 | ::wl_client *client, |
| 240 | struct wl_resource *resource, |
| 241 | uint32_t id, |
| 242 | struct ::wl_resource *surface, |
| 243 | struct ::wl_resource *parent, |
| 244 | struct ::wl_resource *seat, |
| 245 | uint32_t serial, |
| 246 | int32_t x, |
| 247 | int32_t y) |
| 248 | { |
| 249 | Q_UNUSED(client); |
| 250 | Resource *r = Resource::fromResource(resource); |
| 251 | static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_get_xdg_popup( |
| 252 | r, |
| 253 | id, |
| 254 | surface, |
| 255 | parent, |
| 256 | seat, |
| 257 | serial, |
| 258 | x, |
| 259 | y); |
| 260 | } |
| 261 | |
| 262 | void xdg_shell_v5::handle_pong( |
| 263 | ::wl_client *client, |
| 264 | struct wl_resource *resource, |
| 265 | uint32_t serial) |
| 266 | { |
| 267 | Q_UNUSED(client); |
| 268 | Resource *r = Resource::fromResource(resource); |
| 269 | static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_pong( |
| 270 | r, |
| 271 | serial); |
| 272 | } |
| 273 | |
| 274 | void xdg_shell_v5::send_ping(uint32_t serial) |
| 275 | { |
| 276 | send_ping( |
| 277 | resource: m_resource->handle, |
| 278 | serial); |
| 279 | } |
| 280 | |
| 281 | void xdg_shell_v5::send_ping(struct ::wl_resource *resource, uint32_t serial) |
| 282 | { |
| 283 | xdg_shell_send_ping( |
| 284 | resource_: resource, |
| 285 | serial); |
| 286 | } |
| 287 | |
| 288 | |
| 289 | xdg_surface_v5::xdg_surface_v5(struct ::wl_client *client, int id, int version) |
| 290 | : m_resource_map() |
| 291 | , m_resource(nullptr) |
| 292 | , m_global(nullptr) |
| 293 | { |
| 294 | init(client, id, version); |
| 295 | } |
| 296 | |
| 297 | xdg_surface_v5::xdg_surface_v5(struct ::wl_display *display, int version) |
| 298 | : m_resource_map() |
| 299 | , m_resource(nullptr) |
| 300 | , m_global(nullptr) |
| 301 | { |
| 302 | init(display, version); |
| 303 | } |
| 304 | |
| 305 | xdg_surface_v5::xdg_surface_v5(struct ::wl_resource *resource) |
| 306 | : m_resource_map() |
| 307 | , m_resource(nullptr) |
| 308 | , m_global(nullptr) |
| 309 | { |
| 310 | init(resource); |
| 311 | } |
| 312 | |
| 313 | xdg_surface_v5::xdg_surface_v5() |
| 314 | : m_resource_map() |
| 315 | , m_resource(nullptr) |
| 316 | , m_global(nullptr) |
| 317 | { |
| 318 | } |
| 319 | |
| 320 | xdg_surface_v5::~xdg_surface_v5() |
| 321 | { |
| 322 | for (auto resource : qAsConst(t&: m_resource_map)) |
| 323 | wl_resource_set_implementation(resource: resource->handle, implementation: nullptr, data: nullptr, destroy: nullptr); |
| 324 | |
| 325 | if (m_global) { |
| 326 | wl_global_destroy(global: m_global); |
| 327 | wl_list_remove(elm: &m_displayDestroyedListener.link); |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | void xdg_surface_v5::init(struct ::wl_client *client, int id, int version) |
| 332 | { |
| 333 | m_resource = bind(client, id, version); |
| 334 | } |
| 335 | |
| 336 | void xdg_surface_v5::init(struct ::wl_resource *resource) |
| 337 | { |
| 338 | m_resource = bind(handle: resource); |
| 339 | } |
| 340 | |
| 341 | xdg_surface_v5::Resource *xdg_surface_v5::add(struct ::wl_client *client, int version) |
| 342 | { |
| 343 | Resource *resource = bind(client, id: 0, version); |
| 344 | m_resource_map.insert(akey: client, avalue: resource); |
| 345 | return resource; |
| 346 | } |
| 347 | |
| 348 | xdg_surface_v5::Resource *xdg_surface_v5::add(struct ::wl_client *client, int id, int version) |
| 349 | { |
| 350 | Resource *resource = bind(client, id, version); |
| 351 | m_resource_map.insert(akey: client, avalue: resource); |
| 352 | return resource; |
| 353 | } |
| 354 | |
| 355 | void xdg_surface_v5::init(struct ::wl_display *display, int version) |
| 356 | { |
| 357 | m_global = wl_global_create(display, interface: &::xdg_surface_v5_interface, version, data: this, bind: bind_func); |
| 358 | m_globalVersion = version; |
| 359 | m_displayDestroyedListener.notify = xdg_surface_v5::display_destroy_func; |
| 360 | m_displayDestroyedListener.parent = this; |
| 361 | wl_display_add_destroy_listener(display, listener: &m_displayDestroyedListener); |
| 362 | } |
| 363 | |
| 364 | const struct wl_interface *xdg_surface_v5::interface() |
| 365 | { |
| 366 | return &::xdg_surface_v5_interface; |
| 367 | } |
| 368 | |
| 369 | xdg_surface_v5::Resource *xdg_surface_v5::xdg_surface_allocate() |
| 370 | { |
| 371 | return new Resource; |
| 372 | } |
| 373 | |
| 374 | void xdg_surface_v5::xdg_surface_bind_resource(Resource *) |
| 375 | { |
| 376 | } |
| 377 | |
| 378 | void xdg_surface_v5::xdg_surface_destroy_resource(Resource *) |
| 379 | { |
| 380 | } |
| 381 | |
| 382 | void xdg_surface_v5::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) |
| 383 | { |
| 384 | xdg_surface_v5 *that = static_cast<xdg_surface_v5 *>(data); |
| 385 | that->add(client, id, version: qMin(a: that->m_globalVersion, b: version)); |
| 386 | } |
| 387 | |
| 388 | void xdg_surface_v5::display_destroy_func(struct ::wl_listener *listener, void *data) |
| 389 | { |
| 390 | Q_UNUSED(data); |
| 391 | xdg_surface_v5 *that = static_cast<xdg_surface_v5::DisplayDestroyedListener *>(listener)->parent; |
| 392 | that->m_global = nullptr; |
| 393 | } |
| 394 | |
| 395 | void xdg_surface_v5::destroy_func(struct ::wl_resource *client_resource) |
| 396 | { |
| 397 | Resource *resource = Resource::fromResource(resource: client_resource); |
| 398 | xdg_surface_v5 *that = resource->xdg_surface_object; |
| 399 | that->m_resource_map.remove(key: resource->client(), value: resource); |
| 400 | that->xdg_surface_destroy_resource(resource); |
| 401 | delete resource; |
| 402 | } |
| 403 | |
| 404 | xdg_surface_v5::Resource *xdg_surface_v5::bind(struct ::wl_client *client, uint32_t id, int version) |
| 405 | { |
| 406 | Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind" , QStringLiteral("binding to object %1 more than once" ).arg(id).toLocal8Bit().constData()); |
| 407 | struct ::wl_resource *handle = wl_resource_create(client, interface: &::xdg_surface_v5_interface, version, id); |
| 408 | return bind(handle); |
| 409 | } |
| 410 | |
| 411 | xdg_surface_v5::Resource *xdg_surface_v5::bind(struct ::wl_resource *handle) |
| 412 | { |
| 413 | Resource *resource = xdg_surface_allocate(); |
| 414 | resource->xdg_surface_object = this; |
| 415 | |
| 416 | wl_resource_set_implementation(resource: handle, implementation: &m_xdg_surface_interface, data: resource, destroy: destroy_func); |
| 417 | resource->handle = handle; |
| 418 | xdg_surface_bind_resource(resource); |
| 419 | return resource; |
| 420 | } |
| 421 | xdg_surface_v5::Resource *xdg_surface_v5::Resource::fromResource(struct ::wl_resource *resource) |
| 422 | { |
| 423 | if (wl_resource_instance_of(resource, interface: &::xdg_surface_v5_interface, implementation: &m_xdg_surface_interface)) |
| 424 | return static_cast<Resource *>(resource->data); |
| 425 | return nullptr; |
| 426 | } |
| 427 | |
| 428 | const struct ::xdg_surface_v5_interface xdg_surface_v5::m_xdg_surface_interface = { |
| 429 | .destroy: xdg_surface_v5::handle_destroy, |
| 430 | .set_parent: xdg_surface_v5::handle_set_parent, |
| 431 | .set_title: xdg_surface_v5::handle_set_title, |
| 432 | .set_app_id: xdg_surface_v5::handle_set_app_id, |
| 433 | .show_window_menu: xdg_surface_v5::handle_show_window_menu, |
| 434 | .move: xdg_surface_v5::handle_move, |
| 435 | .resize: xdg_surface_v5::handle_resize, |
| 436 | .ack_configure: xdg_surface_v5::handle_ack_configure, |
| 437 | .set_window_geometry: xdg_surface_v5::handle_set_window_geometry, |
| 438 | .set_maximized: xdg_surface_v5::handle_set_maximized, |
| 439 | .unset_maximized: xdg_surface_v5::handle_unset_maximized, |
| 440 | .set_fullscreen: xdg_surface_v5::handle_set_fullscreen, |
| 441 | .unset_fullscreen: xdg_surface_v5::handle_unset_fullscreen, |
| 442 | .set_minimized: xdg_surface_v5::handle_set_minimized |
| 443 | }; |
| 444 | |
| 445 | void xdg_surface_v5::xdg_surface_destroy(Resource *) |
| 446 | { |
| 447 | } |
| 448 | |
| 449 | void xdg_surface_v5::xdg_surface_set_parent(Resource *, struct ::wl_resource *) |
| 450 | { |
| 451 | } |
| 452 | |
| 453 | void xdg_surface_v5::xdg_surface_set_title(Resource *, const QString &) |
| 454 | { |
| 455 | } |
| 456 | |
| 457 | void xdg_surface_v5::xdg_surface_set_app_id(Resource *, const QString &) |
| 458 | { |
| 459 | } |
| 460 | |
| 461 | void xdg_surface_v5::xdg_surface_show_window_menu(Resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t ) |
| 462 | { |
| 463 | } |
| 464 | |
| 465 | void xdg_surface_v5::xdg_surface_move(Resource *, struct ::wl_resource *, uint32_t ) |
| 466 | { |
| 467 | } |
| 468 | |
| 469 | void xdg_surface_v5::xdg_surface_resize(Resource *, struct ::wl_resource *, uint32_t , uint32_t ) |
| 470 | { |
| 471 | } |
| 472 | |
| 473 | void xdg_surface_v5::xdg_surface_ack_configure(Resource *, uint32_t ) |
| 474 | { |
| 475 | } |
| 476 | |
| 477 | void xdg_surface_v5::xdg_surface_set_window_geometry(Resource *, int32_t , int32_t , int32_t , int32_t ) |
| 478 | { |
| 479 | } |
| 480 | |
| 481 | void xdg_surface_v5::xdg_surface_set_maximized(Resource *) |
| 482 | { |
| 483 | } |
| 484 | |
| 485 | void xdg_surface_v5::xdg_surface_unset_maximized(Resource *) |
| 486 | { |
| 487 | } |
| 488 | |
| 489 | void xdg_surface_v5::xdg_surface_set_fullscreen(Resource *, struct ::wl_resource *) |
| 490 | { |
| 491 | } |
| 492 | |
| 493 | void xdg_surface_v5::xdg_surface_unset_fullscreen(Resource *) |
| 494 | { |
| 495 | } |
| 496 | |
| 497 | void xdg_surface_v5::xdg_surface_set_minimized(Resource *) |
| 498 | { |
| 499 | } |
| 500 | |
| 501 | |
| 502 | void xdg_surface_v5::handle_destroy( |
| 503 | ::wl_client *client, |
| 504 | struct wl_resource *resource) |
| 505 | { |
| 506 | Q_UNUSED(client); |
| 507 | Resource *r = Resource::fromResource(resource); |
| 508 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_destroy( |
| 509 | r); |
| 510 | } |
| 511 | |
| 512 | void xdg_surface_v5::handle_set_parent( |
| 513 | ::wl_client *client, |
| 514 | struct wl_resource *resource, |
| 515 | struct ::wl_resource *parent) |
| 516 | { |
| 517 | Q_UNUSED(client); |
| 518 | Resource *r = Resource::fromResource(resource); |
| 519 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_parent( |
| 520 | r, |
| 521 | parent); |
| 522 | } |
| 523 | |
| 524 | void xdg_surface_v5::handle_set_title( |
| 525 | ::wl_client *client, |
| 526 | struct wl_resource *resource, |
| 527 | const char *title) |
| 528 | { |
| 529 | Q_UNUSED(client); |
| 530 | Resource *r = Resource::fromResource(resource); |
| 531 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_title( |
| 532 | r, |
| 533 | QString::fromUtf8(str: title)); |
| 534 | } |
| 535 | |
| 536 | void xdg_surface_v5::handle_set_app_id( |
| 537 | ::wl_client *client, |
| 538 | struct wl_resource *resource, |
| 539 | const char *app_id) |
| 540 | { |
| 541 | Q_UNUSED(client); |
| 542 | Resource *r = Resource::fromResource(resource); |
| 543 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_app_id( |
| 544 | r, |
| 545 | QString::fromUtf8(str: app_id)); |
| 546 | } |
| 547 | |
| 548 | void xdg_surface_v5::handle_show_window_menu( |
| 549 | ::wl_client *client, |
| 550 | struct wl_resource *resource, |
| 551 | struct ::wl_resource *seat, |
| 552 | uint32_t serial, |
| 553 | int32_t x, |
| 554 | int32_t y) |
| 555 | { |
| 556 | Q_UNUSED(client); |
| 557 | Resource *r = Resource::fromResource(resource); |
| 558 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_show_window_menu( |
| 559 | r, |
| 560 | seat, |
| 561 | serial, |
| 562 | x, |
| 563 | y); |
| 564 | } |
| 565 | |
| 566 | void xdg_surface_v5::handle_move( |
| 567 | ::wl_client *client, |
| 568 | struct wl_resource *resource, |
| 569 | struct ::wl_resource *seat, |
| 570 | uint32_t serial) |
| 571 | { |
| 572 | Q_UNUSED(client); |
| 573 | Resource *r = Resource::fromResource(resource); |
| 574 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_move( |
| 575 | r, |
| 576 | seat, |
| 577 | serial); |
| 578 | } |
| 579 | |
| 580 | void xdg_surface_v5::handle_resize( |
| 581 | ::wl_client *client, |
| 582 | struct wl_resource *resource, |
| 583 | struct ::wl_resource *seat, |
| 584 | uint32_t serial, |
| 585 | uint32_t edges) |
| 586 | { |
| 587 | Q_UNUSED(client); |
| 588 | Resource *r = Resource::fromResource(resource); |
| 589 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_resize( |
| 590 | r, |
| 591 | seat, |
| 592 | serial, |
| 593 | edges); |
| 594 | } |
| 595 | |
| 596 | void xdg_surface_v5::handle_ack_configure( |
| 597 | ::wl_client *client, |
| 598 | struct wl_resource *resource, |
| 599 | uint32_t serial) |
| 600 | { |
| 601 | Q_UNUSED(client); |
| 602 | Resource *r = Resource::fromResource(resource); |
| 603 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_ack_configure( |
| 604 | r, |
| 605 | serial); |
| 606 | } |
| 607 | |
| 608 | void xdg_surface_v5::handle_set_window_geometry( |
| 609 | ::wl_client *client, |
| 610 | struct wl_resource *resource, |
| 611 | int32_t x, |
| 612 | int32_t y, |
| 613 | int32_t width, |
| 614 | int32_t height) |
| 615 | { |
| 616 | Q_UNUSED(client); |
| 617 | Resource *r = Resource::fromResource(resource); |
| 618 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_window_geometry( |
| 619 | r, |
| 620 | x, |
| 621 | y, |
| 622 | width, |
| 623 | height); |
| 624 | } |
| 625 | |
| 626 | void xdg_surface_v5::handle_set_maximized( |
| 627 | ::wl_client *client, |
| 628 | struct wl_resource *resource) |
| 629 | { |
| 630 | Q_UNUSED(client); |
| 631 | Resource *r = Resource::fromResource(resource); |
| 632 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_maximized( |
| 633 | r); |
| 634 | } |
| 635 | |
| 636 | void xdg_surface_v5::handle_unset_maximized( |
| 637 | ::wl_client *client, |
| 638 | struct wl_resource *resource) |
| 639 | { |
| 640 | Q_UNUSED(client); |
| 641 | Resource *r = Resource::fromResource(resource); |
| 642 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_unset_maximized( |
| 643 | r); |
| 644 | } |
| 645 | |
| 646 | void xdg_surface_v5::handle_set_fullscreen( |
| 647 | ::wl_client *client, |
| 648 | struct wl_resource *resource, |
| 649 | struct ::wl_resource *output) |
| 650 | { |
| 651 | Q_UNUSED(client); |
| 652 | Resource *r = Resource::fromResource(resource); |
| 653 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_fullscreen( |
| 654 | r, |
| 655 | output); |
| 656 | } |
| 657 | |
| 658 | void xdg_surface_v5::handle_unset_fullscreen( |
| 659 | ::wl_client *client, |
| 660 | struct wl_resource *resource) |
| 661 | { |
| 662 | Q_UNUSED(client); |
| 663 | Resource *r = Resource::fromResource(resource); |
| 664 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_unset_fullscreen( |
| 665 | r); |
| 666 | } |
| 667 | |
| 668 | void xdg_surface_v5::handle_set_minimized( |
| 669 | ::wl_client *client, |
| 670 | struct wl_resource *resource) |
| 671 | { |
| 672 | Q_UNUSED(client); |
| 673 | Resource *r = Resource::fromResource(resource); |
| 674 | static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_minimized( |
| 675 | r); |
| 676 | } |
| 677 | |
| 678 | void xdg_surface_v5::send_configure(int32_t width, int32_t height, const QByteArray &states, uint32_t serial) |
| 679 | { |
| 680 | send_configure( |
| 681 | resource: m_resource->handle, |
| 682 | width, |
| 683 | height, |
| 684 | states, |
| 685 | serial); |
| 686 | } |
| 687 | |
| 688 | void xdg_surface_v5::send_configure(struct ::wl_resource *resource, int32_t width, int32_t height, const QByteArray &states, uint32_t serial) |
| 689 | { |
| 690 | struct wl_array states_data; |
| 691 | states_data.size = states.size(); |
| 692 | states_data.data = static_cast<void *>(const_cast<char *>(states.constData())); |
| 693 | states_data.alloc = 0; |
| 694 | |
| 695 | xdg_surface_send_configure( |
| 696 | resource_: resource, |
| 697 | width, |
| 698 | height, |
| 699 | states: &states_data, |
| 700 | serial); |
| 701 | } |
| 702 | |
| 703 | |
| 704 | void xdg_surface_v5::send_close() |
| 705 | { |
| 706 | send_close( |
| 707 | resource: m_resource->handle); |
| 708 | } |
| 709 | |
| 710 | void xdg_surface_v5::send_close(struct ::wl_resource *resource) |
| 711 | { |
| 712 | xdg_surface_send_close( |
| 713 | resource_: resource); |
| 714 | } |
| 715 | |
| 716 | |
| 717 | xdg_popup_v5::xdg_popup_v5(struct ::wl_client *client, int id, int version) |
| 718 | : m_resource_map() |
| 719 | , m_resource(nullptr) |
| 720 | , m_global(nullptr) |
| 721 | { |
| 722 | init(client, id, version); |
| 723 | } |
| 724 | |
| 725 | xdg_popup_v5::xdg_popup_v5(struct ::wl_display *display, int version) |
| 726 | : m_resource_map() |
| 727 | , m_resource(nullptr) |
| 728 | , m_global(nullptr) |
| 729 | { |
| 730 | init(display, version); |
| 731 | } |
| 732 | |
| 733 | xdg_popup_v5::xdg_popup_v5(struct ::wl_resource *resource) |
| 734 | : m_resource_map() |
| 735 | , m_resource(nullptr) |
| 736 | , m_global(nullptr) |
| 737 | { |
| 738 | init(resource); |
| 739 | } |
| 740 | |
| 741 | xdg_popup_v5::xdg_popup_v5() |
| 742 | : m_resource_map() |
| 743 | , m_resource(nullptr) |
| 744 | , m_global(nullptr) |
| 745 | { |
| 746 | } |
| 747 | |
| 748 | xdg_popup_v5::~xdg_popup_v5() |
| 749 | { |
| 750 | for (auto resource : qAsConst(t&: m_resource_map)) |
| 751 | wl_resource_set_implementation(resource: resource->handle, implementation: nullptr, data: nullptr, destroy: nullptr); |
| 752 | |
| 753 | if (m_global) { |
| 754 | wl_global_destroy(global: m_global); |
| 755 | wl_list_remove(elm: &m_displayDestroyedListener.link); |
| 756 | } |
| 757 | } |
| 758 | |
| 759 | void xdg_popup_v5::init(struct ::wl_client *client, int id, int version) |
| 760 | { |
| 761 | m_resource = bind(client, id, version); |
| 762 | } |
| 763 | |
| 764 | void xdg_popup_v5::init(struct ::wl_resource *resource) |
| 765 | { |
| 766 | m_resource = bind(handle: resource); |
| 767 | } |
| 768 | |
| 769 | xdg_popup_v5::Resource *xdg_popup_v5::add(struct ::wl_client *client, int version) |
| 770 | { |
| 771 | Resource *resource = bind(client, id: 0, version); |
| 772 | m_resource_map.insert(akey: client, avalue: resource); |
| 773 | return resource; |
| 774 | } |
| 775 | |
| 776 | xdg_popup_v5::Resource *xdg_popup_v5::add(struct ::wl_client *client, int id, int version) |
| 777 | { |
| 778 | Resource *resource = bind(client, id, version); |
| 779 | m_resource_map.insert(akey: client, avalue: resource); |
| 780 | return resource; |
| 781 | } |
| 782 | |
| 783 | void xdg_popup_v5::init(struct ::wl_display *display, int version) |
| 784 | { |
| 785 | m_global = wl_global_create(display, interface: &::xdg_popup_v5_interface, version, data: this, bind: bind_func); |
| 786 | m_globalVersion = version; |
| 787 | m_displayDestroyedListener.notify = xdg_popup_v5::display_destroy_func; |
| 788 | m_displayDestroyedListener.parent = this; |
| 789 | wl_display_add_destroy_listener(display, listener: &m_displayDestroyedListener); |
| 790 | } |
| 791 | |
| 792 | const struct wl_interface *xdg_popup_v5::interface() |
| 793 | { |
| 794 | return &::xdg_popup_v5_interface; |
| 795 | } |
| 796 | |
| 797 | xdg_popup_v5::Resource *xdg_popup_v5::xdg_popup_allocate() |
| 798 | { |
| 799 | return new Resource; |
| 800 | } |
| 801 | |
| 802 | void xdg_popup_v5::xdg_popup_bind_resource(Resource *) |
| 803 | { |
| 804 | } |
| 805 | |
| 806 | void xdg_popup_v5::xdg_popup_destroy_resource(Resource *) |
| 807 | { |
| 808 | } |
| 809 | |
| 810 | void xdg_popup_v5::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) |
| 811 | { |
| 812 | xdg_popup_v5 *that = static_cast<xdg_popup_v5 *>(data); |
| 813 | that->add(client, id, version: qMin(a: that->m_globalVersion, b: version)); |
| 814 | } |
| 815 | |
| 816 | void xdg_popup_v5::display_destroy_func(struct ::wl_listener *listener, void *data) |
| 817 | { |
| 818 | Q_UNUSED(data); |
| 819 | xdg_popup_v5 *that = static_cast<xdg_popup_v5::DisplayDestroyedListener *>(listener)->parent; |
| 820 | that->m_global = nullptr; |
| 821 | } |
| 822 | |
| 823 | void xdg_popup_v5::destroy_func(struct ::wl_resource *client_resource) |
| 824 | { |
| 825 | Resource *resource = Resource::fromResource(resource: client_resource); |
| 826 | xdg_popup_v5 *that = resource->xdg_popup_object; |
| 827 | that->m_resource_map.remove(key: resource->client(), value: resource); |
| 828 | that->xdg_popup_destroy_resource(resource); |
| 829 | delete resource; |
| 830 | } |
| 831 | |
| 832 | xdg_popup_v5::Resource *xdg_popup_v5::bind(struct ::wl_client *client, uint32_t id, int version) |
| 833 | { |
| 834 | Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind" , QStringLiteral("binding to object %1 more than once" ).arg(id).toLocal8Bit().constData()); |
| 835 | struct ::wl_resource *handle = wl_resource_create(client, interface: &::xdg_popup_v5_interface, version, id); |
| 836 | return bind(handle); |
| 837 | } |
| 838 | |
| 839 | xdg_popup_v5::Resource *xdg_popup_v5::bind(struct ::wl_resource *handle) |
| 840 | { |
| 841 | Resource *resource = xdg_popup_allocate(); |
| 842 | resource->xdg_popup_object = this; |
| 843 | |
| 844 | wl_resource_set_implementation(resource: handle, implementation: &m_xdg_popup_interface, data: resource, destroy: destroy_func); |
| 845 | resource->handle = handle; |
| 846 | xdg_popup_bind_resource(resource); |
| 847 | return resource; |
| 848 | } |
| 849 | xdg_popup_v5::Resource *xdg_popup_v5::Resource::fromResource(struct ::wl_resource *resource) |
| 850 | { |
| 851 | if (wl_resource_instance_of(resource, interface: &::xdg_popup_v5_interface, implementation: &m_xdg_popup_interface)) |
| 852 | return static_cast<Resource *>(resource->data); |
| 853 | return nullptr; |
| 854 | } |
| 855 | |
| 856 | const struct ::xdg_popup_v5_interface xdg_popup_v5::m_xdg_popup_interface = { |
| 857 | .destroy: xdg_popup_v5::handle_destroy |
| 858 | }; |
| 859 | |
| 860 | void xdg_popup_v5::xdg_popup_destroy(Resource *) |
| 861 | { |
| 862 | } |
| 863 | |
| 864 | |
| 865 | void xdg_popup_v5::handle_destroy( |
| 866 | ::wl_client *client, |
| 867 | struct wl_resource *resource) |
| 868 | { |
| 869 | Q_UNUSED(client); |
| 870 | Resource *r = Resource::fromResource(resource); |
| 871 | static_cast<xdg_popup_v5 *>(r->xdg_popup_object)->xdg_popup_destroy( |
| 872 | r); |
| 873 | } |
| 874 | |
| 875 | void xdg_popup_v5::send_popup_done() |
| 876 | { |
| 877 | send_popup_done( |
| 878 | resource: m_resource->handle); |
| 879 | } |
| 880 | |
| 881 | void xdg_popup_v5::send_popup_done(struct ::wl_resource *resource) |
| 882 | { |
| 883 | xdg_popup_send_popup_done( |
| 884 | resource_: resource); |
| 885 | } |
| 886 | |
| 887 | } |
| 888 | |
| 889 | QT_WARNING_POP |
| 890 | QT_END_NAMESPACE |
| 891 | |