-
Notifications
You must be signed in to change notification settings - Fork 176
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
Conversation
anvil/src/window_map.rs
Outdated
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); | ||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Co-authored-by: Victor Berger <vberger@users.noreply.github.com>
No description provided.