Skip to content

Commit

Permalink
refactor: prefix identifier with namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Nov 27, 2024
1 parent 60558e1 commit a95157c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/wayland/protocols/overlap_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,10 @@ impl OverlapSnapshot {
);
let layer = layer_surface.layer();
let id = layer_surface.wl_surface().id();
let prefix = layer_surface.namespace();
let identifier = layer_surface
.user_data()
.get_or_insert(|| Identifier::from(id.clone()));
.get_or_insert(|| Identifier::new(prefix, id.clone()));

self.layer_overlaps
.insert(id, (identifier.0.clone(), exclusive, layer, overlap));
Expand All @@ -329,9 +330,9 @@ impl OverlapSnapshot {

struct Identifier(String);

impl From<ObjectId> for Identifier {
fn from(value: ObjectId) -> Self {
Identifier(value.to_string())
impl Identifier {
fn new(prefix: &str, id: ObjectId) -> Self {
Identifier(format!("{prefix}-{id}"))
}
}

Expand Down

0 comments on commit a95157c

Please sign in to comment.