1786032420

This commit is contained in:
2026-08-06 18:07:00 +02:00
parent a79b35dff2
commit 43e1d9873f

View File

@@ -1,13 +1,10 @@
use std::cell::OnceCell;
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
use evdev::KeyCode; use evdev::KeyCode;
use linfb::shape::Color; use linfb::shape::Color;
use slint::platform::software_renderer::{MinimalSoftwareWindow, RepaintBufferType, Rgb565Pixel}; use slint::platform::software_renderer::{MinimalSoftwareWindow, RepaintBufferType, Rgb565Pixel};
use slint::platform::{EventLoopProxy, Platform, WindowEvent}; use slint::platform::{Platform, WindowEvent};
use slint::{EventLoopError, LogicalPosition, PhysicalSize, Rgb8Pixel, WindowSize}; use slint::{LogicalPosition, PhysicalSize, Rgb8Pixel, WindowSize};
use self::input::InputState; use self::input::InputState;
use self::screen::Screen; use self::screen::Screen;
@@ -15,8 +12,6 @@ use self::screen::Screen;
mod input; mod input;
mod screen; mod screen;
static EVENTLOOP_PROXY: OnceCell<Box<dyn EventLoopProxy + 'static>> = OnceCell::new();
pub struct Context { pub struct Context {
pub screen: Screen, pub screen: Screen,
pub input: InputState, pub input: InputState,
@@ -106,52 +101,52 @@ impl Platform for Trekstor {
} }
} }
fn new_event_loop_proxy(&self) -> Option<Box<dyn EventLoopProxy>> { // fn new_event_loop_proxy(&self) -> Option<Box<dyn EventLoopProxy>> {
// struct Proxy( // // struct Proxy(
// winit::event_loop::EventLoopProxy<SlintEvent>, // // winit::event_loop::EventLoopProxy<SlintEvent>,
// Arc<AtomicUsize>, // // Arc<AtomicUsize>,
// ); // // );
// impl EventLoopProxy for Proxy { // // impl EventLoopProxy for Proxy {
// fn quit_event_loop(&self) -> Result<(), EventLoopError> { // // fn quit_event_loop(&self) -> Result<(), EventLoopError> {
// Err(EventLoopError::EventLoopTerminated) // // Err(EventLoopError::EventLoopTerminated)
// // }
// // fn invoke_from_event_loop(
// // &self,
// // event: Box<dyn FnOnce() + Send>,
// // ) -> Result<(), EventLoopError> {
// // self.0
// // .send_event(SlintEvent(CustomEvent::UserEvent(event)))
// // .map_err(|_| EventLoopError::EventLoopTerminated)
// // }
// // }
// // Some(Box::new(Proxy(
// // self.shared_data.event_loop_proxy.clone(),
// // Arc::clone(&self.shared_data.event_loop_generation),
// // )))
// None
// } // }
// fn invoke_from_event_loop( // fn click_interval(&self) -> core::time::Duration {
// &self, // // 500ms is the default delay according to https://en.wikipedia.org/wiki/Double-click#Speed_and_timing
// event: Box<dyn FnOnce() + Send>, // core::time::Duration::from_millis(500)
// ) -> Result<(), EventLoopError> {
// self.0
// .send_event(SlintEvent(CustomEvent::UserEvent(event)))
// .map_err(|_| EventLoopError::EventLoopTerminated)
// } // }
// fn cursor_flash_cycle(&self) -> core::time::Duration {
// core::time::Duration::from_millis(1000)
// } // }
// Some(Box::new(Proxy(
// self.shared_data.event_loop_proxy.clone(),
// Arc::clone(&self.shared_data.event_loop_generation),
// )))
None
}
fn click_interval(&self) -> core::time::Duration { // fn set_clipboard_text(&self, _text: &str, _clipboard: slint::platform::Clipboard) {}
// 500ms is the default delay according to https://en.wikipedia.org/wiki/Double-click#Speed_and_timing
core::time::Duration::from_millis(500)
}
fn cursor_flash_cycle(&self) -> core::time::Duration { // fn clipboard_text(&self, _clipboard: slint::platform::Clipboard) -> Option<String> {
core::time::Duration::from_millis(1000) // None
} // }
fn set_clipboard_text(&self, _text: &str, _clipboard: slint::platform::Clipboard) {} // fn debug_log(&self, _arguments: core::fmt::Arguments) {
// crate::debug_log::default_log_message(_arguments);
// }
fn clipboard_text(&self, _clipboard: slint::platform::Clipboard) -> Option<String> { // fn open_url(&self, _url: &str) -> Result<(), slint::PlatformError> {
None // Err(slint::PlatformError::Unsupported)
} // }
fn debug_log(&self, _arguments: core::fmt::Arguments) {
crate::debug_log::default_log_message(_arguments);
}
fn open_url(&self, _url: &str) -> Result<(), slint::PlatformError> {
Err(slint::PlatformError::Unsupported)
}
} }