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;
|
||||
};
|
||||
|
||||
let (fs_and_up_snapshots, under_fs_snapshots) =
|
||||
state.backend.with_renderer(|renderer| {
|
||||
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
||||
});
|
||||
let snapshots = state.backend.with_renderer(|renderer| {
|
||||
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
||||
});
|
||||
|
||||
match set_or_toggle {
|
||||
SetOrToggle::Set => tag.set_active(true, state),
|
||||
|
@ -756,13 +755,15 @@ impl tag_service_server::TagService for TagService {
|
|||
|
||||
state.pinnacle.fixup_xwayland_window_layering();
|
||||
|
||||
output.with_state_mut(|op_state| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
state.pinnacle.loop_handle.clone(),
|
||||
fs_and_up_snapshots,
|
||||
under_fs_snapshots,
|
||||
)
|
||||
});
|
||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
||||
output.with_state_mut(|op_state| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
state.pinnacle.loop_handle.clone(),
|
||||
fs_and_up_snapshots,
|
||||
under_fs_snapshots,
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
state.pinnacle.request_layout(&output);
|
||||
state.update_keyboard_focus(&output);
|
||||
|
@ -786,10 +787,9 @@ impl tag_service_server::TagService for TagService {
|
|||
return;
|
||||
};
|
||||
|
||||
let (fs_and_up_snapshots, under_fs_snapshots) =
|
||||
state.backend.with_renderer(|renderer| {
|
||||
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
||||
});
|
||||
let snapshots = state.backend.with_renderer(|renderer| {
|
||||
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
||||
});
|
||||
|
||||
output.with_state(|op_state| {
|
||||
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();
|
||||
|
||||
output.with_state_mut(|op_state| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
state.pinnacle.loop_handle.clone(),
|
||||
fs_and_up_snapshots,
|
||||
under_fs_snapshots,
|
||||
)
|
||||
});
|
||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
||||
output.with_state_mut(|op_state| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
state.pinnacle.loop_handle.clone(),
|
||||
fs_and_up_snapshots,
|
||||
under_fs_snapshots,
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
state.pinnacle.request_layout(&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);
|
||||
|
||||
let (fs_and_up_snapshots, under_fs_snapshots) =
|
||||
state.backend.with_renderer(|renderer| {
|
||||
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
||||
});
|
||||
let snapshots = state.backend.with_renderer(|renderer| {
|
||||
capture_snapshots_on_output(&mut state.pinnacle, renderer, &output, [])
|
||||
});
|
||||
|
||||
state.pinnacle.change_output_state(
|
||||
&output,
|
||||
|
@ -1108,13 +1109,15 @@ impl output_service_server::OutputService for OutputService {
|
|||
None,
|
||||
);
|
||||
|
||||
output.with_state_mut(|op_state| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
state.pinnacle.loop_handle.clone(),
|
||||
fs_and_up_snapshots,
|
||||
under_fs_snapshots,
|
||||
);
|
||||
});
|
||||
if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
||||
output.with_state_mut(|op_state| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
state.pinnacle.loop_handle.clone(),
|
||||
fs_and_up_snapshots,
|
||||
under_fs_snapshots,
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
state.pinnacle.request_layout(&output);
|
||||
state.schedule_render(&output);
|
||||
|
|
|
@ -248,7 +248,7 @@ impl window_service_server::WindowService for WindowService {
|
|||
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| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
pinnacle.loop_handle.clone(),
|
||||
|
@ -380,7 +380,7 @@ impl window_service_server::WindowService for WindowService {
|
|||
|
||||
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| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
pinnacle.loop_handle.clone(),
|
||||
|
@ -453,7 +453,7 @@ impl window_service_server::WindowService for WindowService {
|
|||
|
||||
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| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
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 {
|
||||
Backend::Winit(winit) => with_renderer(winit.backend.renderer()),
|
||||
Backend::Udev(udev) => with_renderer(udev.renderer().as_mut()),
|
||||
Backend::Winit(winit) => Some(with_renderer(winit.backend.renderer())),
|
||||
Backend::Udev(udev) => Some(with_renderer(udev.renderer().ok()?.as_mut())),
|
||||
#[cfg(feature = "testing")]
|
||||
Backend::Dummy(_) => todo!(),
|
||||
Backend::Dummy(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -866,10 +866,8 @@ fn render_frame<'a>(
|
|||
}
|
||||
|
||||
impl Udev {
|
||||
pub fn renderer(&mut self) -> UdevRenderer<'_> {
|
||||
self.gpu_manager
|
||||
.single_renderer(&self.primary_gpu)
|
||||
.expect("failed to create multirenderer")
|
||||
pub fn renderer(&mut self) -> anyhow::Result<UdevRenderer<'_>> {
|
||||
Ok(self.gpu_manager.single_renderer(&self.primary_gpu)?)
|
||||
}
|
||||
|
||||
/// A GPU was plugged in.
|
||||
|
|
|
@ -211,7 +211,9 @@ impl CompositorHandler for State {
|
|||
if unmapped_window.is_on_active_tag() {
|
||||
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| {
|
||||
state.new_wait_layout_transaction(
|
||||
self.pinnacle.loop_handle.clone(),
|
||||
|
@ -253,23 +255,24 @@ impl CompositorHandler for State {
|
|||
}
|
||||
|
||||
if let Some(output) = window.output(&self.pinnacle) {
|
||||
let (fs_and_up_snapshots, under_fs_snapshots) =
|
||||
self.backend.with_renderer(|renderer| {
|
||||
capture_snapshots_on_output(
|
||||
&mut self.pinnacle,
|
||||
renderer,
|
||||
&output,
|
||||
[],
|
||||
let snapshots = self.backend.with_renderer(|renderer| {
|
||||
capture_snapshots_on_output(
|
||||
&mut self.pinnacle,
|
||||
renderer,
|
||||
&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);
|
||||
|
|
|
@ -21,7 +21,7 @@ impl State {
|
|||
}
|
||||
|
||||
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| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
self.pinnacle.loop_handle.clone(),
|
||||
|
@ -52,7 +52,7 @@ impl State {
|
|||
}
|
||||
|
||||
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| {
|
||||
op_state.new_wait_layout_transaction(
|
||||
self.pinnacle.loop_handle.clone(),
|
||||
|
|
|
@ -73,7 +73,7 @@ impl XdgShellHandler for State {
|
|||
if let Some(output) = window.output(&self.pinnacle) {
|
||||
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| {
|
||||
state.new_wait_layout_transaction(
|
||||
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()));
|
||||
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| {
|
||||
state.new_wait_layout_transaction(
|
||||
self.pinnacle.loop_handle.clone(),
|
||||
|
@ -426,7 +426,7 @@ impl State {
|
|||
self.pinnacle.remove_window(&win, false);
|
||||
|
||||
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| {
|
||||
state.new_wait_layout_transaction(
|
||||
self.pinnacle.loop_handle.clone(),
|
||||
|
|
|
@ -267,7 +267,7 @@ impl State {
|
|||
.fulfilled_requests
|
||||
.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, [])
|
||||
});
|
||||
|
||||
|
@ -278,7 +278,7 @@ impl State {
|
|||
output.with_state_mut(|state| {
|
||||
if let Some(ts) = state.layout_transaction.as_mut() {
|
||||
ts.update_pending(pending_windows);
|
||||
} else {
|
||||
} else if let Some((fs_and_up_snapshots, under_fs_snapshots)) = snapshots {
|
||||
state.layout_transaction = Some(LayoutTransaction::new(
|
||||
self.pinnacle.loop_handle.clone(),
|
||||
fs_and_up_snapshots,
|
||||
|
|
Loading…
Add table
Reference in a new issue