From 555bd0a1bc29f52d27037d1fc52eb9c54d24747f Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Tue, 2 Jul 2024 17:01:45 +0200 Subject: [PATCH 1/4] all: add missing object tracking --- src/ifs/ext_idle_notifier_v1.rs | 1 + src/ifs/wl_seat/zwp_pointer_constraints_v1.rs | 2 ++ src/ifs/wl_seat/zwp_pointer_gestures_v1.rs | 3 +++ src/ifs/wp_alpha_modifier_v1.rs | 2 +- src/ifs/wp_drm_lease_device_v1.rs | 2 ++ src/ifs/wp_drm_lease_request_v1.rs | 1 + src/ifs/wp_linux_drm_syncobj_manager_v1.rs | 1 + 7 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ifs/ext_idle_notifier_v1.rs b/src/ifs/ext_idle_notifier_v1.rs index ed29440e..ffba3c70 100644 --- a/src/ifs/ext_idle_notifier_v1.rs +++ b/src/ifs/ext_idle_notifier_v1.rs @@ -71,6 +71,7 @@ impl ExtIdleNotifierV1RequestHandler for ExtIdleNotifierV1 { duration_usec: (req.timeout as u64).max(1000).saturating_mul(1000), version: self.version, }); + track!(self.client, notification); self.client.add_client_obj(¬ification)?; let future = self.client.state.eng.spawn(run(notification.clone())); notification.task.set(Some(future)); diff --git a/src/ifs/wl_seat/zwp_pointer_constraints_v1.rs b/src/ifs/wl_seat/zwp_pointer_constraints_v1.rs index 2230408d..98a2025f 100644 --- a/src/ifs/wl_seat/zwp_pointer_constraints_v1.rs +++ b/src/ifs/wl_seat/zwp_pointer_constraints_v1.rs @@ -226,6 +226,7 @@ impl ZwpPointerConstraintsV1RequestHandler for ZwpPointerConstraintsV1 { constraint, version: self.version, }); + track!(self.client, lp); self.client.add_client_obj(&lp)?; lp.constraint.owner.set(Some(lp.clone())); lp.constraint @@ -250,6 +251,7 @@ impl ZwpPointerConstraintsV1RequestHandler for ZwpPointerConstraintsV1 { constraint, version: self.version, }); + track!(self.client, lp); self.client.add_client_obj(&lp)?; lp.constraint.owner.set(Some(lp.clone())); lp.constraint diff --git a/src/ifs/wl_seat/zwp_pointer_gestures_v1.rs b/src/ifs/wl_seat/zwp_pointer_gestures_v1.rs index 4c3fc766..a7f76c67 100644 --- a/src/ifs/wl_seat/zwp_pointer_gestures_v1.rs +++ b/src/ifs/wl_seat/zwp_pointer_gestures_v1.rs @@ -79,6 +79,7 @@ impl ZwpPointerGesturesV1RequestHandler for ZwpPointerGesturesV1 { tracker: Default::default(), version: self.version, }); + track!(self.client, obj); self.client.add_client_obj(&obj)?; seat.swipe_bindings.add(&self.client, &obj); Ok(()) @@ -93,6 +94,7 @@ impl ZwpPointerGesturesV1RequestHandler for ZwpPointerGesturesV1 { tracker: Default::default(), version: self.version, }); + track!(self.client, obj); self.client.add_client_obj(&obj)?; seat.pinch_bindings.add(&self.client, &obj); Ok(()) @@ -112,6 +114,7 @@ impl ZwpPointerGesturesV1RequestHandler for ZwpPointerGesturesV1 { tracker: Default::default(), version: self.version, }); + track!(self.client, obj); self.client.add_client_obj(&obj)?; seat.hold_bindings.add(&self.client, &obj); Ok(()) diff --git a/src/ifs/wp_alpha_modifier_v1.rs b/src/ifs/wp_alpha_modifier_v1.rs index ea88381a..36e0dacf 100644 --- a/src/ifs/wp_alpha_modifier_v1.rs +++ b/src/ifs/wp_alpha_modifier_v1.rs @@ -61,7 +61,7 @@ impl WpAlphaModifierV1RequestHandler for WpAlphaModifierV1 { &surface, self.version, )); - track!(self.client, surface); + track!(self.client, modifier); self.client.add_client_obj(&modifier)?; modifier.install()?; Ok(()) diff --git a/src/ifs/wp_drm_lease_device_v1.rs b/src/ifs/wp_drm_lease_device_v1.rs index 3ad2ed5f..c6abc93d 100644 --- a/src/ifs/wp_drm_lease_device_v1.rs +++ b/src/ifs/wp_drm_lease_device_v1.rs @@ -123,6 +123,7 @@ impl WpDrmLeaseDeviceV1 { connector_id: output.connector.connector.id(), bindings: output.lease_connectors.clone(), }); + track!(self.client, obj); self.client.add_server_obj(&obj); self.send_connector(&obj); obj.send_name(&output.connector.name); @@ -172,6 +173,7 @@ impl WpDrmLeaseDeviceV1RequestHandler for WpDrmLeaseDeviceV1 { device: self.device, connectors: Default::default(), }); + track!(self.client, obj); self.client.add_client_obj(&obj)?; Ok(()) } diff --git a/src/ifs/wp_drm_lease_request_v1.rs b/src/ifs/wp_drm_lease_request_v1.rs index 70c95c18..e942bb0a 100644 --- a/src/ifs/wp_drm_lease_request_v1.rs +++ b/src/ifs/wp_drm_lease_request_v1.rs @@ -46,6 +46,7 @@ impl WpDrmLeaseRequestV1RequestHandler for WpDrmLeaseRequestV1 { finished: Cell::new(false), lease: Default::default(), }); + track!(self.client, obj); self.client.add_client_obj(&obj)?; if self.connectors.is_empty() { return Err(WpDrmLeaseRequestV1Error::EmptyLease); diff --git a/src/ifs/wp_linux_drm_syncobj_manager_v1.rs b/src/ifs/wp_linux_drm_syncobj_manager_v1.rs index 5b08571f..dda9467b 100644 --- a/src/ifs/wp_linux_drm_syncobj_manager_v1.rs +++ b/src/ifs/wp_linux_drm_syncobj_manager_v1.rs @@ -99,6 +99,7 @@ impl WpLinuxDrmSyncobjManagerV1RequestHandler for WpLinuxDrmSyncobjManagerV1 { &sync_obj, self.version, )); + track!(self.client, sync); self.client.add_client_obj(&sync)?; Ok(()) } From 498e01a8bbbd8cfa560b019798abed3e91ed7a0f Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Tue, 2 Jul 2024 17:08:48 +0200 Subject: [PATCH 2/4] xwayland: don't transmute setup data to 'static --- src/backends/x.rs | 4 ++-- src/xcon.rs | 14 +++++--------- src/xwayland/xwm.rs | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/backends/x.rs b/src/backends/x.rs index 4c34f267..47545113 100644 --- a/src/backends/x.rs +++ b/src/backends/x.rs @@ -161,7 +161,7 @@ pub async fn create(state: &Rc) -> Result, XBackendError> { { return Err(XBackendError::EnableXkb(e)); } - let root = c.setup().screens[0].root; + let root = c.root_window(); let drm = { let res = c .call(&Dri3Open { @@ -215,7 +215,7 @@ pub async fn create(state: &Rc) -> Result, XBackendError> { }; { let se = XiSelectEvents { - window: c.setup().screens[0].root, + window: c.root_window(), masks: Cow::Borrowed(&[XiEventMask { deviceid: INPUT_DEVICE_ALL, mask: &[XI_EVENT_MASK_HIERARCHY], diff --git a/src/xcon.rs b/src/xcon.rs index 3a4115f1..d12826d2 100644 --- a/src/xcon.rs +++ b/src/xcon.rs @@ -157,7 +157,7 @@ pub struct Xcon { data: Rc, outgoing: Cell>>, incoming: Cell>>, - setup: Reply>, + root_window: u32, extensions: Rc, xid_next: Cell, @@ -371,8 +371,8 @@ impl> Future for AsyncReply { } impl Xcon { - pub fn setup(&self) -> &Setup { - self.setup.get() + pub fn root_window(&self) -> u32 { + self.root_window } pub async fn event(&self) -> Event { @@ -510,11 +510,7 @@ impl Xcon { xid_next: Cell::new(setup.resource_id_base), xid_inc: 1 << setup.resource_id_mask.trailing_zeros(), xid_max: setup.resource_id_mask | setup.resource_id_base, - setup: Reply { - socket: data.clone(), - t: unsafe { mem::transmute(setup) }, - buf, - }, + root_window: setup.screens[0].root, data, }); slf.data.xorg.set(Rc::downgrade(&slf)); @@ -665,7 +661,7 @@ impl Xcon { let create_pixmap = self.call(&CreatePixmap { depth: 32, pid: pixmap, - drawable: self.setup.get().screens[0].root, + drawable: self.root_window, width: width as _, height: height as _, }); diff --git a/src/xwayland/xwm.rs b/src/xwayland/xwm.rs index f05fcb54..5c65d28d 100644 --- a/src/xwayland/xwm.rs +++ b/src/xwayland/xwm.rs @@ -304,7 +304,7 @@ impl Wm { nf.insert(atoms._NET_WM_WINDOW_TYPE_UTILITY); nf }; - let root = c.setup().screens[0].root; + let root = c.root_window(); { let events = 0 | EVENT_MASK_SUBSTRUCTURE_NOTIFY From 84d763234106647a11b6c58bf57f13436bc6481f Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Tue, 2 Jul 2024 17:11:34 +0200 Subject: [PATCH 3/4] all: address clippy lints --- src/backends/metal/video.rs | 32 +++++++-------- src/client.rs | 8 +++- src/edid.rs | 20 ++++++++++ src/gfx_apis/gl/gl/sys.rs | 7 ---- src/ifs/wl_output.rs | 4 +- src/ifs/wl_surface/zwlr_layer_surface_v1.rs | 4 +- src/ifs/wp_presentation.rs | 2 +- src/ifs/wp_presentation_feedback.rs | 2 +- src/ifs/zwlr_screencopy_frame_v1.rs | 2 +- src/ifs/zwlr_screencopy_manager_v1.rs | 2 +- src/it/test_ifs/test_callback.rs | 2 +- src/it/test_ifs/test_dmabuf_feedback.rs | 12 +++--- src/it/test_ifs/test_keyboard.rs | 4 +- src/it/test_ifs/test_registry.rs | 4 +- src/it/test_ifs/test_subcompositor.rs | 2 +- src/it/test_ifs/test_subsurface.rs | 2 +- .../test_ifs/test_virtual_keyboard_manager.rs | 4 +- src/it/test_ifs/test_xdg_base.rs | 2 +- src/it/test_ifs/test_xdg_surface.rs | 2 +- src/it/test_transport.rs | 2 +- src/pipewire/pw_con.rs | 4 +- src/pipewire/pw_ifs/pw_client.rs | 2 +- src/pipewire/pw_ifs/pw_client_node.rs | 30 +++++++------- src/pipewire/pw_ifs/pw_core.rs | 2 +- src/pipewire/pw_ifs/pw_registry.rs | 2 +- src/pipewire/pw_mem.rs | 6 +-- src/pipewire/pw_parser.rs | 10 ++--- src/pipewire/pw_pod.rs | 10 ++--- src/portal/ptl_display.rs | 5 ++- src/portal/ptl_render_ctx.rs | 2 +- src/portal/ptl_screencast.rs | 10 ++--- src/portal/ptr_gui.rs | 4 +- src/rect/region.rs | 2 +- src/state.rs | 2 +- src/tasks/input_device.rs | 2 +- src/tools/tool_client.rs | 8 ++-- src/utils/clone3.rs | 6 ++- src/video/drm.rs | 40 +++++++++---------- src/video/drm/sys.rs | 40 +++++++++---------- src/wl_usr.rs | 4 +- src/xcon.rs | 2 +- toml-config/src/config/parsers/color.rs | 5 +-- toml-config/src/config/parsers/theme.rs | 2 +- 43 files changed, 170 insertions(+), 149 deletions(-) diff --git a/src/backends/metal/video.rs b/src/backends/metal/video.rs index 13adee1f..90a8426e 100644 --- a/src/backends/metal/video.rs +++ b/src/backends/metal/video.rs @@ -84,10 +84,10 @@ pub struct MetalDrmDevice { pub crtcs: AHashMap>, pub encoders: AHashMap>, pub planes: AHashMap>, - pub min_width: u32, - pub max_width: u32, - pub min_height: u32, - pub max_height: u32, + pub _min_width: u32, + pub _max_width: u32, + pub _min_height: u32, + pub _max_height: u32, pub cursor_width: u64, pub cursor_height: u64, pub gbm: GbmDevice, @@ -308,7 +308,7 @@ pub struct ConnectorDisplayData { pub connection: ConnectorStatus, pub mm_width: u32, pub mm_height: u32, - pub subpixel: u32, + pub _subpixel: u32, pub connector_type: ConnectorType, pub connector_type_id: u32, @@ -535,7 +535,7 @@ impl HardwareCursor for MetalHardwareCursor { } pub struct ConnectorFutures { - pub present: SpawnedFuture<()>, + pub _present: SpawnedFuture<()>, } impl Debug for ConnectorFutures { @@ -1272,7 +1272,7 @@ impl Connector for MetalConnector { pub struct MetalCrtc { pub id: DrmCrtc, pub idx: usize, - pub master: Rc, + pub _master: Rc, pub lease: Cell>, @@ -1314,7 +1314,7 @@ pub struct PlaneFormat { pub struct MetalPlane { pub id: DrmPlane, - pub master: Rc, + pub _master: Rc, pub ty: PlaneType, @@ -1417,7 +1417,7 @@ fn create_connector( next_flip_nsec: Cell::new(0), }); let futures = ConnectorFutures { - present: backend + _present: backend .state .eng .spawn2(Phase::Present, slf.clone().present_loop()), @@ -1530,7 +1530,7 @@ fn create_connector_display_data( connection, mm_width: info.mm_width, mm_height: info.mm_height, - subpixel: info.subpixel, + _subpixel: info.subpixel, connector_type, connector_type_id: info.connector_type_id, }) @@ -1571,7 +1571,7 @@ fn create_crtc( Ok(MetalCrtc { id: crtc, idx, - master: master.clone(), + _master: master.clone(), lease: Cell::new(None), possible_planes, connector: Default::default(), @@ -1639,7 +1639,7 @@ fn create_plane(plane: DrmPlane, master: &Rc) -> Result: Debug + Sized { } pub struct PidInfo { - pub uid: c::uid_t, + pub _uid: c::uid_t, pub pid: c::pid_t, pub comm: String, } @@ -525,5 +525,9 @@ fn get_pid_info(uid: c::uid_t, pid: c::pid_t) -> PidInfo { "Unknown".to_string() } }; - PidInfo { uid, pid, comm } + PidInfo { + _uid: uid, + pid, + comm, + } } diff --git a/src/edid.rs b/src/edid.rs index d5623118..de8ecefe 100644 --- a/src/edid.rs +++ b/src/edid.rs @@ -30,6 +30,7 @@ pub enum DigitalVideoInterfaceStandard { HdmiB, MDDI, DisplayPort, + #[allow(dead_code)] Unknown(u8), } @@ -49,6 +50,7 @@ impl Debug for SignalLevelStandard { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub enum VideoInputDefinition { Analog { signal_level_standard: SignalLevelStandard, @@ -73,6 +75,7 @@ pub struct ScreenDimensions { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub struct ChromaticityCoordinates { pub red_x: u16, pub red_y: u16, @@ -85,6 +88,7 @@ pub struct ChromaticityCoordinates { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub struct EstablishedTimings { pub s_720x400_70: bool, pub s_720x400_88: bool, @@ -115,6 +119,7 @@ pub enum AspectRatio { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub struct StandardTiming { pub x_resolution: u16, pub aspect_ratio: AspectRatio, @@ -128,6 +133,7 @@ pub enum AnalogSyncType { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub enum SyncSignal { Analog { ty: AnalogSyncType, @@ -179,6 +185,7 @@ impl Debug for StereoViewingSupport { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub struct DisplayRangeLimitsAndAdditionalTiming { pub vertical_field_rate_min: u16, pub vertical_field_rate_max: u16, @@ -195,10 +202,12 @@ pub enum AspectRatioPreference { A16_10, A5_4, A15_9, + #[allow(dead_code)] Unknown(u8), } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub enum ExtendedTimingInformation { DefaultGtf, NoTimingInformation, @@ -232,6 +241,7 @@ pub enum ExtendedTimingInformation { } #[derive(Copy, Clone, Debug, Default)] +#[allow(dead_code)] pub struct ColorPoint { pub white_point_index: u8, pub white_point_x: u16, @@ -240,6 +250,7 @@ pub struct ColorPoint { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub struct EstablishedTimings3 { pub s640x350_85: bool, pub s640x400_85: bool, @@ -288,6 +299,7 @@ pub struct EstablishedTimings3 { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub struct ColorManagementData { pub red_a3: u16, pub red_a2: u16, @@ -314,6 +326,7 @@ pub enum CvtPreferredVerticalRate { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub struct Cvt3ByteCode { pub addressable_lines_per_field: u16, pub aspect_ration: CvtAspectRatio, @@ -326,6 +339,7 @@ pub struct Cvt3ByteCode { } #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub struct DetailedTimingDescriptor { pub pixel_clock_khz: u32, pub horizontal_addressable_pixels: u16, @@ -346,6 +360,7 @@ pub struct DetailedTimingDescriptor { } #[derive(Clone, Debug)] +#[allow(dead_code)] pub enum Descriptor { Unknown(u8), DetailedTimingDescriptor(DetailedTimingDescriptor), @@ -379,6 +394,7 @@ macro_rules! bail { #[derive(Clone, Debug)] pub enum EdidParseContext { + #[allow(dead_code)] ReadingBytes(usize), BaseBlock, Descriptors, @@ -1015,6 +1031,7 @@ pub enum DisplayColorType { } #[derive(Debug)] +#[allow(dead_code)] pub enum FeatureSupport2 { Analog { display_color_type: DisplayColorType, @@ -1027,6 +1044,7 @@ pub enum FeatureSupport2 { } #[derive(Debug)] +#[allow(dead_code)] pub struct FeatureSupport { pub standby_supported: bool, pub suspend_supported: bool, @@ -1038,6 +1056,7 @@ pub struct FeatureSupport { } #[derive(Debug)] +#[allow(dead_code)] pub struct EdidBaseBlock { pub id_manufacturer_name: BString, pub id_product_code: u16, @@ -1064,6 +1083,7 @@ pub enum EdidExtension { } #[derive(Debug)] +#[allow(dead_code)] pub struct EdidFile { pub base_block: EdidBaseBlock, pub extension_blocks: Vec, diff --git a/src/gfx_apis/gl/gl/sys.rs b/src/gfx_apis/gl/gl/sys.rs index afbaec72..a69fbf7a 100644 --- a/src/gfx_apis/gl/gl/sys.rs +++ b/src/gfx_apis/gl/gl/sys.rs @@ -62,13 +62,6 @@ dynload! { renderbuffertarget: GLenum, renderbuffer: GLuint, ), - glFramebufferTexture2D: unsafe fn( - target: GLenum, - attachment: GLenum, - textarget: GLenum, - texture: GLenum, - level: GLint, - ), glCheckFramebufferStatus: unsafe fn(target: GLenum) -> GLenum, glClear: unsafe fn(mask: GLbitfield), glBlendFunc: unsafe fn(sfactor: GLenum, dfactor: GLenum), diff --git a/src/ifs/wl_output.rs b/src/ifs/wl_output.rs index 837b145f..13b4b606 100644 --- a/src/ifs/wl_output.rs +++ b/src/ifs/wl_output.rs @@ -51,7 +51,7 @@ const MODE_PREFERRED: u32 = 2; pub struct WlOutputGlobal { pub name: GlobalName, - pub state: Rc, + pub _state: Rc, pub connector: Rc, pub pos: Cell, pub output_id: Rc, @@ -127,7 +127,7 @@ impl WlOutputGlobal { ); Self { name, - state: state.clone(), + _state: state.clone(), connector: connector.clone(), pos: Cell::new(Rect::new_sized(x, y, width, height).unwrap()), output_id: output_id.clone(), diff --git a/src/ifs/wl_surface/zwlr_layer_surface_v1.rs b/src/ifs/wl_surface/zwlr_layer_surface_v1.rs index 08f4547e..7c16bc69 100644 --- a/src/ifs/wl_surface/zwlr_layer_surface_v1.rs +++ b/src/ifs/wl_surface/zwlr_layer_surface_v1.rs @@ -54,7 +54,7 @@ pub struct ZwlrLayerSurfaceV1 { pub client: Rc, pub surface: Rc, pub output: Rc, - pub namespace: String, + pub _namespace: String, pub tracker: Tracker, output_extents: Cell, pos: Cell, @@ -160,7 +160,7 @@ impl ZwlrLayerSurfaceV1 { client: shell.client.clone(), surface: surface.clone(), output: output.clone(), - namespace: namespace.to_string(), + _namespace: namespace.to_string(), tracker: Default::default(), output_extents: Default::default(), pos: Default::default(), diff --git a/src/ifs/wp_presentation.rs b/src/ifs/wp_presentation.rs index 5299b64e..cdaa1f18 100644 --- a/src/ifs/wp_presentation.rs +++ b/src/ifs/wp_presentation.rs @@ -83,7 +83,7 @@ impl WpPresentationRequestHandler for WpPresentation { let fb = Rc::new(WpPresentationFeedback { id: req.callback, client: self.client.clone(), - surface: surface.clone(), + _surface: surface.clone(), tracker: Default::default(), version: self.version, }); diff --git a/src/ifs/wp_presentation_feedback.rs b/src/ifs/wp_presentation_feedback.rs index 8b1682bb..a8d94f94 100644 --- a/src/ifs/wp_presentation_feedback.rs +++ b/src/ifs/wp_presentation_feedback.rs @@ -13,7 +13,7 @@ use { pub struct WpPresentationFeedback { pub id: WpPresentationFeedbackId, pub client: Rc, - pub surface: Rc, + pub _surface: Rc, pub tracker: Tracker, pub version: Version, } diff --git a/src/ifs/zwlr_screencopy_frame_v1.rs b/src/ifs/zwlr_screencopy_frame_v1.rs index 710bab74..66d7cbe1 100644 --- a/src/ifs/zwlr_screencopy_frame_v1.rs +++ b/src/ifs/zwlr_screencopy_frame_v1.rs @@ -24,7 +24,7 @@ pub struct ZwlrScreencopyFrameV1 { pub tracker: Tracker, pub output: Rc, pub rect: Rect, - pub overlay_cursor: bool, + pub _overlay_cursor: bool, pub used: Cell, pub with_damage: Cell, pub buffer: Cell>>, diff --git a/src/ifs/zwlr_screencopy_manager_v1.rs b/src/ifs/zwlr_screencopy_manager_v1.rs index 07452ca4..ae99a4b4 100644 --- a/src/ifs/zwlr_screencopy_manager_v1.rs +++ b/src/ifs/zwlr_screencopy_manager_v1.rs @@ -125,7 +125,7 @@ impl ZwlrScreencopyManagerV1 { tracker: Default::default(), output: output.global.clone(), rect, - overlay_cursor, + _overlay_cursor: overlay_cursor, used: Cell::new(false), with_damage: Cell::new(false), buffer: Cell::new(None), diff --git a/src/it/test_ifs/test_callback.rs b/src/it/test_ifs/test_callback.rs index 0fa1163a..81a04bce 100644 --- a/src/it/test_ifs/test_callback.rs +++ b/src/it/test_ifs/test_callback.rs @@ -12,7 +12,7 @@ use { pub struct TestCallback { pub id: WlCallbackId, - pub tran: Rc, + pub _tran: Rc, pub handler: Cell>>, pub done: Cell, } diff --git a/src/it/test_ifs/test_dmabuf_feedback.rs b/src/it/test_ifs/test_dmabuf_feedback.rs index 1abb4050..92271354 100644 --- a/src/it/test_ifs/test_dmabuf_feedback.rs +++ b/src/it/test_ifs/test_dmabuf_feedback.rs @@ -34,9 +34,9 @@ pub struct PendingFeedback { } pub struct Feedback { - pub format_table: Rc, - pub format_table_size: usize, - pub main_device: c::dev_t, + pub _format_table: Rc, + pub _format_table_size: usize, + pub _main_device: c::dev_t, pub tranches: Vec, } @@ -69,12 +69,12 @@ impl TestDmabufFeedback { let _ev = Done::parse_full(parser)?; let mut pending = mem::take(self.pending_feedback.borrow_mut().deref_mut()); self.feedback.push(Feedback { - format_table: match pending.format_table.take() { + _format_table: match pending.format_table.take() { None => bail!("compositor did not send format table"), Some(ft) => ft, }, - format_table_size: pending.format_table_size, - main_device: pending.main_device, + _format_table_size: pending.format_table_size, + _main_device: pending.main_device, tranches: pending.tranches, }); Ok(()) diff --git a/src/it/test_ifs/test_keyboard.rs b/src/it/test_ifs/test_keyboard.rs index f912b6d9..a37c5c27 100644 --- a/src/it/test_ifs/test_keyboard.rs +++ b/src/it/test_ifs/test_keyboard.rs @@ -14,7 +14,7 @@ use { pub struct TestEnterEvent { pub serial: u32, pub surface: WlSurfaceId, - pub keys: Vec, + pub _keys: Vec, } pub struct TestKeyboard { @@ -49,7 +49,7 @@ impl TestKeyboard { self.enter.push(TestEnterEvent { serial: ev.serial, surface: ev.surface, - keys: ev.keys.to_vec(), + _keys: ev.keys.to_vec(), }); Ok(()) } diff --git a/src/it/test_ifs/test_registry.rs b/src/it/test_ifs/test_registry.rs index 5d58d8db..13286ee4 100644 --- a/src/it/test_ifs/test_registry.rs +++ b/src/it/test_ifs/test_registry.rs @@ -34,7 +34,7 @@ use { pub struct TestGlobal { pub name: u32, pub interface: String, - pub version: u32, + pub _version: u32, } pub struct TestRegistrySingletons { @@ -294,7 +294,7 @@ impl TestRegistry { let global = Rc::new(TestGlobal { name: ev.name, interface: ev.interface.to_string(), - version: ev.version, + _version: ev.version, }); let prev = self.globals.set(ev.name, global.clone()); let name = GlobalName::from_raw(ev.name); diff --git a/src/it/test_ifs/test_subcompositor.rs b/src/it/test_ifs/test_subcompositor.rs index 4b8be7aa..2e0302c6 100644 --- a/src/it/test_ifs/test_subcompositor.rs +++ b/src/it/test_ifs/test_subcompositor.rs @@ -48,7 +48,7 @@ impl TestSubcompositor { id, tran: self.tran.clone(), destroyed: Cell::new(false), - server: self.tran.get_server_obj(id)?, + _server: self.tran.get_server_obj(id)?, }); self.tran.add_obj(ss.clone())?; Ok(ss) diff --git a/src/it/test_ifs/test_subsurface.rs b/src/it/test_ifs/test_subsurface.rs index 6748b9e4..caf7dd85 100644 --- a/src/it/test_ifs/test_subsurface.rs +++ b/src/it/test_ifs/test_subsurface.rs @@ -11,7 +11,7 @@ pub struct TestSubsurface { pub id: WlSubsurfaceId, pub tran: Rc, pub destroyed: Cell, - pub server: Rc, + pub _server: Rc, } impl TestSubsurface { diff --git a/src/it/test_ifs/test_virtual_keyboard_manager.rs b/src/it/test_ifs/test_virtual_keyboard_manager.rs index 79e19e33..d117a10e 100644 --- a/src/it/test_ifs/test_virtual_keyboard_manager.rs +++ b/src/it/test_ifs/test_virtual_keyboard_manager.rs @@ -14,7 +14,7 @@ use { pub struct TestVirtualKeyboardManager { pub id: ZwpVirtualKeyboardManagerV1Id, pub tran: Rc, - pub destroyed: Cell, + pub _destroyed: Cell, } impl TestVirtualKeyboardManager { @@ -22,7 +22,7 @@ impl TestVirtualKeyboardManager { Self { id: tran.id(), tran: tran.clone(), - destroyed: Cell::new(false), + _destroyed: Cell::new(false), } } diff --git a/src/it/test_ifs/test_xdg_base.rs b/src/it/test_ifs/test_xdg_base.rs index 5d50c6dc..5701e05b 100644 --- a/src/it/test_ifs/test_xdg_base.rs +++ b/src/it/test_ifs/test_xdg_base.rs @@ -48,7 +48,7 @@ impl TestXdgWmBase { let xdg = Rc::new(TestXdgSurface { id, tran: self.tran.clone(), - server, + _server: server, destroyed: Cell::new(false), last_serial: Cell::new(0), }); diff --git a/src/it/test_ifs/test_xdg_surface.rs b/src/it/test_ifs/test_xdg_surface.rs index 6ba3bdcb..3546648b 100644 --- a/src/it/test_ifs/test_xdg_surface.rs +++ b/src/it/test_ifs/test_xdg_surface.rs @@ -17,7 +17,7 @@ use { pub struct TestXdgSurface { pub id: XdgSurfaceId, pub tran: Rc, - pub server: Rc, + pub _server: Rc, pub destroyed: Cell, pub last_serial: Cell, } diff --git a/src/it/test_transport.rs b/src/it/test_transport.rs index da8484f0..a869f460 100644 --- a/src/it/test_transport.rs +++ b/src/it/test_transport.rs @@ -114,7 +114,7 @@ impl TestTransport { pub fn sync(self: &Rc) -> impl Future { let cb = Rc::new(TestCallback { id: self.id(), - tran: self.clone(), + _tran: self.clone(), handler: Cell::new(None), done: Cell::new(self.killed.get()), }); diff --git a/src/pipewire/pw_con.rs b/src/pipewire/pw_con.rs index 51cec2b8..940a9688 100644 --- a/src/pipewire/pw_con.rs +++ b/src/pipewire/pw_con.rs @@ -222,7 +222,7 @@ impl PwCon { pub fn get_registry(self: &Rc) -> Rc { let registry = Rc::new(PwRegistry { data: self.proxy_data(), - con: self.clone(), + _con: self.clone(), }); if !self.dead.get() { self.objects.set(registry.data.id, registry.clone()); @@ -340,7 +340,7 @@ impl PwConHolder { }); let client = Rc::new(PwClient { data: data.proxy_data(), - con: data.clone(), + _con: data.clone(), }); data.objects.set(0, core.clone()); data.objects.set(1, client.clone()); diff --git a/src/pipewire/pw_ifs/pw_client.rs b/src/pipewire/pw_ifs/pw_client.rs index 579ac6b6..361592a4 100644 --- a/src/pipewire/pw_ifs/pw_client.rs +++ b/src/pipewire/pw_ifs/pw_client.rs @@ -26,7 +26,7 @@ pw_opcodes! { pub struct PwClient { pub data: PwObjectData, - pub con: Rc, + pub _con: Rc, } impl PwClient { diff --git a/src/pipewire/pw_ifs/pw_client_node.rs b/src/pipewire/pw_ifs/pw_client_node.rs index 33b3f1e5..f48099fa 100644 --- a/src/pipewire/pw_ifs/pw_client_node.rs +++ b/src/pipewire/pw_ifs/pw_client_node.rs @@ -109,7 +109,7 @@ pub struct PwClientNodePort { pub direction: SpaDirection, pub id: u32, - pub destroyed: Cell, + pub _destroyed: Cell, pub effective_format: Cell, pub supported_formats: RefCell>, @@ -129,18 +129,18 @@ pub struct PwClientNodePort { pub struct PwClientNodeBufferConfig { pub num_buffers: usize, pub planes: usize, - pub size: Option, - pub stride: Option, - pub align: usize, + pub _size: Option, + pub _stride: Option, + pub _align: usize, pub data_type: SpaDataType, } pub struct PwClientNodeBuffer { - pub meta_header: Option>>, - pub meta_busy: Option>>, + pub _meta_header: Option>>, + pub _meta_busy: Option>>, pub meta_video_crop: Option>>, pub chunks: Vec>>, - pub slices: Vec>, + pub _slices: Vec>, } #[derive(Clone, Debug, Default)] @@ -181,8 +181,8 @@ pub struct PwClientNode { } pub struct PwNodeActivation { - pub activation: Rc>, - pub fd: Rc, + pub _activation: Rc>, + pub _fd: Rc, } // pub struct PwNodeBuffer { @@ -250,7 +250,7 @@ impl PwClientNode { node: self.clone(), direction, id: ids.borrow_mut().acquire(), - destroyed: Cell::new(false), + _destroyed: Cell::new(false), effective_format: Cell::new(Default::default()), supported_formats: RefCell::new(None), supported_metas: Cell::new(PwClientNodePortSupportedMetas::none()), @@ -676,11 +676,11 @@ impl PwClientNode { } res.push(Rc::new(PwClientNodeBuffer { - meta_header, - meta_busy, + _meta_header: meta_header, + _meta_busy: meta_busy, meta_video_crop, chunks, - slices, + _slices: slices, })); } @@ -765,8 +765,8 @@ impl PwClientNode { self.activations.set( node, Rc::new(PwNodeActivation { - activation: typed, - fd: signalfd, + _activation: typed, + _fd: signalfd, }), ); } else { diff --git a/src/pipewire/pw_ifs/pw_core.rs b/src/pipewire/pw_ifs/pw_core.rs index fba71fa1..5d5e4597 100644 --- a/src/pipewire/pw_ifs/pw_core.rs +++ b/src/pipewire/pw_ifs/pw_core.rs @@ -144,7 +144,7 @@ impl PwCore { self.con.mem.mems.set( id, Rc::new(PwMem { - ty, + _ty: ty, read, write, fd, diff --git a/src/pipewire/pw_ifs/pw_registry.rs b/src/pipewire/pw_ifs/pw_registry.rs index 379cf7e9..f1c54b89 100644 --- a/src/pipewire/pw_ifs/pw_registry.rs +++ b/src/pipewire/pw_ifs/pw_registry.rs @@ -19,7 +19,7 @@ pw_opcodes! { pub struct PwRegistry { pub data: PwObjectData, - pub con: Rc, + pub _con: Rc, } impl PwRegistry { diff --git a/src/pipewire/pw_mem.rs b/src/pipewire/pw_mem.rs index 6e9a7768..37a4c113 100644 --- a/src/pipewire/pw_mem.rs +++ b/src/pipewire/pw_mem.rs @@ -23,14 +23,14 @@ pub enum PwMemType { } pub struct PwMem { - pub ty: PwMemType, + pub _ty: PwMemType, pub read: bool, pub write: bool, pub fd: Rc, } pub struct PwMemMap { - pub mem: Rc, + pub _mem: Rc, pub range: Range, pub map: Mmapped, } @@ -77,7 +77,7 @@ impl PwMem { Err(e) => return Err(PwMemError::MmapFailed(e)), }; Ok(Rc::new(PwMemMap { - mem: self.clone(), + _mem: self.clone(), range, map, })) diff --git a/src/pipewire/pw_parser.rs b/src/pipewire/pw_parser.rs index c878e7ec..f713f03d 100644 --- a/src/pipewire/pw_parser.rs +++ b/src/pipewire/pw_parser.rs @@ -261,8 +261,8 @@ impl<'a> PwParser<'a> { controls: PwParser::new(&self.data[self.pos + 8..self.pos + len], self.fds), }), PW_TYPE_Pointer => PwPod::Pointer(PwPodPointer { - ty: PwPointerType(self.read_raw(0)?), - value: self.read_raw(8)?, + _ty: PwPointerType(self.read_raw(0)?), + _value: self.read_raw(8)?, }), PW_TYPE_Fd => PwPod::Fd(self.read_raw(0)?), PW_TYPE_Choice => PwPod::Choice(PwPodChoice { @@ -298,9 +298,9 @@ impl<'a> PwParser<'a> { let ty = PwControlType(self.read_raw(4)?); self.pos += 8; Ok(PwPodControl { - offset, - ty, - value: self.read_pod()?, + _offset: offset, + _ty: ty, + _value: self.read_pod()?, }) } diff --git a/src/pipewire/pw_pod.rs b/src/pipewire/pw_pod.rs index d2de0b5a..a67d5613 100644 --- a/src/pipewire/pw_pod.rs +++ b/src/pipewire/pw_pod.rs @@ -1124,15 +1124,15 @@ pub struct PwPodSequence<'a> { #[derive(Copy, Clone, Debug)] pub struct PwPodControl<'a> { - pub offset: u32, - pub ty: PwControlType, - pub value: PwPod<'a>, + pub _offset: u32, + pub _ty: PwControlType, + pub _value: PwPod<'a>, } #[derive(Copy, Clone, Debug)] pub struct PwPodPointer { - pub ty: PwPointerType, - pub value: usize, + pub _ty: PwPointerType, + pub _value: usize, } #[derive(Copy, Clone, Debug)] diff --git a/src/portal/ptl_display.rs b/src/portal/ptl_display.rs index 9d078e89..0e4c4b34 100644 --- a/src/portal/ptl_display.rs +++ b/src/portal/ptl_display.rs @@ -181,7 +181,10 @@ impl UsrJayRenderCtxOwner for PortalDisplay { return; } }; - let ctx = Rc::new(PortalRenderCtx { dev_id, ctx }); + let ctx = Rc::new(PortalRenderCtx { + _dev_id: dev_id, + ctx, + }); self.render_ctx.set(Some(ctx.clone())); self.state.render_ctxs.set(dev_id, Rc::downgrade(&ctx)); } diff --git a/src/portal/ptl_render_ctx.rs b/src/portal/ptl_render_ctx.rs index 03fd115a..4c72e653 100644 --- a/src/portal/ptl_render_ctx.rs +++ b/src/portal/ptl_render_ctx.rs @@ -1,6 +1,6 @@ use {crate::gfx_api::GfxContext, std::rc::Rc, uapi::c}; pub struct PortalRenderCtx { - pub dev_id: c::dev_t, + pub _dev_id: c::dev_t, pub ctx: Rc, } diff --git a/src/portal/ptl_screencast.rs b/src/portal/ptl_screencast.rs index 4b954000..f49e1581 100644 --- a/src/portal/ptl_screencast.rs +++ b/src/portal/ptl_screencast.rs @@ -101,7 +101,7 @@ pub struct SelectingWorkspaceScreencast { pub struct StartingScreencast { pub session: Rc, - pub request_obj: Rc, + pub _request_obj: Rc, pub reply: Rc>>, pub node: Rc, pub dpy: Rc, @@ -241,7 +241,7 @@ impl SelectingScreencastCore { ]); let starting = Rc::new(StartingScreencast { session: self.session.clone(), - request_obj: self.request_obj.clone(), + _request_obj: self.request_obj.clone(), reply: self.reply.clone(), node, dpy: dpy.clone(), @@ -391,9 +391,9 @@ impl UsrJayScreencastOwner for StartedScreencast { let bc = PwClientNodeBufferConfig { num_buffers: buffers.len(), planes: buffer.planes.len(), - stride: Some(buffer.planes[0].stride), - size: Some(buffer.planes[0].stride * buffer.height as u32), - align: 16, + _stride: Some(buffer.planes[0].stride), + _size: Some(buffer.planes[0].stride * buffer.height as u32), + _align: 16, data_type: SPA_DATA_DmaBuf, }; self.port.buffer_config.set(Some(bc)); diff --git a/src/portal/ptr_gui.rs b/src/portal/ptr_gui.rs index d7c213df..7ad3c413 100644 --- a/src/portal/ptr_gui.rs +++ b/src/portal/ptr_gui.rs @@ -846,7 +846,7 @@ pub struct GuiBuffer { pub fb: Rc, pub _bo: Option, pub free: Cell, - pub size: (i32, i32), + pub _size: (i32, i32), } struct GuiBufferPending { @@ -897,7 +897,7 @@ impl UsrLinuxBufferParamsOwner for GuiBufferPending { fb: self.fb.clone(), _bo: self.bo.take(), free: Cell::new(true), - size: self.size, + _size: self.size, }); buf.wl.owner.set(Some(buf.clone())); self.window.bufs.borrow_mut().push(buf); diff --git a/src/rect/region.rs b/src/rect/region.rs index 72deeba2..0ef3dc28 100644 --- a/src/rect/region.rs +++ b/src/rect/region.rs @@ -37,7 +37,7 @@ impl Region { if rects.len() == 1 { return Self::new(rects[0]); } - let rects = rects_to_bands(unsafe { mem::transmute(rects) }); + let rects = rects_to_bands(unsafe { mem::transmute::<&[Rect], &[RectRaw]>(rects) }); Rc::new(Self { extents: Rect { raw: extents(&rects), diff --git a/src/state.rs b/src/state.rs index e7738daf..9d51140d 100644 --- a/src/state.rs +++ b/src/state.rs @@ -255,7 +255,7 @@ impl IdleState { } pub struct InputDeviceData { - pub handler: SpawnedFuture<()>, + pub _handler: SpawnedFuture<()>, pub id: InputDeviceId, pub data: Rc, pub async_event: Rc, diff --git a/src/tasks/input_device.rs b/src/tasks/input_device.rs index b5fa7f1a..3404d763 100644 --- a/src/tasks/input_device.rs +++ b/src/tasks/input_device.rs @@ -38,7 +38,7 @@ pub fn handle(state: &Rc, dev: Rc) { state.input_device_handlers.borrow_mut().insert( dev.id(), InputDeviceData { - handler, + _handler: handler, id: dev.id(), data, async_event: ae, diff --git a/src/tools/tool_client.rs b/src/tools/tool_client.rs index 91457104..43c58b5b 100644 --- a/src/tools/tool_client.rs +++ b/src/tools/tool_client.rs @@ -72,9 +72,9 @@ pub enum ToolClientError { } pub struct ToolClient { - pub logger: Arc, + pub _logger: Arc, pub ring: Rc, - pub wheel: Rc, + pub _wheel: Rc, pub eng: Rc, obj_ids: RefCell, handlers: RefCell< @@ -173,9 +173,9 @@ impl ToolClient { obj_ids.take(0); obj_ids.take(1); let slf = Rc::new(Self { - logger, + _logger: logger, ring, - wheel, + _wheel: wheel, eng, obj_ids: RefCell::new(obj_ids), handlers: Default::default(), diff --git a/src/utils/clone3.rs b/src/utils/clone3.rs index 6590eff3..4b096bd3 100644 --- a/src/utils/clone3.rs +++ b/src/utils/clone3.rs @@ -22,7 +22,7 @@ struct clone_args { pub enum Forked { Parent { pid: c::pid_t, pidfd: OwnedFd }, - Child { pidfd: Option }, + Child { _pidfd: Option }, } pub fn fork_with_pidfd(pidfd_for_child: bool) -> Result { @@ -47,7 +47,9 @@ pub fn fork_with_pidfd(pidfd_for_child: bool) -> Result { return Err(ForkerError::Fork(e.into())); } let res = if pid == 0 { - Forked::Child { pidfd: child_pidfd } + Forked::Child { + _pidfd: child_pidfd, + } } else { Forked::Parent { pid: pid as _, diff --git a/src/video/drm.rs b/src/video/drm.rs index 39194a49..51d101d3 100644 --- a/src/video/drm.rs +++ b/src/video/drm.rs @@ -628,28 +628,28 @@ impl NodeType { pub struct DrmPropertyDefinition { pub id: DrmProperty, pub name: BString, - pub immutable: bool, - pub atomic: bool, + pub _immutable: bool, + pub _atomic: bool, pub ty: DrmPropertyType, } #[derive(Debug)] pub enum DrmPropertyType { Range { - min: u64, - max: u64, + _min: u64, + _max: u64, }, SignedRange { - min: i64, - max: i64, + _min: i64, + _max: i64, }, Object { - ty: u32, + _ty: u32, }, Blob, Enum { values: Vec, - bitmask: bool, + _bitmask: bool, }, } @@ -712,7 +712,7 @@ pub struct DrmCardResources { pub max_width: u32, pub min_height: u32, pub max_height: u32, - pub fbs: Vec, + pub _fbs: Vec, pub crtcs: Vec, pub connectors: Vec, pub encoders: Vec, @@ -720,21 +720,21 @@ pub struct DrmCardResources { #[derive(Debug)] pub struct DrmPlaneInfo { - pub plane_id: DrmPlane, - pub crtc_id: DrmCrtc, - pub fb_id: DrmFb, + pub _plane_id: DrmPlane, + pub _crtc_id: DrmCrtc, + pub _fb_id: DrmFb, pub possible_crtcs: u32, - pub gamma_size: u32, + pub _gamma_size: u32, pub format_types: Vec, } #[derive(Debug)] pub struct DrmEncoderInfo { - pub encoder_id: DrmEncoder, - pub encoder_type: u32, - pub crtc_id: DrmCrtc, + pub _encoder_id: DrmEncoder, + pub _encoder_type: u32, + pub _crtc_id: DrmCrtc, pub possible_crtcs: u32, - pub possible_clones: u32, + pub _possible_clones: u32, } #[derive(Debug, Clone, Eq, PartialEq)] @@ -820,10 +820,10 @@ impl DrmModeInfo { pub struct DrmConnectorInfo { pub encoders: Vec, pub modes: Vec, - pub props: Vec, + pub _props: Vec, - pub encoder_id: DrmEncoder, - pub connector_id: DrmConnector, + pub _encoder_id: DrmEncoder, + pub _connector_id: DrmConnector, pub connector_type: u32, pub connector_type_id: u32, diff --git a/src/video/drm/sys.rs b/src/video/drm/sys.rs index 61579ce5..b1a431d8 100644 --- a/src/video/drm/sys.rs +++ b/src/video/drm/sys.rs @@ -277,13 +277,13 @@ pub fn mode_getproperty( get(&mut prop)?; if ty == DRM_MODE_PROP_RANGE { DrmPropertyType::Range { - min: vals[0], - max: vals[1], + _min: vals[0], + _max: vals[1], } } else { DrmPropertyType::SignedRange { - min: vals[0] as _, - max: vals[1] as _, + _min: vals[0] as _, + _max: vals[1] as _, } } } @@ -305,7 +305,7 @@ pub fn mode_getproperty( } DrmPropertyType::Enum { values, - bitmask: ty == DRM_MODE_PROP_BITMASK, + _bitmask: ty == DRM_MODE_PROP_BITMASK, } } DRM_MODE_PROP_BLOB => DrmPropertyType::Blob, @@ -316,7 +316,7 @@ pub fn mode_getproperty( let mut ty = 0u64; prop.values_ptr = &mut ty as *mut _ as u64; get(&mut prop)?; - DrmPropertyType::Object { ty: ty as _ } + DrmPropertyType::Object { _ty: ty as _ } } _ => return Err(DrmError::UnknownPropertyType(ty)), }; @@ -324,8 +324,8 @@ pub fn mode_getproperty( Ok(DrmPropertyDefinition { id: property_id, name: prop.name.split(|n| *n == 0).next().unwrap().to_vec().into(), - immutable: prop.flags.contains(DRM_MODE_PROP_IMMUTABLE), - atomic: prop.flags.contains(DRM_MODE_PROP_ATOMIC), + _immutable: prop.flags.contains(DRM_MODE_PROP_IMMUTABLE), + _atomic: prop.flags.contains(DRM_MODE_PROP_ATOMIC), ty, }) } @@ -549,7 +549,7 @@ pub fn mode_get_resources(fd: c::c_int) -> Result { max_width: res.max_width, min_height: res.min_height, max_height: res.max_height, - fbs, + _fbs: fbs, crtcs, connectors, encoders, @@ -647,11 +647,11 @@ pub fn mode_getplane(fd: c::c_int, plane_id: u32) -> Result Result, - pub wheel: Rc, + pub _wheel: Rc, pub eng: Rc, pub server_id: u32, obj_ids: RefCell, @@ -115,7 +115,7 @@ impl UsrCon { obj_ids.take(1); let slf = Rc::new(Self { ring: ring.clone(), - wheel: wheel.clone(), + _wheel: wheel.clone(), eng: eng.clone(), server_id, obj_ids: RefCell::new(obj_ids), diff --git a/src/xcon.rs b/src/xcon.rs index d12826d2..04a0d458 100644 --- a/src/xcon.rs +++ b/src/xcon.rs @@ -680,7 +680,7 @@ impl Xcon { dst_y: 0, left_pad: 0, depth: 32, - data: unsafe { mem::transmute(pixels) }, + data: unsafe { mem::transmute::<&[Cell], &[u8]>(pixels) }, }); self.call(&FreeGC { gc }); let create_picture = self.call(&RenderCreatePicture { diff --git a/toml-config/src/config/parsers/color.rs b/toml-config/src/config/parsers/color.rs index 2aecaafe..a4418b0c 100644 --- a/toml-config/src/config/parsers/color.rs +++ b/toml-config/src/config/parsers/color.rs @@ -1,7 +1,6 @@ use { crate::{ config::{ - context::Context, extractor::ExtractorError, parser::{DataType, ParseResult, Parser, UnexpectedDataType}, }, @@ -12,7 +11,7 @@ use { thiserror::Error, }; -pub struct ColorParser<'a>(pub &'a Context<'a>); +pub struct ColorParser; #[derive(Debug, Error)] pub enum ColorParserError { @@ -28,7 +27,7 @@ pub enum ColorParserError { ParseIntError(#[from] ParseIntError), } -impl Parser for ColorParser<'_> { +impl Parser for ColorParser { type Value = Color; type Error = ColorParserError; const EXPECTED: &'static [DataType] = &[DataType::String]; diff --git a/toml-config/src/config/parsers/theme.rs b/toml-config/src/config/parsers/theme.rs index ee42c6d0..33b91742 100644 --- a/toml-config/src/config/parsers/theme.rs +++ b/toml-config/src/config/parsers/theme.rs @@ -88,7 +88,7 @@ impl Parser for ThemeParser<'_> { ($e:expr) => { match $e { None => None, - Some(v) => match v.parse(&mut ColorParser(self.0)) { + Some(v) => match v.parse(&mut ColorParser) { Ok(v) => Some(v), Err(e) => { log::warn!("Could not parse a color: {}", self.0.error(e)); From 5a552a4ca2e3661ea76fc68c24c7dd15c4ff92a9 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Tue, 2 Jul 2024 16:47:28 +0200 Subject: [PATCH 4/4] wayland: remove duplicate leave events --- src/ifs/wl_seat/event_handling.rs | 6 +----- src/ifs/wl_surface.rs | 11 ----------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/ifs/wl_seat/event_handling.rs b/src/ifs/wl_seat/event_handling.rs index cb3920f9..f64ab341 100644 --- a/src/ifs/wl_seat/event_handling.rs +++ b/src/ifs/wl_seat/event_handling.rs @@ -149,10 +149,6 @@ impl NodeSeatState { self.kb_foci.iter().for_each(|(_, s)| f(s)); } - pub fn for_each_pointer_focus)>(&self, mut f: F) { - self.pointer_foci.iter().for_each(|(_, s)| f(s)); - } - pub fn destroy_node(&self, node: &dyn Node) { self.destroy_node2(node, true); } @@ -173,11 +169,11 @@ impl NodeSeatState { while let Some((_, seat)) = self.pointer_foci.pop() { let mut ps = seat.pointer_stack.borrow_mut(); while let Some(last) = ps.pop() { + last.node_on_leave(&seat); if last.node_id() == node_id { break; } last.node_seat_state().leave(&seat); - last.node_on_leave(&seat); } seat.pointer_stack_modified.set(true); seat.state.tree_changed(); diff --git a/src/ifs/wl_surface.rs b/src/ifs/wl_surface.rs index 954fdc7b..9bb58ca4 100644 --- a/src/ifs/wl_surface.rs +++ b/src/ifs/wl_surface.rs @@ -1261,13 +1261,6 @@ impl WlSurface { } } - fn send_seat_release_events(&self) { - self.seat_state - .for_each_pointer_focus(|s| s.leave_surface(self)); - self.seat_state - .for_each_kb_focus(|s| s.unfocus_surface(self)); - } - pub fn set_visible(&self, visible: bool) { if self.visible.replace(visible) == visible { return; @@ -1287,9 +1280,6 @@ impl WlSurface { } } } - if !visible { - self.send_seat_release_events(); - } self.seat_state.set_visible(self, visible); } @@ -1318,7 +1308,6 @@ impl WlSurface { data.focus_node.remove(&seat); } } - self.send_seat_release_events(); self.seat_state.destroy_node(self); if self.visible.get() { self.client.state.damage();