KWaylandServer

eglstream_controller_interface.cpp
1 /*
2  SPDX-FileCopyrightText: 2019 NVIDIA Inc.
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #include "eglstream_controller_interface.h"
7 #include "clientconnection.h"
8 #include "display.h"
9 #include "logging.h"
10 
11 #include <qwayland-server-wl-eglstream-controller.h>
12 #include <wayland-util.h>
13 
14 namespace KWaylandServer
15 {
16 static const quint32 s_version = 1;
17 
18 class EglStreamControllerInterfacePrivate : public QtWaylandServer::wl_eglstream_controller
19 {
20 public:
21  EglStreamControllerInterfacePrivate(EglStreamControllerInterface *controller, Display *display);
22 
23  EglStreamControllerInterface *q;
24 
25 protected:
26  void eglstream_controller_attach_eglstream_consumer(Resource *resource, wl_resource *wl_surface, wl_resource *eglStream) override;
27  void
28  eglstream_controller_attach_eglstream_consumer_attribs(Resource *resource, wl_resource *wl_surface, wl_resource *eglStream, wl_array *attribs) override;
29 };
30 
31 void EglStreamControllerInterfacePrivate::eglstream_controller_attach_eglstream_consumer(Resource *resource, wl_resource *wl_surface, wl_resource *eglStream)
32 {
33  wl_array noAttribs = {0, 0, nullptr};
34  eglstream_controller_attach_eglstream_consumer_attribs(resource, wl_surface, eglStream, &noAttribs);
35 }
36 
37 void EglStreamControllerInterfacePrivate::eglstream_controller_attach_eglstream_consumer_attribs(Resource *resource,
38  wl_resource *wl_surface,
39  wl_resource *eglStream,
40  wl_array *attribs)
41 {
42  SurfaceInterface *surface = SurfaceInterface::get(wl_surface);
43  if (!surface) {
44  wl_resource_post_error(resource->handle, 0, "Invalid surface");
45  return;
46  }
47  Q_EMIT q->streamConsumerAttached(surface, eglStream, attribs);
48 }
49 
50 EglStreamControllerInterfacePrivate::EglStreamControllerInterfacePrivate(EglStreamControllerInterface *_q, Display *display)
51  : QtWaylandServer::wl_eglstream_controller(*display, s_version)
52  , q(_q)
53 {
54 }
55 
56 EglStreamControllerInterface::~EglStreamControllerInterface() = default;
57 
58 EglStreamControllerInterface::EglStreamControllerInterface(Display *display, QObject *parent)
59  : QObject(parent)
60  , d(new EglStreamControllerInterfacePrivate(this, display))
61 {
62 }
63 
64 }
static SurfaceInterface * get(wl_resource *native)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 23:08:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.