Skip to content

Commit b459485

Browse files
mahkohgithub-actions[bot]
authored andcommitted
Update protocols
1 parent 03d4a4b commit b459485

File tree

11 files changed

+536
-47
lines changed

11 files changed

+536
-47
lines changed

protocols/wayland/wayland.xml

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
<arg name="callback_data" type="uint" summary="request-specific data for the callback"/>
171171
</event>
172172
</interface>
173-
<interface name="wl_compositor" version="6">
173+
<interface name="wl_compositor" version="7">
174174
<description summary="the compositor singleton">
175175
A compositor. This object is a singleton global. The
176176
compositor is in charge of combining the contents of multiple
@@ -188,6 +188,11 @@
188188
</description>
189189
<arg name="id" type="new_id" interface="wl_region" summary="the new region"/>
190190
</request>
191+
<request name="release" type="destructor" since="7">
192+
<description summary="destroy wl_compositor">
193+
This request destroys the wl_compositor. This has no effect on any other objects.
194+
</description>
195+
</request>
191196
</interface>
192197
<interface name="wl_shm_pool" version="2">
193198
<description summary="a shared memory pool">
@@ -498,7 +503,7 @@
498503
</description>
499504
</event>
500505
</interface>
501-
<interface name="wl_data_offer" version="3">
506+
<interface name="wl_data_offer" version="4">
502507
<description summary="offer to transfer data">
503508
A wl_data_offer represents a piece of data offered for transfer
504509
by another client (the source client). It is used by the
@@ -671,7 +676,7 @@
671676
<entry name="invalid_offer" value="3" summary="offer doesn&apos;t accept this request"/>
672677
</enum>
673678
</interface>
674-
<interface name="wl_data_source" version="3">
679+
<interface name="wl_data_source" version="4">
675680
<description summary="offer to transfer data">
676681
The wl_data_source object is the source side of a wl_data_offer.
677682
It is created by the source client in a data transfer and
@@ -809,7 +814,7 @@
809814
<entry name="invalid_source" value="1" summary="source doesn&apos;t accept this request"/>
810815
</enum>
811816
</interface>
812-
<interface name="wl_data_device" version="3">
817+
<interface name="wl_data_device" version="4">
813818
<description summary="data transfer device">
814819
There is one wl_data_device per seat which can be obtained
815820
from the global wl_data_device_manager singleton.
@@ -955,7 +960,7 @@
955960
<entry name="used_source" value="1" summary="source has already been used"/>
956961
</enum>
957962
</interface>
958-
<interface name="wl_data_device_manager" version="3">
963+
<interface name="wl_data_device_manager" version="4">
959964
<description summary="data transfer interface">
960965
The wl_data_device_manager is a singleton global object that
961966
provides access to inter-client data transfer mechanisms such as
@@ -981,6 +986,12 @@
981986
<arg name="id" type="new_id" interface="wl_data_device" summary="data device to create"/>
982987
<arg name="seat" type="object" interface="wl_seat" summary="seat associated with the data device"/>
983988
</request>
989+
<request name="release" type="destructor" since="4">
990+
<description summary="destroy wl_data_device_manager">
991+
This request destroys the wl_data_device_manager. This has no effect on any other
992+
objects.
993+
</description>
994+
</request>
984995
<enum name="dnd_action" since="3" bitfield="true">
985996
<description summary="drag and drop actions">
986997
This is a bitmask of the available/preferred actions in a
@@ -1295,7 +1306,7 @@
12951306
<entry name="fill" value="3" summary="no upscaling, center on output and add black borders to compensate size mismatch"/>
12961307
</enum>
12971308
</interface>
1298-
<interface name="wl_surface" version="6">
1309+
<interface name="wl_surface" version="7">
12991310
<description summary="an onscreen surface">
13001311
A surface is a rectangular area that may be displayed on zero
13011312
or more outputs, and shown any number of times at the compositor's
@@ -1391,9 +1402,11 @@
13911402
If a pending wl_buffer has been committed to more than one wl_surface,
13921403
the delivery of wl_buffer.release events becomes undefined. A well
13931404
behaved client should not rely on wl_buffer.release events in this
1394-
case. Alternatively, a client could create multiple wl_buffer objects
1395-
from the same backing storage or use a protocol extension providing
1396-
per-commit release notifications.
1405+
case. Instead, clients hitting this case should use
1406+
wl_surface.get_release or use a protocol extension providing per-commit
1407+
release notifications (if none of these options are available, a
1408+
fallback can be implemented by creating multiple wl_buffer objects from
1409+
the same backing storage).
13971410

13981411
Destroying the wl_buffer after wl_buffer.release does not change
13991412
the surface contents. Destroying the wl_buffer before wl_buffer.release
@@ -1769,6 +1782,29 @@
17691782
</description>
17701783
<arg name="transform" type="uint" enum="wl_output.transform" summary="preferred transform"/>
17711784
</event>
1785+
<request name="get_release" since="7">
1786+
<description summary="get a release callback">
1787+
Create a callback for the release of the buffer attached by the client
1788+
with wl_surface.attach.
1789+
1790+
The compositor will release the buffer when it has finished its usage of
1791+
the underlying storage for the relevant commit. Once the client receives
1792+
this event, and assuming the associated buffer is not pending release
1793+
from other wl_surface.commit requests, the client can safely re-use the
1794+
buffer.
1795+
1796+
Release callbacks are double-buffered state, and will be associated
1797+
with the pending buffer at wl_surface.commit time.
1798+
1799+
The callback_data passed in the wl_callback.done event is unused and
1800+
is always zero.
1801+
1802+
Sending this request without attaching a non-null buffer in the same
1803+
content update is a protocol error. The compositor will send the
1804+
no_buffer error in this case.
1805+
</description>
1806+
<arg name="callback" type="new_id" interface="wl_callback" summary="callback object for the release"/>
1807+
</request>
17721808
<enum name="error">
17731809
<description summary="wl_surface error values">
17741810
These errors can be emitted in response to wl_surface requests.
@@ -1778,6 +1814,7 @@
17781814
<entry name="invalid_size" value="2" summary="buffer size is invalid"/>
17791815
<entry name="invalid_offset" value="3" summary="buffer offset is invalid"/>
17801816
<entry name="defunct_role_object" value="4" summary="surface was destroyed before its role object"/>
1817+
<entry name="no_buffer" value="5" summary="no buffer was attached"/>
17811818
</enum>
17821819
</interface>
17831820
<interface name="wl_seat" version="10">
@@ -2794,7 +2831,7 @@
27942831
<entry name="preferred" value="0x2" summary="indicates this is the preferred mode"/>
27952832
</enum>
27962833
</interface>
2797-
<interface name="wl_region" version="1">
2834+
<interface name="wl_region" version="7">
27982835
<description summary="region interface">
27992836
A region object describes an area.
28002837

wl-proxy/src/baseline/versions/prototyping.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@ const weston_touch_calibrator: u32 = 1;
9494
const weston_touch_coordinate: u32 = 1;
9595
const wl_buffer: u32 = 1;
9696
const wl_callback: u32 = 1;
97-
const wl_compositor: u32 = 6;
98-
const wl_data_device: u32 = 3;
99-
const wl_data_device_manager: u32 = 3;
100-
const wl_data_offer: u32 = 3;
101-
const wl_data_source: u32 = 3;
97+
const wl_compositor: u32 = 7;
98+
const wl_data_device: u32 = 4;
99+
const wl_data_device_manager: u32 = 4;
100+
const wl_data_offer: u32 = 4;
101+
const wl_data_source: u32 = 4;
102102
const wl_display: u32 = 1;
103103
const wl_drm: u32 = 2;
104104
const wl_fixes: u32 = 1;
105105
const wl_keyboard: u32 = 10;
106106
const wl_output: u32 = 4;
107107
const wl_pointer: u32 = 10;
108-
const wl_region: u32 = 1;
108+
const wl_region: u32 = 7;
109109
const wl_registry: u32 = 1;
110110
const wl_seat: u32 = 10;
111111
const wl_shell: u32 = 1;
@@ -114,7 +114,7 @@ const wl_shm: u32 = 2;
114114
const wl_shm_pool: u32 = 2;
115115
const wl_subcompositor: u32 = 1;
116116
const wl_subsurface: u32 = 1;
117-
const wl_surface: u32 = 6;
117+
const wl_surface: u32 = 7;
118118
const wl_touch: u32 = 10;
119119
const wlproxy_sync_v1: u32 = 1;
120120
const wlproxy_test: u32 = 1;

wl-proxy/src/baseline/versions/prototyping.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,18 @@ weston_touch_calibrator = 1
8989
weston_touch_coordinate = 1
9090
wl_buffer = 1
9191
wl_callback = 1
92-
wl_compositor = 6
93-
wl_data_device = 3
94-
wl_data_device_manager = 3
95-
wl_data_offer = 3
96-
wl_data_source = 3
92+
wl_compositor = 7
93+
wl_data_device = 4
94+
wl_data_device_manager = 4
95+
wl_data_offer = 4
96+
wl_data_source = 4
9797
wl_display = 1
9898
wl_drm = 2
9999
wl_fixes = 1
100100
wl_keyboard = 10
101101
wl_output = 4
102102
wl_pointer = 10
103-
wl_region = 1
103+
wl_region = 7
104104
wl_registry = 1
105105
wl_seat = 10
106106
wl_shell = 1
@@ -109,7 +109,7 @@ wl_shm = 2
109109
wl_shm_pool = 2
110110
wl_subcompositor = 1
111111
wl_subsurface = 1
112-
wl_surface = 6
112+
wl_surface = 7
113113
wl_touch = 10
114114
wlproxy_sync_v1 = 1
115115
wlproxy_test = 1

wl-proxy/src/protocols.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5500,17 +5500,17 @@ impl ObjectInterface {
55005500
Self::ZwpVirtualKeyboardV1 => 1,
55015501
Self::WlBuffer => 1,
55025502
Self::WlCallback => 1,
5503-
Self::WlCompositor => 6,
5504-
Self::WlDataDevice => 3,
5505-
Self::WlDataDeviceManager => 3,
5506-
Self::WlDataOffer => 3,
5507-
Self::WlDataSource => 3,
5503+
Self::WlCompositor => 7,
5504+
Self::WlDataDevice => 4,
5505+
Self::WlDataDeviceManager => 4,
5506+
Self::WlDataOffer => 4,
5507+
Self::WlDataSource => 4,
55085508
Self::WlDisplay => 1,
55095509
Self::WlFixes => 1,
55105510
Self::WlKeyboard => 10,
55115511
Self::WlOutput => 4,
55125512
Self::WlPointer => 10,
5513-
Self::WlRegion => 1,
5513+
Self::WlRegion => 7,
55145514
Self::WlRegistry => 1,
55155515
Self::WlSeat => 10,
55165516
Self::WlShell => 1,
@@ -5519,7 +5519,7 @@ impl ObjectInterface {
55195519
Self::WlShmPool => 2,
55205520
Self::WlSubcompositor => 1,
55215521
Self::WlSubsurface => 1,
5522-
Self::WlSurface => 6,
5522+
Self::WlSurface => 7,
55235523
Self::WlTouch => 10,
55245524
#[cfg(feature = "protocol-alpha_modifier_v1")]
55255525
Self::WpAlphaModifierSurfaceV1 => 1,

wl-proxy/src/protocols/wayland/wl_compositor.rs

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct DefaultHandler;
2020
impl WlCompositorHandler for DefaultHandler { }
2121

2222
impl ConcreteObject for WlCompositor {
23-
const XML_VERSION: u32 = 6;
23+
const XML_VERSION: u32 = 7;
2424
const INTERFACE: ObjectInterface = ObjectInterface::WlCompositor;
2525
const INTERFACE_NAME: &str = "wl_compositor";
2626
}
@@ -260,6 +260,62 @@ impl WlCompositor {
260260
);
261261
id
262262
}
263+
264+
/// Since when the release message is available.
265+
pub const MSG__RELEASE__SINCE: u32 = 7;
266+
267+
/// destroy wl_compositor
268+
///
269+
/// This request destroys the wl_compositor. This has no effect on any other objects.
270+
#[inline]
271+
pub fn try_send_release(
272+
&self,
273+
) -> Result<(), ObjectError> {
274+
let core = self.core();
275+
let Some(id) = core.server_obj_id.get() else {
276+
return Err(ObjectError(ObjectErrorKind::ReceiverNoServerId));
277+
};
278+
#[cfg(feature = "logging")]
279+
if self.core.state.log {
280+
#[cold]
281+
fn log(state: &State, id: u32) {
282+
let (millis, micros) = time_since_epoch();
283+
let prefix = &state.log_prefix;
284+
let args = format_args!("[{millis:7}.{micros:03}] {prefix}server <= wl_compositor#{}.release()\n", id);
285+
state.log(args);
286+
}
287+
log(&self.core.state, id);
288+
}
289+
let Some(endpoint) = &self.core.state.server else {
290+
return Ok(());
291+
};
292+
if !endpoint.flush_queued.replace(true) {
293+
self.core.state.add_flushable_endpoint(endpoint, None);
294+
}
295+
let mut outgoing_ref = endpoint.outgoing.borrow_mut();
296+
let outgoing = &mut *outgoing_ref;
297+
let mut fmt = outgoing.formatter();
298+
fmt.words([
299+
id,
300+
2,
301+
]);
302+
self.core.handle_server_destroy();
303+
Ok(())
304+
}
305+
306+
/// destroy wl_compositor
307+
///
308+
/// This request destroys the wl_compositor. This has no effect on any other objects.
309+
#[inline]
310+
pub fn send_release(
311+
&self,
312+
) {
313+
let res = self.try_send_release(
314+
);
315+
if let Err(e) = res {
316+
log_send("wl_compositor.release", &e);
317+
}
318+
}
263319
}
264320

