Compare commits

..

No commits in common. "8e63e5210ce711aa5793350979aab83c00ac70cc" and "20623284ed86adaaf904ee419ca98995650394a5" have entirely different histories.

1 changed files with 5 additions and 18 deletions

View File

@ -128,12 +128,12 @@ impl Animation for CrossFade {
let frames = (now - self.start_time).as_secs_f64() * FPS as f64; let frames = (now - self.start_time).as_secs_f64() * FPS as f64;
let alpha = alpha_rate * frames as f64; let alpha = alpha_rate * frames as f64;
let text_display = Text::new(self.old_text.clone(), context, 64., width); let text_display = Text::new(self.old_text.clone(), context, 32., width);
let _ = context.move_to(0., text_display.extents().height()); let _ = context.move_to(0., text_display.extents().height());
let _ = context.set_source_rgba(PURPLE.0, PURPLE.1, PURPLE.2, 1. - alpha); let _ = context.set_source_rgba(PURPLE.0, PURPLE.1, PURPLE.2, 1. - alpha);
text_display.draw(); text_display.draw();
let text_display = Text::new(self.new_text.clone(), context, 64., width); let text_display = Text::new(self.new_text.clone(), context, 32., width);
let _ = context.move_to(0., text_display.extents().height()); let _ = context.move_to(0., text_display.extents().height());
let _ = context.set_source_rgba(PURPLE.0, PURPLE.1, PURPLE.2, alpha); let _ = context.set_source_rgba(PURPLE.0, PURPLE.1, PURPLE.2, alpha);
text_display.draw(); text_display.draw();
@ -367,29 +367,20 @@ fn main() {
}); });
app.connect_activate(move |app| { app.connect_activate(move |app| {
let window = gtk::ApplicationWindow::new(app);
let screen = CyberScreen::new(script.read().unwrap().clone()); let screen = CyberScreen::new(script.read().unwrap().clone());
let events = EventControllerKey::new(); let events = EventControllerKey::new();
events.connect_key_released({ events.connect_key_released({
let app = app.clone();
let window = window.clone();
let screen = screen.clone(); let screen = screen.clone();
move |_, key, _, _| { move |_, key, _, _| {
let name = key if key.name() == Some(GString::from("Right")) {
.name() screen.next_page();
.map(|s| s.as_str().to_owned())
.unwrap_or("".to_owned());
match name.as_ref() {
"Right" => screen.next_page(),
"q" => app.quit(),
"Escape" => window.unfullscreen(),
_ => {}
} }
} }
}); });
let window = gtk::ApplicationWindow::new(app);
window.add_controller(events); window.add_controller(events);
window.set_child(Some(&screen)); window.set_child(Some(&screen));
@ -397,10 +388,6 @@ fn main() {
window.set_height_request(600); window.set_height_request(600);
window.present(); window.present();
window.connect_maximized_notify(|window| {
window.fullscreen();
});
let _ = glib::spawn_future_local({ let _ = glib::spawn_future_local({
let screen = screen.clone(); let screen = screen.clone();
async move { async move {