Add panel-wide styles and the Morph hub (#26)
Panel appearance now applies to the whole panel, with seven styles: Floating, Capsules, Notch, Edge to edge, Fused islands, Adaptive and Morph. - Share composition, geometry, and motion through the renderer-independent `ferese-panel` crate, including native materials, input regions, and Settings previews. - Add the Morph hub with media, calendar, notifications, controls, workspace previews, hover feedback, and attached mode. Keep recording and low-battery status visible and respect window clearance. - Cache workspace preview geometry, draw thumbnails directly, centralize Morph transitions, and keep rendering settings local to each shell instance. - Put Record Screen in the Morph header and show the display control only when an external monitor is connected. Update panel documentation, the desktop screenshot, and native check style names. Local validation included 660 compositor tests, 191 shell tests, isolated preview-cache checks, GPU Morph captures at 1×/1.25×/1.5×, formatting, and Clippy with warnings denied. The final header change passed all 23 Morph tests. Release workflow jobs are skipped for this PR.
This commit is contained in:
1 parent
42c3b290dd
commit
e22f0ebef9
131 files changed
+12562
-1634
No files matched your search
@@ -48,15 +48,15 @@ pub(crate) struct WorkspaceSnapshot {
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct WindowSnapshot {
|
||||
#[cfg_attr(not(test), expect(dead_code, reason = "Retained for window-targeted shell views."))]
|
||||
pub(crate) id: u64,
|
||||
pub(crate) workspace: u64,
|
||||
pub(crate) geometry: Option<[f64; 4]>,
|
||||
pub(crate) app_id: String,
|
||||
pub(crate) title: String,
|
||||
pub(crate) focused: bool,
|
||||
#[cfg_attr(not(test), expect(dead_code, reason = "The current bar does not display urgency."))]
|
||||
pub(crate) urgent: bool,
|
||||
pub(crate) fullscreen: bool,
|
||||
pub(crate) maximized: bool,
|
||||
#[cfg_attr(
|
||||
not(test),
|
||||
expect(dead_code, reason = "The current bar does not display window placement.")
|
||||
@@ -136,7 +136,7 @@ impl ShellControl {
|
||||
let connection = control_connection()?;
|
||||
let (globals, mut queue) = registry_queue_init::<ControlState>(&connection)?;
|
||||
let qh = queue.handle();
|
||||
let manager = globals.bind::<FereseShellManagerV1, _, _>(&qh, 4..=6, ())?;
|
||||
let manager = globals.bind::<FereseShellManagerV1, _, _>(&qh, 7..=8, ())?;
|
||||
let shell = manager.get_shell(&qh, ());
|
||||
let (sender, updates) = mpsc::channel();
|
||||
let wake = Wake(Arc::new(tokio::sync::Notify::new()));
|
||||
@@ -194,6 +194,16 @@ impl ShellControl {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn move_window_to_workspace(&self, window: u64, workspace: u64) {
|
||||
if self.shell.version() < 8 {
|
||||
return;
|
||||
}
|
||||
let (hi, lo) = split_id(window);
|
||||
let (workspace_hi, workspace_lo) = split_id(workspace);
|
||||
self.shell.move_window_to_workspace(hi, lo, workspace_hi, workspace_lo);
|
||||
let _ = self.connection.flush();
|
||||
}
|
||||
|
||||
pub(crate) fn activate_workspace(&self, id: u64) {
|
||||
let (hi, lo) = split_id(id);
|
||||
|
||||
@@ -375,14 +385,36 @@ impl Dispatch<FereseShellV1, ()> for ControlState {
|
||||
state.pending.windows.push(WindowSnapshot {
|
||||
id: join_id(window_hi, window_lo),
|
||||
workspace: join_id(workspace_hi, workspace_lo),
|
||||
geometry: None,
|
||||
app_id,
|
||||
title,
|
||||
focused: flags.contains(ferese_shell_v1::WindowState::Focused),
|
||||
urgent: flags.contains(ferese_shell_v1::WindowState::Urgent),
|
||||
fullscreen: flags.contains(ferese_shell_v1::WindowState::Fullscreen),
|
||||
maximized: flags.contains(ferese_shell_v1::WindowState::Maximized),
|
||||
floating: flags.contains(ferese_shell_v1::WindowState::Floating),
|
||||
});
|
||||
}
|
||||
ferese_shell_v1::Event::WindowGeometry {
|
||||
window_hi,
|
||||
window_lo,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
} => {
|
||||
if [x, y, width, height].iter().all(|n| n.is_finite())
|
||||
&& width > 0.
|
||||
&& height > 0.
|
||||
&& let Some(window) = state
|
||||
.pending
|
||||
.windows
|
||||
.last_mut()
|
||||
.filter(|window| window.id == join_id(window_hi, window_lo))
|
||||
{
|
||||
window.geometry = Some([x, y, width, height]);
|
||||
}
|
||||
}
|
||||
ferese_shell_v1::Event::Capabilities { .. } => {
|
||||
let _ = state.sender.send(ControlUpdate::MonitorsChanged);
|
||||
}
|
||||
@@ -564,6 +596,110 @@ mod tests {
|
||||
assert_ne!(tiled.id, floating.id);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn geometry_is_attached_to_its_window_and_published_only_with_the_complete_snapshot() {
|
||||
let (control, mut state, queue, _peer) = control_fixture();
|
||||
dispatch_event(
|
||||
&control,
|
||||
&mut state,
|
||||
&queue,
|
||||
ferese_shell_v1::Event::SnapshotBegin { serial: 8 },
|
||||
);
|
||||
let id = 0x1234_5678_9abc_def0;
|
||||
dispatch_event(&control, &mut state, &queue, window_event(id, 0));
|
||||
let (window_hi, window_lo) = split_id(id);
|
||||
dispatch_event(
|
||||
&control,
|
||||
&mut state,
|
||||
&queue,
|
||||
ferese_shell_v1::Event::WindowGeometry {
|
||||
window_hi,
|
||||
window_lo,
|
||||
x: -640.,
|
||||
y: 20.,
|
||||
width: 620.,
|
||||
height: 480.,
|
||||
},
|
||||
);
|
||||
// Invalid geometry must not replace a valid rectangle.
|
||||
dispatch_event(
|
||||
&control,
|
||||
&mut state,
|
||||
&queue,
|
||||
ferese_shell_v1::Event::WindowGeometry {
|
||||
window_hi,
|
||||
window_lo,
|
||||
x: 0.,
|
||||
y: 0.,
|
||||
width: -1.,
|
||||
height: 480.,
|
||||
},
|
||||
);
|
||||
assert!(control.poll().snapshot.is_none());
|
||||
dispatch_event(
|
||||
&control,
|
||||
&mut state,
|
||||
&queue,
|
||||
ferese_shell_v1::Event::SnapshotEnd { serial: 8 },
|
||||
);
|
||||
assert_eq!(
|
||||
control.poll().snapshot.unwrap().windows[0].geometry,
|
||||
Some([-640., 20., 620., 480.])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn geometry_stream_uses_only_the_preceding_window() {
|
||||
let (control, mut state, queue, _peer) = control_fixture();
|
||||
dispatch_event(
|
||||
&control,
|
||||
&mut state,
|
||||
&queue,
|
||||
ferese_shell_v1::Event::SnapshotBegin { serial: 9 },
|
||||
);
|
||||
for id in 1..=512 {
|
||||
dispatch_event(&control, &mut state, &queue, window_event(id, 0));
|
||||
let (window_hi, window_lo) = split_id(id);
|
||||
dispatch_event(
|
||||
&control,
|
||||
&mut state,
|
||||
&queue,
|
||||
ferese_shell_v1::Event::WindowGeometry {
|
||||
window_hi,
|
||||
window_lo,
|
||||
x: id as f64,
|
||||
y: 0.,
|
||||
width: 50.,
|
||||
height: 40.,
|
||||
},
|
||||
);
|
||||
}
|
||||
// A malformed late event must not overwrite an earlier window.
|
||||
dispatch_event(
|
||||
&control,
|
||||
&mut state,
|
||||
&queue,
|
||||
ferese_shell_v1::Event::WindowGeometry {
|
||||
window_hi: 0,
|
||||
window_lo: 1,
|
||||
x: -1.,
|
||||
y: 0.,
|
||||
width: 50.,
|
||||
height: 40.,
|
||||
},
|
||||
);
|
||||
dispatch_event(
|
||||
&control,
|
||||
&mut state,
|
||||
&queue,
|
||||
ferese_shell_v1::Event::SnapshotEnd { serial: 9 },
|
||||
);
|
||||
let snapshot = control.poll().snapshot.unwrap();
|
||||
for window in snapshot.windows {
|
||||
assert_eq!(window.geometry, Some([window.id as f64, 0., 50., 40.]));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn known_window_flags_survive_unknown_future_bits() {
|
||||
use ferese_shell_v1::WindowState as Flags;
|
||||
@@ -575,14 +711,15 @@ mod tests {
|
||||
wayland_client::WEnum::Unknown(_)
|
||||
));
|
||||
let cases = [
|
||||
(known.bits(), [true, true, true, true]),
|
||||
(known.bits() | future, [true, true, true, true]),
|
||||
(Flags::Focused.bits() | future, [true, false, false, false]),
|
||||
(Flags::Urgent.bits() | future, [false, true, false, false]),
|
||||
(Flags::Fullscreen.bits() | future, [false, false, true, false]),
|
||||
(Flags::Floating.bits() | future, [false, false, false, true]),
|
||||
(future, [false; 4]),
|
||||
(0, [false; 4]),
|
||||
(known.bits(), [true, true, true, true, false]),
|
||||
(known.bits() | future, [true, true, true, true, false]),
|
||||
(Flags::Focused.bits() | future, [true, false, false, false, false]),
|
||||
(Flags::Urgent.bits() | future, [false, true, false, false, false]),
|
||||
(Flags::Fullscreen.bits() | future, [false, false, true, false, false]),
|
||||
(Flags::Floating.bits() | future, [false, false, false, true, false]),
|
||||
(Flags::Maximized.bits() | future, [false, false, false, false, true]),
|
||||
(future, [false; 5]),
|
||||
(0, [false; 5]),
|
||||
];
|
||||
dispatch_event(
|
||||
&control,
|
||||
@@ -602,7 +739,13 @@ mod tests {
|
||||
let snapshot = control.poll().snapshot.unwrap();
|
||||
for (window, (_, expected)) in snapshot.windows.iter().zip(cases) {
|
||||
assert_eq!(
|
||||
[window.focused, window.urgent, window.fullscreen, window.floating],
|
||||
[
|
||||
window.focused,
|
||||
window.urgent,
|
||||
window.fullscreen,
|
||||
window.floating,
|
||||
window.maximized
|
||||
],
|
||||
expected
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user