forge
Explore
Log in

Don't you dare go Hollow

Move PartialEq from LayoutElement to an associated type

Browse files at this commit

d421e1fbf8f5d10e331de0572def08a8c1bb402eIvan MolodetskikhParent: 23ac3d7
niri-visual-tests/src/cases/layout.rsmodified+11 -11
@@ -2,7 +2,7 @@ use std::collections::HashMap;
22 use std::time::Duration;
33
44 use niri::layout::workspace::ColumnWidth;
5-use niri::layout::Options;
5+use niri::layout::{LayoutElement as _, Options};
66 use niri::utils::get_monotonic_time;
77 use niri_config::Color;
88 use smithay::backend::renderer::element::RenderElement;
@@ -73,12 +73,12 @@ impl Layout {
7373
7474 rv.add_window(TestWindow::freeform(0), Some(ColumnWidth::Proportion(0.3)));
7575 rv.add_window(TestWindow::freeform(1), Some(ColumnWidth::Proportion(0.3)));
76- rv.layout.activate_window(&rv.windows[0]);
76+ rv.layout.activate_window(&0);
7777
7878 rv.add_step(500, |l| {
7979 let win = TestWindow::freeform(2);
8080 l.add_window(win.clone(), Some(ColumnWidth::Proportion(0.3)));
81- l.layout.start_open_animation_for_window(&win);
81+ l.layout.start_open_animation_for_window(win.id());
8282 });
8383
8484 rv
@@ -91,7 +91,7 @@ impl Layout {
9191 rv.add_step(delay, move |l| {
9292 let win = TestWindow::freeform(delay as usize);
9393 l.add_window(win.clone(), Some(ColumnWidth::Proportion(0.3)));
94- l.layout.start_open_animation_for_window(&win);
94+ l.layout.start_open_animation_for_window(win.id());
9595 });
9696 }
9797
@@ -105,7 +105,7 @@ impl Layout {
105105 rv.add_step(delay, move |l| {
106106 let win = TestWindow::freeform(delay as usize);
107107 l.add_window(win.clone(), Some(ColumnWidth::Proportion(0.5)));
108- l.layout.start_open_animation_for_window(&win);
108+ l.layout.start_open_animation_for_window(win.id());
109109 });
110110 }
111111
@@ -122,7 +122,7 @@ impl Layout {
122122 let win = TestWindow::freeform(2);
123123 let right_of = l.windows[0].clone();
124124 l.add_window_right_of(&right_of, win.clone(), Some(ColumnWidth::Proportion(0.3)));
125- l.layout.start_open_animation_for_window(&win);
125+ l.layout.start_open_animation_for_window(win.id());
126126 });
127127
128128 rv
@@ -138,7 +138,7 @@ impl Layout {
138138 let win = TestWindow::freeform(2);
139139 let right_of = l.windows[0].clone();
140140 l.add_window_right_of(&right_of, win.clone(), Some(ColumnWidth::Proportion(0.5)));
141- l.layout.start_open_animation_for_window(&win);
141+ l.layout.start_open_animation_for_window(win.id());
142142 });
143143
144144 rv
@@ -147,7 +147,7 @@ impl Layout {
147147 fn add_window(&mut self, window: TestWindow, width: Option<ColumnWidth>) {
148148 self.layout.add_window(window.clone(), width, false);
149149 if window.communicate() {
150- self.layout.update_window(&window);
150+ self.layout.update_window(window.id());
151151 }
152152 self.windows.push(window);
153153 }
@@ -159,9 +159,9 @@ impl Layout {
159159 width: Option<ColumnWidth>,
160160 ) {
161161 self.layout
162- .add_window_right_of(right_of, window.clone(), width, false);
162+ .add_window_right_of(right_of.id(), window.clone(), width, false);
163163 if window.communicate() {
164- self.layout.update_window(&window);
164+ self.layout.update_window(window.id());
165165 }
166166 self.windows.push(window);
167167 }
@@ -183,7 +183,7 @@ impl TestCase for Layout {
183183 self.layout.update_output_size(&self.output);
184184 for win in &self.windows {
185185 if win.communicate() {
186- self.layout.update_window(win);
186+ self.layout.update_window(win.id());
187187 }
188188 }
189189 }
niri-visual-tests/src/test_window.rsmodified+34 -30
@@ -12,7 +12,6 @@ use smithay::utils::{Logical, Point, Scale, Size, Transform};
1212
1313 #[derive(Debug)]
1414 struct TestWindowInner {
15- id: usize,
1615 size: Size<i32, Logical>,
1716 requested_size: Option<Size<i32, Logical>>,
1817 min_size: Size<i32, Logical>,
@@ -24,7 +23,10 @@ struct TestWindowInner {
2423 }
2524
2625 #[derive(Debug, Clone)]
27-pub struct TestWindow(Rc<RefCell<TestWindowInner>>);
26+pub struct TestWindow {
27+ id: usize,
28+ inner: Rc<RefCell<TestWindowInner>>,
29+}
2830
2931 impl TestWindow {
3032 pub fn freeform(id: usize) -> Self {
@@ -33,17 +35,19 @@ impl TestWindow {
3335 let max_size = Size::from((0, 0));
3436 let buffer = SolidColorBuffer::new(size, [0.15, 0.64, 0.41, 1.]);
3537
36- Self(Rc::new(RefCell::new(TestWindowInner {
38+ Self {
3739 id,
38- size,
39- requested_size: None,
40- min_size,
41- max_size,
42- buffer,
43- pending_fullscreen: false,
44- csd_shadow_width: 0,
45- csd_shadow_buffer: SolidColorBuffer::new((0, 0), [0., 0., 0., 0.3]),
46- })))
40+ inner: Rc::new(RefCell::new(TestWindowInner {
41+ size,
42+ requested_size: None,
43+ min_size,
44+ max_size,
45+ buffer,
46+ pending_fullscreen: false,
47+ csd_shadow_width: 0,
48+ csd_shadow_buffer: SolidColorBuffer::new((0, 0), [0., 0., 0., 0.3]),
49+ })),
50+ }
4751 }
4852
4953 pub fn fixed_size(id: usize) -> Self {
@@ -56,24 +60,24 @@ impl TestWindow {
5660 }
5761
5862 pub fn set_min_size(&self, size: Size<i32, Logical>) {
59- self.0.borrow_mut().min_size = size;
63+ self.inner.borrow_mut().min_size = size;
6064 }
6165
6266 pub fn set_max_size(&self, size: Size<i32, Logical>) {
63- self.0.borrow_mut().max_size = size;
67+ self.inner.borrow_mut().max_size = size;
6468 }
6569
6670 pub fn set_color(&self, color: [f32; 4]) {
67- self.0.borrow_mut().buffer.set_color(color);
71+ self.inner.borrow_mut().buffer.set_color(color);
6872 }
6973
7074 pub fn set_csd_shadow_width(&self, width: i32) {
71- self.0.borrow_mut().csd_shadow_width = width;
75+ self.inner.borrow_mut().csd_shadow_width = width;
7276 }
7377
7478 pub fn communicate(&self) -> bool {
7579 let mut rv = false;
76- let mut inner = self.0.borrow_mut();
80+ let mut inner = self.inner.borrow_mut();
7781
7882 let mut new_size = inner.size;
7983
@@ -117,15 +121,15 @@ impl TestWindow {
117121 }
118122 }
119123
120-impl PartialEq for TestWindow {
121- fn eq(&self, other: &Self) -> bool {
122- self.0.borrow().id == other.0.borrow().id
124+impl LayoutElement for TestWindow {
125+ type Id = usize;
126+
127+ fn id(&self) -> &Self::Id {
128+ &self.id
123129 }
124-}
125130
126-impl LayoutElement for TestWindow {
127131 fn size(&self) -> Size<i32, Logical> {
128- self.0.borrow().size
132+ self.inner.borrow().size
129133 }
130134
131135 fn buf_loc(&self) -> Point<i32, Logical> {
@@ -142,7 +146,7 @@ impl LayoutElement for TestWindow {
142146 location: Point<i32, Logical>,
143147 scale: Scale<f64>,
144148 ) -> Vec<LayoutElementRenderElement<R>> {
145- let inner = self.0.borrow();
149+ let inner = self.inner.borrow();
146150
147151 vec![
148152 SolidColorRenderElement::from_buffer(
@@ -166,20 +170,20 @@ impl LayoutElement for TestWindow {
166170 }
167171
168172 fn request_size(&self, size: Size<i32, Logical>) {
169- self.0.borrow_mut().requested_size = Some(size);
170- self.0.borrow_mut().pending_fullscreen = false;
173+ self.inner.borrow_mut().requested_size = Some(size);
174+ self.inner.borrow_mut().pending_fullscreen = false;
171175 }
172176
173177 fn request_fullscreen(&self, _size: Size<i32, Logical>) {
174- self.0.borrow_mut().pending_fullscreen = true;
178+ self.inner.borrow_mut().pending_fullscreen = true;
175179 }
176180
177181 fn min_size(&self) -> Size<i32, Logical> {
178- self.0.borrow().min_size
182+ self.inner.borrow().min_size
179183 }
180184
181185 fn max_size(&self) -> Size<i32, Logical> {
182- self.0.borrow().max_size
186+ self.inner.borrow().max_size
183187 }
184188
185189 fn is_wl_surface(&self, _wl_surface: &WlSurface) -> bool {
@@ -203,6 +207,6 @@ impl LayoutElement for TestWindow {
203207 }
204208
205209 fn is_pending_fullscreen(&self) -> bool {
206- self.0.borrow().pending_fullscreen
210+ self.inner.borrow().pending_fullscreen
207211 }
208212 }
src/handlers/mod.rsmodified+1 -1
@@ -365,7 +365,7 @@ impl ForeignToplevelHandler for State {
365365 if &requested_output != current_output {
366366 self.niri
367367 .layout
368- .move_window_to_output(window.clone(), &requested_output);
368+ .move_window_to_output(&window, &requested_output);
369369 }
370370 }
371371
src/handlers/xdg_shell.rsmodified+1 -1
@@ -289,7 +289,7 @@ impl XdgShellHandler for State {
289289 if &requested_output != current_output {
290290 self.niri
291291 .layout
292- .move_window_to_output(window.clone(), &requested_output);
292+ .move_window_to_output(&window, &requested_output);
293293 }
294294 }
295295
src/layout/mod.rsmodified+49 -45
@@ -69,7 +69,13 @@ niri_render_elements! {
6969 }
7070 }
7171
72-pub trait LayoutElement: PartialEq {
72+pub trait LayoutElement {
73+ /// Type that can be used as a unique ID of this element.
74+ type Id: PartialEq;
75+
76+ /// Unique ID of this element.
77+ fn id(&self) -> &Self::Id;
78+
7379 /// Visual size of the element.
7480 ///
7581 /// This is what the user would consider the size, i.e. excluding CSD shadows and whatnot.
@@ -217,6 +223,12 @@ impl Options {
217223 }
218224
219225 impl LayoutElement for Window {
226+ type Id = Self;
227+
228+ fn id(&self) -> &Self::Id {
229+ self
230+ }
231+
220232 fn size(&self) -> Size<i32, Logical> {
221233 self.geometry().size
222234 }
@@ -599,7 +611,7 @@ impl<W: LayoutElement> Layout<W> {
599611 /// Returns an output that the window was added to, if there were any outputs.
600612 pub fn add_window_right_of(
601613 &mut self,
602- right_of: &W,
614+ right_of: &W::Id,
603615 window: W,
604616 width: Option<ColumnWidth>,
605617 is_full_width: bool,
@@ -681,13 +693,15 @@ impl<W: LayoutElement> Layout<W> {
681693 );
682694 }
683695
684- pub fn remove_window(&mut self, window: &W) {
696+ pub fn remove_window(&mut self, window: &W::Id) -> Option<W> {
697+ let mut rv = None;
698+
685699 match &mut self.monitor_set {
686700 MonitorSet::Normal { monitors, .. } => {
687701 for mon in monitors {
688702 for (idx, ws) in mon.workspaces.iter_mut().enumerate() {
689703 if ws.has_window(window) {
690- ws.remove_window(window);
704+ rv = Some(ws.remove_window(window));
691705
692706 // Clean up empty workspaces that are not active and not last.
693707 if !ws.has_windows()
@@ -710,7 +724,7 @@ impl<W: LayoutElement> Layout<W> {
710724 MonitorSet::NoOutputs { workspaces, .. } => {
711725 for (idx, ws) in workspaces.iter_mut().enumerate() {
712726 if ws.has_window(window) {
713- ws.remove_window(window);
727+ rv = Some(ws.remove_window(window));
714728
715729 // Clean up empty workspaces.
716730 if !ws.has_windows() {
@@ -722,9 +736,11 @@ impl<W: LayoutElement> Layout<W> {
722736 }
723737 }
724738 }
739+
740+ rv
725741 }
726742
727- pub fn update_window(&mut self, window: &W) {
743+ pub fn update_window(&mut self, window: &W::Id) {
728744 match &mut self.monitor_set {
729745 MonitorSet::Normal { monitors, .. } => {
730746 for mon in monitors {
@@ -761,7 +777,7 @@ impl<W: LayoutElement> Layout<W> {
761777 None
762778 }
763779
764- pub fn window_y(&self, window: &W) -> Option<i32> {
780+ pub fn window_y(&self, window: &W::Id) -> Option<i32> {
765781 match &self.monitor_set {
766782 MonitorSet::Normal { monitors, .. } => {
767783 for mon in monitors {
@@ -810,7 +826,7 @@ impl<W: LayoutElement> Layout<W> {
810826 }
811827 }
812828
813- pub fn activate_window(&mut self, window: &W) {
829+ pub fn activate_window(&mut self, window: &W::Id) {
814830 let MonitorSet::Normal {
815831 monitors,
816832 active_monitor_idx,
@@ -1493,7 +1509,7 @@ impl<W: LayoutElement> Layout<W> {
14931509 }
14941510 }
14951511
1496- pub fn move_window_to_output(&mut self, window: W, output: &Output) {
1512+ pub fn move_window_to_output(&mut self, window: &W::Id, output: &Output) {
14971513 let mut width = None;
14981514 let mut is_full_width = false;
14991515
@@ -1501,7 +1517,7 @@ impl<W: LayoutElement> Layout<W> {
15011517 for mon in &*monitors {
15021518 for ws in &mon.workspaces {
15031519 for col in &ws.columns {
1504- if col.contains(&window) {
1520+ if col.contains(window) {
15051521 width = Some(col.width);
15061522 is_full_width = col.is_full_width;
15071523 break;
@@ -1513,7 +1529,7 @@ impl<W: LayoutElement> Layout<W> {
15131529
15141530 let Some(width) = width else { return };
15151531
1516- self.remove_window(&window);
1532+ let window = self.remove_window(window).unwrap();
15171533
15181534 if let MonitorSet::Normal { monitors, .. } = &mut self.monitor_set {
15191535 let new_idx = monitors
@@ -1570,7 +1586,7 @@ impl<W: LayoutElement> Layout<W> {
15701586 *active_monitor_idx = target_idx;
15711587 }
15721588
1573- pub fn set_fullscreen(&mut self, window: &W, is_fullscreen: bool) {
1589+ pub fn set_fullscreen(&mut self, window: &W::Id, is_fullscreen: bool) {
15741590 match &mut self.monitor_set {
15751591 MonitorSet::Normal { monitors, .. } => {
15761592 for mon in monitors {
@@ -1593,7 +1609,7 @@ impl<W: LayoutElement> Layout<W> {
15931609 }
15941610 }
15951611
1596- pub fn toggle_fullscreen(&mut self, window: &W) {
1612+ pub fn toggle_fullscreen(&mut self, window: &W::Id) {
15971613 match &mut self.monitor_set {
15981614 MonitorSet::Normal { monitors, .. } => {
15991615 for mon in monitors {
@@ -1746,14 +1762,14 @@ impl<W: LayoutElement> Layout<W> {
17461762 monitor.move_workspace_up();
17471763 }
17481764
1749- pub fn start_open_animation_for_window(&mut self, window: &W) {
1765+ pub fn start_open_animation_for_window(&mut self, window: &W::Id) {
17501766 match &mut self.monitor_set {
17511767 MonitorSet::Normal { monitors, .. } => {
17521768 for mon in monitors {
17531769 for ws in &mut mon.workspaces {
17541770 for col in &mut ws.columns {
17551771 for tile in &mut col.tiles {
1756- if tile.window() == window {
1772+ if tile.window().id() == window {
17571773 tile.start_open_animation();
17581774 return;
17591775 }
@@ -1764,13 +1780,11 @@ impl<W: LayoutElement> Layout<W> {
17641780 }
17651781 MonitorSet::NoOutputs { workspaces, .. } => {
17661782 for ws in workspaces {
1767- if ws.has_window(window) {
1768- for col in &mut ws.columns {
1769- for tile in &mut col.tiles {
1770- if tile.window() == window {
1771- tile.start_open_animation();
1772- return;
1773- }
1783+ for col in &mut ws.columns {
1784+ for tile in &mut col.tiles {
1785+ if tile.window().id() == window {
1786+ tile.start_open_animation();
1787+ return;
17741788 }
17751789 }
17761790 }
@@ -1889,13 +1903,13 @@ mod tests {
18891903 }
18901904 }
18911905
1892- impl PartialEq for TestWindow {
1893- fn eq(&self, other: &Self) -> bool {
1894- self.0.id == other.0.id
1906+ impl LayoutElement for TestWindow {
1907+ type Id = usize;
1908+
1909+ fn id(&self) -> &Self::Id {
1910+ &self.0.id
18951911 }
1896- }
18971912
1898- impl LayoutElement for TestWindow {
18991913 fn size(&self) -> Size<i32, Logical> {
19001914 self.0.bbox.get().size
19011915 }
@@ -2208,24 +2222,14 @@ mod tests {
22082222 return;
22092223 }
22102224
2211- let right_of_win = TestWindow::new(
2212- right_of_id,
2213- Rectangle::default(),
2214- Size::default(),
2215- Size::default(),
2216- );
22172225 let win = TestWindow::new(id, bbox, min_max_size.0, min_max_size.1);
2218- layout.add_window_right_of(&right_of_win, win, None, false);
2226+ layout.add_window_right_of(&right_of_id, win, None, false);
22192227 }
22202228 Op::CloseWindow(id) => {
2221- let dummy =
2222- TestWindow::new(id, Rectangle::default(), Size::default(), Size::default());
2223- layout.remove_window(&dummy);
2229+ layout.remove_window(&id);
22242230 }
22252231 Op::FullscreenWindow(id) => {
2226- let dummy =
2227- TestWindow::new(id, Rectangle::default(), Size::default(), Size::default());
2228- layout.toggle_fullscreen(&dummy);
2232+ layout.toggle_fullscreen(&id);
22292233 }
22302234 Op::FocusColumnLeft => layout.focus_left(),
22312235 Op::FocusColumnRight => layout.focus_right(),
@@ -2284,7 +2288,7 @@ mod tests {
22842288 Op::SetColumnWidth(change) => layout.set_column_width(change),
22852289 Op::SetWindowHeight(change) => layout.set_window_height(change),
22862290 Op::Communicate(id) => {
2287- let mut window = None;
2291+ let mut update = false;
22882292 match &mut layout.monitor_set {
22892293 MonitorSet::Normal { monitors, .. } => {
22902294 'outer: for mon in monitors {
@@ -2292,7 +2296,7 @@ mod tests {
22922296 for win in ws.windows() {
22932297 if win.0.id == id {
22942298 if win.communicate() {
2295- window = Some(win.clone());
2299+ update = true;
22962300 }
22972301 break 'outer;
22982302 }
@@ -2305,7 +2309,7 @@ mod tests {
23052309 for win in ws.windows() {
23062310 if win.0.id == id {
23072311 if win.communicate() {
2308- window = Some(win.clone());
2312+ update = true;
23092313 }
23102314 break 'outer;
23112315 }
@@ -2314,8 +2318,8 @@ mod tests {
23142318 }
23152319 }
23162320
2317- if let Some(win) = window {
2318- layout.update_window(&win);
2321+ if update {
2322+ layout.update_window(&id);
23192323 }
23202324 }
23212325 Op::MoveWorkspaceToOutput(id) => {
src/layout/monitor.rsmodified+1 -1
@@ -159,7 +159,7 @@ impl<W: LayoutElement> Monitor<W> {
159159
160160 pub fn add_window_right_of(
161161 &mut self,
162- right_of: &W,
162+ right_of: &W::Id,
163163 window: W,
164164 width: ColumnWidth,
165165 is_full_width: bool,
src/layout/workspace.rsmodified+19 -16
@@ -577,8 +577,8 @@ impl<W: LayoutElement> Workspace<W> {
577577 self.windows().next().is_some()
578578 }
579579
580- pub fn has_window(&self, window: &W) -> bool {
581- self.windows().any(|win| win == window)
580+ pub fn has_window(&self, window: &W::Id) -> bool {
581+ self.windows().any(|win| win.id() == window)
582582 }
583583
584584 pub fn find_wl_surface(&self, wl_surface: &WlSurface) -> Option<&W> {
@@ -658,7 +658,7 @@ impl<W: LayoutElement> Workspace<W> {
658658
659659 pub fn add_window_right_of(
660660 &mut self,
661- right_of: &W,
661+ right_of: &W::Id,
662662 window: W,
663663 width: ColumnWidth,
664664 is_full_width: bool,
@@ -835,7 +835,7 @@ impl<W: LayoutElement> Workspace<W> {
835835 column
836836 }
837837
838- pub fn remove_window(&mut self, window: &W) {
838+ pub fn remove_window(&mut self, window: &W::Id) -> W {
839839 let column_idx = self
840840 .columns
841841 .iter()
@@ -844,10 +844,10 @@ impl<W: LayoutElement> Workspace<W> {
844844 let column = &self.columns[column_idx];
845845
846846 let window_idx = column.position(window).unwrap();
847- self.remove_window_by_idx(column_idx, window_idx);
847+ self.remove_window_by_idx(column_idx, window_idx)
848848 }
849849
850- pub fn update_window(&mut self, window: &W) {
850+ pub fn update_window(&mut self, window: &W::Id) {
851851 let (idx, column) = self
852852 .columns
853853 .iter_mut()
@@ -869,7 +869,7 @@ impl<W: LayoutElement> Workspace<W> {
869869 }
870870 }
871871
872- pub fn activate_window(&mut self, window: &W) {
872+ pub fn activate_window(&mut self, window: &W::Id) {
873873 let column_idx = self
874874 .columns
875875 .iter()
@@ -1233,7 +1233,7 @@ impl<W: LayoutElement> Workspace<W> {
12331233 self.columns[self.active_column_idx].set_window_height(change);
12341234 }
12351235
1236- pub fn set_fullscreen(&mut self, window: &W, is_fullscreen: bool) {
1236+ pub fn set_fullscreen(&mut self, window: &W::Id, is_fullscreen: bool) {
12371237 let (mut col_idx, tile_idx) = self
12381238 .columns
12391239 .iter()
@@ -1275,7 +1275,7 @@ impl<W: LayoutElement> Workspace<W> {
12751275 col.set_fullscreen(is_fullscreen);
12761276 }
12771277
1278- pub fn toggle_fullscreen(&mut self, window: &W) {
1278+ pub fn toggle_fullscreen(&mut self, window: &W::Id) {
12791279 let col = self
12801280 .columns
12811281 .iter_mut()
@@ -1654,18 +1654,21 @@ impl<W: LayoutElement> Column<W> {
16541654 self.tiles.iter().any(Tile::are_animations_ongoing)
16551655 }
16561656
1657- pub fn contains(&self, window: &W) -> bool {
1658- self.tiles.iter().map(Tile::window).any(|win| win == window)
1657+ pub fn contains(&self, window: &W::Id) -> bool {
1658+ self.tiles
1659+ .iter()
1660+ .map(Tile::window)
1661+ .any(|win| win.id() == window)
16591662 }
16601663
1661- pub fn position(&self, window: &W) -> Option<usize> {
1664+ pub fn position(&self, window: &W::Id) -> Option<usize> {
16621665 self.tiles
16631666 .iter()
16641667 .map(Tile::window)
1665- .position(|win| win == window)
1668+ .position(|win| win.id() == window)
16661669 }
16671670
1668- fn activate_window(&mut self, window: &W) {
1671+ fn activate_window(&mut self, window: &W::Id) {
16691672 let idx = self.position(window).unwrap();
16701673 self.active_tile_idx = idx;
16711674 }
@@ -1678,11 +1681,11 @@ impl<W: LayoutElement> Column<W> {
16781681 self.update_tile_sizes();
16791682 }
16801683
1681- fn update_window(&mut self, window: &W) {
1684+ fn update_window(&mut self, window: &W::Id) {
16821685 let tile = self
16831686 .tiles
16841687 .iter_mut()
1685- .find(|tile| tile.window() == window)
1688+ .find(|tile| tile.window().id() == window)
16861689 .unwrap();
16871690 tile.update_window();
16881691 }