bunch of things

This commit is contained in:
Erica Z 2024-11-13 20:54:05 +01:00
parent 29774b136b
commit 7ad9096277
2 changed files with 25 additions and 46 deletions

View file

@ -31,10 +31,6 @@ template $AudreyUiPlayQueue: Adw.Bin {
Picture {
valign: center;
styles [
"frame"
]
halign: center;
paintable: bind template.playing-cover-art;
}

View file

@ -270,51 +270,34 @@ mod imp {
// only send property change notifications after the event queue is drained
let freeze_notify = window.freeze_notify();
let listener = loop {
let listener = window.imp().mpv.wakeup_listener();
let listener = window.imp().mpv.wakeup_listener();
while let Some(event) = window.imp().mpv.wait_event(0.0) {
use crate::mpv::Event;
while let Some(event) = window.imp().mpv.wait_event(0.0) {
use crate::mpv::Event;
match event {
Event::PropertyChange(event) => {
window.imp().on_property_change(event)
}
Event::Hook(event) => window.imp().on_hook(event),
Event::LogMessage(event) => window.imp().on_log_message(event),
match event {
Event::PropertyChange(event) => window.imp().on_property_change(event),
Event::Hook(event) => window.imp().on_hook(event),
Event::LogMessage(event) => window.imp().on_log_message(event),
Event::StartFile(_) => window.imp().on_start_file(),
Event::FileLoaded => window.imp().on_file_loaded(),
Event::PlaybackRestart => window.imp().on_playback_restart(),
Event::Seek => window.imp().on_seek(),
Event::EndFile(event) => window.imp().on_end_file(event),
Event::StartFile(_) => window.imp().on_start_file(),
Event::FileLoaded => window.imp().on_file_loaded(),
Event::PlaybackRestart => window.imp().on_playback_restart(),
Event::Seek => window.imp().on_seek(),
Event::EndFile(event) => window.imp().on_end_file(event),
Event::Unknown(_) => {
// either deprecated or future, ignore
}
Event::AudioReconfig => {
// "This is relatively uninteresting, because there is no such thing as audio output embedding."
// ^ ignore
}
_ => event!(Level::DEBUG, "unhandled {event:?}"),
}
}
match window.imp().state.get() {
State::FileLoaded | State::FileEnded => {
// really annoying intermediary states we're not really interested
// in seeing outside of this loop
// just block until it's done lol
use event_listener::Listener;
event!(Level::INFO, "blocking");
listener.wait();
Event::Unknown(_) => {
// either deprecated or future, ignore
}
_ => break listener,
Event::AudioReconfig => {
// "This is relatively uninteresting, because there is no such thing as audio output embedding."
// ^ ignore
}
_ => event!(Level::DEBUG, "unhandled {event:?}"),
}
};
}
// send property change notifications now
drop(freeze_notify);
@ -649,6 +632,9 @@ mod imp {
self.duration.set(0.0);
event!(Level::DEBUG, "duration is now 0 (idle active)");
self.obj().notify("duration");
self.obj().set_playing_cover_art(None::<gdk::Texture>);
self.obj().set_background(None::<gdk::Texture>);
}
fn on_start_file(&self) {
@ -691,7 +677,7 @@ mod imp {
// from g4music
let snapshot = gtk::Snapshot::new();
snapshot.push_blur(512.0 * 0.2);
snapshot.push_blur(512.0 * 0.1);
snapshot.push_opacity(0.5);
texture.snapshot(&snapshot, 512.0, 512.0);
snapshot.pop();
@ -794,9 +780,6 @@ mod imp {
// cancel queued seek always
self.queued_seek.set(None);
self.obj().set_playing_cover_art(None::<gdk::Texture>);
self.obj().set_background(None::<gdk::Texture>);
}
#[template_callback]