Groundwork for tiling layout

This commit is contained in:
Victoria Brekenfeld 2022-03-24 20:32:31 +01:00
parent 5657a77c5b
commit 4796832521
19 changed files with 1685 additions and 837 deletions

View file

@ -102,7 +102,7 @@ pub fn init_backend(event_loop: &mut EventLoop<State>, state: &mut State) -> Res
.handle()
.insert_source(libinput_backend, move |event, _, state| {
state.common.process_input_event(event);
for output in state.common.spaces.outputs() {
for output in state.common.shell.outputs() {
state.backend.kms().schedule_render(output);
}
})
@ -246,8 +246,9 @@ impl State {
surface.pending = false;
state
.common
.spaces
.shell
.active_space_mut(&surface.output)
.space
.send_frames(
state.common.start_time.elapsed().as_millis() as u32
);
@ -300,7 +301,7 @@ impl State {
&mut self.common.display.borrow_mut(),
&mut self.common.event_loop_handle,
) {
Ok(output) => self.common.spaces.map_output(&output),
Ok(output) => self.common.shell.map_output(&output),
Err(err) => slog_scope::warn!("Failed to initialize output: {}", err),
};
}
@ -319,7 +320,7 @@ impl State {
if let Some(token) = surface.render_timer_token.take() {
self.common.event_loop_handle.remove(token);
}
self.common.spaces.unmap_output(&surface.output);
self.common.shell.unmap_output(&surface.output);
}
}
for (crtc, conn) in changes.added {
@ -331,7 +332,7 @@ impl State {
&mut self.common.display.borrow_mut(),
&mut self.common.event_loop_handle,
) {
Ok(output) => self.common.spaces.map_output(&output),
Ok(output) => self.common.shell.map_output(&output),
Err(err) => slog_scope::warn!("Failed to initialize output: {}", err),
};
}
@ -346,7 +347,7 @@ impl State {
if let Some(token) = surface.render_timer_token.take() {
self.common.event_loop_handle.remove(token);
}
self.common.spaces.unmap_output(&surface.output);
self.common.shell.unmap_output(&surface.output);
}
if let Some(token) = device.event_token.take() {
self.common.event_loop_handle.remove(token);
@ -504,8 +505,9 @@ impl Surface {
state: &mut Common,
) -> Result<()> {
let nodes = state
.spaces
.shell
.active_space(&self.output)
.space
.windows()
.flat_map(|w| {
w.toplevel()

View file

@ -120,17 +120,18 @@ where
#[cfg(feature = "debug")]
{
let space = state.spaces.active_space(output);
let output_geo = space
let workspace = state.shell.active_space(output);
let output_geo = workspace
.space
.output_geometry(output)
.unwrap_or(Rectangle::from_loc_and_size((0, 0), (0, 0)));
let scale = space.output_scale(output).unwrap();
let scale = workspace.space.output_scale(output).unwrap();
let fps_overlay = fps_ui(_gpu, state, fps, output_geo, scale);
custom_elements.push(fps_overlay.into());
let mut area = state.spaces.global_space();
area.loc = state.spaces.space_relative_output_geometry((0, 0), output);
let mut area = state.shell.global_space();
area.loc = state.shell.space_relative_output_geometry((0, 0), output);
if let Some(log_ui) = log_ui(state, area, scale, output_geo.size.w as f32 * 0.6) {
custom_elements.push(log_ui.into());
}
@ -145,7 +146,7 @@ where
None => continue,
};
let location = state
.spaces
.shell
.space_relative_output_geometry(pointer.current_location().to_i32_round(), output);
if let Some(cursor) = cursor::draw_cursor(
@ -159,7 +160,7 @@ where
}
}
let res = state.spaces.active_space_mut(output).render_output(
let res = state.shell.active_space_mut(output).space.render_output(
renderer,
&output,
age as usize,

View file

@ -56,8 +56,9 @@ impl WinitState {
) {
Ok(damage) => {
state
.spaces
.shell
.active_space_mut(&self.output)
.space
.send_frames(state.start_time.elapsed().as_millis() as u32);
backend
.submit(damage.as_ref().map(|x| &**x), 1.0)
@ -101,7 +102,7 @@ pub fn init_backend(event_loop: &mut EventLoop<State>, state: &mut State) -> Res
);
output.set_preferred(mode);
state.common.spaces.map_output(&output);
state.common.shell.map_output(&output);
let (event_ping, event_source) =
ping::make_ping().with_context(|| "Failed to init eventloop timer for winit")?;
@ -133,7 +134,7 @@ pub fn init_backend(event_loop: &mut EventLoop<State>, state: &mut State) -> Res
}
Err(winit::WinitError::WindowClosed) => {
let winit_state = state.backend.winit();
state.common.spaces.unmap_output(&winit_state.output);
state.common.shell.unmap_output(&winit_state.output);
if let Some(token) = token.take() {
event_loop_handle.remove(token);
}

View file

@ -174,8 +174,9 @@ impl Surface {
) {
Ok(_) => {
state
.spaces
.shell
.active_space_mut(&self.output)
.space
.send_frames(state.start_time.elapsed().as_millis() as u32);
self.surface
.submit()
@ -228,7 +229,7 @@ pub fn init_backend(event_loop: &mut EventLoop<State>, state: &mut State) -> Res
.x11()
.add_window(&mut *state.common.display.borrow_mut(), event_loop.handle())
.with_context(|| "Failed to create wl_output")?;
state.common.spaces.map_output(&output);
state.common.shell.map_output(&output);
event_loop
.handle()
@ -243,7 +244,7 @@ pub fn init_backend(event_loop: &mut EventLoop<State>, state: &mut State) -> Res
.filter(|s| s.window.id() == window_id)
{
surface.window.unmap();
state.common.spaces.unmap_output(&surface.output);
state.common.shell.unmap_output(&surface.output);
}
state
.backend
@ -353,7 +354,7 @@ impl State {
self.common.process_input_event(event);
// TODO actually figure out the output
for output in self.common.spaces.outputs() {
for output in self.common.shell.outputs() {
self.backend.schedule_render(output);
}
}