jay_config/xwayland.rs
1//! Tools for configuring Xwayland.
2
3use serde::{Deserialize, Serialize};
4
5/// Sets whether Xwayland is enabled
6///
7/// The default is `true`.
8pub fn set_x_wayland_enabled(enabled: bool) {
9 get!().set_x_wayland_enabled(enabled)
10}
11
12/// The scaling mode of X windows.
13#[derive(Serialize, Deserialize, Copy, Clone, Debug, Eq, PartialEq, Hash, Default)]
14pub struct XScalingMode(pub u32);
15
16impl XScalingMode {
17 /// The default mode.
18 ///
19 /// Currently this means that windows are rendered at the lowest scale and then
20 /// upscaled if necessary.
21 pub const DEFAULT: Self = Self(0);
22 /// Windows are rendered at the highest integer scale and then downscaled.
23 ///
24 /// This has significant performance implications unless the window is running on the
25 /// output with the highest scale and that scale is an integer scale.
26 ///
27 /// For example, on a 3840x2160 output with a 1.5 scale, a fullscreen window will be
28 /// rendered at 3840x2160 * 2 / 1.5 = 5120x2880 pixels and then downscaled to
29 /// 3840x2160. This overhead gets worse the lower the scale of the output is.
30 ///
31 /// Additionally, this mode requires the X window to scale its contents itself. In the
32 /// example above, you might achieve this by setting the environment variable
33 /// `GDK_SCALE=2`.
34 pub const DOWNSCALED: Self = Self(1);
35}
36
37/// Sets the scaling mode for X windows.
38pub fn set_x_scaling_mode(mode: XScalingMode) {
39 get!().set_x_scaling_mode(mode)
40}