all: track serials as u64 internally
This commit is contained in:
parent
437c6b0596
commit
c987fdb58d
28 changed files with 123 additions and 119 deletions
|
|
@ -161,7 +161,7 @@ impl Clients {
|
|||
is_xwayland,
|
||||
effective_caps,
|
||||
bounding_caps,
|
||||
last_enter_serial: Cell::new(0),
|
||||
last_enter_serial: Default::default(),
|
||||
pid_info: get_pid_info(uid, pid),
|
||||
serials: Default::default(),
|
||||
symmetric_delete: Cell::new(false),
|
||||
|
|
@ -277,7 +277,7 @@ pub struct Client {
|
|||
pub is_xwayland: bool,
|
||||
pub effective_caps: ClientCaps,
|
||||
pub bounding_caps: ClientCaps,
|
||||
pub last_enter_serial: Cell<u32>,
|
||||
pub last_enter_serial: Cell<Option<u64>>,
|
||||
pub pid_info: PidInfo,
|
||||
pub serials: RefCell<VecDeque<SerialRange>>,
|
||||
pub symmetric_delete: Cell<bool>,
|
||||
|
|
@ -291,8 +291,8 @@ pub struct Client {
|
|||
pub const NUM_CACHED_SERIAL_RANGES: usize = 64;
|
||||
|
||||
pub struct SerialRange {
|
||||
pub lo: u32,
|
||||
pub hi: u32,
|
||||
pub lo: u64,
|
||||
pub hi: u64,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
|
|
@ -320,20 +320,28 @@ impl Client {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn valid_serial(&self, serial: u32) -> bool {
|
||||
pub fn map_serial(&self, serial: u32) -> Option<u64> {
|
||||
let serials = self.serials.borrow_mut();
|
||||
let latest = serials.back()?;
|
||||
let mut serial = ((latest.hi >> 32) << 32) | (serial as u64);
|
||||
if serial > latest.hi {
|
||||
serial = serial.checked_sub(1 << 32)?;
|
||||
}
|
||||
for range in serials.iter().rev() {
|
||||
if serial.wrapping_sub(range.hi) as i32 > 0 {
|
||||
return false;
|
||||
if serial > range.hi {
|
||||
return None;
|
||||
}
|
||||
if serial.wrapping_sub(range.lo) as i32 >= 0 {
|
||||
return true;
|
||||
if serial >= range.lo {
|
||||
return Some(serial);
|
||||
}
|
||||
}
|
||||
serials.len() == NUM_CACHED_SERIAL_RANGES
|
||||
if serials.len() == NUM_CACHED_SERIAL_RANGES {
|
||||
return Some(serial);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn next_serial(&self) -> u32 {
|
||||
pub fn next_serial(&self) -> u64 {
|
||||
self.state.next_serial(Some(self))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ pub trait DynDataOffer: 'static {
|
|||
any::type_name_of_val(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) {
|
||||
let _ = surface;
|
||||
let _ = x;
|
||||
let _ = y;
|
||||
|
|
@ -155,7 +155,7 @@ pub trait IpcVtable: Sized {
|
|||
fn set_seat_selection(
|
||||
seat: &Rc<WlSeatGlobal>,
|
||||
source: &Rc<Self::Source>,
|
||||
serial: Option<u32>,
|
||||
serial: Option<u64>,
|
||||
) -> Result<(), WlSeatError>;
|
||||
fn create_offer(
|
||||
dd: &Rc<Self::Device>,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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())),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,9 +173,9 @@ pub struct WlSeatGlobal {
|
|||
tree_changed: Rc<AsyncEvent>,
|
||||
tree_changed_needs_layout: Cell<bool>,
|
||||
selection: CloneCell<Option<Rc<dyn DynDataSource>>>,
|
||||
selection_serial: Cell<u32>,
|
||||
selection_serial: Cell<u64>,
|
||||
primary_selection: CloneCell<Option<Rc<dyn DynDataSource>>>,
|
||||
primary_selection_serial: Cell<u32>,
|
||||
primary_selection_serial: Cell<u64>,
|
||||
pointer_owner: PointerOwnerHolder,
|
||||
kb_owner: KbOwnerHolder,
|
||||
gesture_owner: GestureOwnerHolder,
|
||||
|
|
@ -766,7 +766,7 @@ impl WlSeatGlobal {
|
|||
origin: &Rc<WlSurface>,
|
||||
source: Option<Rc<WlDataSource>>,
|
||||
icon: Option<Rc<DndIcon>>,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) -> Result<(), WlSeatError> {
|
||||
if let Some(icon) = &icon {
|
||||
icon.surface().set_output(&self.pointer_cursor.output());
|
||||
|
|
@ -798,7 +798,7 @@ impl WlSeatGlobal {
|
|||
pub fn set_wl_data_source_selection(
|
||||
self: &Rc<Self>,
|
||||
selection: Option<Rc<WlDataSource>>,
|
||||
serial: Option<u32>,
|
||||
serial: Option<u64>,
|
||||
) -> Result<(), WlSeatError> {
|
||||
if let Some(serial) = serial {
|
||||
self.selection_serial.set(serial);
|
||||
|
|
@ -825,18 +825,16 @@ impl WlSeatGlobal {
|
|||
self.selection.get()
|
||||
}
|
||||
|
||||
pub fn may_modify_selection(&self, client: &Rc<Client>, serial: u32) -> bool {
|
||||
let dist = serial.wrapping_sub(self.selection_serial.get()) as i32;
|
||||
if dist < 0 {
|
||||
pub fn may_modify_selection(&self, client: &Rc<Client>, serial: u64) -> bool {
|
||||
if serial < self.selection_serial.get() {
|
||||
return false;
|
||||
}
|
||||
self.keyboard_node.get().node_client_id() == Some(client.id)
|
||||
}
|
||||
|
||||
pub fn may_modify_primary_selection(&self, client: &Rc<Client>, serial: Option<u32>) -> bool {
|
||||
pub fn may_modify_primary_selection(&self, client: &Rc<Client>, serial: Option<u64>) -> bool {
|
||||
if let Some(serial) = serial {
|
||||
let dist = serial.wrapping_sub(self.primary_selection_serial.get()) as i32;
|
||||
if dist < 0 {
|
||||
if serial < self.primary_selection_serial.get() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -851,7 +849,7 @@ impl WlSeatGlobal {
|
|||
pub fn set_zwp_primary_selection(
|
||||
self: &Rc<Self>,
|
||||
selection: Option<Rc<ZwpPrimarySelectionSourceV1>>,
|
||||
serial: Option<u32>,
|
||||
serial: Option<u64>,
|
||||
) -> Result<(), WlSeatError> {
|
||||
if let Some(serial) = serial {
|
||||
self.primary_selection_serial.set(serial);
|
||||
|
|
|
|||
|
|
@ -1137,7 +1137,7 @@ impl WlSeatGlobal {
|
|||
time_usec: u64,
|
||||
button: u32,
|
||||
state: KeyState,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) {
|
||||
let (state, pressed) = match state {
|
||||
KeyState::Released => (wl_pointer::RELEASED, false),
|
||||
|
|
@ -1250,7 +1250,7 @@ impl WlSeatGlobal {
|
|||
|
||||
pub fn enter_surface(&self, n: &WlSurface, x: Fixed, y: Fixed) {
|
||||
let serial = n.client.next_serial();
|
||||
n.client.last_enter_serial.set(serial);
|
||||
n.client.last_enter_serial.set(Some(serial));
|
||||
self.surface_pointer_event(Version::ALL, n, |p| p.send_enter(serial, n.id, x, y));
|
||||
self.surface_pointer_frame(n);
|
||||
for (_, constraint) in &n.constraints {
|
||||
|
|
@ -1428,7 +1428,7 @@ impl WlSeatGlobal {
|
|||
dnd: &Dnd,
|
||||
x: Fixed,
|
||||
y: Fixed,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) {
|
||||
if let Some(src) = &dnd.src {
|
||||
if !surface.client.is_xwayland {
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ impl PointerOwnerHolder {
|
|||
origin: &Rc<WlSurface>,
|
||||
source: Option<Rc<WlDataSource>>,
|
||||
icon: Option<Rc<DndIcon>>,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) -> Result<(), WlSeatError> {
|
||||
self.owner
|
||||
.get()
|
||||
|
|
@ -230,7 +230,7 @@ trait PointerOwner {
|
|||
origin: &Rc<WlSurface>,
|
||||
source: Option<Rc<WlDataSource>>,
|
||||
icon: Option<Rc<DndIcon>>,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) -> Result<(), WlSeatError> {
|
||||
let _ = origin;
|
||||
let _ = icon;
|
||||
|
|
@ -284,7 +284,7 @@ struct SimpleGrabPointerOwner<T> {
|
|||
usecase: T,
|
||||
buttons: SmallMap<u32, (), 1>,
|
||||
node: Rc<dyn Node>,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
}
|
||||
|
||||
struct DndPointerOwner {
|
||||
|
|
@ -473,7 +473,7 @@ impl<T: SimplePointerOwnerUsecase> PointerOwner for SimpleGrabPointerOwner<T> {
|
|||
origin: &Rc<WlSurface>,
|
||||
src: Option<Rc<WlDataSource>>,
|
||||
icon: Option<Rc<DndIcon>>,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) -> Result<(), WlSeatError> {
|
||||
self.usecase
|
||||
.start_drag(self, seat, origin, src, icon, serial)
|
||||
|
|
@ -627,7 +627,7 @@ trait SimplePointerOwnerUsecase: Sized + Clone + 'static {
|
|||
origin: &Rc<WlSurface>,
|
||||
src: Option<Rc<WlDataSource>>,
|
||||
icon: Option<Rc<DndIcon>>,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) -> Result<(), WlSeatError> {
|
||||
let _ = grab;
|
||||
let _ = origin;
|
||||
|
|
@ -720,7 +720,7 @@ impl SimplePointerOwnerUsecase for DefaultPointerUsecase {
|
|||
origin: &Rc<WlSurface>,
|
||||
src: Option<Rc<WlDataSource>>,
|
||||
icon: Option<Rc<DndIcon>>,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) -> Result<(), WlSeatError> {
|
||||
let button = match grab.buttons.iter().next() {
|
||||
Some((b, _)) => b,
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@ impl ZwpTabletPadGroupV2 {
|
|||
self.client.event(Done { self_id: self.id });
|
||||
}
|
||||
|
||||
pub fn send_mode_switch(&self, time: u32, serial: u32, mode: u32) {
|
||||
pub fn send_mode_switch(&self, time: u32, serial: u64, mode: u32) {
|
||||
self.client.event(ModeSwitch {
|
||||
self_id: self.id,
|
||||
time,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
mode,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,21 +68,21 @@ impl ZwpTabletPadV2 {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn send_enter(&self, serial: u32, tablet: &ZwpTabletV2, surface: &WlSurface) {
|
||||
pub fn send_enter(&self, serial: u64, tablet: &ZwpTabletV2, surface: &WlSurface) {
|
||||
self.entered.set(true);
|
||||
self.client.event(Enter {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
tablet: tablet.id,
|
||||
surface: surface.id,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_leave(&self, serial: u32, surface: &WlSurface) {
|
||||
pub fn send_leave(&self, serial: u64, surface: &WlSurface) {
|
||||
self.entered.set(false);
|
||||
self.client.event(Leave {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
surface: surface.id,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ impl ZwpTabletToolV2 {
|
|||
self.client.event(Removed { self_id: self.id });
|
||||
}
|
||||
|
||||
pub fn send_proximity_in(&self, serial: u32, tablet: &ZwpTabletV2, surface: &WlSurface) {
|
||||
pub fn send_proximity_in(&self, serial: u64, tablet: &ZwpTabletV2, surface: &WlSurface) {
|
||||
self.entered.set(true);
|
||||
self.client.event(ProximityIn {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
tablet: tablet.id,
|
||||
surface: surface.id,
|
||||
});
|
||||
|
|
@ -113,10 +113,10 @@ impl ZwpTabletToolV2 {
|
|||
self.client.event(ProximityOut { self_id: self.id });
|
||||
}
|
||||
|
||||
pub fn send_down(&self, serial: u32) {
|
||||
pub fn send_down(&self, serial: u64) {
|
||||
self.client.event(Down {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -177,10 +177,10 @@ impl ZwpTabletToolV2 {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn send_button(&self, serial: u32, button: u32, state: ToolButtonState) {
|
||||
pub fn send_button(&self, serial: u64, button: u32, state: ToolButtonState) {
|
||||
self.client.event(Button {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
button,
|
||||
state: match state {
|
||||
ToolButtonState::Released => 0,
|
||||
|
|
@ -204,7 +204,7 @@ impl ZwpTabletToolV2RequestHandler for ZwpTabletToolV2 {
|
|||
let Some(tool) = self.tool.get() else {
|
||||
return Ok(());
|
||||
};
|
||||
if !self.seat.client.valid_serial(req.serial) {
|
||||
if self.seat.client.map_serial(req.serial).is_none() {
|
||||
log::warn!("Client tried to set_cursor with an invalid serial");
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ impl ZwpInputMethodKeyboardGrabV2 {
|
|||
});
|
||||
}
|
||||
|
||||
fn update_state(&self, serial: u32, kb_state: &KeyboardState) {
|
||||
fn update_state(&self, serial: u64, kb_state: &KeyboardState) {
|
||||
self.send_keymap(kb_state);
|
||||
self.send_modifiers(serial, kb_state);
|
||||
self.kb_state_id.set(kb_state.id);
|
||||
|
|
@ -56,10 +56,10 @@ impl ZwpInputMethodKeyboardGrabV2 {
|
|||
self.send_key(serial, time_usec, key, state);
|
||||
}
|
||||
|
||||
fn send_key(&self, serial: u32, time_usec: u64, key: u32, state: u32) {
|
||||
fn send_key(&self, serial: u64, time_usec: u64, key: u32, state: u32) {
|
||||
self.client.event(Key {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time: (time_usec / 1000) as _,
|
||||
key,
|
||||
state,
|
||||
|
|
@ -74,10 +74,10 @@ impl ZwpInputMethodKeyboardGrabV2 {
|
|||
self.send_modifiers(serial, kb_state);
|
||||
}
|
||||
|
||||
fn send_modifiers(&self, serial: u32, kb_state: &KeyboardState) {
|
||||
fn send_modifiers(&self, serial: u64, kb_state: &KeyboardState) {
|
||||
self.client.event(Modifiers {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
mods_depressed: kb_state.mods.mods_depressed,
|
||||
mods_latched: kb_state.mods.mods_latched,
|
||||
mods_locked: kb_state.mods.mods_locked,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ impl WlKeyboard {
|
|||
|
||||
fn send_kb_state(
|
||||
&self,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
kb_state: &KeyboardState,
|
||||
surface_id: WlSurfaceId,
|
||||
send_leave: bool,
|
||||
|
|
@ -78,7 +78,7 @@ impl WlKeyboard {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn enter(&self, serial: u32, surface: WlSurfaceId, kb_state: &KeyboardState) {
|
||||
pub fn enter(&self, serial: u64, surface: WlSurfaceId, kb_state: &KeyboardState) {
|
||||
if kb_state.id != self.kb_state_id.get() {
|
||||
self.send_kb_state(serial, kb_state, surface, false);
|
||||
} else {
|
||||
|
|
@ -87,26 +87,26 @@ impl WlKeyboard {
|
|||
}
|
||||
}
|
||||
|
||||
fn send_enter(&self, serial: u32, surface: WlSurfaceId, keys: &[u32]) {
|
||||
fn send_enter(&self, serial: u64, surface: WlSurfaceId, keys: &[u32]) {
|
||||
self.seat.client.event(Enter {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
surface,
|
||||
keys,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn send_leave(&self, serial: u32, surface: WlSurfaceId) {
|
||||
pub fn send_leave(&self, serial: u64, surface: WlSurfaceId) {
|
||||
self.seat.client.event(Leave {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
surface,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn on_key(
|
||||
&self,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
time: u32,
|
||||
key: u32,
|
||||
state: u32,
|
||||
|
|
@ -119,17 +119,17 @@ impl WlKeyboard {
|
|||
self.send_key(serial, time, key, state);
|
||||
}
|
||||
|
||||
fn send_key(&self, serial: u32, time: u32, key: u32, state: u32) {
|
||||
fn send_key(&self, serial: u64, time: u32, key: u32, state: u32) {
|
||||
self.seat.client.event(Key {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time,
|
||||
key,
|
||||
state,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn on_mods_changed(&self, serial: u32, surface: WlSurfaceId, kb_state: &KeyboardState) {
|
||||
pub fn on_mods_changed(&self, serial: u64, surface: WlSurfaceId, kb_state: &KeyboardState) {
|
||||
if self.kb_state_id.get() != kb_state.id {
|
||||
self.send_kb_state(serial, kb_state, surface, true);
|
||||
} else {
|
||||
|
|
@ -137,10 +137,10 @@ impl WlKeyboard {
|
|||
}
|
||||
}
|
||||
|
||||
fn send_modifiers(&self, serial: u32, mods: &ModifierState) {
|
||||
fn send_modifiers(&self, serial: u64, mods: &ModifierState) {
|
||||
self.seat.client.event(Modifiers {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
mods_depressed: mods.mods_depressed,
|
||||
mods_latched: mods.mods_latched,
|
||||
mods_locked: mods.mods_locked,
|
||||
|
|
|
|||
|
|
@ -86,22 +86,22 @@ impl WlPointer {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn send_enter(&self, serial: u32, surface: WlSurfaceId, mut x: Fixed, mut y: Fixed) {
|
||||
pub fn send_enter(&self, serial: u64, surface: WlSurfaceId, mut x: Fixed, mut y: Fixed) {
|
||||
self.last_motion.set((x, y));
|
||||
logical_to_client_wire_scale!(self.seat.client, x, y);
|
||||
self.seat.client.event(Enter {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as u32,
|
||||
surface,
|
||||
surface_x: x,
|
||||
surface_y: y,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn send_leave(&self, serial: u32, surface: WlSurfaceId) {
|
||||
pub fn send_leave(&self, serial: u64, surface: WlSurfaceId) {
|
||||
self.seat.client.event(Leave {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as u32,
|
||||
surface,
|
||||
})
|
||||
}
|
||||
|
|
@ -119,10 +119,10 @@ impl WlPointer {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn send_button(&self, serial: u32, time: u32, button: u32, state: u32) {
|
||||
pub fn send_button(&self, serial: u64, time: u32, button: u32, state: u32) {
|
||||
self.seat.client.event(Button {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as u32,
|
||||
time,
|
||||
button,
|
||||
state,
|
||||
|
|
@ -187,7 +187,7 @@ impl WlPointerRequestHandler for WlPointer {
|
|||
type Error = WlPointerError;
|
||||
|
||||
fn set_cursor(&self, mut req: SetCursor, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||
if !self.seat.client.valid_serial(req.serial) {
|
||||
if self.seat.client.map_serial(req.serial).is_none() {
|
||||
log::warn!("Client tried to set_cursor with an invalid serial");
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ impl WlTouch {
|
|||
|
||||
pub fn send_down(
|
||||
&self,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
time: u32,
|
||||
surface: WlSurfaceId,
|
||||
id: i32,
|
||||
|
|
@ -43,7 +43,7 @@ impl WlTouch {
|
|||
logical_to_client_wire_scale!(self.seat.client, x, y);
|
||||
self.seat.client.event(Down {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time,
|
||||
surface,
|
||||
id,
|
||||
|
|
@ -52,10 +52,10 @@ impl WlTouch {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn send_up(&self, serial: u32, time: u32, id: i32) {
|
||||
pub fn send_up(&self, serial: u64, time: u32, id: i32) {
|
||||
self.seat.client.event(Up {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time,
|
||||
id,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -23,20 +23,20 @@ impl ZwpPointerGestureHoldV1 {
|
|||
self.seat.hold_bindings.remove(&self.client, self);
|
||||
}
|
||||
|
||||
pub fn send_hold_begin(&self, n: &WlSurface, serial: u32, time_usec: u64, finger_count: u32) {
|
||||
pub fn send_hold_begin(&self, n: &WlSurface, serial: u64, time_usec: u64, finger_count: u32) {
|
||||
self.client.event(Begin {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time: (time_usec / 1000) as u32,
|
||||
surface: n.id,
|
||||
fingers: finger_count,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn send_hold_end(&self, serial: u32, time_usec: u64, cancelled: bool) {
|
||||
pub fn send_hold_end(&self, serial: u64, time_usec: u64, cancelled: bool) {
|
||||
self.client.event(End {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time: (time_usec / 1000) as u32,
|
||||
cancelled: cancelled as _,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ impl ZwpPointerGesturePinchV1 {
|
|||
self.seat.pinch_bindings.remove(&self.client, self);
|
||||
}
|
||||
|
||||
pub fn send_pinch_begin(&self, n: &WlSurface, serial: u32, time_usec: u64, finger_count: u32) {
|
||||
pub fn send_pinch_begin(&self, n: &WlSurface, serial: u64, time_usec: u64, finger_count: u32) {
|
||||
self.client.event(Begin {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time: (time_usec / 1000) as u32,
|
||||
surface: n.id,
|
||||
fingers: finger_count,
|
||||
|
|
@ -52,10 +52,10 @@ impl ZwpPointerGesturePinchV1 {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn send_pinch_end(&self, serial: u32, time_usec: u64, cancelled: bool) {
|
||||
pub fn send_pinch_end(&self, serial: u64, time_usec: u64, cancelled: bool) {
|
||||
self.client.event(End {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time: (time_usec / 1000) as u32,
|
||||
cancelled: cancelled as _,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ impl ZwpPointerGestureSwipeV1 {
|
|||
self.seat.swipe_bindings.remove(&self.client, self);
|
||||
}
|
||||
|
||||
pub fn send_swipe_begin(&self, n: &WlSurface, serial: u32, time_usec: u64, finger_count: u32) {
|
||||
pub fn send_swipe_begin(&self, n: &WlSurface, serial: u64, time_usec: u64, finger_count: u32) {
|
||||
self.client.event(Begin {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time: (time_usec / 1000) as u32,
|
||||
surface: n.id,
|
||||
fingers: finger_count,
|
||||
|
|
@ -43,10 +43,10 @@ impl ZwpPointerGestureSwipeV1 {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn send_swipe_end(&self, serial: u32, time_usec: u64, cancelled: bool) {
|
||||
pub fn send_swipe_end(&self, serial: u64, time_usec: u64, cancelled: bool) {
|
||||
self.client.event(End {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
serial: serial as _,
|
||||
time: (time_usec / 1000) as u32,
|
||||
cancelled: cancelled as _,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ pub struct ZwpVirtualKeyboardV1 {
|
|||
impl ZwpVirtualKeyboardV1 {
|
||||
fn for_each_kb<F>(&self, mut f: F)
|
||||
where
|
||||
F: FnMut(u32, &WlSurface, &WlKeyboard),
|
||||
F: FnMut(u64, &WlSurface, &WlKeyboard),
|
||||
{
|
||||
let Some(surface) = self.seat.keyboard_node.get().node_into_surface() else {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1776,7 +1776,7 @@ impl Node for WlSurface {
|
|||
time_usec: u64,
|
||||
button: u32,
|
||||
state: KeyState,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) {
|
||||
seat.button_surface(&self, time_usec, button, state, serial);
|
||||
}
|
||||
|
|
@ -1829,7 +1829,7 @@ impl Node for WlSurface {
|
|||
dnd.seat.dnd_surface_leave(self, dnd);
|
||||
}
|
||||
|
||||
fn node_on_dnd_enter(&self, dnd: &Dnd, x: Fixed, y: Fixed, serial: u32) {
|
||||
fn node_on_dnd_enter(&self, dnd: &Dnd, x: Fixed, y: Fixed, serial: u64) {
|
||||
dnd.seat.dnd_surface_enter(self, dnd, x, y, serial);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ use {
|
|||
cell::{Cell, RefCell},
|
||||
fmt::{Debug, Formatter},
|
||||
mem,
|
||||
num::Wrapping,
|
||||
ops::DerefMut,
|
||||
rc::{Rc, Weak},
|
||||
sync::Arc,
|
||||
|
|
@ -169,7 +168,7 @@ pub struct State {
|
|||
pub run_args: RunArgs,
|
||||
pub xwayland: XWaylandState,
|
||||
pub acceptor: CloneCell<Option<Rc<Acceptor>>>,
|
||||
pub serial: NumCell<Wrapping<u32>>,
|
||||
pub serial: NumCell<u64>,
|
||||
pub run_toplevel: Rc<RunToplevel>,
|
||||
pub config_dir: Option<String>,
|
||||
pub config_file_id: NumCell<u64>,
|
||||
|
|
@ -755,8 +754,8 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn next_serial(&self, client: Option<&Client>) -> u32 {
|
||||
let serial = self.serial.fetch_add(Wrapping(1)).0;
|
||||
pub fn next_serial(&self, client: Option<&Client>) -> u64 {
|
||||
let serial = self.serial.fetch_add(1);
|
||||
if let Some(client) = client {
|
||||
'update_range: {
|
||||
let mut serials = client.serials.borrow_mut();
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ pub trait Node: 'static {
|
|||
time_usec: u64,
|
||||
button: u32,
|
||||
state: KeyState,
|
||||
serial: u32,
|
||||
serial: u64,
|
||||
) {
|
||||
let _ = seat;
|
||||
let _ = time_usec;
|
||||
|
|
@ -322,7 +322,7 @@ pub trait Node: 'static {
|
|||
let _ = dnd;
|
||||
}
|
||||
|
||||
fn node_on_dnd_enter(&self, dnd: &Dnd, x: Fixed, y: Fixed, serial: u32) {
|
||||
fn node_on_dnd_enter(&self, dnd: &Dnd, x: Fixed, y: Fixed, serial: u64) {
|
||||
let _ = dnd;
|
||||
let _ = x;
|
||||
let _ = y;
|
||||
|
|
|
|||
|
|
@ -1623,7 +1623,7 @@ impl Node for ContainerNode {
|
|||
time_usec: u64,
|
||||
button: u32,
|
||||
state: KeyState,
|
||||
_serial: u32,
|
||||
_serial: u64,
|
||||
) {
|
||||
let id = CursorType::Seat(seat.id());
|
||||
self.button(id, seat, time_usec, state == KeyState::Pressed, button);
|
||||
|
|
|
|||
|
|
@ -632,7 +632,7 @@ impl Node for FloatNode {
|
|||
time_usec: u64,
|
||||
button: u32,
|
||||
state: KeyState,
|
||||
_serial: u32,
|
||||
_serial: u64,
|
||||
) {
|
||||
if button != BTN_LEFT {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1356,7 +1356,7 @@ impl Node for OutputNode {
|
|||
_time_usec: u64,
|
||||
button: u32,
|
||||
state: KeyState,
|
||||
_serial: u32,
|
||||
_serial: u64,
|
||||
) {
|
||||
if button != BTN_LEFT {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::client::Client;
|
||||
|
||||
pub struct PendingSerial<'a> {
|
||||
serial: Option<u32>,
|
||||
serial: Option<u64>,
|
||||
client: &'a Client,
|
||||
}
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ impl<'a> PendingSerial<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get(&mut self) -> u32 {
|
||||
pub fn get(&mut self) -> u64 {
|
||||
*self.serial.get_or_insert_with(|| self.client.next_serial())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue