Skip to content

Commit

Permalink
feat: bump wlr_output_management_unstable_v1 to version 3
Browse files Browse the repository at this point in the history
This version only adds some destructor requests.
  • Loading branch information
romangg committed Mar 31, 2023
1 parent 23980f3 commit 63e4934
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 22 deletions.
1 change: 1 addition & 0 deletions server/wlr_output_configuration_v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ struct zwlr_output_configuration_v1_interface const
disable_head_callback,
apply_callback,
test_callback,
destroyCallback,
};

wlr_output_configuration_v1_res::wlr_output_configuration_v1_res(Client* client,
Expand Down
6 changes: 5 additions & 1 deletion server/wlr_output_head_v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ wlr_output_head_v1_res::Private::Private(Client* client,
version,
0,
&zwlr_output_head_v1_interface,
nullptr,
&s_interface,
&q_ptr)
, head{&head}
{
Expand All @@ -128,6 +128,10 @@ wlr_output_head_v1_res::Private::~Private()
}
}

struct zwlr_output_head_v1_interface const wlr_output_head_v1_res::Private::s_interface = {
destroyCallback,
};

wlr_output_head_v1_res::wlr_output_head_v1_res(Client* client,
uint32_t version,
wlr_output_head_v1& head)
Expand Down
3 changes: 3 additions & 0 deletions server/wlr_output_head_v1_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ class wlr_output_head_v1_res::Private : public Wayland::Resource<wlr_output_head

std::vector<wlr_output_mode_v1*> modes;
wlr_output_head_v1* head;

private:
static struct zwlr_output_head_v1_interface const s_interface;
};

}
2 changes: 1 addition & 1 deletion server/wlr_output_manager_v1_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Wrapland::Server
class wlr_output_configuration_v1;
class wlr_output_head_v1;

constexpr uint32_t wlr_output_manager_v1_version = 2;
constexpr uint32_t wlr_output_manager_v1_version = 3;
using wlr_output_manager_v1_global
= Wayland::Global<wlr_output_manager_v1, wlr_output_manager_v1_version>;
using wlr_output_manager_v1_bind = Wayland::Bind<wlr_output_manager_v1_global>;
Expand Down
8 changes: 5 additions & 3 deletions server/wlr_output_mode_v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include "utils.h"
#include "wayland/global.h"

#include "wayland-wlr-output-management-v1-server-protocol.h"

namespace Wrapland::Server
{

Expand All @@ -22,7 +20,7 @@ wlr_output_mode_v1::Private::Private(Client* client,
version,
0,
&zwlr_output_mode_v1_interface,
nullptr,
&s_interface,
&q_ptr)
, mode{mode}
{
Expand All @@ -37,6 +35,10 @@ void wlr_output_mode_v1::Private::send_data()
}
}

struct zwlr_output_mode_v1_interface const wlr_output_mode_v1::Private::s_interface = {
destroyCallback,
};

wlr_output_mode_v1::wlr_output_mode_v1(Client* client, uint32_t version, output_mode const& mode)
: d_ptr{new Private(client, version, mode, *this)}
{
Expand Down
5 changes: 5 additions & 0 deletions server/wlr_output_mode_v1_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "output_p.h"
#include "wayland/resource.h"

#include "wayland-wlr-output-management-v1-server-protocol.h"

#include <QObject>

namespace Wrapland::Server
Expand Down Expand Up @@ -35,6 +37,9 @@ class wlr_output_mode_v1::Private : public Wayland::Resource<wlr_output_mode_v1>
void send_data();

output_mode mode;

private:
static struct zwlr_output_mode_v1_interface const s_interface;
};

}
47 changes: 33 additions & 14 deletions src/client/protocols/wlr-output-management-unstable-v1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
interface version number is reset.
</description>

<interface name="zwlr_output_manager_v1" version="2">
<interface name="zwlr_output_manager_v1" version="3">
<description summary="output device configuration manager">
This interface is a manager that allows reading and writing the current
output device configuration.
Expand Down Expand Up @@ -115,7 +115,7 @@
</description>
</request>

