Isaac Freund: 1 Support output-management version 3 release requests 2 files changed, 43 insertions(+), 16 deletions(-)
Copy & paste the following snippet into your terminal to import this patchset into git:
curl -s https://lists.sr.ht/~emersion/public-inbox/patches/33411/mbox | git am -3Learn more about email & git
This is a proposed addition to the protocol to fix a race condition. References: https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/merge_requests/114 --- main.c | 14 ++++-- .../wlr-output-management-unstable-v1.xml | 45 +++++++++++++------ 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/main.c b/main.c index 349a214..87f94af 100644 --- a/main.c +++ b/main.c @@ -214,7 +214,11 @@ static void mode_handle_finished(void *data, struct zwlr_output_mode_v1 *wlr_mode) { struct randr_mode *mode = data; wl_list_remove(&mode->link); - zwlr_output_mode_v1_destroy(mode->wlr_mode); + if (zwlr_output_mode_v1_get_version(mode->wlr_mode) >= 3) { + zwlr_output_mode_v1_release(mode->wlr_mode); + } else { + zwlr_output_mode_v1_destroy(mode->wlr_mode); + } free(mode); } @@ -304,7 +308,11 @@ static void head_handle_finished(void *data, struct zwlr_output_head_v1 *wlr_head) { struct randr_head *head = data; wl_list_remove(&head->link); - zwlr_output_head_v1_destroy(head->wlr_head); + if (zwlr_output_head_v1_get_version(head->wlr_head) >= 3) { + zwlr_output_head_v1_release(head->wlr_head); + } else { + zwlr_output_head_v1_destroy(head->wlr_head); + } free(head->name); free(head->description); free(head); @@ -381,7 +389,7 @@ static void registry_handle_global(void *data, struct wl_registry *registry, struct randr_state *state = data; if (strcmp(interface, zwlr_output_manager_v1_interface.name) == 0) { - uint32_t version_to_bind = version <= 2 ? version : 2; + uint32_t version_to_bind = version <= 3 ? version : 3; state->output_manager = wl_registry_bind(registry, name, &zwlr_output_manager_v1_interface, version_to_bind); zwlr_output_manager_v1_add_listener(state->output_manager, diff --git a/protocol/wlr-output-management-unstable-v1.xml b/protocol/wlr-output-management-unstable-v1.xml index bf0cc93..3568e04 100644 --- a/protocol/wlr-output-management-unstable-v1.xml +++ b/protocol/wlr-output-management-unstable-v1.xml @@ -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. @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. -- 2.36.1
LGTM