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

@ -1,6 +1,7 @@
use {
crate::{
backend::{Connector, ConnectorEvent, ConnectorId, MonitorInfo},
fixed::Fixed,
ifs::wl_output::WlOutputGlobal,
state::{ConnectorData, OutputData, State},
tree::{OutputNode, OutputRenderData},
@ -121,7 +122,9 @@ impl ConnectorHandler {
scroll: Default::default(),
pointer_positions: Default::default(),
lock_surface: Default::default(),
preferred_scale: Cell::new(Fixed::from_int(1)),
});
self.state.add_output_scale(on.preferred_scale.get());
let mode = info.initial_mode;
let output_data = Rc::new(OutputData {
connector: self.data.clone(),
@ -154,7 +157,7 @@ impl ConnectorHandler {
}
}
for ws in ws_to_move {
ws.output.set(on.clone());
ws.set_output(&on);
on.workspaces.add_last_existing(&ws);
if ws.visible_on_desired_output.get() && on.workspace.get().is_none() {
on.show_workspace(&ws);
@ -220,7 +223,7 @@ impl ConnectorHandler {
let is_visible =
!target_is_dummy && target.workspaces.is_empty() && ws.visible.get();
ws.visible_on_desired_output.set(ws.visible.get());
ws.output.set(target.clone());
ws.set_output(&target);
target.workspaces.add_last_existing(&ws);
if is_visible {
target.show_workspace(&ws);
@ -243,5 +246,6 @@ impl ConnectorHandler {
if let Some(dev) = &self.data.drm_dev {
dev.connectors.remove(&self.id);
}
self.state.remove_output_scale(on.preferred_scale.get());
}
}