<event name="finished">
<event name="finished" type="destructor">
<description summary="the compositor has finished with the manager">
This event indicates that the compositor is done sending manager events.
The compositor will destroy the object immediately after sending this
Expand All @@ -125,7 +125,7 @@
</event>
</interface>

<interface name="zwlr_output_head_v1" version="2">
<interface name="zwlr_output_head_v1" version="3">
<description summary="output device">
A head is an output device. The difference between a wl_output object and
a head is that heads are advertised even if they are turned off. A head
Expand Down Expand Up @@ -251,14 +251,15 @@
</event>

<event name="finished">
<description summary="the head has been destroyed">
The compositor will destroy the object immediately after sending this
event, so it will become invalid and the client should release any
resources associated with it.
<description summary="the head has disappeared">
This event indicates that the head is no longer available. The head
object becomes inert. Clients should send a destroy request and release
any resources associated with it.
</description>
</event>

<!-- Version 2 additions -->

<event name="make" since="2">
<description summary="head manufacturer">
This event describes the manufacturer of the head.
Expand Down Expand Up @@ -328,9 +329,18 @@
</description>
<arg name="serial_number" type="string"/>
</event>

<!-- Version 3 additions -->

<request name="release" type="destructor" since="3">
<description summary="destroy the head object">
This request indicates that the client will no longer use this head
object.
</description>
</request>
</interface>

<interface name="zwlr_output_mode_v1" version="2">
<interface name="zwlr_output_mode_v1" version="3">
<description summary="output mode">
This object describes an output mode.

Expand Down Expand Up @@ -368,15 +378,24 @@
</event>

<event name="finished">
<description summary="the mode has been destroyed">
The compositor will destroy the object immediately after sending this
event, so it will become invalid and the client should release any
resources associated with it.
<description summary="the mode has disappeared">
This event indicates that the mode is no longer available. The mode
object becomes inert. Clients should send a destroy request and release
any resources associated with it.
</description>
</event>

<!-- Version 3 additions -->

<request name="release" type="destructor" since="3">
<description summary="destroy the mode object">
This request indicates that the client will no longer use this mode
object.
</description>
</request>
</interface>

<interface name="zwlr_output_configuration_v1" version="2">
<interface name="zwlr_output_configuration_v1" version="3">
<description summary="output configuration">
This object is used by the client to describe a full output configuration.

Expand Down Expand Up @@ -494,7 +513,7 @@
</request>
</interface>

<interface name="zwlr_output_configuration_head_v1" version="2">
<interface name="zwlr_output_configuration_head_v1" version="3">
<description summary="head configuration">
This object is used by the client to update a single head's configuration.

Expand Down
2 changes: 1 addition & 1 deletion src/client/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ static QMap<Registry::Interface, SuppertedInterfaceData> const s_interfaces = {
{
Registry::Interface::WlrOutputManagerV1,
{
2,
3,
QByteArrayLiteral("zwlr_output_manager_v1"),
&zwlr_output_manager_v1_interface,
&Registry::wlrOutputManagerV1Announced,
Expand Down
6 changes: 4 additions & 2 deletions src/client/wlr_output_manager_v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ class Q_DECL_HIDDEN WlrOutputModeV1::Private
Private(WlrOutputModeV1* q, zwlr_output_mode_v1* mode);
~Private() = default;

WaylandPointer<zwlr_output_mode_v1, zwlr_output_mode_v1_destroy> outputMode;
// TODO(romangg): release request only available starting version 3.
WaylandPointer<zwlr_output_mode_v1, zwlr_output_mode_v1_release> outputMode;
EventQueue* queue = nullptr;

void name(QString const& name);
Expand Down Expand Up @@ -264,7 +265,8 @@ class Q_DECL_HIDDEN WlrOutputHeadV1::Private
Private(WlrOutputHeadV1* q, zwlr_output_head_v1* head);
~Private() = default;

WaylandPointer<zwlr_output_head_v1, zwlr_output_head_v1_destroy> outputHead;
// TODO(romangg): release request only available starting version 3.
WaylandPointer<zwlr_output_head_v1, zwlr_output_head_v1_release> outputHead;
EventQueue* queue = nullptr;

static void nameCallback(void* data, zwlr_output_head_v1* head, char const* name);
Expand Down

0 comments on commit 63e4934

Please sign in to comment.