Skip to content

Commit

Permalink
chore: update sctk
Browse files Browse the repository at this point in the history
fixes sctk_drag example
  • Loading branch information
wash2 committed Sep 25, 2023
1 parent 58588f2 commit cb51336
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 24 deletions.
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 = "f49df45", optional = true }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "dc8c4a0", 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 = "f49df45" }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "dc8c4a0" }
iced = { path = "../..", default-features = false, features = ["wayland", "debug", "a11y"] }
iced_style = { path = "../../style" }
env_logger = "0.10"
Expand Down
1 change: 1 addition & 0 deletions examples/sctk_drag/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ impl iced_style::application::StyleSheet for CustomTheme {
fn appearance(&self, style: &Self::Style) -> application::Appearance {
iced_style::application::Appearance {
background_color: Color::from_rgba(1.0, 0.0, 1.0, 1.0),
icon_color: Color::BLACK,
text_color: Color::from_rgb(0.0, 1.0, 0.0),
}
}
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 = "f49df45" }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", rev = "dc8c4a0" }
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 = "f49df45", optional = true }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "dc8c4a0", optional = true }

[dependencies.iced_core]
version = "0.10"
Expand Down
6 changes: 3 additions & 3 deletions sctk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ 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 = "f49df45" }
wayland-protocols = { version = "0.30.0", features = [ "staging"]}
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "dc8c4a0" }
wayland-protocols = { version = "0.31.0", features = [ "staging"]}
# sctk = { package = "smithay-client-toolkit", path = "../../fork/client-toolkit/" }
raw-window-handle = "0.5"
enum-repr = "0.2"
futures = "0.3"
wayland-backend = {version = "0.1.0", features = ["client_system"]}
wayland-backend = {version = "0.3.1", features = ["client_system"]}
float-cmp = "0.9"
smithay-clipboard = "0.6"
accesskit = { version = "0.8.1", optional = true }
Expand Down
6 changes: 5 additions & 1 deletion sctk/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ where
.create_surface(&event_loop.state.queue_handle);

// let (display, context, config, surface) = init_egl(&wl_surface, 100, 100);
let backend = event_loop.state.connection.backend();
let backend = event_loop
.wayland_dispatcher
.as_source_ref()
.connection()
.backend();
let qh = event_loop.state.queue_handle.clone();
let wrapper = SurfaceDisplayWrapper::<C> {
comp_surface: None,
Expand Down
18 changes: 10 additions & 8 deletions sctk/src/event_loop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use iced_runtime::command::platform_specific::{
window::SctkWindowSettings,
},
};
use sctk::data_device_manager::data_source::DragSource;
use sctk::{
compositor::CompositorState,
data_device_manager::DataDeviceManagerState,
Expand All @@ -38,14 +37,18 @@ use sctk::{
calloop::{self, EventLoop},
client::{
globals::registry_queue_init, protocol::wl_surface::WlSurface,
ConnectError, Connection, DispatchError, Proxy, WaylandSource,
ConnectError, Connection, DispatchError, Proxy,
},
},
registry::RegistryState,
seat::SeatState,
shell::{wlr_layer::LayerShell, xdg::XdgShell, WaylandSurface},
shm::Shm,
};
use sctk::{
data_device_manager::data_source::DragSource,
reexports::calloop_wayland_source::WaylandSource,
};
#[cfg(feature = "a11y")]
use std::sync::{Arc, Mutex};
use std::{
Expand Down Expand Up @@ -121,7 +124,7 @@ where
calloop::channel::Event::Closed => {}
})
.unwrap();
let wayland_source = WaylandSource::new(event_queue).unwrap();
let wayland_source = WaylandSource::new(connection, event_queue);

let wayland_dispatcher = calloop::Dispatcher::new(
wayland_source,
Expand Down Expand Up @@ -162,7 +165,6 @@ where
event_loop,
wayland_dispatcher,
state: SctkState {
connection,
registry_state,
seat_state: SeatState::new(&globals, &qh),
output_state: OutputState::new(&globals, &qh),
Expand Down Expand Up @@ -306,7 +308,7 @@ where
// Still, we set the exit code to the error's OS error code, or to 1 if not possible.
let exit_code = loop {
// Send pending events to the server.
match self.state.connection.flush() {
match self.wayland_dispatcher.as_source_ref().connection().flush() {
Ok(_) => {}
Err(error) => {
break match error {
Expand Down Expand Up @@ -748,7 +750,7 @@ where
Event::SetCursor(iced_icon) => {
if let Some(ptr) = self.state.seats.get(0).and_then(|s| s.ptr.as_ref()) {
let icon = conversion::cursor_icon(iced_icon);
let _ = ptr.set_cursor(&self.state.connection, icon);
let _ = ptr.set_cursor(&self.wayland_dispatcher.as_source_ref().connection(), icon);
}

}
Expand Down Expand Up @@ -1164,7 +1166,7 @@ where
Some(s) => s,
None => return,
};
let mut reader = BufReader::new(f);
let mut reader = BufReader::new(f.as_ref());
let consumed = match reader.fill_buf() {
Ok(buf) => {
if buf.is_empty() {
Expand Down Expand Up @@ -1222,7 +1224,7 @@ where
Some(s) => s,
None => return,
};
let mut reader = BufReader::new(f);
let mut reader = BufReader::new(f.as_ref());
let consumed = match reader.fill_buf() {
Ok(buf) => {
if buf.is_empty() {
Expand Down
6 changes: 2 additions & 4 deletions sctk/src/event_loop/state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
collections::HashMap,
fmt::{Debug, Formatter},
num::NonZeroU32,
};
Expand All @@ -13,7 +12,7 @@ use crate::{
},
sctk_event::{
LayerSurfaceEventVariant, PopupEventVariant, SctkEvent,
SurfaceCompositorUpdate, WindowEventVariant,
WindowEventVariant,
},
};

Expand Down Expand Up @@ -50,7 +49,7 @@ use sctk::{
wl_surface::{self, WlSurface},
wl_touch::WlTouch,
},
Connection, QueueHandle,
QueueHandle,
},
},
registry::RegistryState,
Expand Down Expand Up @@ -334,7 +333,6 @@ pub struct SctkState<T> {
pub(crate) xdg_shell_state: XdgShell,
pub(crate) layer_shell: Option<LayerShell>,
pub(crate) data_device_manager_state: DataDeviceManagerState,
pub(crate) connection: Connection,
pub(crate) token_ctr: u32,
}

Expand Down
5 changes: 2 additions & 3 deletions sctk/src/handlers/data_device/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use sctk::{
Connection, QueueHandle,
},
};
use std::fmt::Debug;
use std::io::{BufWriter, Write};
use tracing::error;

Expand Down Expand Up @@ -74,7 +73,7 @@ impl<T> DataSourceHandler for SctkState<T> {
Some(s) => s,
None => return,
};
let mut writer = BufWriter::new(f);
let mut writer = BufWriter::new(f.as_ref());
let slice = &data.as_slice()[cur_index
..(cur_index + writer.capacity()).min(data.len())];
match writer.write(slice) {
Expand Down Expand Up @@ -142,7 +141,7 @@ impl<T> DataSourceHandler for SctkState<T> {
Some(s) => s,
None => return,
};
let mut writer = BufWriter::new(f);
let mut writer = BufWriter::new(f.as_ref());
let slice = &data.as_slice()[cur_index
..(cur_index + writer.capacity()).min(data.len())];
match writer.write(slice) {
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 = "f49df45", optional = true }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/smithay/client-toolkit", rev = "dc8c4a0", optional = true }
thiserror = "1"

[dependencies.iced_runtime]
Expand Down

0 comments on commit cb51336

Please sign in to comment.