Skip to content

Commit

Permalink
Update to SCTK 0.18.0
Browse files Browse the repository at this point in the history
The main highlight is the move to calloop to handle all the requests
which makes it possible to remove all the active polling and clean the
data reading/writing, as well as accepting arbitrary long payloads.

This update also fixes the CI for the repository by moving it to github
actions, sets the minimum rust version, and edition to 2021.

Fixes Smithay#46.
Fixes Smithay#44.
Fixes Smithay#34.
  • Loading branch information
kchibisov committed Oct 8, 2023
1 parent c6cb0d7 commit 8b54054
Show file tree
Hide file tree
Showing 17 changed files with 828 additions and 931 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
pull_request:
push:
branches: [main]

env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Cdebuginfo=0 --deny=warnings"
RUSTDOCFLAGS: "--deny=warnings"

jobs:
fmt:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
components: rustfmt
- name: Check Formatting
run: cargo +nightly fmt --all -- --check

tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
rust_version: ["1.65", stable, nightly]

steps:
- uses: actions/checkout@v3

- uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust_version }}

- name: Check documentation
run: cargo doc --features=log --no-deps --document-private-items

- name: Run tests
run: cargo test --verbose --features=log
45 changes: 45 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy Docs to GitHub Pages

on:
push:
branches:
- master

jobs:
doc:
name: Documentation on Github Pages
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Cargo cache
uses: actions/cache@v1
with:
path: ~/.cargo
key: cargo-stable

- name: Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install system dependencies
run: sudo apt-get install libxkbcommon-dev libwayland-dev

- name: Build Documentation
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps

- name: Setup index
run: cp ./doc_index.html ./target/doc/index.html

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
78 changes: 0 additions & 78 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

- Update SCTK to 0.18
- Fix active polling of the clipboard each 50ms
- Fix freeze when copying data larger than the pipe buffer size

## 0.6.6 -- 2022-06-20

- Update SCTK to 0.16
Expand Down
14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
[package]
name = "smithay-clipboard"
version = "0.6.6"
authors = ["Kirill Chibisov <[email protected]>", "Victor Berger <[email protected]>", "Lucas Timmins <[email protected]>"]
authors = ["Kirill Chibisov <[email protected]>", "Victor Berger <[email protected]>"]
edition = "2021"
description = "Provides access to the wayland clipboard for client applications."
repository = "https://github.com/smithay/smithay-clipboard"
documentation = "https://smithay.github.io/smithay-clipboard"
license = "MIT"
keywords = ["clipboard", "wayland"]
rust-version = "1.65.0"

[dependencies]
sctk = { package = "smithay-client-toolkit", path = "../client-toolkit", default-features = false }
libc = "0.2.149"
sctk = { package = "smithay-client-toolkit", git = "https://github.com/kchibisov/client-toolkit", branch = "improve-selection", default-features = false, features = ["calloop"] }
wayland-backend = { version = "0.3.0", default_features = false, features = ["client_system"] }

[dev-dependencies]
sctk = { package = "smithay-client-toolkit", path = "../client-toolkit", default-features = false, features = ["calloop", "xkbcommon"] }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/kchibisov/client-toolkit", branch = "improve-selection", default-features = false, features = ["calloop", "xkbcommon"] }

# [features]
# default = ["dlopen"]
# dlopen = ["wayland-backend/dlopen" ]
[features]
default = ["dlopen"]
dlopen = ["wayland-backend/dlopen" ]
21 changes: 11 additions & 10 deletions examples/clipboard.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The example just demonstrates how to integrate the smithay-clipboard into the
// application. For more details on what is going on, consult the `smithay-client-toolkit`
// examples.
// application. For more details on what is going on, consult the
// `smithay-client-toolkit` examples.

use std::convert::TryInto;

Expand Down Expand Up @@ -277,35 +277,35 @@ impl KeyboardHandler for SimpleWindow {
_: u32,
event: KeyEvent,
) {
match event.utf8.as_ref().map(|s| s.as_str()) {
match event.utf8.as_deref() {
// Paste primary.
Some("P") => {
let contents = self
.clipboard
.load_primary()
.unwrap_or_else(|_| String::from("failed to load primary clipboard"));
println!("Paste from primary clipboard: {contents}");
}
},
// Paste clipboard.
Some("p") => {
let contents = self
.clipboard
.load()
.unwrap_or_else(|_| String::from("failed to load primary clipboard"));
println!("Paste from clipboard: {contents}");
}
},
// Copy primary.
Some("C") => {
let to_store = "Copy primary";
self.clipboard.store_primary(to_store);
println!("Copied string into primary clipboard: {}", to_store);
}
},
// Copy clipboard.
Some("c") => {
let to_store = "Copy";
self.clipboard.store_primary(to_store);
self.clipboard.store(to_store);
println!("Copied string into clipboard: {}", to_store);
}
},
_ => (),
}
}
Expand Down Expand Up @@ -366,7 +366,7 @@ impl SimpleWindow {
.expect("create buffer");
*buffer = second_buffer;
canvas
}
},
};

// Draw to the window:
Expand Down Expand Up @@ -403,8 +403,9 @@ delegate_xdg_window!(SimpleWindow);
delegate_registry!(SimpleWindow);

impl ProvidesRegistryState for SimpleWindow {
registry_handlers![OutputState, SeatState,];

fn registry(&mut self) -> &mut RegistryState {
&mut self.registry_state
}
registry_handlers![OutputState, SeatState,];
}
15 changes: 13 additions & 2 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
use_small_heuristics = "Max"
format_code_in_doc_comments = true
match_block_trailing_comma = true
condense_wildcard_suffixes = true
use_field_init_shorthand = true
normalize_doc_attributes = true
overflow_delimited_expr = true
imports_granularity = "Module"
use_small_heuristics = "Max"
normalize_comments = true
reorder_impl_items = true
use_try_shorthand = true
newline_style = "Unix"
edition = "2018"
format_strings = true
wrap_comments = true
comment_width = 80
edition = "2021"
79 changes: 0 additions & 79 deletions src/env.rs

This file was deleted.

Loading

0 comments on commit 8b54054

Please sign in to comment.