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.
2020-09-29 07:11:43 +10:00
|
|
|
#![cfg(any(
|
|
|
|
target_os = "linux",
|
|
|
|
target_os = "dragonfly",
|
|
|
|
target_os = "freebsd",
|
|
|
|
target_os = "netbsd",
|
|
|
|
target_os = "openbsd"
|
|
|
|
))]
|
2015-09-26 02:04:55 +10:00
|
|
|
|
2020-06-15 17:15:27 +10:00
|
|
|
use std::os::raw;
|
|
|
|
#[cfg(feature = "x11")]
|
|
|
|
use std::{ptr, sync::Arc};
|
2018-06-15 09:42:18 +10:00
|
|
|
|
2019-06-22 01:33:15 +10:00
|
|
|
use crate::{
|
2019-08-09 07:50:22 +10:00
|
|
|
event_loop::{EventLoop, EventLoopWindowTarget},
|
2019-06-22 01:33:15 +10:00
|
|
|
monitor::MonitorHandle,
|
|
|
|
window::{Window, WindowBuilder},
|
|
|
|
};
|
2019-02-21 20:51:43 +11:00
|
|
|
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
|
|
|
use crate::dpi::Size;
|
|
|
|
#[cfg(feature = "x11")]
|
|
|
|
use crate::platform_impl::x11::{ffi::XVisualInfo, XConnection};
|
2019-06-18 04:27:00 +10:00
|
|
|
use crate::platform_impl::{
|
2019-08-09 07:50:22 +10:00
|
|
|
EventLoop as LinuxEventLoop, EventLoopWindowTarget as LinuxEventLoopWindowTarget,
|
|
|
|
Window as LinuxWindow,
|
2018-06-15 09:42:18 +10:00
|
|
|
};
|
2019-04-28 02:06:51 +10:00
|
|
|
|
2017-09-23 17:36:30 +10:00
|
|
|
// TODO: stupid hack so that glutin can do its work
|
2019-04-28 02:06:51 +10:00
|
|
|
#[doc(hidden)]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-06-18 04:27:00 +10:00
|
|
|
pub use crate::platform_impl::x11;
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-06-22 01:33:15 +10:00
|
|
|
pub use crate::platform_impl::{x11::util::WindowType as XWindowType, XNotSupported};
|
2017-03-15 20:11:43 +11:00
|
|
|
|
2019-08-09 07:50:22 +10:00
|
|
|
/// Additional methods on `EventLoopWindowTarget` that are specific to Unix.
|
|
|
|
pub trait EventLoopWindowTargetExtUnix {
|
|
|
|
/// True if the `EventLoopWindowTarget` uses Wayland.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2017-09-23 17:36:30 +10:00
|
|
|
fn is_wayland(&self) -> bool;
|
2020-06-15 17:15:27 +10:00
|
|
|
|
2019-08-09 07:50:22 +10:00
|
|
|
/// True if the `EventLoopWindowTarget` uses X11.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2017-09-23 17:36:30 +10:00
|
|
|
fn is_x11(&self) -> bool;
|
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[doc(hidden)]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_xconnection(&self) -> Option<Arc<XConnection>>;
|
2019-04-08 15:07:47 +10:00
|
|
|
|
2019-08-09 07:50:22 +10:00
|
|
|
/// Returns a pointer to the `wl_display` object of wayland that is used by this
|
|
|
|
/// `EventLoopWindowTarget`.
|
2019-04-08 15:07:47 +10:00
|
|
|
///
|
2019-05-02 09:03:30 +10:00
|
|
|
/// Returns `None` if the `EventLoop` doesn't use wayland (if it uses xlib for example).
|
2019-04-08 15:07:47 +10:00
|
|
|
///
|
2019-08-09 07:50:22 +10:00
|
|
|
/// The pointer will become invalid when the winit `EventLoop` is destroyed.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn wayland_display(&self) -> Option<*mut raw::c_void>;
|
2017-09-01 19:04:57 +10:00
|
|
|
}
|
|
|
|
|
2019-08-09 07:50:22 +10:00
|
|
|
impl<T> EventLoopWindowTargetExtUnix for EventLoopWindowTarget<T> {
|
2017-09-23 17:36:30 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2017-09-23 17:36:30 +10:00
|
|
|
fn is_wayland(&self) -> bool {
|
2019-08-09 07:50:22 +10:00
|
|
|
self.p.is_wayland()
|
2017-09-23 17:36:30 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2017-09-23 17:36:30 +10:00
|
|
|
fn is_x11(&self) -> bool {
|
2019-08-09 07:50:22 +10:00
|
|
|
!self.p.is_wayland()
|
2017-09-23 17:36:30 +10:00
|
|
|
}
|
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[inline]
|
|
|
|
#[doc(hidden)]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_xconnection(&self) -> Option<Arc<XConnection>> {
|
2019-08-09 07:50:22 +10:00
|
|
|
match self.p {
|
|
|
|
LinuxEventLoopWindowTarget::X(ref e) => Some(e.x_connection().clone()),
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-06-22 01:33:15 +10:00
|
|
|
_ => None,
|
2019-04-28 02:06:51 +10:00
|
|
|
}
|
|
|
|
}
|
2019-04-08 15:07:47 +10:00
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn wayland_display(&self) -> Option<*mut raw::c_void> {
|
2019-08-09 07:50:22 +10:00
|
|
|
match self.p {
|
|
|
|
LinuxEventLoopWindowTarget::Wayland(ref p) => {
|
|
|
|
Some(p.display().get_display_ptr() as *mut _)
|
|
|
|
}
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-06-22 01:33:15 +10:00
|
|
|
_ => None,
|
2019-04-08 15:07:47 +10:00
|
|
|
}
|
|
|
|
}
|
2017-01-08 00:34:38 +11:00
|
|
|
}
|
|
|
|
|
2019-08-09 07:50:22 +10:00
|
|
|
/// Additional methods on `EventLoop` that are specific to Unix.
|
|
|
|
pub trait EventLoopExtUnix {
|
2019-10-19 02:51:06 +11:00
|
|
|
/// Builds a new `EventLoop` that is forced to use X11.
|
|
|
|
///
|
|
|
|
/// # Panics
|
|
|
|
///
|
|
|
|
/// If called outside the main thread. To initialize an X11 event loop outside
|
|
|
|
/// the main thread, use [`new_x11_any_thread`](#tymethod.new_x11_any_thread).
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-08-09 07:50:22 +10:00
|
|
|
fn new_x11() -> Result<Self, XNotSupported>
|
|
|
|
where
|
|
|
|
Self: Sized;
|
|
|
|
|
|
|
|
/// Builds a new `EventLoop` that is forced to use Wayland.
|
2019-10-19 02:51:06 +11:00
|
|
|
///
|
|
|
|
/// # Panics
|
|
|
|
///
|
|
|
|
/// If called outside the main thread. To initialize a Wayland event loop outside
|
|
|
|
/// the main thread, use [`new_wayland_any_thread`](#tymethod.new_wayland_any_thread).
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-08-09 07:50:22 +10:00
|
|
|
fn new_wayland() -> Self
|
|
|
|
where
|
|
|
|
Self: Sized;
|
2019-10-19 02:51:06 +11:00
|
|
|
|
|
|
|
/// Builds a new `EventLoop` on any thread.
|
|
|
|
///
|
|
|
|
/// This method bypasses the cross-platform compatibility requirement
|
|
|
|
/// that `EventLoop` be created on the main thread.
|
|
|
|
fn new_any_thread() -> Self
|
|
|
|
where
|
|
|
|
Self: Sized;
|
|
|
|
|
|
|
|
/// Builds a new X11 `EventLoop` on any thread.
|
|
|
|
///
|
|
|
|
/// This method bypasses the cross-platform compatibility requirement
|
|
|
|
/// that `EventLoop` be created on the main thread.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-10-19 02:51:06 +11:00
|
|
|
fn new_x11_any_thread() -> Result<Self, XNotSupported>
|
|
|
|
where
|
|
|
|
Self: Sized;
|
|
|
|
|
|
|
|
/// Builds a new Wayland `EventLoop` on any thread.
|
|
|
|
///
|
|
|
|
/// This method bypasses the cross-platform compatibility requirement
|
|
|
|
/// that `EventLoop` be created on the main thread.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-10-19 02:51:06 +11:00
|
|
|
fn new_wayland_any_thread() -> Self
|
|
|
|
where
|
|
|
|
Self: Sized;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn wrap_ev<T>(event_loop: LinuxEventLoop<T>) -> EventLoop<T> {
|
|
|
|
EventLoop {
|
|
|
|
event_loop,
|
|
|
|
_marker: std::marker::PhantomData,
|
|
|
|
}
|
2019-08-09 07:50:22 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> EventLoopExtUnix for EventLoop<T> {
|
2019-10-19 02:51:06 +11:00
|
|
|
#[inline]
|
|
|
|
fn new_any_thread() -> Self {
|
|
|
|
wrap_ev(LinuxEventLoop::new_any_thread())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-10-19 02:51:06 +11:00
|
|
|
fn new_x11_any_thread() -> Result<Self, XNotSupported> {
|
|
|
|
LinuxEventLoop::new_x11_any_thread().map(wrap_ev)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-10-19 02:51:06 +11:00
|
|
|
fn new_wayland_any_thread() -> Self {
|
|
|
|
wrap_ev(
|
|
|
|
LinuxEventLoop::new_wayland_any_thread()
|
|
|
|
// TODO: propagate
|
|
|
|
.expect("failed to open Wayland connection"),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-08-09 07:50:22 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-08-09 07:50:22 +10:00
|
|
|
fn new_x11() -> Result<Self, XNotSupported> {
|
2019-10-19 02:51:06 +11:00
|
|
|
LinuxEventLoop::new_x11().map(wrap_ev)
|
2019-08-09 07:50:22 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-08-09 07:50:22 +10:00
|
|
|
fn new_wayland() -> Self {
|
2019-10-19 02:51:06 +11:00
|
|
|
wrap_ev(
|
|
|
|
LinuxEventLoop::new_wayland()
|
|
|
|
// TODO: propagate
|
|
|
|
.expect("failed to open Wayland connection"),
|
|
|
|
)
|
2019-08-09 07:50:22 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-08 02:01:18 +11:00
|
|
|
/// Additional methods on `Window` that are specific to Unix.
|
2019-02-06 02:30:33 +11:00
|
|
|
pub trait WindowExtUnix {
|
2017-12-17 20:17:26 +11:00
|
|
|
/// Returns the ID of the `Window` xlib object that is used by this window.
|
2015-09-26 02:04:55 +10:00
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use xlib (if it uses wayland for example).
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_window(&self) -> Option<raw::c_ulong>;
|
2015-09-26 02:04:55 +10:00
|
|
|
|
|
|
|
/// Returns a pointer to the `Display` object of xlib that is used by this window.
|
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use xlib (if it uses wayland for example).
|
|
|
|
///
|
|
|
|
/// The pointer will become invalid when the glutin `Window` is destroyed.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_display(&self) -> Option<*mut raw::c_void>;
|
2016-10-20 03:11:02 +11:00
|
|
|
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_screen_id(&self) -> Option<raw::c_int>;
|
2016-10-20 03:11:02 +11:00
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[doc(hidden)]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_xconnection(&self) -> Option<Arc<XConnection>>;
|
2017-07-12 14:00:51 +10:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
/// Set window urgency hint (`XUrgencyHint`). Only relevant on X.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2018-05-21 00:47:22 +10:00
|
|
|
fn set_urgent(&self, is_urgent: bool);
|
|
|
|
|
2016-07-31 07:58:28 +10:00
|
|
|
/// This function returns the underlying `xcb_connection_t` of an xlib `Display`.
|
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use xlib (if it uses wayland for example).
|
|
|
|
///
|
|
|
|
/// The pointer will become invalid when the glutin `Window` is destroyed.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xcb_connection(&self) -> Option<*mut raw::c_void>;
|
2016-05-08 17:28:54 +10:00
|
|
|
|
2016-10-10 17:01:58 +11:00
|
|
|
/// Returns a pointer to the `wl_surface` object of wayland that is used by this window.
|
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use wayland (if it uses xlib for example).
|
|
|
|
///
|
|
|
|
/// The pointer will become invalid when the glutin `Window` is destroyed.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn wayland_surface(&self) -> Option<*mut raw::c_void>;
|
2016-10-10 17:01:58 +11:00
|
|
|
|
|
|
|
/// Returns a pointer to the `wl_display` object of wayland that is used by this window.
|
|
|
|
///
|
|
|
|
/// Returns `None` if the window doesn't use wayland (if it uses xlib for example).
|
|
|
|
///
|
|
|
|
/// The pointer will become invalid when the glutin `Window` is destroyed.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn wayland_display(&self) -> Option<*mut raw::c_void>;
|
2017-09-28 00:31:46 +10:00
|
|
|
|
2019-01-29 21:04:15 +11:00
|
|
|
/// Sets the color theme of the client side window decorations on wayland
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2020-01-27 13:56:54 +11:00
|
|
|
fn set_wayland_theme<T: Theme>(&self, theme: T);
|
2019-01-29 21:04:15 +11:00
|
|
|
|
2017-09-28 00:31:46 +10:00
|
|
|
/// Check if the window is ready for drawing
|
|
|
|
///
|
2017-11-04 03:35:29 +11:00
|
|
|
/// It is a remnant of a previous implementation detail for the
|
|
|
|
/// wayland backend, and is no longer relevant.
|
2017-09-28 00:31:46 +10:00
|
|
|
///
|
2017-11-04 03:35:29 +11:00
|
|
|
/// Always return true.
|
|
|
|
#[deprecated]
|
2017-09-28 00:31:46 +10:00
|
|
|
fn is_ready(&self) -> bool;
|
2015-09-26 02:04:55 +10:00
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl WindowExtUnix for Window {
|
2015-09-26 02:04:55 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_window(&self) -> Option<raw::c_ulong> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-05-30 11:29:54 +10:00
|
|
|
LinuxWindow::X(ref w) => Some(w.xlib_window()),
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-06-22 01:33:15 +10:00
|
|
|
_ => None,
|
2015-09-26 02:04:55 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_display(&self) -> Option<*mut raw::c_void> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-05-30 11:29:54 +10:00
|
|
|
LinuxWindow::X(ref w) => Some(w.xlib_display()),
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-06-22 01:33:15 +10:00
|
|
|
_ => None,
|
2015-09-26 02:04:55 +10:00
|
|
|
}
|
|
|
|
}
|
2016-05-08 17:28:54 +10:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_screen_id(&self) -> Option<raw::c_int> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-05-30 11:29:54 +10:00
|
|
|
LinuxWindow::X(ref w) => Some(w.xlib_screen_id()),
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-06-22 01:33:15 +10:00
|
|
|
_ => None,
|
2016-10-20 03:11:02 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[inline]
|
|
|
|
#[doc(hidden)]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn xlib_xconnection(&self) -> Option<Arc<XConnection>> {
|
2019-04-28 02:06:51 +10:00
|
|
|
match self.window {
|
2019-05-30 11:29:54 +10:00
|
|
|
LinuxWindow::X(ref w) => Some(w.xlib_xconnection()),
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-06-22 01:33:15 +10:00
|
|
|
_ => None,
|
2019-04-28 02:06:51 +10:00
|
|
|
}
|
|
|
|
}
|
2016-10-20 03:11:02 +11:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn set_urgent(&self, is_urgent: bool) {
|
2020-06-15 17:15:27 +10:00
|
|
|
match self.window {
|
|
|
|
LinuxWindow::X(ref w) => w.set_urgent(is_urgent),
|
|
|
|
#[cfg(feature = "wayland")]
|
|
|
|
_ => (),
|
2016-07-31 07:58:28 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn xcb_connection(&self) -> Option<*mut raw::c_void> {
|
|
|
|
match self.window {
|
|
|
|
LinuxWindow::X(ref w) => Some(w.xcb_connection()),
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-09-24 00:10:33 +10:00
|
|
|
_ => None,
|
2019-04-28 02:06:51 +10:00
|
|
|
}
|
2018-05-21 00:47:22 +10:00
|
|
|
}
|
|
|
|
|
2016-05-08 17:28:54 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn wayland_surface(&self) -> Option<*mut raw::c_void> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
2019-05-30 11:29:54 +10:00
|
|
|
LinuxWindow::Wayland(ref w) => Some(w.surface().as_ref().c_ptr() as *mut _),
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-06-22 01:33:15 +10:00
|
|
|
_ => None,
|
2016-05-08 17:28:54 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-05-30 11:29:54 +10:00
|
|
|
fn wayland_display(&self) -> Option<*mut raw::c_void> {
|
2017-03-04 07:41:51 +11:00
|
|
|
match self.window {
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
LinuxWindow::Wayland(ref w) => Some(w.display().get_display_ptr() as *mut _),
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-06-22 01:33:15 +10:00
|
|
|
_ => None,
|
2016-05-08 17:28:54 +10:00
|
|
|
}
|
|
|
|
}
|
2017-09-28 00:31:46 +10:00
|
|
|
|
2019-01-29 21:04:15 +11:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2020-01-27 13:56:54 +11:00
|
|
|
fn set_wayland_theme<T: Theme>(&self, theme: T) {
|
2019-01-29 21:04:15 +11:00
|
|
|
match self.window {
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
LinuxWindow::Wayland(ref w) => w.set_theme(theme),
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-06-25 02:14:55 +10:00
|
|
|
_ => {}
|
2019-01-29 21:04:15 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-28 00:31:46 +10:00
|
|
|
#[inline]
|
|
|
|
fn is_ready(&self) -> bool {
|
2017-11-04 03:35:29 +11:00
|
|
|
true
|
2017-09-28 00:31:46 +10:00
|
|
|
}
|
2015-09-26 02:04:55 +10:00
|
|
|
}
|
2016-01-08 02:01:18 +11:00
|
|
|
|
|
|
|
/// Additional methods on `WindowBuilder` that are specific to Unix.
|
2019-02-06 02:30:33 +11:00
|
|
|
pub trait WindowBuilderExtUnix {
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_x11_visual<T>(self, visual_infos: *const T) -> Self;
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_x11_screen(self, screen_id: i32) -> Self;
|
2018-05-03 23:41:11 +10:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
/// Build window with `WM_CLASS` hint; defaults to the name of the binary. Only relevant on X11.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_class(self, class: String, instance: String) -> Self;
|
2018-05-21 00:47:22 +10:00
|
|
|
/// Build window with override-redirect flag; defaults to false. Only relevant on X11.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_override_redirect(self, override_redirect: bool) -> Self;
|
|
|
|
/// Build window with `_NET_WM_WINDOW_TYPE` hints; defaults to `Normal`. Only relevant on X11.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_x11_window_type(self, x11_window_type: Vec<XWindowType>) -> Self;
|
2018-09-21 07:00:04 +10:00
|
|
|
/// Build window with `_GTK_THEME_VARIANT` hint set to the specified value. Currently only relevant on X11.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_gtk_theme_variant(self, variant: String) -> Self;
|
2018-05-03 23:41:11 +10:00
|
|
|
/// Build window with resize increment hint. Only implemented on X11.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2020-01-04 17:14:11 +11:00
|
|
|
fn with_resize_increments<S: Into<Size>>(self, increments: S) -> Self;
|
2018-05-03 23:41:11 +10:00
|
|
|
/// Build window with base size hint. Only implemented on X11.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2020-01-04 17:14:11 +11:00
|
|
|
fn with_base_size<S: Into<Size>>(self, base_size: S) -> Self;
|
2018-11-16 08:59:56 +11:00
|
|
|
|
|
|
|
/// Build window with a given application ID. It should match the `.desktop` file distributed with
|
|
|
|
/// your program. Only relevant on Wayland.
|
|
|
|
///
|
|
|
|
/// For details about application ID conventions, see the
|
|
|
|
/// [Desktop Entry Spec](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#desktop-file-id)
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_app_id(self, app_id: String) -> Self;
|
2016-01-08 02:01:18 +11:00
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl WindowBuilderExtUnix for WindowBuilder {
|
2017-01-07 07:59:35 +11:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_x11_visual<T>(mut self, visual_infos: *const T) -> Self {
|
2020-06-15 17:15:27 +10:00
|
|
|
{
|
|
|
|
self.platform_specific.visual_infos =
|
|
|
|
Some(unsafe { ptr::read(visual_infos as *const XVisualInfo) });
|
|
|
|
}
|
2017-01-07 07:59:35 +11:00
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_x11_screen(mut self, screen_id: i32) -> Self {
|
2017-01-07 07:59:35 +11:00
|
|
|
self.platform_specific.screen_id = Some(screen_id);
|
|
|
|
self
|
|
|
|
}
|
2018-05-03 23:41:11 +10:00
|
|
|
|
2018-05-21 00:47:22 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_class(mut self, instance: String, class: String) -> Self {
|
2018-05-21 00:47:22 +10:00
|
|
|
self.platform_specific.class = Some((instance, class));
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_override_redirect(mut self, override_redirect: bool) -> Self {
|
2018-05-21 00:47:22 +10:00
|
|
|
self.platform_specific.override_redirect = override_redirect;
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2019-04-28 02:06:51 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_x11_window_type(mut self, x11_window_types: Vec<XWindowType>) -> Self {
|
|
|
|
self.platform_specific.x11_window_types = x11_window_types;
|
2019-04-28 02:06:51 +10:00
|
|
|
self
|
|
|
|
}
|
2018-05-21 00:47:22 +10:00
|
|
|
|
2018-05-03 23:41:11 +10:00
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_gtk_theme_variant(mut self, variant: String) -> Self {
|
|
|
|
self.platform_specific.gtk_theme_variant = Some(variant);
|
2018-05-03 23:41:11 +10:00
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2020-01-04 17:14:11 +11:00
|
|
|
fn with_resize_increments<S: Into<Size>>(mut self, increments: S) -> Self {
|
2019-09-24 00:10:33 +10:00
|
|
|
self.platform_specific.resize_increments = Some(increments.into());
|
2018-05-03 23:41:11 +10:00
|
|
|
self
|
|
|
|
}
|
2018-09-21 07:00:04 +10:00
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "x11")]
|
2020-01-04 17:14:11 +11:00
|
|
|
fn with_base_size<S: Into<Size>>(mut self, base_size: S) -> Self {
|
2019-09-24 00:10:33 +10:00
|
|
|
self.platform_specific.base_size = Some(base_size.into());
|
2018-09-21 07:00:04 +10:00
|
|
|
self
|
|
|
|
}
|
2018-11-16 08:59:56 +11:00
|
|
|
|
|
|
|
#[inline]
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2019-09-24 00:10:33 +10:00
|
|
|
fn with_app_id(mut self, app_id: String) -> Self {
|
2018-11-16 08:59:56 +11:00
|
|
|
self.platform_specific.app_id = Some(app_id);
|
|
|
|
self
|
|
|
|
}
|
2016-01-08 02:01:18 +11:00
|
|
|
}
|
2017-08-30 16:49:18 +10:00
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
/// Additional methods on `MonitorHandle` that are specific to Linux.
|
|
|
|
pub trait MonitorHandleExtUnix {
|
2017-08-30 16:49:18 +10:00
|
|
|
/// Returns the inner identifier of the monitor.
|
|
|
|
fn native_id(&self) -> u32;
|
|
|
|
}
|
|
|
|
|
2019-02-06 02:30:33 +11:00
|
|
|
impl MonitorHandleExtUnix for MonitorHandle {
|
2017-08-30 16:49:18 +10:00
|
|
|
#[inline]
|
|
|
|
fn native_id(&self) -> u32 {
|
2019-05-30 11:29:54 +10:00
|
|
|
self.inner.native_identifier()
|
2017-08-30 16:49:18 +10:00
|
|
|
}
|
|
|
|
}
|
2020-01-27 13:56:54 +11:00
|
|
|
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
/// A theme for a Wayland's client side decorations.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
2020-01-27 13:56:54 +11:00
|
|
|
pub trait Theme: Send + 'static {
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
/// Title bar color.
|
|
|
|
fn element_color(&self, element: Element, window_active: bool) -> ARGBColor;
|
|
|
|
|
|
|
|
/// Color for a given button part.
|
|
|
|
fn button_color(
|
|
|
|
&self,
|
|
|
|
button: Button,
|
|
|
|
state: ButtonState,
|
|
|
|
foreground: bool,
|
|
|
|
window_active: bool,
|
|
|
|
) -> ARGBColor;
|
|
|
|
|
|
|
|
/// Font name and the size for the title bar.
|
|
|
|
///
|
|
|
|
/// By default the font is `sans-serif` at the size of 11.
|
|
|
|
///
|
|
|
|
/// Returning `None` means that title won't be drawn.
|
|
|
|
fn font(&self) -> Option<(String, f32)> {
|
|
|
|
// Not having any title isn't something desirable for the users, so setting it to
|
|
|
|
// something generic.
|
|
|
|
Some((String::from("sans-serif"), 11.))
|
2020-01-27 13:56:54 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
/// A button on Wayland's client side decorations.
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
|
|
pub enum Button {
|
|
|
|
/// Button that maximizes the window.
|
|
|
|
Maximize,
|
2020-01-27 13:56:54 +11:00
|
|
|
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
/// Button that minimizes the window.
|
|
|
|
Minimize,
|
2020-01-27 13:56:54 +11:00
|
|
|
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
/// Button that closes the window.
|
|
|
|
Close,
|
2020-01-27 13:56:54 +11:00
|
|
|
}
|
|
|
|
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
/// A button state of the button on Wayland's client side decorations.
|
|
|
|
#[cfg(feature = "wayland")]
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
2020-01-27 13:56:54 +11:00
|
|
|
pub enum ButtonState {
|
|
|
|
/// Button is being hovered over by pointer.
|
|
|
|
Hovered,
|
|
|
|
/// Button is not being hovered over by pointer.
|
|
|
|
Idle,
|
|
|
|
/// Button is disabled.
|
|
|
|
Disabled,
|
|
|
|
}
|
|
|
|
|
2020-06-15 17:15:27 +10:00
|
|
|
#[cfg(feature = "wayland")]
|
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.
2020-09-29 07:11:43 +10:00
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
|
|
pub enum Element {
|
|
|
|
/// Bar itself.
|
|
|
|
Bar,
|
|
|
|
|
|
|
|
/// Separator between window and title bar.
|
|
|
|
Separator,
|
|
|
|
|
|
|
|
/// Title bar text.
|
|
|
|
Text,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "wayland")]
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
|
|
pub struct ARGBColor {
|
|
|
|
pub a: u8,
|
|
|
|
pub r: u8,
|
|
|
|
pub g: u8,
|
|
|
|
pub b: u8,
|
2020-01-27 13:56:54 +11:00
|
|
|
}
|