Skip to content

Commit

Permalink
chore: update sctk
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Sep 19, 2023
1 parent 94cb290 commit ace55af
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 209 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ keywords = ["gui", "ui", "graphics", "interface", "widgets"]
categories = ["gui"]

[features]
default = ["wayland"]
# Enable the `wgpu` GPU-accelerated renderer backend
wgpu = ["iced_renderer/wgpu"]
# Enables the `Image` widget
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bitflags = "1.2"
thiserror = "1"
log = "0.4.17"
twox-hash = { version = "1.5", default-features = false }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "c9940f4", optional = true }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", optional = true }

[dependencies.palette]
version = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion examples/sctk_drag/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "c9940f4" }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit" }
iced = { path = "../..", default-features = false, features = ["wayland", "debug", "a11y"] }
iced_style = { path = "../../style" }
env_logger = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion examples/sctk_todos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ iced = { path = "../..", default-features=false, features = ["async-std", "wayla
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
once_cell = "1.15"
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "c9940f4" }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit" }
iced_style = { path = "../../style" }

log = "0.4.17"
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ wayland = ["iced_accessibility?/accesskit_unix", "iced_core/wayland", "sctk"]

[dependencies]
thiserror = "1"
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "c9940f4", optional = true }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", optional = true }

[dependencies.iced_core]
version = "0.10"
Expand Down
4 changes: 3 additions & 1 deletion sctk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ a11y = ["iced_accessibility", "iced_runtime/a11y"]
[dependencies]
tracing = "0.1"
thiserror = "1.0"
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "c9940f4" }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit" }
wayland-protocols = { version = "0.30.0", features = [ "staging"]}
# sctk = { package = "smithay-client-toolkit", path = "../../fork/client-toolkit/" }
raw-window-handle = "0.5"
Expand All @@ -27,6 +27,8 @@ smithay-clipboard = "0.6"
accesskit = { version = "0.8.1", optional = true }
accesskit_unix = { version = "0.1.1", optional = true }
itertools = "0.10"
xkeysym = "0.2.0"
lazy_static = "1.4.0"

[dependencies.iced_runtime]
version = "0.1"
Expand Down
252 changes: 64 additions & 188 deletions sctk/src/conversion.rs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions sctk/src/handlers/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ impl<T: Debug> CompositorHandler for SctkState<T> {
) {
self.frame_events.push(surface.clone());
}

fn transform_changed(
&mut self,
conn: &Connection,
qh: &QueueHandle<Self>,
surface: &wl_surface::WlSurface,
new_transform: sctk::reexports::client::protocol::wl_output::Transform,
) {
// TODO
// this is not required
}
}

delegate_compositor!(@<T: 'static + Debug> SctkState<T>);
7 changes: 5 additions & 2 deletions sctk/src/handlers/seat/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use crate::{
sctk_event::{KeyboardEventVariant, SctkEvent},
};

use sctk::{delegate_keyboard, seat::keyboard::KeyboardHandler};
use sctk::{
delegate_keyboard,
seat::keyboard::{KeyboardHandler, Keysym},
};
use std::fmt::Debug;

impl<T: Debug> KeyboardHandler for SctkState<T> {
Expand All @@ -15,7 +18,7 @@ impl<T: Debug> KeyboardHandler for SctkState<T> {
surface: &sctk::reexports::client::protocol::wl_surface::WlSurface,
_serial: u32,
_raw: &[u32],
_keysyms: &[u32],
_keysyms: &[Keysym],
) {
let (i, mut is_active, seat) = {
let (i, is_active, my_seat) =
Expand Down
28 changes: 15 additions & 13 deletions sctk/src/sctk_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ impl SctkEvent {
KeyboardEventVariant::Press(ke) => {
let mut skip_char = false;

let mut events: Vec<_> = keysym_to_vkey(ke.keysym)
let mut events: Vec<_> = keysym_to_vkey(ke.keysym.raw())
.map(|k| {
if k == KeyCode::Backspace {
skip_char = true;
Expand Down Expand Up @@ -580,7 +580,7 @@ impl SctkEvent {
KeyboardEventVariant::Repeat(ke) => {
let mut skip_char = false;

let mut events: Vec<_> = keysym_to_vkey(ke.keysym)
let mut events: Vec<_> = keysym_to_vkey(ke.keysym.raw())
.map(|k| {
if k == KeyCode::Backspace {
skip_char = true;
Expand Down Expand Up @@ -609,17 +609,19 @@ impl SctkEvent {
}
events
}
KeyboardEventVariant::Release(k) => keysym_to_vkey(k.keysym)
.map(|k| {
iced_runtime::core::Event::Keyboard(
keyboard::Event::KeyReleased {
key_code: k,
modifiers: modifiers_to_native(*modifiers),
},
)
})
.into_iter()
.collect(),
KeyboardEventVariant::Release(k) => {
keysym_to_vkey(k.keysym.raw())
.map(|k| {
iced_runtime::core::Event::Keyboard(
keyboard::Event::KeyReleased {
key_code: k,
modifiers: modifiers_to_native(*modifiers),
},
)
})
.into_iter()
.collect()
}
KeyboardEventVariant::Modifiers(new_mods) => {
*modifiers = new_mods;
vec![iced_runtime::core::Event::Keyboard(
Expand Down
2 changes: 1 addition & 1 deletion widget/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ wayland = ["sctk"]
[dependencies]
unicode-segmentation = "1.6"
num-traits = "0.2"
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "c9940f4", optional = true }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", optional = true }
thiserror = "1"

[dependencies.iced_runtime]
Expand Down

0 comments on commit ace55af

Please sign in to comment.