1
0
Fork 0
forked from wry/wry

wayland: implement scaling

This involves many subsystems:

- config:
    - allow setting the connector scale
    - allow setting the cursor size
- cursors:
    - load server cursors for all requested sizes and scales
- wl_surface:
    - track the output the surface belongs to
    - send wl_surface.enter/leave
- wl_output:
    - implement wl_output.scale
- text:
    - pre-render texts for all used scales
- renderer:
    - properly align scale textures and rectangles
- wp_fractional_scale:
    - new interface for fractional scaling
This commit is contained in:
Julian Orth 2022-05-30 17:00:25 +02:00
parent 16aec8f87e
commit e52a60b3b6
41 changed files with 1417 additions and 364 deletions

View file

@ -14,6 +14,7 @@ use {
clientmem::{self, ClientMemError},
config::ConfigProxy,
dbus::Dbus,
fixed::Fixed,
forker,
globals::Globals,
ifs::{wl_output::WlOutputGlobal, wl_surface::NoneSurfaceExt},
@ -31,7 +32,8 @@ use {
user_session::import_environment,
utils::{
clonecell::CloneCell, errorfmt::ErrorFmt, fdcloser::FdCloser, numcell::NumCell,
oserror::OsError, queue::AsyncQueue, run_toplevel::RunToplevel, tri::Try,
oserror::OsError, queue::AsyncQueue, refcounted::RefCounted, run_toplevel::RunToplevel,
tri::Try,
},
wheel::{Wheel, WheelError},
xkbcommon::XkbContext,
@ -120,6 +122,8 @@ fn start_compositor2(
let wheel = Wheel::new(&engine, &ring)?;
let (_run_toplevel_future, run_toplevel) = RunToplevel::install(&engine);
let node_ids = NodeIds::default();
let scales = RefCounted::default();
scales.add(Fixed::from_int(1));
let state = Rc::new(State {
xkb_ctx,
backend: CloneCell::new(Rc::new(DummyBackend)),
@ -187,6 +191,8 @@ fn start_compositor2(
locked: Cell::new(false),
lock: Default::default(),
},
scales,
cursor_sizes: Default::default(),
});
state.tracker.register(ClientId::from_raw(0));
create_dummy_output(&state);
@ -376,6 +382,7 @@ fn create_dummy_output(state: &Rc<State>) {
scroll: Default::default(),
pointer_positions: Default::default(),
lock_surface: Default::default(),
preferred_scale: Cell::new(Fixed::from_int(1)),
});
let dummy_workspace = Rc::new(WorkspaceNode {
id: state.node_ids.next(),