Add touchscreen support with onscreen keyboard #1

Merged
stjet merged 21 commits from dev into master 2025-02-10 05:03:49 +00:00
Showing only changes of commit 1f394d4068 - Show all commits

View File

@@ -134,7 +134,7 @@ pub fn init(framebuffer: Framebuffer, framebuffer_info: FramebufferInfo) {
//top right, clear //top right, clear
//useful sometimes, I think. //useful sometimes, I think.
if x2 > dimensions[0] - 100 && y2 < 100 { if x2 > dimensions[0] - 100 && y2 < 100 {
tx1.send(ThreadMessage::Clear); tx1.send(ThreadMessage::Clear).unwrap();
} }
tx1.send(ThreadMessage::Touch(x2, y2)).unwrap(); tx1.send(ThreadMessage::Touch(x2, y2)).unwrap();
x = None; x = None;
@@ -665,10 +665,14 @@ impl WindowManager {
} }
pub fn handle_request(&mut self, request: WindowManagerRequest) { pub fn handle_request(&mut self, request: WindowManagerRequest) {
let focused_index = self.get_focused_index().unwrap(); let subtype = if let Some(focused_index) = self.get_focused_index() {
let subtype = self.window_infos[focused_index].window_like.subtype(); Some(self.window_infos[focused_index].window_like.subtype())
} else {
None
};
match request { match request {
WindowManagerRequest::OpenWindow(w) => { WindowManagerRequest::OpenWindow(w) => {
let subtype = subtype.unwrap();
if subtype != WindowLikeType::Taskbar && subtype != WindowLikeType::StartMenu { if subtype != WindowLikeType::Taskbar && subtype != WindowLikeType::StartMenu {
return; return;
} }
@@ -700,6 +704,7 @@ impl WindowManager {
self.taskbar_update_windows(); self.taskbar_update_windows();
}, },
WindowManagerRequest::CloseStartMenu => { WindowManagerRequest::CloseStartMenu => {
let subtype = subtype.unwrap();
if subtype != WindowLikeType::Taskbar && subtype != WindowLikeType::StartMenu { if subtype != WindowLikeType::Taskbar && subtype != WindowLikeType::StartMenu {
return; return;
} }
@@ -709,13 +714,13 @@ impl WindowManager {
} }
}, },
WindowManagerRequest::Unlock => { WindowManagerRequest::Unlock => {
if subtype != WindowLikeType::LockScreen { if subtype.unwrap() != WindowLikeType::LockScreen {
return; return;
} }
self.unlock(); self.unlock();
}, },
WindowManagerRequest::Lock => { WindowManagerRequest::Lock => {
if subtype != WindowLikeType::StartMenu { if subtype.unwrap() != WindowLikeType::StartMenu {
return; return;
} }
self.lock(); self.lock();