Release v0.2.4

This commit is contained in:
burnintuna 2026-07-23 21:03:11 +09:00
parent 86f3185c59
commit cbc762fb4c
5 changed files with 43 additions and 8 deletions

View file

@ -794,9 +794,10 @@ impl ViewerController {
let fullscreen_keys = gtk::EventControllerKey::new();
fullscreen_keys.set_propagation_phase(gtk::PropagationPhase::Capture);
let controller = Rc::downgrade(self);
fullscreen_keys.connect_key_pressed(move |_, _, _, _| {
fullscreen_keys.connect_key_pressed(move |_, key, _, _| {
if let Some(controller) = controller.upgrade()
&& controller.window.is_fullscreen()
&& fullscreen_key_reveals_ui(key)
{
controller.show_fullscreen_ui_temporarily();
}
@ -2115,9 +2116,10 @@ impl MediaViewerController {
let fullscreen_keys = gtk::EventControllerKey::new();
fullscreen_keys.set_propagation_phase(gtk::PropagationPhase::Capture);
let controller = Rc::downgrade(self);
fullscreen_keys.connect_key_pressed(move |_, _, _, _| {
fullscreen_keys.connect_key_pressed(move |_, key, _, _| {
if let Some(controller) = controller.upgrade()
&& controller.window.is_fullscreen()
&& fullscreen_key_reveals_ui(key)
{
controller.show_fullscreen_ui_temporarily();
}
@ -2824,6 +2826,20 @@ fn file_list_typeahead_select(
glib::Propagation::Stop
}
fn fullscreen_key_reveals_ui(key: gdk::Key) -> bool {
!matches!(
key,
gdk::Key::Left
| gdk::Key::Right
| gdk::Key::Up
| gdk::Key::Down
| gdk::Key::KP_Left
| gdk::Key::KP_Right
| gdk::Key::KP_Up
| gdk::Key::KP_Down
)
}
fn find_sibling_prefix(files: &[SiblingFile], query: &str, start: usize) -> Option<usize> {
if files.is_empty() {
return None;
@ -3332,6 +3348,24 @@ mod tests {
assert_eq!(find_sibling_prefix(&files, "b", 3), Some(1));
}
#[test]
fn fullscreen_direction_keys_do_not_reveal_controls() {
for key in [
gdk::Key::Left,
gdk::Key::Right,
gdk::Key::Up,
gdk::Key::Down,
gdk::Key::KP_Left,
gdk::Key::KP_Right,
gdk::Key::KP_Up,
gdk::Key::KP_Down,
] {
assert!(!fullscreen_key_reveals_ui(key));
}
assert!(fullscreen_key_reveals_ui(gdk::Key::bracketleft));
assert!(fullscreen_key_reveals_ui(gdk::Key::bracketright));
}
#[test]
fn navigation_boundary_messages_match_direction() {
assert_eq!(