265321
/// A message handler for [`WlCompositor`] proxies.
@@ -319,6 +375,24 @@ pub trait WlCompositorHandler: Any {
319375
log_forward("wl_compositor.create_region", &e);
320376
}
321377
}
378+
379+
/// destroy wl_compositor
380+
///
381+
/// This request destroys the wl_compositor. This has no effect on any other objects.
382+
#[inline]
383+
fn handle_release(
384+
&mut self,
385+
slf: &Rc<WlCompositor>,
386+
) {
387+
if !slf.core.forward_to_server.get() {
388+
return;
389+
}
390+
let res = slf.try_send_release(
391+
);
392+
if let Err(e) = res {
393+
log_forward("wl_compositor.release", &e);
394+
}
395+
}
322396
}
323397

324398
impl ObjectPrivate for WlCompositor {
@@ -403,6 +477,28 @@ impl ObjectPrivate for WlCompositor {
403477
DefaultHandler.handle_create_region(&self, arg0);
404478
}
405479
}
480+
2 => {
481+
if msg.len() != 2 {
482+
return Err(ObjectError(ObjectErrorKind::WrongMessageSize(msg.len() as u32 * 4, 8)));
483+
}
484+
#[cfg(feature = "logging")]
485+
if self.core.state.log {
486+
#[cold]
487+
fn log(state: &State, client_id: u64, id: u32) {
488+
let (millis, micros) = time_since_epoch();
489+
let prefix = &state.log_prefix;
490+
let args = format_args!("[{millis:7}.{micros:03}] {prefix}client#{:<4} -> wl_compositor#{}.release()\n", client_id, id);
491+
state.log(args);
492+
}
493+
log(&self.core.state, client.endpoint.id, msg[0]);
494+
}
495+
self.core.handle_client_destroy();
496+
if let Some(handler) = handler {
497+
(**handler).handle_release(&self);
498+
} else {
499+
DefaultHandler.handle_release(&self);
500+
}
501+
}
406502
n => {
407503
let _ = client;
408504
let _ = msg;
@@ -434,6 +530,7 @@ impl ObjectPrivate for WlCompositor {
434530
let name = match id {
435531
0 => "create_surface",
436532
1 => "create_region",
533+
2 => "release",
437534
_ => return None,
438535
};
439536
Some(name)

wl-proxy/src/protocols/wayland/wl_data_device.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct DefaultHandler;
2222
impl WlDataDeviceHandler for DefaultHandler { }
2323

2424
impl ConcreteObject for WlDataDevice {
25-
const XML_VERSION: u32 = 3;
25+
const XML_VERSION: u32 = 4;
2626
const INTERFACE: ObjectInterface = ObjectInterface::WlDataDevice;
2727
const INTERFACE_NAME: &str = "wl_data_device";
2828
}

0 commit comments

Comments
 (0)