layout: Make rendering not Window-specific
Browse files at this commit7a4bb8ba8ae9022c572c5d4b66182f1af7fd3fb7Parent: 72c8f562 changed files +23 -26
- src/layout/monitor.rs +0 -3
- src/layout/workspace.rs +23 -23
src/layout/monitor.rsmodified+0 -3
| @@ -7,7 +7,6 @@ use smithay::backend::renderer::element::utils::{ | |||
| 7 | CropRenderElement, Relocate, RelocateRenderElement, | 7 | CropRenderElement, Relocate, RelocateRenderElement, |
| 8 | }; | 8 | }; |
| 9 | use smithay::backend::renderer::{ImportAll, Renderer}; | 9 | use smithay::backend::renderer::{ImportAll, Renderer}; |
| 10 | -use smithay::desktop::Window; | ||
| 11 | use smithay::output::Output; | 10 | use smithay::output::Output; |
| 12 | use smithay::utils::{Logical, Point, Rectangle, Scale}; | 11 | use smithay::utils::{Logical, Point, Rectangle, Scale}; |
| 13 | 12 | ||
| @@ -578,9 +577,7 @@ impl<W: LayoutElement> Monitor<W> { | |||
| 578 | let ws = &self.workspaces[self.active_workspace_idx]; | 577 | let ws = &self.workspaces[self.active_workspace_idx]; |
| 579 | ws.render_above_top_layer() | 578 | ws.render_above_top_layer() |
| 580 | } | 579 | } |
| 581 | -} | ||
| 582 | 580 | ||
| 583 | -impl Monitor<Window> { | ||
| 584 | pub fn render_elements<R: Renderer + ImportAll>( | 581 | pub fn render_elements<R: Renderer + ImportAll>( |
| 585 | &self, | 582 | &self, |
| 586 | renderer: &mut R, | 583 | renderer: &mut R, |
src/layout/workspace.rsmodified+23 -23
| @@ -1058,29 +1058,6 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 1058 | 1058 | ||
| 1059 | self.columns[self.active_column_idx].is_fullscreen | 1059 | self.columns[self.active_column_idx].is_fullscreen |
| 1060 | } | 1060 | } |
| 1061 | -} | ||
| 1062 | - | ||
| 1063 | -impl Workspace<Window> { | ||
| 1064 | - pub fn refresh(&self, is_active: bool) { | ||
| 1065 | - let bounds = self.toplevel_bounds(); | ||
| 1066 | - | ||
| 1067 | - for (col_idx, col) in self.columns.iter().enumerate() { | ||
| 1068 | - for (tile_idx, tile) in col.tiles.iter().enumerate() { | ||
| 1069 | - let win = tile.window(); | ||
| 1070 | - let active = is_active | ||
| 1071 | - && self.active_column_idx == col_idx | ||
| 1072 | - && col.active_tile_idx == tile_idx; | ||
| 1073 | - win.set_activated(active); | ||
| 1074 | - | ||
| 1075 | - win.toplevel().with_pending_state(|state| { | ||
| 1076 | - state.bounds = Some(bounds); | ||
| 1077 | - }); | ||
| 1078 | - | ||
| 1079 | - win.toplevel().send_pending_configure(); | ||
| 1080 | - win.refresh(); | ||
| 1081 | - } | ||
| 1082 | - } | ||
| 1083 | - } | ||
| 1084 | 1061 | ||
| 1085 | pub fn render_elements<R: Renderer + ImportAll>( | 1062 | pub fn render_elements<R: Renderer + ImportAll>( |
| 1086 | &self, | 1063 | &self, |
| @@ -1137,6 +1114,29 @@ impl Workspace<Window> { | |||
| 1137 | } | 1114 | } |
| 1138 | } | 1115 | } |
| 1139 | 1116 | ||
| 1117 | +impl Workspace<Window> { | ||
| 1118 | + pub fn refresh(&self, is_active: bool) { | ||
| 1119 | + let bounds = self.toplevel_bounds(); | ||
| 1120 | + | ||
| 1121 | + for (col_idx, col) in self.columns.iter().enumerate() { | ||
| 1122 | + for (tile_idx, tile) in col.tiles.iter().enumerate() { | ||
| 1123 | + let win = tile.window(); | ||
| 1124 | + let active = is_active | ||
| 1125 | + && self.active_column_idx == col_idx | ||
| 1126 | + && col.active_tile_idx == tile_idx; | ||
| 1127 | + win.set_activated(active); | ||
| 1128 | + | ||
| 1129 | + win.toplevel().with_pending_state(|state| { | ||
| 1130 | + state.bounds = Some(bounds); | ||
| 1131 | + }); | ||
| 1132 | + | ||
| 1133 | + win.toplevel().send_pending_configure(); | ||
| 1134 | + win.refresh(); | ||
| 1135 | + } | ||
| 1136 | + } | ||
| 1137 | + } | ||
| 1138 | +} | ||
| 1139 | + | ||
| 1140 | impl<W: LayoutElement> Column<W> { | 1140 | impl<W: LayoutElement> Column<W> { |
| 1141 | fn new( | 1141 | fn new( |
| 1142 | window: W, | 1142 | window: W, |