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:
parent
471b1e003a
commit
3d85af04be
31 changed files with 3791 additions and 2630 deletions
149
src/platform_impl/linux/wayland/env.rs
Normal file
149
src/platform_impl/linux/wayland/env.rs
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
//! SCTK environment setup.
|
||||
|
||||
use sctk::reexports::client::protocol::wl_compositor::WlCompositor;
|
||||
use sctk::reexports::client::protocol::wl_output::WlOutput;
|
||||
use sctk::reexports::protocols::unstable::xdg_shell::v6::client::zxdg_shell_v6::ZxdgShellV6;
|
||||
use sctk::reexports::client::protocol::wl_seat::WlSeat;
|
||||
use sctk::reexports::protocols::unstable::xdg_decoration::v1::client::zxdg_decoration_manager_v1::ZxdgDecorationManagerV1;
|
||||
use sctk::reexports::client::protocol::wl_shell::WlShell;
|
||||
use sctk::reexports::client::protocol::wl_subcompositor::WlSubcompositor;
|
||||
use sctk::reexports::client::{Attached, DispatchData};
|
||||
use sctk::reexports::client::protocol::wl_shm::WlShm;
|
||||
use sctk::reexports::protocols::xdg_shell::client::xdg_wm_base::XdgWmBase;
|
||||
use sctk::reexports::protocols::unstable::relative_pointer::v1::client::zwp_relative_pointer_manager_v1::ZwpRelativePointerManagerV1;
|
||||
use sctk::reexports::protocols::unstable::pointer_constraints::v1::client::zwp_pointer_constraints_v1::ZwpPointerConstraintsV1;
|
||||
use sctk::reexports::protocols::unstable::text_input::v3::client::zwp_text_input_manager_v3::ZwpTextInputManagerV3;
|
||||
|
||||
use sctk::environment::{Environment, SimpleGlobal};
|
||||
use sctk::output::{OutputHandler, OutputHandling, OutputInfo, OutputStatusListener};
|
||||
use sctk::seat::{SeatData, SeatHandler, SeatHandling, SeatListener};
|
||||
use sctk::shell::{Shell, ShellHandler, ShellHandling};
|
||||
use sctk::shm::ShmHandler;
|
||||
|
||||
/// Set of extra features that are supported by the compositor.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct WindowingFeatures {
|
||||
cursor_grab: bool,
|
||||
}
|
||||
|
||||
impl WindowingFeatures {
|
||||
/// Create `WindowingFeatures` based on the presented interfaces.
|
||||
pub fn new(env: &Environment<WinitEnv>) -> Self {
|
||||
let cursor_grab = env.get_global::<ZwpPointerConstraintsV1>().is_some();
|
||||
Self { cursor_grab }
|
||||
}
|
||||
|
||||
pub fn cursor_grab(&self) -> bool {
|
||||
self.cursor_grab
|
||||
}
|
||||
}
|
||||
|
||||
sctk::environment!(WinitEnv,
|
||||
singles = [
|
||||
WlShm => shm,
|
||||
WlCompositor => compositor,
|
||||
WlSubcompositor => subcompositor,
|
||||
WlShell => shell,
|
||||
XdgWmBase => shell,
|
||||
ZxdgShellV6 => shell,
|
||||
ZxdgDecorationManagerV1 => decoration_manager,
|
||||
ZwpRelativePointerManagerV1 => relative_pointer_manager,
|
||||
ZwpPointerConstraintsV1 => pointer_constraints,
|
||||
ZwpTextInputManagerV3 => text_input_manager,
|
||||
],
|
||||
multis = [
|
||||
WlSeat => seats,
|
||||
WlOutput => outputs,
|
||||
]
|
||||
);
|
||||
|
||||
/// The environment that we utilize.
|
||||
pub struct WinitEnv {
|
||||
seats: SeatHandler,
|
||||
|
||||
outputs: OutputHandler,
|
||||
|
||||
shm: ShmHandler,
|
||||
|
||||
compositor: SimpleGlobal<WlCompositor>,
|
||||
|
||||
subcompositor: SimpleGlobal<WlSubcompositor>,
|
||||
|
||||
shell: ShellHandler,
|
||||
|
||||
relative_pointer_manager: SimpleGlobal<ZwpRelativePointerManagerV1>,
|
||||
|
||||
pointer_constraints: SimpleGlobal<ZwpPointerConstraintsV1>,
|
||||
|
||||
text_input_manager: SimpleGlobal<ZwpTextInputManagerV3>,
|
||||
|
||||
decoration_manager: SimpleGlobal<ZxdgDecorationManagerV1>,
|
||||
}
|
||||
|
||||
impl WinitEnv {
|
||||
pub fn new() -> Self {
|
||||
// Output tracking for available_monitors, etc.
|
||||
let outputs = OutputHandler::new();
|
||||
|
||||
// Keyboard/Pointer/Touch input.
|
||||
let seats = SeatHandler::new();
|
||||
|
||||
// Essential globals.
|
||||
let shm = ShmHandler::new();
|
||||
let compositor = SimpleGlobal::new();
|
||||
let subcompositor = SimpleGlobal::new();
|
||||
|
||||
// Gracefully handle shell picking, since SCTK automatically supports multiple
|
||||
// backends.
|
||||
let shell = ShellHandler::new();
|
||||
|
||||
// Server side decorations.
|
||||
let decoration_manager = SimpleGlobal::new();
|
||||
|
||||
// Device events for pointer.
|
||||
let relative_pointer_manager = SimpleGlobal::new();
|
||||
|
||||
// Pointer grab functionality.
|
||||
let pointer_constraints = SimpleGlobal::new();
|
||||
|
||||
// IME handling.
|
||||
let text_input_manager = SimpleGlobal::new();
|
||||
|
||||
Self {
|
||||
seats,
|
||||
outputs,
|
||||
shm,
|
||||
compositor,
|
||||
subcompositor,
|
||||
shell,
|
||||
decoration_manager,
|
||||
relative_pointer_manager,
|
||||
pointer_constraints,
|
||||
text_input_manager,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ShellHandling for WinitEnv {
|
||||
fn get_shell(&self) -> Option<Shell> {
|
||||
self.shell.get_shell()
|
||||
}
|
||||
}
|
||||
|
||||
impl SeatHandling for WinitEnv {
|
||||
fn listen<F: FnMut(Attached<WlSeat>, &SeatData, DispatchData<'_>) + 'static>(
|
||||
&mut self,
|
||||
f: F,
|
||||
) -> SeatListener {
|
||||
self.seats.listen(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl OutputHandling for WinitEnv {
|
||||
fn listen<F: FnMut(WlOutput, &OutputInfo, DispatchData<'_>) + 'static>(
|
||||
&mut self,
|
||||
f: F,
|
||||
) -> OutputStatusListener {
|
||||
self.outputs.listen(f)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue