space: make window activation optional
This commit is contained in:
parent
537b34fe0b
commit
26e1576f87
|
@ -70,21 +70,21 @@ impl Space {
|
||||||
/// Map window and moves it to top of the stack
|
/// Map window and moves it to top of the stack
|
||||||
///
|
///
|
||||||
/// This can safely be called on an already mapped window
|
/// This can safely be called on an already mapped window
|
||||||
pub fn map_window<P: Into<Point<i32, Logical>>>(&mut self, window: &Window, location: P) {
|
pub fn map_window<P: Into<Point<i32, Logical>>>(&mut self, window: &Window, location: P, activate: bool) {
|
||||||
self.insert_window(window);
|
self.insert_window(window, activate);
|
||||||
window_state(self.id, window).location = location.into();
|
window_state(self.id, window).location = location.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn raise_window(&mut self, window: &Window) {
|
pub fn raise_window(&mut self, window: &Window, activate: bool) {
|
||||||
if self.windows.shift_remove(window) {
|
if self.windows.shift_remove(window) {
|
||||||
self.insert_window(window);
|
self.insert_window(window, activate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert_window(&mut self, window: &Window) {
|
fn insert_window(&mut self, window: &Window, activate: bool) {
|
||||||
self.windows.insert(window.clone());
|
self.windows.insert(window.clone());
|
||||||
|
|
||||||
// TODO: should this be handled by us?
|
if activate {
|
||||||
window.set_activated(true);
|
window.set_activated(true);
|
||||||
for w in self.windows.iter() {
|
for w in self.windows.iter() {
|
||||||
if w != window {
|
if w != window {
|
||||||
|
@ -92,6 +92,7 @@ impl Space {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Unmap a window from this space by its id
|
/// Unmap a window from this space by its id
|
||||||
pub fn unmap_window(&mut self, window: &Window) {
|
pub fn unmap_window(&mut self, window: &Window) {
|
||||||
|
|
Loading…
Reference in New Issue