Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

deps: Update keyboard-types to 0.7. #158

Merged
merged 1 commit into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ lazy_static = "1.4.0"
cfg-if = "1.0.0"
instant = { version = "0.1.6", features = ["wasm-bindgen"] }
anyhow = "1.0.32"
keyboard-types = { version = "0.6.2", default_features = false }
keyboard-types = { version = "0.7", default_features = false }
memchr = "2.5"

# Optional dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/backend/mac/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use objc::{msg_send, sel, sel_impl};
use super::util::make_nsstring;
use crate::common_util::strip_access_key;
use crate::hotkey::HotKey;
use crate::keyboard::{KbKey, Modifiers, ModifiersExt};
use crate::keyboard::{KbKey, Modifiers};

pub struct Menu {
pub menu: id,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/windows/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::convert::TryInto;
use std::mem;
use std::ops::RangeInclusive;

use crate::keyboard::{Code, KbKey, KeyEvent, KeyState, Location, Modifiers, ModifiersExt};
use crate::keyboard::{Code, KbKey, KeyEvent, KeyState, Location, Modifiers};

use winapi::shared::minwindef::{HKL, INT, LPARAM, UINT, WPARAM};
use winapi::shared::ntdef::SHORT;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/windows/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use winapi::um::winuser::*;

use super::util::ToWide;
use crate::hotkey::HotKey;
use crate::keyboard::{KbKey, Modifiers, ModifiersExt};
use crate::keyboard::{KbKey, Modifiers};

/// A menu object, which can be either a top-level menubar or a
/// submenu.
Expand Down
2 changes: 1 addition & 1 deletion src/backend/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use super::util::{self, ToWide, OPTIONAL_FUNCTIONS};
use crate::common_util::IdleCallback;
use crate::dialog::{FileDialogOptions, FileDialogType, FileInfo};
use crate::error::Error as ShellError;
use crate::keyboard::{KbKey, KeyState, ModifiersExt};
use crate::keyboard::{KbKey, KeyState};
use crate::mouse::{Cursor, CursorDesc};
use crate::pointer::{
MouseInfo, PointerButton, PointerButtons, PointerEvent, PointerId, PointerType,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use crate::backend::shared::Timer;
use crate::common_util::IdleCallback;
use crate::dialog::FileDialogOptions;
use crate::error::Error as ShellError;
use crate::keyboard::{KeyState, Modifiers, ModifiersExt};
use crate::keyboard::{KeyState, Modifiers};
use crate::kurbo::{Insets, Point, Rect, Size, Vec2};
use crate::mouse::{Cursor, CursorDesc};
use crate::region::Region;
Expand Down
2 changes: 1 addition & 1 deletion src/hotkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::borrow::Borrow;

use tracing::warn;

use crate::keyboard::{IntoKey, KbKey, KeyEvent, Modifiers, ModifiersExt};
use crate::keyboard::{IntoKey, KbKey, KeyEvent, Modifiers};

// TODO: fix docstring

Expand Down
33 changes: 0 additions & 33 deletions src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,39 +75,6 @@ impl KeyEvent {
}
}

/// Extension methods for [`Modifiers`].
pub trait ModifiersExt {
/// Determine whether Shift is set.
fn shift(&self) -> bool;

/// Determine whether Ctrl is set.
fn ctrl(&self) -> bool;

/// Determine whether Alt is set.
fn alt(&self) -> bool;

/// Determine whether Meta is set.
fn meta(&self) -> bool;
}

impl ModifiersExt for Modifiers {
fn shift(&self) -> bool {
self.contains(Modifiers::SHIFT)
}

fn ctrl(&self) -> bool {
self.contains(Modifiers::CONTROL)
}

fn alt(&self) -> bool {
self.contains(Modifiers::ALT)
}

fn meta(&self) -> bool {
self.contains(Modifiers::META)
}
}

impl IntoKey for KbKey {
fn into_key(self) -> KbKey {
self
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub use common_util::Counter;
pub use dialog::{FileDialogOptions, FileInfo, FileSpec};
pub use error::Error;
pub use hotkey::{HotKey, RawMods, SysMods};
pub use keyboard::{Code, IntoKey, KbKey, KeyEvent, KeyState, Location, Modifiers, ModifiersExt};
pub use keyboard::{Code, IntoKey, KbKey, KeyEvent, KeyState, Location, Modifiers};
pub use menu::Menu;
pub use mouse::{Cursor, CursorDesc};
pub use pointer::{
Expand Down
2 changes: 1 addition & 1 deletion src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
//! `InputHandler` calls are simulated from keypresses on other platforms, which
//! doesn't allow for IME input, dead keys, etc.

use crate::keyboard::{KbKey, KeyEvent, ModifiersExt};
use crate::keyboard::{KbKey, KeyEvent};
use crate::kurbo::{Point, Rect};
use crate::window::{TextFieldToken, WinHandler};
use std::borrow::Cow;
Expand Down