Skip to content

Commit

Permalink
Merge pull request #219 from mahkoh/jorth/duplicate-kb-events
Browse files Browse the repository at this point in the history
all: add missing object tracking
  • Loading branch information
mahkoh authored Jul 5, 2024
2 parents f94f199 + 5a552a4 commit 136e6e7
Show file tree
Hide file tree
Showing 54 changed files with 190 additions and 178 deletions.
32 changes: 16 additions & 16 deletions src/backends/metal/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ pub struct MetalDrmDevice {
pub crtcs: AHashMap<DrmCrtc, Rc<MetalCrtc>>,
pub encoders: AHashMap<DrmEncoder, Rc<MetalEncoder>>,
pub planes: AHashMap<DrmPlane, Rc<MetalPlane>>,
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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -535,7 +535,7 @@ impl HardwareCursor for MetalHardwareCursor {
}

pub struct ConnectorFutures {
pub present: SpawnedFuture<()>,
pub _present: SpawnedFuture<()>,
}

impl Debug for ConnectorFutures {
Expand Down Expand Up @@ -1272,7 +1272,7 @@ impl Connector for MetalConnector {
pub struct MetalCrtc {
pub id: DrmCrtc,
pub idx: usize,
pub master: Rc<DrmMaster>,
pub _master: Rc<DrmMaster>,

pub lease: Cell<Option<MetalLeaseId>>,

Expand Down Expand Up @@ -1314,7 +1314,7 @@ pub struct PlaneFormat {

pub struct MetalPlane {
pub id: DrmPlane,
pub master: Rc<DrmMaster>,
pub _master: Rc<DrmMaster>,

pub ty: PlaneType,

Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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,
})
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -1639,7 +1639,7 @@ fn create_plane(plane: DrmPlane, master: &Rc<DrmMaster>) -> Result<MetalPlane, D
};
Ok(MetalPlane {
id: plane,
master: master.clone(),
_master: master.clone(),
ty,
possible_crtcs: info.possible_crtcs,
formats,
Expand Down Expand Up @@ -2025,10 +2025,10 @@ impl MetalBackend {
crtcs,
encoders,
planes,
min_width: resources.min_width,
max_width: resources.max_width,
min_height: resources.min_height,
max_height: resources.max_height,
_min_width: resources.min_width,
_max_width: resources.max_width,
_min_height: resources.min_height,
_max_height: resources.max_height,
cursor_width,
cursor_height,
gbm,
Expand Down
4 changes: 2 additions & 2 deletions src/backends/x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pub async fn create(state: &Rc<State>) -> Result<Rc<XBackend>, 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 {
Expand Down Expand Up @@ -215,7 +215,7 @@ pub async fn create(state: &Rc<State>) -> Result<Rc<XBackend>, 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],
Expand Down
8 changes: 6 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ pub trait RequestParser<'a>: Debug + Sized {
}

pub struct PidInfo {
pub uid: c::uid_t,
pub _uid: c::uid_t,
pub pid: c::pid_t,
pub comm: String,
}
Expand Down Expand Up @@ -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,
}
}
20 changes: 20 additions & 0 deletions src/edid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub enum DigitalVideoInterfaceStandard {
HdmiB,
MDDI,
DisplayPort,
#[allow(dead_code)]
Unknown(u8),
}

Expand All @@ -49,6 +50,7 @@ impl Debug for SignalLevelStandard {
}

#[derive(Copy, Clone, Debug)]
#[allow(dead_code)]
pub enum VideoInputDefinition {
Analog {
signal_level_standard: SignalLevelStandard,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -128,6 +133,7 @@ pub enum AnalogSyncType {
}

#[derive(Copy, Clone, Debug)]
#[allow(dead_code)]
pub enum SyncSignal {
Analog {
ty: AnalogSyncType,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -346,6 +360,7 @@ pub struct DetailedTimingDescriptor {
}

#[derive(Clone, Debug)]
#[allow(dead_code)]
pub enum Descriptor {
Unknown(u8),
DetailedTimingDescriptor(DetailedTimingDescriptor),
Expand Down Expand Up @@ -379,6 +394,7 @@ macro_rules! bail {

#[derive(Clone, Debug)]
pub enum EdidParseContext {
#[allow(dead_code)]
ReadingBytes(usize),
BaseBlock,
Descriptors,
Expand Down Expand Up @@ -1015,6 +1031,7 @@ pub enum DisplayColorType {
}

#[derive(Debug)]
#[allow(dead_code)]
pub enum FeatureSupport2 {
Analog {
display_color_type: DisplayColorType,
Expand All @@ -1027,6 +1044,7 @@ pub enum FeatureSupport2 {
}

#[derive(Debug)]
#[allow(dead_code)]
pub struct FeatureSupport {
pub standby_supported: bool,
pub suspend_supported: bool,
Expand All @@ -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,
Expand All @@ -1064,6 +1083,7 @@ pub enum EdidExtension {
}

#[derive(Debug)]
#[allow(dead_code)]
pub struct EdidFile {
pub base_block: EdidBaseBlock,
pub extension_blocks: Vec<EdidExtension>,
Expand Down
7 changes: 0 additions & 7 deletions src/gfx_apis/gl/gl/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions src/ifs/ext_idle_notifier_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&notification)?;
let future = self.client.state.eng.spawn(run(notification.clone()));
notification.task.set(Some(future));
Expand Down
4 changes: 2 additions & 2 deletions src/ifs/wl_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const MODE_PREFERRED: u32 = 2;

pub struct WlOutputGlobal {
pub name: GlobalName,
pub state: Rc<State>,
pub _state: Rc<State>,
pub connector: Rc<ConnectorData>,
pub pos: Cell<Rect>,
pub output_id: Rc<OutputId>,
Expand Down Expand Up @@ -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(),
Expand Down
6 changes: 1 addition & 5 deletions src/ifs/wl_seat/event_handling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ impl NodeSeatState {
self.kb_foci.iter().for_each(|(_, s)| f(s));
}

pub fn for_each_pointer_focus<F: FnMut(Rc<WlSeatGlobal>)>(&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);
}
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/ifs/wl_seat/zwp_pointer_constraints_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit 136e6e7

Please sign in to comment.