Merge pull request #113 from pop-os/update-libcosmic-latest
chore: update libcosmic
This commit is contained in:
commit
4dbce334c6
6 changed files with 458 additions and 499 deletions
762
Cargo.lock
generated
762
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
11
Cargo.toml
11
Cargo.toml
|
|
@ -30,13 +30,11 @@ git = "https://github.com/pop-os/cosmic-syntax-theme"
|
||||||
[dependencies.cosmic-text]
|
[dependencies.cosmic-text]
|
||||||
git = "https://github.com/pop-os/cosmic-text"
|
git = "https://github.com/pop-os/cosmic-text"
|
||||||
features = ["syntect", "vi"]
|
features = ["syntect", "vi"]
|
||||||
#path = "../cosmic-text"
|
|
||||||
|
|
||||||
[dependencies.libcosmic]
|
[dependencies.libcosmic]
|
||||||
git = "https://github.com/pop-os/libcosmic"
|
git = "https://github.com/pop-os/libcosmic"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["tokio", "winit"]
|
features = ["tokio", "winit"]
|
||||||
#path = "../libcosmic"
|
|
||||||
|
|
||||||
[dependencies.rfd]
|
[dependencies.rfd]
|
||||||
version = "0.13.0"
|
version = "0.13.0"
|
||||||
|
|
@ -44,6 +42,10 @@ default-features = false
|
||||||
features = ["tokio", "xdg-portal"]
|
features = ["tokio", "xdg-portal"]
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
|
[dependencies.smol_str]
|
||||||
|
version = "0.2.1"
|
||||||
|
features = ["serde"]
|
||||||
|
|
||||||
#TODO: clean up and send changes upstream
|
#TODO: clean up and send changes upstream
|
||||||
[dependencies.systemicons]
|
[dependencies.systemicons]
|
||||||
git = "https://github.com/jackpot51/systemicons"
|
git = "https://github.com/jackpot51/systemicons"
|
||||||
|
|
@ -55,11 +57,6 @@ fork = "0.1"
|
||||||
default = ["rfd", "wgpu"]
|
default = ["rfd", "wgpu"]
|
||||||
wgpu = ["libcosmic/wgpu"]
|
wgpu = ["libcosmic/wgpu"]
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
smithay-client-toolkit = { git = "https://github.com/pop-os/client-toolkit", branch = "wayland-resize" }
|
|
||||||
# https://github.com/gfx-rs/wgpu/pull/4959
|
|
||||||
wgpu = { git = "https://github.com/pop-os/wgpu", branch = "v0.18" }
|
|
||||||
|
|
||||||
[profile.release-with-debug]
|
[profile.release-with-debug]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
debug = true
|
debug = true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
use cosmic::iced::keyboard::{KeyCode, Modifiers};
|
use cosmic::{
|
||||||
|
iced::keyboard::{Key, Modifiers},
|
||||||
|
iced_core::keyboard::key::Named,
|
||||||
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{collections::HashMap, fmt};
|
use std::{collections::HashMap, fmt};
|
||||||
|
|
||||||
|
|
@ -15,12 +18,12 @@ pub enum Modifier {
|
||||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||||
pub struct KeyBind {
|
pub struct KeyBind {
|
||||||
pub modifiers: Vec<Modifier>,
|
pub modifiers: Vec<Modifier>,
|
||||||
pub key_code: KeyCode,
|
pub key: Key,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeyBind {
|
impl KeyBind {
|
||||||
pub fn matches(&self, modifiers: Modifiers, key_code: KeyCode) -> bool {
|
pub fn matches(&self, modifiers: Modifiers, key: Key) -> bool {
|
||||||
self.key_code == key_code
|
self.key == key
|
||||||
&& modifiers.logo() == self.modifiers.contains(&Modifier::Super)
|
&& modifiers.logo() == self.modifiers.contains(&Modifier::Super)
|
||||||
&& modifiers.control() == self.modifiers.contains(&Modifier::Ctrl)
|
&& modifiers.control() == self.modifiers.contains(&Modifier::Ctrl)
|
||||||
&& modifiers.alt() == self.modifiers.contains(&Modifier::Alt)
|
&& modifiers.alt() == self.modifiers.contains(&Modifier::Alt)
|
||||||
|
|
@ -33,7 +36,7 @@ impl fmt::Display for KeyBind {
|
||||||
for modifier in self.modifiers.iter() {
|
for modifier in self.modifiers.iter() {
|
||||||
write!(f, "{:?} + ", modifier)?;
|
write!(f, "{:?} + ", modifier)?;
|
||||||
}
|
}
|
||||||
write!(f, "{:?}", self.key_code)
|
write!(f, "{:?}", self.key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,47 +45,55 @@ pub fn key_binds() -> HashMap<KeyBind, Action> {
|
||||||
let mut key_binds = HashMap::new();
|
let mut key_binds = HashMap::new();
|
||||||
|
|
||||||
macro_rules! bind {
|
macro_rules! bind {
|
||||||
([$($modifier:ident),+ $(,)?], $key_code:ident, $action:ident) => {{
|
([$($modifier:ident),+ $(,)?], $key:expr, $action:ident) => {{
|
||||||
key_binds.insert(
|
key_binds.insert(
|
||||||
KeyBind {
|
KeyBind {
|
||||||
modifiers: vec![$(Modifier::$modifier),+],
|
modifiers: vec![$(Modifier::$modifier),+],
|
||||||
key_code: KeyCode::$key_code,
|
key: $key,
|
||||||
},
|
},
|
||||||
Action::$action,
|
Action::$action,
|
||||||
);
|
);
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
bind!([Ctrl], W, CloseFile);
|
bind!([Ctrl], Key::Character("w".into()), CloseFile);
|
||||||
bind!([Ctrl], X, Cut);
|
bind!([Ctrl], Key::Character("x".into()), Cut);
|
||||||
bind!([Ctrl], C, Copy);
|
bind!([Ctrl], Key::Character("c".into()), Copy);
|
||||||
bind!([Ctrl], F, Find);
|
bind!([Ctrl], Key::Character("f".into()), Find);
|
||||||
bind!([Ctrl], H, FindAndReplace);
|
bind!([Ctrl], Key::Character("h".into()), FindAndReplace);
|
||||||
bind!([Ctrl], V, Paste);
|
bind!([Ctrl], Key::Character("v".into()), Paste);
|
||||||
bind!([Ctrl], T, NewFile);
|
bind!([Ctrl], Key::Character("t".into()), NewFile);
|
||||||
bind!([Ctrl], N, NewWindow);
|
bind!([Ctrl], Key::Character("n".into()), NewWindow);
|
||||||
bind!([Ctrl], O, OpenFileDialog);
|
bind!([Ctrl], Key::Character("o".into()), OpenFileDialog);
|
||||||
bind!([Ctrl, Shift], O, OpenProjectDialog);
|
bind!([Ctrl, Shift], Key::Character("O".into()), OpenProjectDialog);
|
||||||
bind!([Ctrl], Q, Quit);
|
bind!([Ctrl], Key::Character("q".into()), Quit);
|
||||||
bind!([Ctrl, Shift], Z, Redo);
|
bind!([Ctrl, Shift], Key::Character("z".into()), Redo);
|
||||||
bind!([Ctrl], S, Save);
|
bind!([Ctrl], Key::Character("s".into()), Save);
|
||||||
bind!([Ctrl], A, SelectAll);
|
bind!([Ctrl], Key::Character("a".into()), SelectAll);
|
||||||
bind!([Ctrl], Key1, TabActivate0);
|
bind!([Ctrl], Key::Character("1".into()), TabActivate0);
|
||||||
bind!([Ctrl], Key2, TabActivate1);
|
bind!([Ctrl], Key::Character("2".into()), TabActivate1);
|
||||||
bind!([Ctrl], Key3, TabActivate2);
|
bind!([Ctrl], Key::Character("3".into()), TabActivate2);
|
||||||
bind!([Ctrl], Key4, TabActivate3);
|
bind!([Ctrl], Key::Character("4".into()), TabActivate3);
|
||||||
bind!([Ctrl], Key5, TabActivate4);
|
bind!([Ctrl], Key::Character("5".into()), TabActivate4);
|
||||||
bind!([Ctrl], Key6, TabActivate5);
|
bind!([Ctrl], Key::Character("6".into()), TabActivate5);
|
||||||
bind!([Ctrl], Key7, TabActivate6);
|
bind!([Ctrl], Key::Character("7".into()), TabActivate6);
|
||||||
bind!([Ctrl], Key8, TabActivate7);
|
bind!([Ctrl], Key::Character("8".into()), TabActivate7);
|
||||||
bind!([Ctrl], Key9, TabActivate8);
|
bind!([Ctrl], Key::Character("9".into()), TabActivate8);
|
||||||
bind!([Ctrl], Tab, TabNext);
|
bind!([Ctrl], Key::Named(Named::Tab), TabNext);
|
||||||
bind!([Ctrl, Shift], Tab, TabPrev);
|
bind!([Ctrl, Shift], Key::Named(Named::Tab), TabPrev);
|
||||||
bind!([Ctrl, Shift], G, ToggleGitManagement);
|
bind!(
|
||||||
bind!([Ctrl, Shift], F, ToggleProjectSearch);
|
[Ctrl, Shift],
|
||||||
bind!([Ctrl], Comma, ToggleSettingsPage);
|
Key::Character("G".into()),
|
||||||
bind!([Alt], Z, ToggleWordWrap);
|
ToggleGitManagement
|
||||||
bind!([Ctrl], Z, Undo);
|
);
|
||||||
|
bind!(
|
||||||
|
[Ctrl, Shift],
|
||||||
|
Key::Character("F".into()),
|
||||||
|
ToggleProjectSearch
|
||||||
|
);
|
||||||
|
bind!([Ctrl], Key::Character(",".into()), ToggleSettingsPage);
|
||||||
|
bind!([Alt], Key::Character("z".into()), ToggleWordWrap);
|
||||||
|
bind!([Ctrl], Key::Character("z".into()), Undo);
|
||||||
|
|
||||||
key_binds
|
key_binds
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
src/main.rs
13
src/main.rs
|
|
@ -295,7 +295,7 @@ pub enum Message {
|
||||||
FindReplaceValueChanged(String),
|
FindReplaceValueChanged(String),
|
||||||
FindSearchValueChanged(String),
|
FindSearchValueChanged(String),
|
||||||
GitProjectStatus(Vec<(String, PathBuf, Vec<GitStatus>)>),
|
GitProjectStatus(Vec<(String, PathBuf, Vec<GitStatus>)>),
|
||||||
Key(Modifiers, keyboard::KeyCode),
|
Key(Modifiers, keyboard::Key),
|
||||||
Modifiers(Modifiers),
|
Modifiers(Modifiers),
|
||||||
NewFile,
|
NewFile,
|
||||||
NewWindow,
|
NewWindow,
|
||||||
|
|
@ -1389,9 +1389,9 @@ impl Application for App {
|
||||||
Message::GitProjectStatus(project_status) => {
|
Message::GitProjectStatus(project_status) => {
|
||||||
self.git_project_status = Some(project_status);
|
self.git_project_status = Some(project_status);
|
||||||
}
|
}
|
||||||
Message::Key(modifiers, key_code) => {
|
Message::Key(modifiers, key) => {
|
||||||
for (key_bind, action) in self.key_binds.iter() {
|
for (key_bind, action) in self.key_binds.iter() {
|
||||||
if key_bind.matches(modifiers, key_code) {
|
if key_bind.matches(modifiers, key.clone()) {
|
||||||
return self.update(action.message());
|
return self.update(action.message());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2173,10 +2173,9 @@ impl Application for App {
|
||||||
|
|
||||||
subscription::Subscription::batch([
|
subscription::Subscription::batch([
|
||||||
event::listen_with(|event, _status| match event {
|
event::listen_with(|event, _status| match event {
|
||||||
event::Event::Keyboard(keyboard::Event::KeyPressed {
|
event::Event::Keyboard(keyboard::Event::KeyPressed { modifiers, key, .. }) => {
|
||||||
modifiers,
|
Some(Message::Key(modifiers, key))
|
||||||
key_code,
|
}
|
||||||
}) => Some(Message::Key(modifiers, key_code)),
|
|
||||||
event::Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => {
|
event::Event::Keyboard(keyboard::Event::ModifiersChanged(modifiers)) => {
|
||||||
Some(Message::Modifiers(modifiers))
|
Some(Message::Modifiers(modifiers))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
src/menu.rs
10
src/menu.rs
|
|
@ -6,6 +6,7 @@ use cosmic::{
|
||||||
widget::{column, horizontal_rule},
|
widget::{column, horizontal_rule},
|
||||||
Alignment, Background, Length,
|
Alignment, Background, Length,
|
||||||
},
|
},
|
||||||
|
iced_core::Border,
|
||||||
theme,
|
theme,
|
||||||
widget::{
|
widget::{
|
||||||
self, horizontal_space,
|
self, horizontal_space,
|
||||||
|
|
@ -71,9 +72,12 @@ pub fn context_menu<'a>(
|
||||||
icon_color: Some(component.on.into()),
|
icon_color: Some(component.on.into()),
|
||||||
text_color: Some(component.on.into()),
|
text_color: Some(component.on.into()),
|
||||||
background: Some(Background::Color(component.base.into())),
|
background: Some(Background::Color(component.base.into())),
|
||||||
border_radius: 8.0.into(),
|
border: Border {
|
||||||
border_width: 1.0,
|
radius: 8.0.into(),
|
||||||
border_color: component.divider.into(),
|
width: 1.0,
|
||||||
|
color: component.divider.into(),
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
.width(Length::Fixed(240.0))
|
.width(Length::Fixed(240.0))
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,14 @@ use cosmic::{
|
||||||
cosmic_theme::palette::{blend::Compose, WithAlpha},
|
cosmic_theme::palette::{blend::Compose, WithAlpha},
|
||||||
iced::{
|
iced::{
|
||||||
event::{Event, Status},
|
event::{Event, Status},
|
||||||
keyboard::{Event as KeyEvent, KeyCode, Modifiers},
|
keyboard::{Event as KeyEvent, Modifiers},
|
||||||
mouse::{self, Button, Event as MouseEvent, ScrollDelta},
|
mouse::{self, Button, Event as MouseEvent, ScrollDelta},
|
||||||
Color, Element, Length, Padding, Point, Rectangle, Size, Vector,
|
Color, Element, Length, Padding, Point, Rectangle, Size, Vector,
|
||||||
},
|
},
|
||||||
iced_core::{
|
iced_core::{
|
||||||
clipboard::Clipboard,
|
clipboard::Clipboard,
|
||||||
image,
|
image,
|
||||||
|
keyboard::{key::Named, Key},
|
||||||
layout::{self, Layout},
|
layout::{self, Layout},
|
||||||
renderer::{self, Quad, Renderer as _},
|
renderer::{self, Quad, Renderer as _},
|
||||||
widget::{
|
widget::{
|
||||||
|
|
@ -18,7 +19,7 @@ use cosmic::{
|
||||||
operation::{self, Operation, OperationOutputWrapper},
|
operation::{self, Operation, OperationOutputWrapper},
|
||||||
tree, Id, Widget,
|
tree, Id, Widget,
|
||||||
},
|
},
|
||||||
Shell,
|
Border, Shell,
|
||||||
},
|
},
|
||||||
theme::Theme,
|
theme::Theme,
|
||||||
Renderer,
|
Renderer,
|
||||||
|
|
@ -215,7 +216,7 @@ fn draw_rect(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Message> Widget<Message, Renderer> for TextBox<'a, Message>
|
impl<'a, Message> Widget<Message, cosmic::Theme, Renderer> for TextBox<'a, Message>
|
||||||
where
|
where
|
||||||
Message: Clone,
|
Message: Clone,
|
||||||
{
|
{
|
||||||
|
|
@ -227,12 +228,8 @@ where
|
||||||
tree::State::new(State::new())
|
tree::State::new(State::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn width(&self) -> Length {
|
fn size(&self) -> Size<Length> {
|
||||||
Length::Fill
|
Size::new(Length::Fill, Length::Fill)
|
||||||
}
|
|
||||||
|
|
||||||
fn height(&self) -> Length {
|
|
||||||
Length::Fill
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layout(
|
fn layout(
|
||||||
|
|
@ -261,7 +258,7 @@ where
|
||||||
let height = layout_lines as f32 * buffer.metrics().line_height;
|
let height = layout_lines as f32 * buffer.metrics().line_height;
|
||||||
let size = Size::new(limits.max().width, height);
|
let size = Size::new(limits.max().width, height);
|
||||||
|
|
||||||
layout::Node::new(limits.resolve(size))
|
layout::Node::new(limits.resolve(Length::Fill, Length::Fill, size))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -609,9 +606,12 @@ where
|
||||||
Point::new(image_position.x + scrollbar_rect.x, image_position.y),
|
Point::new(image_position.x + scrollbar_rect.x, image_position.y),
|
||||||
Size::new(scrollbar_rect.width, layout.bounds().height),
|
Size::new(scrollbar_rect.width, layout.bounds().height),
|
||||||
),
|
),
|
||||||
border_radius: (scrollbar_rect.width / 2.0).into(),
|
border: Border {
|
||||||
border_width: 0.0,
|
radius: (scrollbar_rect.width / 2.0).into(),
|
||||||
border_color: Color::TRANSPARENT,
|
width: 0.0,
|
||||||
|
color: Color::TRANSPARENT,
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
Color::from(track_color),
|
Color::from(track_color),
|
||||||
);
|
);
|
||||||
|
|
@ -666,9 +666,12 @@ where
|
||||||
renderer.fill_quad(
|
renderer.fill_quad(
|
||||||
Quad {
|
Quad {
|
||||||
bounds: scrollbar_draw,
|
bounds: scrollbar_draw,
|
||||||
border_radius: (scrollbar_draw.width / 2.0).into(),
|
border: Border {
|
||||||
border_width: 0.0,
|
radius: (scrollbar_draw.width / 2.0).into(),
|
||||||
border_color: Color::TRANSPARENT,
|
width: 0.0,
|
||||||
|
color: Color::TRANSPARENT,
|
||||||
|
},
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
Color::from(scrollbar_color),
|
Color::from(scrollbar_color),
|
||||||
);
|
);
|
||||||
|
|
@ -702,58 +705,59 @@ where
|
||||||
let mut status = Status::Ignored;
|
let mut status = Status::Ignored;
|
||||||
match event {
|
match event {
|
||||||
Event::Keyboard(KeyEvent::KeyPressed {
|
Event::Keyboard(KeyEvent::KeyPressed {
|
||||||
key_code,
|
key: Key::Named(key),
|
||||||
modifiers,
|
modifiers,
|
||||||
}) if state.is_focused => match key_code {
|
..
|
||||||
KeyCode::Left => {
|
}) if state.is_focused => match key {
|
||||||
|
Named::ArrowLeft => {
|
||||||
editor.action(Action::Motion(Motion::Left));
|
editor.action(Action::Motion(Motion::Left));
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::Right => {
|
Named::ArrowRight => {
|
||||||
editor.action(Action::Motion(Motion::Right));
|
editor.action(Action::Motion(Motion::Right));
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::Up => {
|
Named::ArrowUp => {
|
||||||
editor.action(Action::Motion(Motion::Up));
|
editor.action(Action::Motion(Motion::Up));
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::Down => {
|
Named::ArrowDown => {
|
||||||
editor.action(Action::Motion(Motion::Down));
|
editor.action(Action::Motion(Motion::Down));
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::Home => {
|
Named::Home => {
|
||||||
editor.action(Action::Motion(Motion::Home));
|
editor.action(Action::Motion(Motion::Home));
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::End => {
|
Named::End => {
|
||||||
editor.action(Action::Motion(Motion::End));
|
editor.action(Action::Motion(Motion::End));
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::PageUp => {
|
Named::PageUp => {
|
||||||
editor.action(Action::Motion(Motion::PageUp));
|
editor.action(Action::Motion(Motion::PageUp));
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::PageDown => {
|
Named::PageDown => {
|
||||||
editor.action(Action::Motion(Motion::PageDown));
|
editor.action(Action::Motion(Motion::PageDown));
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::Escape => {
|
Named::Escape => {
|
||||||
editor.action(Action::Escape);
|
editor.action(Action::Escape);
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::Enter => {
|
Named::Enter => {
|
||||||
editor.action(Action::Enter);
|
editor.action(Action::Enter);
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::Backspace => {
|
Named::Backspace => {
|
||||||
editor.action(Action::Backspace);
|
editor.action(Action::Backspace);
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::Delete => {
|
Named::Delete => {
|
||||||
editor.action(Action::Delete);
|
editor.action(Action::Delete);
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
KeyCode::Tab => {
|
Named::Tab => {
|
||||||
if modifiers.shift() {
|
if modifiers.shift() {
|
||||||
editor.action(Action::Unindent);
|
editor.action(Action::Unindent);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -766,7 +770,13 @@ where
|
||||||
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
||||||
state.modifiers = modifiers;
|
state.modifiers = modifiers;
|
||||||
}
|
}
|
||||||
Event::Keyboard(KeyEvent::CharacterReceived(character)) if state.is_focused => {
|
Event::Keyboard(KeyEvent::KeyPressed {
|
||||||
|
key: Key::Character(character),
|
||||||
|
modifiers,
|
||||||
|
text,
|
||||||
|
..
|
||||||
|
}) if state.is_focused => {
|
||||||
|
let character = character.chars().next().unwrap_or_default();
|
||||||
// Only parse keys when Super, Ctrl, and Alt are not pressed
|
// Only parse keys when Super, Ctrl, and Alt are not pressed
|
||||||
if !state.modifiers.logo() && !state.modifiers.control() && !state.modifiers.alt() {
|
if !state.modifiers.logo() && !state.modifiers.control() && !state.modifiers.alt() {
|
||||||
if !character.is_control() {
|
if !character.is_control() {
|
||||||
|
|
@ -939,7 +949,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Message> From<TextBox<'a, Message>> for Element<'a, Message, Renderer>
|
impl<'a, Message> From<TextBox<'a, Message>> for Element<'a, Message, cosmic::Theme, Renderer>
|
||||||
where
|
where
|
||||||
Message: Clone + 'a,
|
Message: Clone + 'a,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue