Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XDG activation support #358

Merged
merged 6 commits into from
Aug 1, 2021
Merged

XDG activation support #358

merged 6 commits into from
Aug 1, 2021

Conversation

PolyMeilex
Copy link
Member

No description provided.

Comment on lines 303 to 324
pub fn bring_surface_to_top(&mut self, surface: &WlSurface) {
let found = self.windows.iter().enumerate().find(|(_, w)| {
if let Some(s) = w.toplevel.get_surface() {
s.as_ref().equals(surface.as_ref())
} else {
false
}
});

if let Some((i, _)) = found {
let winner = self.windows.remove(i);

// Take activation away from all the windows
for window in self.windows.iter() {
window.toplevel.set_activated(false);
}

// Give activation to our winner
winner.toplevel.set_activated(true);
self.windows.insert(0, winner);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not thrilled by the code duplication with get_surface_and_bring_to_top, but I'm not quite sure how to avoid it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the "move the nth window to top" part to a separate method, that helps a little

@elinorbgr elinorbgr merged commit dbd0356 into Smithay:master Aug 1, 2021
@PolyMeilex PolyMeilex deleted the xdg-activate branch August 1, 2021 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants