mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-23 19:58:05 +01:00
Fix tests
This commit is contained in:
parent
04b7c0533f
commit
6982587a84
9 changed files with 74 additions and 67 deletions
69
src/api.rs
69
src/api.rs
|
@ -742,10 +742,9 @@ impl tag_service_server::TagService for TagService {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let (fs_and_up_snapshots, under_fs_snapshots) =
|
let snapshots = state.backend.with_renderer(|renderer| {
|
||||||
state.backend.with_renderer(|renderer| {
|
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
||||||
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
});
|
||||||
});
|
|
||||||
|
|
||||||
match set_or_toggle {
|
match set_or_toggle {
|
||||||
SetOrToggle::Set => tag.set_active(true, state),
|
SetOrToggle::Set => tag.set_active(true, state),
|
||||||
|
@ -756,13 +755,15 @@ impl tag_service_server::TagService for TagService {
|
||||||
|
|
||||||
state.pinnacle.fixup_xwayland_window_layering();
|
state.pinnacle.fixup_xwayland_window_layering();
|
||||||
|
|
||||||
output.with_state_mut(|op_state| {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
||||||
op_state.new_wait_layout_transaction(
|
output.with_state_mut(|op_state| {
|
||||||
state.pinnacle.loop_handle.clone(),
|
op_state.new_wait_layout_transaction(
|
||||||
fs_and_up_snapshots,
|
state.pinnacle.loop_handle.clone(),
|
||||||
under_fs_snapshots,
|
fs_and_up_snapshots,
|
||||||
)
|
under_fs_snapshots,
|
||||||
});
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
state.pinnacle.request_layout(&output);
|
state.pinnacle.request_layout(&output);
|
||||||
state.update_keyboard_focus(&output);
|
state.update_keyboard_focus(&output);
|
||||||
|
@ -786,10 +787,9 @@ impl tag_service_server::TagService for TagService {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let (fs_and_up_snapshots, under_fs_snapshots) =
|
let snapshots = state.backend.with_renderer(|renderer| {
|
||||||
state.backend.with_renderer(|renderer| {
|
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
||||||
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
});
|
||||||
});
|
|
||||||
|
|
||||||
output.with_state(|op_state| {
|
output.with_state(|op_state| {
|
||||||
for op_tag in op_state.tags.iter() {
|
for op_tag in op_state.tags.iter() {
|
||||||
|
@ -800,13 +800,15 @@ impl tag_service_server::TagService for TagService {
|
||||||
|
|
||||||
state.pinnacle.fixup_xwayland_window_layering();
|
state.pinnacle.fixup_xwayland_window_layering();
|
||||||
|
|
||||||
output.with_state_mut(|op_state| {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
||||||
op_state.new_wait_layout_transaction(
|
output.with_state_mut(|op_state| {
|
||||||
state.pinnacle.loop_handle.clone(),
|
op_state.new_wait_layout_transaction(
|
||||||
fs_and_up_snapshots,
|
state.pinnacle.loop_handle.clone(),
|
||||||
under_fs_snapshots,
|
fs_and_up_snapshots,
|
||||||
)
|
under_fs_snapshots,
|
||||||
});
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
state.pinnacle.request_layout(&output);
|
state.pinnacle.request_layout(&output);
|
||||||
state.update_keyboard_focus(&output);
|
state.update_keyboard_focus(&output);
|
||||||
|
@ -1095,10 +1097,9 @@ impl output_service_server::OutputService for OutputService {
|
||||||
|
|
||||||
current_scale = f64::max(current_scale, 0.25);
|
current_scale = f64::max(current_scale, 0.25);
|
||||||
|
|
||||||
let (fs_and_up_snapshots, under_fs_snapshots) =
|
let snapshots = state.backend.with_renderer(|renderer| {
|
||||||
state.backend.with_renderer(|renderer| {
|
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
||||||
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
});
|
||||||
});
|
|
||||||
|
|
||||||
state.pinnacle.change_output_state(
|
state.pinnacle.change_output_state(
|
||||||
&output,
|
&output,
|
||||||
|
@ -1108,13 +1109,15 @@ impl output_service_server::OutputService for OutputService {
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
output.with_state_mut(|op_state| {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
||||||
op_state.new_wait_layout_transaction(
|
output.with_state_mut(|op_state| {
|
||||||
state.pinnacle.loop_handle.clone(),
|
op_state.new_wait_layout_transaction(
|
||||||
fs_and_up_snapshots,
|
state.pinnacle.loop_handle.clone(),
|
||||||
under_fs_snapshots,
|
fs_and_up_snapshots,
|
||||||
);
|
under_fs_snapshots,
|
||||||
});
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
state.pinnacle.request_layout(&output);
|
state.pinnacle.request_layout(&output);
|
||||||
state.schedule_render(&output);
|
state.schedule_render(&output);
|
||||||
|
|
|
@ -248,7 +248,7 @@ impl window_service_server::WindowService for WindowService {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots.flatten() {
|
||||||
output.with_state_mut(|op_state| {
|
output.with_state_mut(|op_state| {
|
||||||
op_state.new_wait_layout_transaction(
|
op_state.new_wait_layout_transaction(
|
||||||
pinnacle.loop_handle.clone(),
|
pinnacle.loop_handle.clone(),
|
||||||
|
@ -380,7 +380,7 @@ impl window_service_server::WindowService for WindowService {
|
||||||
|
|
||||||
let Some(output) = tag.output(pinnacle) else { return };
|
let Some(output) = tag.output(pinnacle) else { return };
|
||||||
|
|
||||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots.flatten() {
|
||||||
output.with_state_mut(|op_state| {
|
output.with_state_mut(|op_state| {
|
||||||
op_state.new_wait_layout_transaction(
|
op_state.new_wait_layout_transaction(
|
||||||
pinnacle.loop_handle.clone(),
|
pinnacle.loop_handle.clone(),
|
||||||
|
@ -453,7 +453,7 @@ impl window_service_server::WindowService for WindowService {
|
||||||
|
|
||||||
let Some(output) = tag.output(pinnacle) else { return };
|
let Some(output) = tag.output(pinnacle) else { return };
|
||||||
|
|
||||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots.flatten() {
|
||||||
output.with_state_mut(|op_state| {
|
output.with_state_mut(|op_state| {
|
||||||
op_state.new_wait_layout_transaction(
|
op_state.new_wait_layout_transaction(
|
||||||
pinnacle.loop_handle.clone(),
|
pinnacle.loop_handle.clone(),
|
||||||
|
|
|
@ -107,12 +107,15 @@ impl Backend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_renderer<T>(&mut self, with_renderer: impl FnOnce(&mut GlesRenderer) -> T) -> T {
|
pub fn with_renderer<T>(
|
||||||
|
&mut self,
|
||||||
|
with_renderer: impl FnOnce(&mut GlesRenderer) -> T,
|
||||||
|
) -> Option<T> {
|
||||||
match self {
|
match self {
|
||||||
Backend::Winit(winit) => with_renderer(winit.backend.renderer()),
|
Backend::Winit(winit) => Some(with_renderer(winit.backend.renderer())),
|
||||||
Backend::Udev(udev) => with_renderer(udev.renderer().as_mut()),
|
Backend::Udev(udev) => Some(with_renderer(udev.renderer().ok()?.as_mut())),
|
||||||
#[cfg(feature = "testing")]
|
#[cfg(feature = "testing")]
|
||||||
Backend::Dummy(_) => todo!(),
|
Backend::Dummy(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -866,10 +866,8 @@ fn render_frame<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Udev {
|
impl Udev {
|
||||||
pub fn renderer(&mut self) -> UdevRenderer<'_> {
|
pub fn renderer(&mut self) -> anyhow::Result<UdevRenderer<'_>> {
|
||||||
self.gpu_manager
|
Ok(self.gpu_manager.single_renderer(&self.primary_gpu)?)
|
||||||
.single_renderer(&self.primary_gpu)
|
|
||||||
.expect("failed to create multirenderer")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A GPU was plugged in.
|
/// A GPU was plugged in.
|
||||||
|
|
|
@ -211,7 +211,9 @@ impl CompositorHandler for State {
|
||||||
if unmapped_window.is_on_active_tag() {
|
if unmapped_window.is_on_active_tag() {
|
||||||
self.update_keyboard_focus(&focused_output);
|
self.update_keyboard_focus(&focused_output);
|
||||||
|
|
||||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) =
|
||||||
|
snapshots.flatten()
|
||||||
|
{
|
||||||
focused_output.with_state_mut(|state| {
|
focused_output.with_state_mut(|state| {
|
||||||
state.new_wait_layout_transaction(
|
state.new_wait_layout_transaction(
|
||||||
self.pinnacle.loop_handle.clone(),
|
self.pinnacle.loop_handle.clone(),
|
||||||
|
@ -253,23 +255,24 @@ impl CompositorHandler for State {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(output) = window.output(&self.pinnacle) {
|
if let Some(output) = window.output(&self.pinnacle) {
|
||||||
let (fs_and_up_snapshots, under_fs_snapshots) =
|
let snapshots = self.backend.with_renderer(|renderer| {
|
||||||
self.backend.with_renderer(|renderer| {
|
capture_snapshots_on_output(
|
||||||
capture_snapshots_on_output(
|
&mut self.pinnacle,
|
||||||
&mut self.pinnacle,
|
renderer,
|
||||||
renderer,
|
&output,
|
||||||
&output,
|
[],
|
||||||
[],
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
||||||
|
output.with_state_mut(|op_state| {
|
||||||
|
op_state.new_wait_layout_transaction(
|
||||||
|
self.pinnacle.loop_handle.clone(),
|
||||||
|
fs_and_up_snapshots,
|
||||||
|
under_fs_snapshots,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
}
|
||||||
output.with_state_mut(|state| {
|
|
||||||
state.new_wait_layout_transaction(
|
|
||||||
self.pinnacle.loop_handle.clone(),
|
|
||||||
fs_and_up_snapshots,
|
|
||||||
under_fs_snapshots,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.pinnacle.remove_window(&window, true);
|
self.pinnacle.remove_window(&window, true);
|
||||||
|
|
|
@ -21,7 +21,7 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(output) = window.output(&self.pinnacle) {
|
if let Some(output) = window.output(&self.pinnacle) {
|
||||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots.flatten() {
|
||||||
output.with_state_mut(|op_state| {
|
output.with_state_mut(|op_state| {
|
||||||
op_state.new_wait_layout_transaction(
|
op_state.new_wait_layout_transaction(
|
||||||
self.pinnacle.loop_handle.clone(),
|
self.pinnacle.loop_handle.clone(),
|
||||||
|
@ -52,7 +52,7 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(output) = window.output(&self.pinnacle) {
|
if let Some(output) = window.output(&self.pinnacle) {
|
||||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots.flatten() {
|
||||||
output.with_state_mut(|op_state| {
|
output.with_state_mut(|op_state| {
|
||||||
op_state.new_wait_layout_transaction(
|
op_state.new_wait_layout_transaction(
|
||||||
self.pinnacle.loop_handle.clone(),
|
self.pinnacle.loop_handle.clone(),
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl XdgShellHandler for State {
|
||||||
if let Some(output) = window.output(&self.pinnacle) {
|
if let Some(output) = window.output(&self.pinnacle) {
|
||||||
self.pinnacle.request_layout(&output);
|
self.pinnacle.request_layout(&output);
|
||||||
|
|
||||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots.flatten() {
|
||||||
output.with_state_mut(|state| {
|
output.with_state_mut(|state| {
|
||||||
state.new_wait_layout_transaction(
|
state.new_wait_layout_transaction(
|
||||||
self.pinnacle.loop_handle.clone(),
|
self.pinnacle.loop_handle.clone(),
|
||||||
|
|
|
@ -116,7 +116,7 @@ impl XwmHandler for State {
|
||||||
output.with_state_mut(|state| state.focus_stack.set_focus(window.clone()));
|
output.with_state_mut(|state| state.focus_stack.set_focus(window.clone()));
|
||||||
self.update_keyboard_focus(&output);
|
self.update_keyboard_focus(&output);
|
||||||
|
|
||||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots.flatten() {
|
||||||
output.with_state_mut(|state| {
|
output.with_state_mut(|state| {
|
||||||
state.new_wait_layout_transaction(
|
state.new_wait_layout_transaction(
|
||||||
self.pinnacle.loop_handle.clone(),
|
self.pinnacle.loop_handle.clone(),
|
||||||
|
@ -426,7 +426,7 @@ impl State {
|
||||||
self.pinnacle.remove_window(&win, false);
|
self.pinnacle.remove_window(&win, false);
|
||||||
|
|
||||||
if let Some(output) = win.output(&self.pinnacle) {
|
if let Some(output) = win.output(&self.pinnacle) {
|
||||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots.flatten() {
|
||||||
output.with_state_mut(|state| {
|
output.with_state_mut(|state| {
|
||||||
state.new_wait_layout_transaction(
|
state.new_wait_layout_transaction(
|
||||||
self.pinnacle.loop_handle.clone(),
|
self.pinnacle.loop_handle.clone(),
|
||||||
|
|
|
@ -267,7 +267,7 @@ impl State {
|
||||||
.fulfilled_requests
|
.fulfilled_requests
|
||||||
.insert(output.clone(), current_pending);
|
.insert(output.clone(), current_pending);
|
||||||
|
|
||||||
let (fs_and_up_snapshots, under_fs_snapshots) = self.backend.with_renderer(|renderer| {
|
let snapshots = self.backend.with_renderer(|renderer| {
|
||||||
capture_snapshots_on_output(&mut self.pinnacle, renderer, &output, [])
|
capture_snapshots_on_output(&mut self.pinnacle, renderer, &output, [])
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ impl State {
|
||||||
output.with_state_mut(|state| {
|
output.with_state_mut(|state| {
|
||||||
if let Some(ts) = state.layout_transaction.as_mut() {
|
if let Some(ts) = state.layout_transaction.as_mut() {
|
||||||
ts.update_pending(pending_windows);
|
ts.update_pending(pending_windows);
|
||||||
} else {
|
} else if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
||||||
state.layout_transaction = Some(LayoutTransaction::new(
|
state.layout_transaction = Some(LayoutTransaction::new(
|
||||||
self.pinnacle.loop_handle.clone(),
|
self.pinnacle.loop_handle.clone(),
|
||||||
fs_and_up_snapshots,
|
fs_and_up_snapshots,
|
||||||
|
|
Loading…
Add table
Reference in a new issue