xwayland: allow windows to scale themselves
This commit is contained in:
parent
cc8db84289
commit
19b07fa7dc
40 changed files with 800 additions and 80 deletions
|
|
@ -27,6 +27,7 @@ use {
|
|||
connector_type::{ConnectorType, CON_UNKNOWN},
|
||||
Connector, DrmDevice, Format, GfxApi, Mode, TearingMode, Transform, VrrMode,
|
||||
},
|
||||
xwayland::XScalingMode,
|
||||
Axis, Direction, ModifiedKeySym, PciId, Workspace,
|
||||
},
|
||||
bincode::Options,
|
||||
|
|
@ -816,6 +817,10 @@ impl Client {
|
|||
(width, height)
|
||||
}
|
||||
|
||||
pub fn set_x_scaling_mode(&self, mode: XScalingMode) {
|
||||
self.send(&ClientMessage::SetXScalingMode { mode })
|
||||
}
|
||||
|
||||
pub fn set_vrr_mode(&self, connector: Option<Connector>, mode: VrrMode) {
|
||||
self.send(&ClientMessage::SetVrrMode { connector, mode })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use {
|
|||
},
|
||||
Axis, Direction, PciId, Workspace,
|
||||
_private::{PollableId, WireMode},
|
||||
xwayland::XScalingMode,
|
||||
},
|
||||
serde::{Deserialize, Serialize},
|
||||
std::time::Duration,
|
||||
|
|
@ -523,6 +524,9 @@ pub enum ClientMessage<'a> {
|
|||
SetUiDragThreshold {
|
||||
threshold: i32,
|
||||
},
|
||||
SetXScalingMode {
|
||||
mode: XScalingMode,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ pub mod tasks;
|
|||
pub mod theme;
|
||||
pub mod timer;
|
||||
pub mod video;
|
||||
pub mod xwayland;
|
||||
|
||||
/// A planar direction.
|
||||
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Eq, PartialEq)]
|
||||
|
|
|
|||
33
jay-config/src/xwayland.rs
Normal file
33
jay-config/src/xwayland.rs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
//! Tools for configuring Xwayland.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The scaling mode of X windows.
|
||||
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Eq, PartialEq, Hash, Default)]
|
||||
pub struct XScalingMode(pub u32);
|
||||
|
||||
impl XScalingMode {
|
||||
/// The default mode.
|
||||
///
|
||||
/// Currently this means that windows are rendered at the lowest scale and then
|
||||
/// upscaled if necessary.
|
||||
pub const DEFAULT: Self = Self(0);
|
||||
/// Windows are rendered at the highest integer scale and then downscaled.
|
||||
///
|
||||
/// This has significant performance implications unless the window is running on the
|
||||
/// output with the highest scale and that scale is an integer scale.
|
||||
///
|
||||
/// For example, on a 3840x2160 output with a 1.5 scale, a fullscreen window will be
|
||||
/// rendered at 3840x2160 * 2 / 1.5 = 5120x2880 pixels and then downscaled to
|
||||
/// 3840x2160. This overhead gets worse the lower the scale of the output is.
|
||||
///
|
||||
/// Additionally, this mode requires the X window to scale its contents itself. In the
|
||||
/// example above, you might achieve this by setting the environment variable
|
||||
/// `GDK_SCALE=2`.
|
||||
pub const DOWNSCALED: Self = Self(1);
|
||||
}
|
||||
|
||||
/// Sets the scaling mode for X windows.
|
||||
pub fn set_x_scaling_mode(mode: XScalingMode) {
|
||||
get!().set_x_scaling_mode(mode)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue