1
0
Fork 0
forked from wry/wry

all: track serials as u64 internally

This commit is contained in:
Julian Orth 2024-10-17 15:20:46 +02:00
parent 437c6b0596
commit c987fdb58d
28 changed files with 123 additions and 119 deletions

View file

@ -73,11 +73,11 @@ impl WlDataDevice {
x: Fixed,
y: Fixed,
offer: WlDataOfferId,
serial: u32,
serial: u64,
) {
self.client.event(Enter {
self_id: self.id,
serial,
serial: serial as _,
surface,
x,
y,
@ -103,10 +103,10 @@ impl WlDataDeviceRequestHandler for WlDataDevice {
type Error = WlDataDeviceError;
fn start_drag(&self, req: StartDrag, _slf: &Rc<Self>) -> Result<(), Self::Error> {
if !self.client.valid_serial(req.serial) {
let Some(serial) = self.client.map_serial(req.serial) else {
log::warn!("Client tried to start_drag with an invalid serial");
return Ok(());
}
};
let origin = self.client.lookup(req.origin)?;
let source = if req.source.is_some() {
Some(self.client.lookup(req.source)?)
@ -119,16 +119,16 @@ impl WlDataDeviceRequestHandler for WlDataDevice {
} else {
None
};
self.seat.start_drag(&origin, source, icon, req.serial)?;
self.seat.start_drag(&origin, source, icon, serial)?;
Ok(())
}
fn set_selection(&self, req: SetSelection, _slf: &Rc<Self>) -> Result<(), Self::Error> {
if !self.client.valid_serial(req.serial) {
let Some(serial) = self.client.map_serial(req.serial) else {
log::warn!("Client tried to set_selection with an invalid serial");
return Ok(());
}
if !self.seat.may_modify_selection(&self.client, req.serial) {
};
if !self.seat.may_modify_selection(&self.client, serial) {
log::warn!("Ignoring disallowed set_selection request");
return Ok(());
}
@ -137,8 +137,7 @@ impl WlDataDeviceRequestHandler for WlDataDevice {
} else {
Some(self.client.lookup(req.source)?)
};
self.seat
.set_wl_data_source_selection(src, Some(req.serial))?;
self.seat.set_wl_data_source_selection(src, Some(serial))?;
Ok(())
}
@ -177,7 +176,7 @@ impl IpcVtable for ClipboardIpc {
fn set_seat_selection(
seat: &Rc<WlSeatGlobal>,
source: &Rc<Self::Source>,
serial: Option<u32>,
serial: Option<u64>,
) -> Result<(), WlSeatError> {
seat.set_wl_data_source_selection(Some(source.clone()), serial)
}

View file

@ -68,7 +68,7 @@ impl DynDataOffer for WlDataOffer {
cancel_offer::<ClipboardIpc>(self);
}
fn send_enter(&self, surface: WlSurfaceId, x: Fixed, y: Fixed, serial: u32) {
fn send_enter(&self, surface: WlSurfaceId, x: Fixed, y: Fixed, serial: u64) {
self.device.send_enter(surface, x, y, self.id, serial);
}

View file

@ -80,7 +80,7 @@ impl<T: XIpc> IpcVtable for T {
fn set_seat_selection(
seat: &Rc<WlSeatGlobal>,
source: &Rc<Self::Source>,
_serial: Option<u32>,
_serial: Option<u64>,
) -> Result<(), WlSeatError> {
match source.location {
IpcLocation::Clipboard => seat.set_selection(Some(source.clone())),

View file

@ -232,7 +232,7 @@ impl<T: WlrIpc> IpcVtable for WlrIpcImpl<T> {
fn set_seat_selection(
seat: &Rc<WlSeatGlobal>,
source: &Rc<Self::Source>,
serial: Option<u32>,
serial: Option<u64>,
) -> Result<(), WlSeatError> {
debug_assert!(serial.is_none());
let _ = serial;

View file

@ -69,13 +69,13 @@ impl ZwpPrimarySelectionDeviceV1RequestHandler for ZwpPrimarySelectionDeviceV1 {
type Error = ZwpPrimarySelectionDeviceV1Error;
fn set_selection(&self, req: SetSelection, _slf: &Rc<Self>) -> Result<(), Self::Error> {
if !self.client.valid_serial(req.serial) {
let Some(serial) = self.client.map_serial(req.serial) else {
log::warn!("Client tried to set_selection with an invalid serial");
return Ok(());
}
};
if !self
.seat
.may_modify_primary_selection(&self.client, Some(req.serial))
.may_modify_primary_selection(&self.client, Some(serial))
{
log::warn!("Ignoring disallowed set_selection request");
return Ok(());
@ -85,7 +85,7 @@ impl ZwpPrimarySelectionDeviceV1RequestHandler for ZwpPrimarySelectionDeviceV1 {
} else {
Some(self.client.lookup(req.source)?)
};
self.seat.set_zwp_primary_selection(src, Some(req.serial))?;
self.seat.set_zwp_primary_selection(src, Some(serial))?;
Ok(())
}
@ -124,7 +124,7 @@ impl IpcVtable for PrimarySelectionIpc {
fn set_seat_selection(
seat: &Rc<WlSeatGlobal>,
source: &Rc<Self::Source>,
serial: Option<u32>,
serial: Option<u64>,
) -> Result<(), WlSeatError> {
seat.set_zwp_primary_selection(Some(source.clone()), serial)
}