From cffa581fc57342024fb68dd58cb11029730b18ce Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Wed, 19 Jun 2024 12:42:14 +0800 Subject: [PATCH] fix: typo induce base workflows --- .github/dependabot.yml | 33 ++++++++++ .github/workflows/typos.yml | 19 ++++++ Cargo.lock | 2 +- README.md | 2 +- iced_examples/counter_lock/src/main.rs | 4 +- iced_examples/counter_muti/Cargo.toml | 2 +- iced_examples/counter_muti/src/main.rs | 4 +- iced_layershell/src/application.rs | 2 +- iced_layershell/src/event.rs | 6 +- iced_layershell/src/lib.rs | 16 ++--- iced_layershell/src/multi_window.rs | 26 ++++---- iced_sessionlock/src/event.rs | 7 +- iced_sessionlock/src/lib.rs | 16 ++--- iced_sessionlock/src/multi_window.rs | 26 ++++---- layershellev/README.md | 2 +- layershellev/src/events.rs | 6 +- layershellev/src/lib.rs | 66 +++++++++---------- sessionlockev/README.md | 2 +- sessionlockev/src/events.rs | 6 +- sessionlockev/src/lib.rs | 46 ++++++------- starcolorkeyboard/src/consts.rs | 4 +- starcolorkeyboard/src/main.rs | 10 +-- starcolorkeyboard/src/pangoui.rs | 10 +-- starcolorkeyboard/src/pangoui/mainkeyboard.rs | 8 +-- .../src/pangoui/smallkeyboard.rs | 12 ++-- 25 files changed, 195 insertions(+), 142 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/typos.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2193598 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,33 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +# docs +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "weekly" + # We release on Tuesdays and open dependabot PRs will rebase after the + # version bump and thus consume unnecessary workers during release, thus + # let's open new ones on Wednesday + day: "wednesday" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-patch"] + groups: + # Only update polars as a whole as there are many subcrates that need to + # be updated at once. We explicitly depend on some of them, so batch their + # updates to not take up dependabot PR slots with dysfunctional PRs + polars: + patterns: + - "polars" + - "polars-*" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "wednesday" diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 0000000..a55af98 --- /dev/null +++ b/.github/workflows/typos.yml @@ -0,0 +1,19 @@ +--- +# yamllint disable rule:line-length +name: check_typos + +on: # yamllint disable-line rule:truthy + push: + pull_request: + branches: + - '**' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: typos-action + uses: crate-ci/typos@v1.1.7 diff --git a/Cargo.lock b/Cargo.lock index 403f188..3baaf07 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -515,7 +515,7 @@ dependencies = [ ] [[package]] -name = "counter_muti" +name = "counter_multi" version = "0.2.4" dependencies = [ "iced", diff --git a/README.md b/README.md index 7a71d56..1f37976 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ Take winit as reference a lot, to make easilier program on layershell and ext-session-lock. -This project bind `ext-session-lock` and `layershell` with the simillar way of winit, which storing message and handle it in callback +This project bind `ext-session-lock` and `layershell` with the similar way of winit, which storing message and handle it in callback diff --git a/iced_examples/counter_lock/src/main.rs b/iced_examples/counter_lock/src/main.rs index b773148..ab6dd4f 100644 --- a/iced_examples/counter_lock/src/main.rs +++ b/iced_examples/counter_lock/src/main.rs @@ -3,7 +3,7 @@ use iced::{event, Alignment, Command, Element, Event, Length, Theme}; use iced_sessionlock::actions::UnLockAction; use iced_sessionlock::settings::Settings; -use iced_sessionlock::MutiApplication; +use iced_sessionlock::MultiApplication; pub fn main() -> Result<(), iced_sessionlock::Error> { Counter::run(Settings::default()) @@ -23,7 +23,7 @@ enum Message { Lock, } -impl MutiApplication for Counter { +impl MultiApplication for Counter { type Message = Message; type Flags = (); type Theme = Theme; diff --git a/iced_examples/counter_muti/Cargo.toml b/iced_examples/counter_muti/Cargo.toml index f5ac033..128fa4d 100644 --- a/iced_examples/counter_muti/Cargo.toml +++ b/iced_examples/counter_muti/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "counter_muti" +name = "counter_multi" authors.workspace = true edition.workspace = true version.workspace = true diff --git a/iced_examples/counter_muti/src/main.rs b/iced_examples/counter_muti/src/main.rs index 4f21728..b3b83a2 100644 --- a/iced_examples/counter_muti/src/main.rs +++ b/iced_examples/counter_muti/src/main.rs @@ -4,7 +4,7 @@ use iced::{event, Alignment, Command, Element, Event, Length, Theme}; use iced_layershell::actions::{LayershellCustomActions, LayershellCustomActionsWithId}; use iced_layershell::reexport::Anchor; use iced_layershell::settings::{LayerShellSettings, Settings}; -use iced_layershell::MutiApplication; +use iced_layershell::MultiApplication; pub fn main() -> Result<(), iced_layershell::Error> { Counter::run(Settings { layer_settings: LayerShellSettings { @@ -39,7 +39,7 @@ enum Message { IcedEvent(Event), } -impl MutiApplication for Counter { +impl MultiApplication for Counter { type Message = Message; type Flags = (); type Theme = Theme; diff --git a/iced_layershell/src/application.rs b/iced_layershell/src/application.rs index 196a013..3e27f9c 100644 --- a/iced_layershell/src/application.rs +++ b/iced_layershell/src/application.rs @@ -411,7 +411,7 @@ async fn run_instance( custom_actions.push(LayerShellActions::Mouse(new_mouse_interaction)); mouse_interaction = new_mouse_interaction; } - // TODO: check mosue_interaction + // TODO: check mouse_interaction debug.render_started(); diff --git a/iced_layershell/src/event.rs b/iced_layershell/src/event.rs index 03725b4..78dfccc 100644 --- a/iced_layershell/src/event.rs +++ b/iced_layershell/src/event.rs @@ -68,13 +68,13 @@ pub enum IcedLayerEvent { #[allow(unused)] #[derive(Debug)] -pub struct MutiWindowIcedLayerEvent(pub Option, pub IcedLayerEvent); +pub struct MultiWindowIcedLayerEvent(pub Option, pub IcedLayerEvent); impl From<(Option, IcedLayerEvent)> - for MutiWindowIcedLayerEvent + for MultiWindowIcedLayerEvent { fn from((id, message): (Option, IcedLayerEvent)) -> Self { - MutiWindowIcedLayerEvent(id, message) + MultiWindowIcedLayerEvent(id, message) } } diff --git a/iced_layershell/src/lib.rs b/iced_layershell/src/lib.rs index e9a553e..9583757 100644 --- a/iced_layershell/src/lib.rs +++ b/iced_layershell/src/lib.rs @@ -202,7 +202,7 @@ where } } -pub trait MutiApplication: Sized { +pub trait MultiApplication: Sized { /// The [`Executor`] that will run commands and subscriptions. /// /// The [default executor] can be a good starting point! @@ -320,18 +320,18 @@ pub trait MutiApplication: Sized { ..iced_renderer::Settings::default() }; - multi_window::run::, Self::Executor, iced_renderer::Compositor>( + multi_window::run::, Self::Executor, iced_renderer::Compositor>( settings, renderer_settings, ) } } -struct MutiInstance(A); +struct MultiInstance(A); -impl iced_runtime::multi_window::Program for MutiInstance +impl iced_runtime::multi_window::Program for MultiInstance where - A: MutiApplication, + A: MultiApplication, { type Message = A::Message; type Theme = A::Theme; @@ -349,16 +349,16 @@ where } } -impl multi_window::Application for MutiInstance +impl multi_window::Application for MultiInstance where - A: MutiApplication, + A: MultiApplication, { type Flags = A::Flags; fn new(flags: Self::Flags) -> (Self, Command) { let (app, command) = A::new(flags); - (MutiInstance(app), command) + (MultiInstance(app), command) } fn namespace(&self) -> String { diff --git a/iced_layershell/src/multi_window.rs b/iced_layershell/src/multi_window.rs index d22c4b8..8452b73 100644 --- a/iced_layershell/src/multi_window.rs +++ b/iced_layershell/src/multi_window.rs @@ -30,7 +30,7 @@ use layershellev::{ use futures::{channel::mpsc, SinkExt, StreamExt}; use crate::{ - event::{IcedLayerEvent, MutiWindowIcedLayerEvent}, + event::{IcedLayerEvent, MultiWindowIcedLayerEvent}, proxy::IcedProxy, settings::Settings, }; @@ -179,7 +179,7 @@ where ); let (mut event_sender, event_receiver) = - mpsc::unbounded::>(); + mpsc::unbounded::>(); let (control_sender, mut control_receiver) = mpsc::unbounded::>(); let mut instance = Box::pin(run_instance::( @@ -212,7 +212,7 @@ where match message { DispatchMessage::RequestRefresh { width, height } => { event_sender - .start_send(MutiWindowIcedLayerEvent( + .start_send(MultiWindowIcedLayerEvent( id, IcedLayerEvent::RequestRefreshWithWrapper { width: *width, @@ -238,7 +238,7 @@ where } event_sender - .start_send(MutiWindowIcedLayerEvent(id, message.into())) + .start_send(MultiWindowIcedLayerEvent(id, message.into())) .expect("Cannot send"); } LayerEvent::NormalDispatch => match &key_event { @@ -247,12 +247,12 @@ where let event = IcedLayerEvent::Window(*windowevent); if key_ping_count > 70 && key_ping_count < 74 { event_sender - .start_send(MutiWindowIcedLayerEvent(id, event)) + .start_send(MultiWindowIcedLayerEvent(id, event)) .expect("Cannot send"); key_ping_count = 0; } else { event_sender - .start_send(MutiWindowIcedLayerEvent( + .start_send(MultiWindowIcedLayerEvent( id, IcedLayerEvent::NormalUpdate, )) @@ -267,13 +267,13 @@ where } None => { event_sender - .start_send(MutiWindowIcedLayerEvent(id, IcedLayerEvent::NormalUpdate)) + .start_send(MultiWindowIcedLayerEvent(id, IcedLayerEvent::NormalUpdate)) .expect("Cannot send"); } }, LayerEvent::UserEvent(event) => { event_sender - .start_send(MutiWindowIcedLayerEvent( + .start_send(MultiWindowIcedLayerEvent( id, IcedLayerEvent::UserEvent(event), )) @@ -342,7 +342,7 @@ async fn run_instance( mut runtime: Runtime, A::Message>, mut proxy: IcedProxy, mut debug: Debug, - mut event_receiver: mpsc::UnboundedReceiver>, + mut event_receiver: mpsc::UnboundedReceiver>, mut control_sender: mpsc::UnboundedSender>, mut window_manager: WindowManager, init_command: Command, @@ -403,7 +403,7 @@ async fn run_instance( runtime.track(application.subscription().into_recipes()); while let Some(event) = event_receiver.next().await { match event { - MutiWindowIcedLayerEvent( + MultiWindowIcedLayerEvent( _id, IcedLayerEvent::RequestRefreshWithWrapper { width, @@ -523,7 +523,7 @@ async fn run_instance( debug.render_finished(); } - MutiWindowIcedLayerEvent(Some(id), IcedLayerEvent::Window(event)) => { + MultiWindowIcedLayerEvent(Some(id), IcedLayerEvent::Window(event)) => { let Some((id, window)) = window_manager.get_mut_alias(id) else { continue; }; @@ -532,10 +532,10 @@ async fn run_instance( events.push((Some(id), event)); } } - MutiWindowIcedLayerEvent(_, IcedLayerEvent::UserEvent(event)) => { + MultiWindowIcedLayerEvent(_, IcedLayerEvent::UserEvent(event)) => { messages.push(event); } - MutiWindowIcedLayerEvent(_, IcedLayerEvent::NormalUpdate) => { + MultiWindowIcedLayerEvent(_, IcedLayerEvent::NormalUpdate) => { if events.is_empty() && messages.is_empty() { continue; } diff --git a/iced_sessionlock/src/event.rs b/iced_sessionlock/src/event.rs index cec6a70..856e718 100644 --- a/iced_sessionlock/src/event.rs +++ b/iced_sessionlock/src/event.rs @@ -57,6 +57,7 @@ pub enum IcedSessionLockEvent { height: u32, wrapper: WindowWrapper, }, + #[allow(unused)] RequestRefresh { width: u32, height: u32, @@ -67,16 +68,16 @@ pub enum IcedSessionLockEvent { } #[derive(Debug)] -pub struct MutiWindowIcedSessionLockEvent( +pub struct MultiWindowIcedSessionLockEvent( pub Option, pub IcedSessionLockEvent, ); impl From<(Option, IcedSessionLockEvent)> - for MutiWindowIcedSessionLockEvent + for MultiWindowIcedSessionLockEvent { fn from((id, message): (Option, IcedSessionLockEvent)) -> Self { - MutiWindowIcedSessionLockEvent(id, message) + MultiWindowIcedSessionLockEvent(id, message) } } diff --git a/iced_sessionlock/src/lib.rs b/iced_sessionlock/src/lib.rs index 69f981d..0cecf9e 100644 --- a/iced_sessionlock/src/lib.rs +++ b/iced_sessionlock/src/lib.rs @@ -17,7 +17,7 @@ use iced_futures::Subscription; use iced_runtime::Command; use iced_style::application::StyleSheet; -pub trait MutiApplication: Sized { +pub trait MultiApplication: Sized { /// The [`Executor`] that will run commands and subscriptions. /// /// The [default executor] can be a good starting point! @@ -135,18 +135,18 @@ pub trait MutiApplication: Sized { ..iced_renderer::Settings::default() }; - multi_window::run::, Self::Executor, iced_renderer::Compositor>( + multi_window::run::, Self::Executor, iced_renderer::Compositor>( settings, renderer_settings, ) } } -struct MutiInstance(A); +struct MultiInstance(A); -impl iced_runtime::multi_window::Program for MutiInstance +impl iced_runtime::multi_window::Program for MultiInstance where - A: MutiApplication, + A: MultiApplication, { type Message = A::Message; type Theme = A::Theme; @@ -164,16 +164,16 @@ where } } -impl multi_window::Application for MutiInstance +impl multi_window::Application for MultiInstance where - A: MutiApplication, + A: MultiApplication, { type Flags = A::Flags; fn new(flags: Self::Flags) -> (Self, Command) { let (app, command) = A::new(flags); - (MutiInstance(app), command) + (MultiInstance(app), command) } fn namespace(&self) -> String { diff --git a/iced_sessionlock/src/multi_window.rs b/iced_sessionlock/src/multi_window.rs index f17bd9d..9c9b509 100644 --- a/iced_sessionlock/src/multi_window.rs +++ b/iced_sessionlock/src/multi_window.rs @@ -24,7 +24,7 @@ use sessionlockev::{ use futures::{channel::mpsc, SinkExt, StreamExt}; use crate::{ - event::{IcedSessionLockEvent, MutiWindowIcedSessionLockEvent}, + event::{IcedSessionLockEvent, MultiWindowIcedSessionLockEvent}, proxy::IcedProxy, settings::Settings, }; @@ -166,7 +166,7 @@ where ); let (mut event_sender, event_receiver) = - mpsc::unbounded::>(); + mpsc::unbounded::>(); let (control_sender, mut control_receiver) = mpsc::unbounded::>(); let mut instance = Box::pin(run_instance::( @@ -199,7 +199,7 @@ where match message { DispatchMessage::RequestRefresh { width, height } => { event_sender - .start_send(MutiWindowIcedSessionLockEvent( + .start_send(MultiWindowIcedSessionLockEvent( id, IcedSessionLockEvent::RequestRefreshWithWrapper { width: *width, @@ -225,7 +225,7 @@ where } event_sender - .start_send(MutiWindowIcedSessionLockEvent(id, message.into())) + .start_send(MultiWindowIcedSessionLockEvent(id, message.into())) .expect("Cannot send"); } SessionLockEvent::NormalDispatch => match &key_event { @@ -234,12 +234,12 @@ where let event = IcedSessionLockEvent::Window(*windowevent); if key_ping_count > 70 && key_ping_count < 74 { event_sender - .start_send(MutiWindowIcedSessionLockEvent(id, event)) + .start_send(MultiWindowIcedSessionLockEvent(id, event)) .expect("Cannot send"); key_ping_count = 0; } else { event_sender - .start_send(MutiWindowIcedSessionLockEvent( + .start_send(MultiWindowIcedSessionLockEvent( id, IcedSessionLockEvent::NormalUpdate, )) @@ -254,7 +254,7 @@ where } None => { event_sender - .start_send(MutiWindowIcedSessionLockEvent( + .start_send(MultiWindowIcedSessionLockEvent( id, IcedSessionLockEvent::NormalUpdate, )) @@ -263,7 +263,7 @@ where }, SessionLockEvent::UserEvent(event) => { event_sender - .start_send(MutiWindowIcedSessionLockEvent( + .start_send(MultiWindowIcedSessionLockEvent( id, IcedSessionLockEvent::UserEvent(event), )) @@ -314,7 +314,7 @@ async fn run_instance( mut runtime: Runtime, A::Message>, mut proxy: IcedProxy, mut debug: Debug, - mut event_receiver: mpsc::UnboundedReceiver>, + mut event_receiver: mpsc::UnboundedReceiver>, mut control_sender: mpsc::UnboundedSender>, mut window_manager: WindowManager, init_command: Command, @@ -375,7 +375,7 @@ async fn run_instance( runtime.track(application.subscription().into_recipes()); while let Some(event) = event_receiver.next().await { match event { - MutiWindowIcedSessionLockEvent( + MultiWindowIcedSessionLockEvent( _id, IcedSessionLockEvent::RequestRefreshWithWrapper { width, @@ -495,7 +495,7 @@ async fn run_instance( debug.render_finished(); } - MutiWindowIcedSessionLockEvent(Some(id), IcedSessionLockEvent::Window(event)) => { + MultiWindowIcedSessionLockEvent(Some(id), IcedSessionLockEvent::Window(event)) => { let Some((id, window)) = window_manager.get_mut_alias(id) else { continue; }; @@ -504,10 +504,10 @@ async fn run_instance( events.push((Some(id), event)); } } - MutiWindowIcedSessionLockEvent(_, IcedSessionLockEvent::UserEvent(event)) => { + MultiWindowIcedSessionLockEvent(_, IcedSessionLockEvent::UserEvent(event)) => { messages.push(event); } - MutiWindowIcedSessionLockEvent(_, IcedSessionLockEvent::NormalUpdate) => { + MultiWindowIcedSessionLockEvent(_, IcedSessionLockEvent::NormalUpdate) => { if events.is_empty() && messages.is_empty() { continue; } diff --git a/layershellev/README.md b/layershellev/README.md index 0d01f0d..4a59f30 100644 --- a/layershellev/README.md +++ b/layershellev/README.md @@ -1,5 +1,5 @@ # Layershellev -Layershelleventloop, take lot refrence from winit, amin to make a easy way to create layershell window. +Layershelleventloop, take lot reference from winit, amin to make a easy way to create layershell window. you can take `./examples/simple.rs` for example diff --git a/layershellev/src/events.rs b/layershellev/src/events.rs index b84eec5..44cc4be 100644 --- a/layershellev/src/events.rs +++ b/layershellev/src/events.rs @@ -48,14 +48,14 @@ pub enum LayerEvent<'a, T: Debug, Message> { /// the return data /// Note: when event is RequestBuffer, you must return WlBuffer /// Note: when receive InitRequest, you can request to bind extra wayland-protocols. this time you -/// can bind virtual-keybaord. you can take startcolorkeyboard as refrence, or the simple.rs. Also, +/// can bind virtual-keyboard. you can take startcolorkeyboard as reference, or the simple.rs. Also, /// it should can bind with text-input, but I am not fully understand about this, maybe someone /// famillar with it can do /// /// When send RequestExist, it will tell the event to finish. /// -/// When send RequestSetCursorShape, you can set current pointer shape. pleace take -/// [cursor-shape](https://wayland.app/protocols/cursor-shape-v1#wp_cursor_shape_device_v1:enum:shape) as refrence. +/// When send RequestSetCursorShape, you can set current pointer shape. please take +/// [cursor-shape](https://wayland.app/protocols/cursor-shape-v1#wp_cursor_shape_device_v1:enum:shape) as reference. /// /// None means nothing will happened, no request, and no return data #[derive(Debug, PartialEq, Eq)] diff --git a/layershellev/src/lib.rs b/layershellev/src/lib.rs index ff45714..fa8d2b5 100644 --- a/layershellev/src/lib.rs +++ b/layershellev/src/lib.rs @@ -310,8 +310,8 @@ impl ZxdgOutputInfo { } } - /// you can get the Logic positon of the screen current surface in - pub fn get_positon(&self) -> (i32, i32) { + /// you can get the Logic position of the screen current surface in + pub fn get_position(&self) -> (i32, i32) { self.position } @@ -427,7 +427,7 @@ impl WindowStateUnit { self.zxdgoutput.as_ref() } - /// set the anchor of the current unit. please take the simple.rs as refrence + /// set the anchor of the current unit. please take the simple.rs as reference pub fn set_anchor(&self, anchor: Anchor) { self.layer_shell.set_anchor(anchor); self.wl_surface.commit(); @@ -475,7 +475,7 @@ impl WindowStateUnit { } /// this function will refresh whole surface. it will reattach the buffer, and damage whole, - /// and finall commit + /// and final commit pub fn request_refresh(&self, (width, height): (i32, i32)) { self.wl_surface.attach(self.buffer.as_ref(), 0, 0); self.wl_surface.damage(0, 0, width, height); @@ -637,7 +637,7 @@ impl WindowState { self } - /// keyboard_interacivity, pleace take look at [layer_shell](https://wayland.app/protocols/wlr-layer-shell-unstable-v1) + /// keyboard_interacivity, please take look at [layer_shell](https://wayland.app/protocols/wlr-layer-shell-unstable-v1) pub fn with_keyboard_interacivity( mut self, keyboard_interacivity: zwlr_layer_surface_v1::KeyboardInteractivity, @@ -1067,7 +1067,7 @@ delegate_noop!(@WindowState: ignore WlOutput); // output is need to delegate_noop!(@WindowState: ignore WlShm); // shm is used to create buffer pool delegate_noop!(@WindowState: ignore WlShmPool); // so it is pool, created by wl_shm delegate_noop!(@WindowState: ignore WlBuffer); // buffer show the picture -delegate_noop!(@WindowState: ignore ZwlrLayerShellV1); // it is simillar with xdg_toplevel, also the +delegate_noop!(@WindowState: ignore ZwlrLayerShellV1); // it is similar with xdg_toplevel, also the // ext-session-shell delegate_noop!(@WindowState: ignore WpCursorShapeManagerV1); @@ -1257,7 +1257,7 @@ impl WindowState { pub fn running_with_proxy( mut self, message_receiver: std::sync::mpsc::Receiver, - mut event_hander: F, + mut event_handler: F, ) -> Result<(), LayerEventError> where F: FnMut(LayerEvent, &mut WindowState, Option) -> ReturnData, @@ -1276,16 +1276,16 @@ impl WindowState { while !matches!(init_event, Some(ReturnData::None)) { match init_event { None => { - init_event = Some(event_hander(LayerEvent::InitRequest, &mut self, None)); + init_event = Some(event_handler(LayerEvent::InitRequest, &mut self, None)); } Some(ReturnData::RequestBind) => { - init_event = Some(event_hander( + init_event = Some(event_handler( LayerEvent::BindProvide(&globals, &qh), &mut self, None, )); } - _ => panic!("Not privide server here"), + _ => panic!("Not provide server here"), } } @@ -1309,7 +1309,7 @@ impl WindowState { // I will use it in iced if self.units[index].buffer.is_none() && !self.use_display_handle { let mut file = tempfile::tempfile()?; - let ReturnData::WlBuffer(buffer) = event_hander( + let ReturnData::WlBuffer(buffer) = event_handler( LayerEvent::RequestBuffer(&mut file, &shm, &qh, *width, *height), &mut self, Some(index), @@ -1320,7 +1320,7 @@ impl WindowState { surface.attach(Some(&buffer), 0, 0); self.units[index].buffer = Some(buffer); } else { - event_hander( + event_handler( LayerEvent::RequestMessages(&DispatchMessage::RequestRefresh { width: *width, height: *height, @@ -1334,7 +1334,7 @@ impl WindowState { surface.commit(); } (index_info, DispatchMessageInner::XdgInfoChanged(change_type)) => { - event_hander( + event_handler( LayerEvent::XdgInfoChanged(*change_type), &mut self, *index_info, @@ -1401,7 +1401,7 @@ impl WindowState { _ => { let (index_message, msg) = msg; let msg: DispatchMessage = msg.clone().into(); - match event_hander( + match event_handler( LayerEvent::RequestMessages(&msg), &mut self, *index_message, @@ -1409,7 +1409,7 @@ impl WindowState { ReturnData::RedrawAllRequest => { for index in 0..self.units.len() { let unit = &self.units[index]; - event_hander( + event_handler( LayerEvent::RequestMessages( &DispatchMessage::RequestRefresh { width: unit.size.0, @@ -1428,7 +1428,7 @@ impl WindowState { .enumerate() .find(|(_, unit)| unit.id == id) { - event_hander( + event_handler( LayerEvent::RequestMessages( &DispatchMessage::RequestRefresh { width: unit.size.0, @@ -1478,7 +1478,7 @@ impl WindowState { } } if let Ok(event) = message_receiver.try_recv() { - match event_hander(LayerEvent::UserEvent(event), &mut self, None) { + match event_handler(LayerEvent::UserEvent(event), &mut self, None) { ReturnData::RequestExist => { break 'out; } @@ -1514,15 +1514,15 @@ impl WindowState { _ => {} } } - let mut return_data = vec![event_hander(LayerEvent::NormalDispatch, &mut self, None)]; + let mut return_data = vec![event_handler(LayerEvent::NormalDispatch, &mut self, None)]; loop { - let mut replace_datas = Vec::new(); + let mut replace_data = Vec::new(); for data in return_data { match data { ReturnData::RedrawAllRequest => { for index in 0..self.units.len() { let unit = &self.units[index]; - replace_datas.push(event_hander( + replace_data.push(event_handler( LayerEvent::RequestMessages(&DispatchMessage::RequestRefresh { width: unit.size.0, height: unit.size.1, @@ -1539,7 +1539,7 @@ impl WindowState { .enumerate() .find(|(_, unit)| unit.id == id) { - replace_datas.push(event_hander( + replace_data.push(event_handler( LayerEvent::RequestMessages(&DispatchMessage::RequestRefresh { width: unit.size.0, height: unit.size.1, @@ -1584,11 +1584,11 @@ impl WindowState { _ => {} } } - replace_datas.retain(|x| *x != ReturnData::None); - if replace_datas.is_empty() { + replace_data.retain(|x| *x != ReturnData::None); + if replace_data.is_empty() { break; } - return_data = replace_datas; + return_data = replace_data; } continue; } @@ -1606,7 +1606,7 @@ impl WindowState { /// it will return [None]. /// /// - pub fn running(mut self, mut event_hander: F) -> Result<(), LayerEventError> + pub fn running(mut self, mut event_handler: F) -> Result<(), LayerEventError> where F: FnMut(LayerEvent, &mut WindowState, Option) -> ReturnData, { @@ -1624,16 +1624,16 @@ impl WindowState { while !matches!(init_event, Some(ReturnData::None)) { match init_event { None => { - init_event = Some(event_hander(LayerEvent::InitRequest, &mut self, None)); + init_event = Some(event_handler(LayerEvent::InitRequest, &mut self, None)); } Some(ReturnData::RequestBind) => { - init_event = Some(event_hander( + init_event = Some(event_handler( LayerEvent::BindProvide(&globals, &qh), &mut self, None, )); } - _ => panic!("Not privide server here"), + _ => panic!("Not provide server here"), } } let mut event_loop: EventLoop = @@ -1657,7 +1657,7 @@ impl WindowState { // I will use it in iced if self.units[index].buffer.is_none() && !self.use_display_handle { let mut file = tempfile::tempfile()?; - let ReturnData::WlBuffer(buffer) = event_hander( + let ReturnData::WlBuffer(buffer) = event_handler( LayerEvent::RequestBuffer(&mut file, &shm, &qh, *width, *height), &mut self, Some(index), @@ -1668,7 +1668,7 @@ impl WindowState { surface.attach(Some(&buffer), 0, 0); self.units[index].buffer = Some(buffer); } else { - event_hander( + event_handler( LayerEvent::RequestMessages(&DispatchMessage::RequestRefresh { width: *width, height: *height, @@ -1682,7 +1682,7 @@ impl WindowState { surface.commit(); } (index_info, DispatchMessageInner::XdgInfoChanged(change_type)) => { - event_hander( + event_handler( LayerEvent::XdgInfoChanged(*change_type), &mut self, *index_info, @@ -1749,7 +1749,7 @@ impl WindowState { _ => { let (index_message, msg) = msg; let msg: DispatchMessage = msg.clone().into(); - match event_hander( + match event_handler( LayerEvent::RequestMessages(&msg), &mut self, *index_message, @@ -1791,7 +1791,7 @@ impl WindowState { } } } - match event_hander(LayerEvent::NormalDispatch, &mut self, None) { + match event_handler(LayerEvent::NormalDispatch, &mut self, None) { ReturnData::RequestExist => { break 'out; } diff --git a/sessionlockev/README.md b/sessionlockev/README.md index 0d01f0d..4a59f30 100644 --- a/sessionlockev/README.md +++ b/sessionlockev/README.md @@ -1,5 +1,5 @@ # Layershellev -Layershelleventloop, take lot refrence from winit, amin to make a easy way to create layershell window. +Layershelleventloop, take lot reference from winit, amin to make a easy way to create layershell window. you can take `./examples/simple.rs` for example diff --git a/sessionlockev/src/events.rs b/sessionlockev/src/events.rs index ff8547b..cb2ce5c 100644 --- a/sessionlockev/src/events.rs +++ b/sessionlockev/src/events.rs @@ -45,14 +45,14 @@ pub enum SessionLockEvent<'a, T: Debug, Message> { /// the return data /// Note: when event is RequestBuffer, you must return WlBuffer /// Note: when receive InitRequest, you can request to bind extra wayland-protocols. this time you -/// can bind virtual-keybaord. you can take startcolorkeyboard as refrence, or the simple.rs. Also, +/// can bind virtual-keyboard. you can take startcolorkeyboard as reference, or the simple.rs. Also, /// it should can bind with text-input, but I am not fully understand about this, maybe someone /// famillar with it can do /// /// When send RequestExist, it will tell the event to finish. /// -/// When send RequestSetCursorShape, you can set current pointer shape. pleace take -/// [cursor-shape](https://wayland.app/protocols/cursor-shape-v1#wp_cursor_shape_device_v1:enum:shape) as refrence. +/// When send RequestSetCursorShape, you can set current pointer shape. please take +/// [cursor-shape](https://wayland.app/protocols/cursor-shape-v1#wp_cursor_shape_device_v1:enum:shape) as reference. /// /// None means nothing will happened, no request, and no return data /// diff --git a/sessionlockev/src/lib.rs b/sessionlockev/src/lib.rs index 0e97467..0deb624 100644 --- a/sessionlockev/src/lib.rs +++ b/sessionlockev/src/lib.rs @@ -356,7 +356,7 @@ impl WindowStateUnit { } /// this function will refresh whole surface. it will reattach the buffer, and damage whole, - /// and finall commit + /// and final commit pub fn request_refresh(&self, (width, height): (i32, i32)) { self.wl_surface.attach(self.buffer.as_ref(), 0, 0); self.wl_surface.damage(0, 0, width, height); @@ -873,7 +873,7 @@ impl WindowState { pub fn running_with_proxy( &mut self, message_receiver: std::sync::mpsc::Receiver, - mut event_hander: F, + mut event_handler: F, ) -> Result<(), SessonLockEventError> where F: FnMut(SessionLockEvent, &mut WindowState, Option) -> ReturnData, @@ -892,16 +892,16 @@ impl WindowState { while !matches!(init_event, Some(ReturnData::None)) { match init_event { None => { - init_event = Some(event_hander(SessionLockEvent::InitRequest, self, None)); + init_event = Some(event_handler(SessionLockEvent::InitRequest, self, None)); } Some(ReturnData::RequestBind) => { - init_event = Some(event_hander( + init_event = Some(event_handler( SessionLockEvent::BindProvide(&globals, &qh), self, None, )); } - _ => panic!("Not privide server here"), + _ => panic!("Not provide server here"), } } @@ -923,7 +923,7 @@ impl WindowState { let index = *unit_index; if self.units[index].buffer.is_none() && !self.use_display_handle { let mut file = tempfile::tempfile()?; - let ReturnData::WlBuffer(buffer) = event_hander( + let ReturnData::WlBuffer(buffer) = event_handler( SessionLockEvent::RequestBuffer( &mut file, &shm, &qh, *width, *height, ), @@ -936,7 +936,7 @@ impl WindowState { surface.attach(Some(&buffer), 0, 0); self.units[index].buffer = Some(buffer); } else { - event_hander( + event_handler( SessionLockEvent::RequestMessages( &DispatchMessage::RequestRefresh { width: *width, @@ -985,7 +985,7 @@ impl WindowState { _ => { let (index_message, msg) = msg; let msg: DispatchMessage = msg.clone().into(); - match event_hander( + match event_handler( SessionLockEvent::RequestMessages(&msg), self, *index_message, @@ -1030,7 +1030,7 @@ impl WindowState { } } if let Ok(event) = message_receiver.try_recv() { - match event_hander(SessionLockEvent::UserEvent(event), self, None) { + match event_handler(SessionLockEvent::UserEvent(event), self, None) { ReturnData::RequestUnlockAndExist => { lock.unlock_and_destroy(); connection.roundtrip()?; @@ -1068,15 +1068,15 @@ impl WindowState { _ => {} } } - let mut return_data = vec![event_hander(SessionLockEvent::NormalDispatch, self, None)]; + let mut return_data = vec![event_handler(SessionLockEvent::NormalDispatch, self, None)]; loop { - let mut replace_datas = Vec::new(); + let mut replace_data = Vec::new(); for data in return_data { match data { ReturnData::RedrawAllRequest => { for index in 0..self.units.len() { let unit = &self.units[index]; - replace_datas.push(event_hander( + replace_data.push(event_handler( SessionLockEvent::RequestMessages( &DispatchMessage::RequestRefresh { width: unit.size.0, @@ -1095,7 +1095,7 @@ impl WindowState { .enumerate() .find(|(_, unit)| unit.id == id) { - replace_datas.push(event_hander( + replace_data.push(event_handler( SessionLockEvent::RequestMessages( &DispatchMessage::RequestRefresh { width: unit.size.0, @@ -1144,11 +1144,11 @@ impl WindowState { _ => {} } } - replace_datas.retain(|x| *x != ReturnData::None); - if replace_datas.is_empty() { + replace_data.retain(|x| *x != ReturnData::None); + if replace_data.is_empty() { break; } - return_data = replace_datas; + return_data = replace_data; } } Ok(()) @@ -1158,7 +1158,7 @@ impl WindowState { /// happened on, like tell you this time you do a click, what surface it is on. you can use the /// index to get the unit, with [WindowState::get_unit] if the even is not spical on one surface, /// it will return [None]. - pub fn running(&mut self, mut event_hander: F) -> Result<(), SessonLockEventError> + pub fn running(&mut self, mut event_handler: F) -> Result<(), SessonLockEventError> where F: FnMut(SessionLockEvent, &mut WindowState, Option) -> ReturnData, { @@ -1176,16 +1176,16 @@ impl WindowState { while !matches!(init_event, Some(ReturnData::None)) { match init_event { None => { - init_event = Some(event_hander(SessionLockEvent::InitRequest, self, None)); + init_event = Some(event_handler(SessionLockEvent::InitRequest, self, None)); } Some(ReturnData::RequestBind) => { - init_event = Some(event_hander( + init_event = Some(event_handler( SessionLockEvent::BindProvide(&globals, &qh), self, None, )); } - _ => panic!("Not privide server here"), + _ => panic!("Not provide server here"), } } @@ -1203,7 +1203,7 @@ impl WindowState { let index = *unit_index; if self.units[index].buffer.is_none() { let mut file = tempfile::tempfile()?; - let ReturnData::WlBuffer(buffer) = event_hander( + let ReturnData::WlBuffer(buffer) = event_handler( SessionLockEvent::RequestBuffer( &mut file, &shm, &qh, *width, *height, ), @@ -1216,7 +1216,7 @@ impl WindowState { surface.attach(Some(&buffer), 0, 0); self.units[index].buffer = Some(buffer); } else { - event_hander( + event_handler( SessionLockEvent::RequestMessages( &DispatchMessage::RequestRefresh { width: *width, @@ -1265,7 +1265,7 @@ impl WindowState { _ => { let (index_message, msg) = msg; let msg: DispatchMessage = msg.clone().into(); - match event_hander( + match event_handler( SessionLockEvent::RequestMessages(&msg), self, *index_message, diff --git a/starcolorkeyboard/src/consts.rs b/starcolorkeyboard/src/consts.rs index a962aaf..e9d5455 100644 --- a/starcolorkeyboard/src/consts.rs +++ b/starcolorkeyboard/src/consts.rs @@ -1,5 +1,5 @@ -pub const EXCULDE_ZONE_RIGHT: f64 = 80_f64; -pub const EXCULDE_ZONE_TOP: f64 = 40_f64; +pub const EXCLUDE_ZONE_RIGHT: f64 = 80_f64; +pub const EXCLUDE_ZONE_TOP: f64 = 40_f64; pub const KEYBOARD_TITLE: &str = "Anyone can be the persion they want to be"; diff --git a/starcolorkeyboard/src/main.rs b/starcolorkeyboard/src/main.rs index 24faab7..003f6d8 100644 --- a/starcolorkeyboard/src/main.rs +++ b/starcolorkeyboard/src/main.rs @@ -5,7 +5,7 @@ mod otherkeys; mod pangoui; use std::{ffi::CString, fs::File, io::Write, os::fd::AsFd, path::PathBuf}; -use consts::EXCULDE_ZONE_TOP; +use consts::EXCLUDE_ZONE_TOP; use keyboardlayouts::Layouts; use layershellev::reexport::wayland_client::KeyState; @@ -164,8 +164,8 @@ fn main() { return ReturnData::None; } if is_min { - windowunit.set_size((0, EXCULDE_ZONE_TOP as u32)); - windowunit.set_exclusive_zone(EXCULDE_ZONE_TOP as i32); + windowunit.set_size((0, EXCLUDE_ZONE_TOP as u32)); + windowunit.set_exclusive_zone(EXCLUDE_ZONE_TOP as i32); } else { windowunit.set_size((0, 300)); windowunit.set_exclusive_zone(300); @@ -216,8 +216,8 @@ fn main() { otherkeys::CLOSE_KEYBOARD => ReturnData::RequestExist, otherkeys::MIN_KEYBOARD => { if is_min { - windowunit.set_size((0, EXCULDE_ZONE_TOP as u32)); - windowunit.set_exclusive_zone(EXCULDE_ZONE_TOP as i32); + windowunit.set_size((0, EXCLUDE_ZONE_TOP as u32)); + windowunit.set_exclusive_zone(EXCLUDE_ZONE_TOP as i32); } else { windowunit.set_size((0, 300)); windowunit.set_exclusive_zone(300); diff --git a/starcolorkeyboard/src/pangoui.rs b/starcolorkeyboard/src/pangoui.rs index 16a34e7..3bbf87f 100644 --- a/starcolorkeyboard/src/pangoui.rs +++ b/starcolorkeyboard/src/pangoui.rs @@ -18,7 +18,7 @@ use mainkeyboard::find_keycode_from_mainkeyboard; use super::KeyModifierType; -use crate::consts::{EXCULDE_ZONE_RIGHT, EXCULDE_ZONE_TOP}; +use crate::consts::{EXCLUDE_ZONE_RIGHT, EXCLUDE_ZONE_TOP}; #[derive(Debug, Default)] pub struct PangoUi { @@ -86,16 +86,16 @@ impl PangoUi { pub fn get_key(&self, (pos_x, pos_y): (f64, f64)) -> Option { let (pos_x, pos_y) = (pos_x as i32, pos_y as i32); - let exclude_zone = EXCULDE_ZONE_TOP as i32; + let exclude_zone = EXCLUDE_ZONE_TOP as i32; let step = (self.height - exclude_zone) / 3; let x_1 = self.width - 4 * step; let x_4 = self.width - step; - let x_exclude = self.width - EXCULDE_ZONE_RIGHT as i32; - if pos_y < EXCULDE_ZONE_TOP as i32 { + let x_exclude = self.width - EXCLUDE_ZONE_RIGHT as i32; + if pos_y < EXCLUDE_ZONE_TOP as i32 { if pos_x < x_exclude { return None; } - let step_right = EXCULDE_ZONE_TOP as i32; + let step_right = EXCLUDE_ZONE_TOP as i32; let right_w = pos_x - x_exclude; if right_w / step_right == 0 { return Some(otherkeys::MIN_KEYBOARD); diff --git a/starcolorkeyboard/src/pangoui/mainkeyboard.rs b/starcolorkeyboard/src/pangoui/mainkeyboard.rs index 611d380..7d232fb 100644 --- a/starcolorkeyboard/src/pangoui/mainkeyboard.rs +++ b/starcolorkeyboard/src/pangoui/mainkeyboard.rs @@ -6,7 +6,7 @@ use std::sync::OnceLock; use crate::KeyModifierType; -use crate::consts::EXCULDE_ZONE_TOP; +use crate::consts::EXCLUDE_ZONE_TOP; use super::contain_mode; @@ -131,7 +131,7 @@ fn draw_unit_key( locked, }: DrawInfo, ) { - let exclude_zone = EXCULDE_ZONE_TOP; + let exclude_zone = EXCLUDE_ZONE_TOP; let start_x = step * start_pos as f64 / 2.0; let end_x = step * width as f64 / 2.0 + start_x; let start_y = step * line as f64 + exclude_zone; @@ -169,7 +169,7 @@ pub(crate) fn draw_main_keyboard( font_size: i32, key_type: KeyModifierType, ) { - let exclude_zone = EXCULDE_ZONE_TOP; + let exclude_zone = EXCLUDE_ZONE_TOP; let step = (height - exclude_zone as i32) / 4; for oneline in get_main_layout().iter() { @@ -184,7 +184,7 @@ pub(crate) fn draw_main_keyboard( } pub fn find_keycode_from_mainkeyboard((pos_x, pos_y): (i32, i32), step: i32) -> Option { - let exclude_zone = EXCULDE_ZONE_TOP; + let exclude_zone = EXCLUDE_ZONE_TOP; let main_layout = get_main_layout(); let aby = (pos_y - exclude_zone as i32) / step; if aby >= main_layout.len() as i32 { diff --git a/starcolorkeyboard/src/pangoui/smallkeyboard.rs b/starcolorkeyboard/src/pangoui/smallkeyboard.rs index 8bb8a90..605c9bb 100644 --- a/starcolorkeyboard/src/pangoui/smallkeyboard.rs +++ b/starcolorkeyboard/src/pangoui/smallkeyboard.rs @@ -1,6 +1,6 @@ use cairo::Context; -use crate::consts::{EXCULDE_ZONE_RIGHT, EXCULDE_ZONE_TOP}; +use crate::consts::{EXCLUDE_ZONE_RIGHT, EXCLUDE_ZONE_TOP}; use super::contain_mode; use crate::KeyModifierType; @@ -10,7 +10,7 @@ fn contain_shift(key_type: KeyModifierType) -> bool { } pub fn find_keycode_from_smallkeyboard((pos_x, pos_y): (i32, i32), start_x: i32, step: i32) -> u32 { - let exclude_zone = EXCULDE_ZONE_TOP as i32; + let exclude_zone = EXCLUDE_ZONE_TOP as i32; let abx = (pos_x - start_x) / step; let aby = (pos_y - exclude_zone) / step; let code = aby * 3 + abx + 2; @@ -18,8 +18,8 @@ pub fn find_keycode_from_smallkeyboard((pos_x, pos_y): (i32, i32), start_x: i32, } fn draw_extra_btn(content: &Context, pangolayout: &pango::Layout, width: i32, font_size: i32) { - let step = EXCULDE_ZONE_RIGHT / 2.0; - let x_1 = width as f64 - EXCULDE_ZONE_RIGHT; + let step = EXCLUDE_ZONE_RIGHT / 2.0; + let x_1 = width as f64 - EXCLUDE_ZONE_RIGHT; let x_2 = width as f64 - step; let x_3 = width as f64; let y_1 = 0.0; @@ -62,9 +62,9 @@ pub(super) fn draw_number_keyboard( key_type: KeyModifierType, ) { // NOTE: here require width > height - assert!(width - EXCULDE_ZONE_RIGHT as i32 > height); + assert!(width - EXCLUDE_ZONE_RIGHT as i32 > height); - let exclude_zone = EXCULDE_ZONE_RIGHT / 2.0; + let exclude_zone = EXCLUDE_ZONE_RIGHT / 2.0; let step = (height as f64 - exclude_zone) / 3.0; let x_1 = width as f64 - 4.0 * step;