xwayland: Set scaled cursor size via xsettings
This commit is contained in:
parent
de1e528ba7
commit
2cbe89d89d
2 changed files with 17 additions and 2 deletions
|
|
@ -219,7 +219,7 @@ impl CursorStateInner {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn load_cursor_theme() -> (CursorTheme, u32) {
|
||||
pub fn load_cursor_env() -> (String, u32) {
|
||||
let name = std::env::var("XCURSOR_THEME")
|
||||
.ok()
|
||||
.unwrap_or_else(|| "default".into());
|
||||
|
|
@ -227,6 +227,11 @@ pub fn load_cursor_theme() -> (CursorTheme, u32) {
|
|||
.ok()
|
||||
.and_then(|s| s.parse().ok())
|
||||
.unwrap_or(24);
|
||||
(name, size)
|
||||
}
|
||||
|
||||
pub fn load_cursor_theme() -> (CursorTheme, u32) {
|
||||
let (name, size) = load_cursor_env();
|
||||
(CursorTheme::load(&name), size)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::{ffi::OsString, os::unix::io::OwnedFd, process::Stdio};
|
||||
|
||||
use crate::{
|
||||
backend::render::cursor::{load_cursor_theme, Cursor},
|
||||
backend::render::cursor::{load_cursor_env, load_cursor_theme, Cursor},
|
||||
shell::{
|
||||
focus::target::KeyboardFocusTarget, grabs::ReleaseMode, CosmicSurface, PendingWindow, Shell,
|
||||
},
|
||||
|
|
@ -595,12 +595,18 @@ impl Common {
|
|||
.filter_map(|s| s.0.x11_surface().map(|x| (x.clone(), x.geometry())))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let (_, cursor_size) = load_cursor_env();
|
||||
|
||||
// update xorg dpi
|
||||
if let Some(xwm) = xwayland.xwm.as_mut() {
|
||||
let dpi = new_scale * 96. * 1024.;
|
||||
if let Err(err) = xwm.set_xsettings(
|
||||
[
|
||||
("Xft/DPI".into(), (dpi.round() as i32).into()),
|
||||
(
|
||||
"Xcursor/size".into(),
|
||||
((new_scale * cursor_size as f64).round() as i32).into(),
|
||||
),
|
||||
(
|
||||
"Gdk/UnscaledDPI".into(),
|
||||
((dpi / new_scale).round() as i32).into(),
|
||||
|
|
@ -609,6 +615,10 @@ impl Common {
|
|||
"Gdk/WindowScalingFactor".into(),
|
||||
(new_scale.round() as i32).into(),
|
||||
),
|
||||
(
|
||||
"Gtk/CursorThemeSize".into(),
|
||||
((new_scale * cursor_size as f64).round() as i32).into(),
|
||||
),
|
||||
]
|
||||
.into_iter(),
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue