Update SCTK to 0.11.0

* Update SCTK to 0.11.0

Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:

  - Disabled repeat rate not being handled.
  - Decoration buttons not working after tty switch.
  - Scaling not being applied on output reenable.
  - Crash when `XCURSOR_SIZE` is `0`.
  - Pointer getting created in some cases without pointer capability.
  - On kwin, fix space between window and decorations on startup.
  - Incorrect size event when entering fullscreen when using
    client side decorations.
  - Client side decorations not being hided properly in fullscreen.
  - Size tracking between fullscreen/tiled state changes.
  - Repeat rate triggering multiple times from slow callback handler.
  - Resizable attribute not being applied properly on startup.
  - Not working IME

Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.

It also adds new methods to a `Theme` trait, such as:
  - `title_font(&self) -> Option<(String, f32)>` - The font for a title.
  - `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
  the text in the title.

Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #952.
Fixes #947.
This commit is contained in:
Kirill Chibisov 2020-09-29 00:11:43 +03:00 committed by GitHub
parent 471b1e003a
commit 3d85af04be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 3791 additions and 2630 deletions

View file

@ -9,6 +9,8 @@
#[cfg(all(not(feature = "x11"), not(feature = "wayland")))]
compile_error!("Please select a feature to build for unix: `x11`, `wayland`");
#[cfg(feature = "wayland")]
use std::error::Error;
use std::{collections::VecDeque, env, fmt};
#[cfg(feature = "x11")]
use std::{ffi::CStr, mem::MaybeUninit, os::raw::*, sync::Arc};
@ -16,8 +18,6 @@ use std::{ffi::CStr, mem::MaybeUninit, os::raw::*, sync::Arc};
#[cfg(feature = "x11")]
use parking_lot::Mutex;
use raw_window_handle::RawWindowHandle;
#[cfg(feature = "wayland")]
use smithay_client_toolkit::reexports::client::ConnectError;
#[cfg(feature = "x11")]
pub use self::x11::XNotSupported;
@ -108,6 +108,8 @@ pub enum OsError {
XError(XError),
#[cfg(feature = "x11")]
XMisc(&'static str),
#[cfg(feature = "wayland")]
WaylandMisc(&'static str),
}
impl fmt::Display for OsError {
@ -117,6 +119,8 @@ impl fmt::Display for OsError {
OsError::XError(ref e) => _f.pad(&e.description),
#[cfg(feature = "x11")]
OsError::XMisc(ref e) => _f.pad(e),
#[cfg(feature = "wayland")]
OsError::WaylandMisc(ref e) => _f.pad(e),
}
}
}
@ -410,13 +414,8 @@ impl Window {
}
#[inline]
pub fn set_ime_position(&self, _position: Position) {
match self {
#[cfg(feature = "x11")]
&Window::X(ref w) => w.set_ime_position(_position),
#[cfg(feature = "wayland")]
_ => (),
}
pub fn set_ime_position(&self, position: Position) {
x11_or_wayland!(match self; Window(w) => w.set_ime_position(position))
}
#[inline]
@ -597,14 +596,14 @@ impl<T: 'static> EventLoop<T> {
}
#[cfg(feature = "wayland")]
pub fn new_wayland() -> Result<EventLoop<T>, ConnectError> {
pub fn new_wayland() -> Result<EventLoop<T>, Box<dyn Error>> {
assert_is_main_thread("new_wayland_any_thread");
EventLoop::new_wayland_any_thread()
}
#[cfg(feature = "wayland")]
pub fn new_wayland_any_thread() -> Result<EventLoop<T>, ConnectError> {
pub fn new_wayland_any_thread() -> Result<EventLoop<T>, Box<dyn Error>> {
wayland::EventLoop::new().map(EventLoop::Wayland)
}