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