1
0
Fork 0
forked from wry/wry

portal: include mapping_id in screencasts

This commit is contained in:
Julian Orth 2024-10-11 13:23:54 +02:00
parent edafe16742
commit 5df018046c
5 changed files with 31 additions and 5 deletions

View file

@ -15,8 +15,8 @@ use {
wire_ei::{
ei_device::{
ClientFrame, ClientStartEmulating, ClientStopEmulating, Destroyed, DeviceType,
Done, EiDeviceRequestHandler, Interface, Paused, Region, Release, Resumed,
ServerFrame, ServerStartEmulating,
Done, EiDeviceRequestHandler, Interface, Paused, Region, RegionMappingId, Release,
Resumed, ServerFrame, ServerStartEmulating,
},
EiDeviceId,
},
@ -100,6 +100,13 @@ impl EiDevice {
});
}
pub fn send_region_mapping_id(&self, mapping_id: &str) {
self.client.event(RegionMappingId {
self_id: self.id,
mapping_id,
});
}
#[expect(dead_code)]
pub fn send_paused(&self, serial: u32) {
self.client.event(Paused {

View file

@ -346,6 +346,7 @@ impl EiSeat {
apply!(EI_CAP_KEYBOARD, create_keyboard);
apply!(EI_CAP_TOUCHSCREEN, create_touchscreen);
for output in self.client.state.root.outputs.lock().values() {
device.send_region_mapping_id(&output.global.connector.name);
device.send_region(
output.node_absolute_position(),
output.global.persistent.scale.get(),

View file

@ -90,7 +90,7 @@ impl UsrJayEiSessionOwner for StartingRemoteDesktop {
Some(self.dpy.clone()),
);
} else {
self.session.send_start_reply(None, None);
self.session.send_start_reply(None, None, None);
}
}

View file

@ -159,8 +159,19 @@ bitflags! {
impl PwClientNodeOwner for StartingScreencast {
fn bound_id(&self, node_id: u32) {
self.session
.send_start_reply(Some(node_id), create_restore_data(&self.dpy, &self.target));
{
let output = match &self.target {
ScreencastTarget::Output(o) => Some(o),
ScreencastTarget::Workspace(o, _, _) => Some(o),
ScreencastTarget::Toplevel(_) => None,
};
let mapping_id = output.and_then(|o| o.wl.name.borrow().clone());
self.session.send_start_reply(
Some(node_id),
create_restore_data(&self.dpy, &self.target),
mapping_id.as_deref(),
);
}
let mut supported_formats = PwClientNodePortSupportedFormats {
media_type: Some(SPA_MEDIA_TYPE_video),
media_sub_type: Some(SPA_MEDIA_SUBTYPE_raw),

View file

@ -100,6 +100,7 @@ impl PortalSession {
&self,
pw_node_id: Option<u32>,
restore_data: Option<Variant<'static>>,
mapping_id: Option<&str>,
) {
let inner_type = DynamicType::DictEntry(
Box::new(DynamicType::String),
@ -133,6 +134,12 @@ impl PortalSession {
value: rd,
});
}
if let Some(mapping_id) = mapping_id {
variants.push(DictEntry {
key: "mapping_id".into(),
value: Variant::String(mapping_id.into()),
});
}
if let Some(reply) = self.start_reply.take() {
match reply {
PortalSessionReply::RemoteDesktop(reply) => {