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:
parent
16aec8f87e
commit
e52a60b3b6
41 changed files with 1417 additions and 364 deletions
|
|
@ -5,8 +5,8 @@ use {
|
|||
format::XRGB8888,
|
||||
globals::{Global, GlobalName},
|
||||
ifs::{
|
||||
wl_buffer::WlBufferStorage, zwlr_screencopy_frame_v1::ZwlrScreencopyFrameV1,
|
||||
zxdg_output_v1::ZxdgOutputV1,
|
||||
wl_buffer::WlBufferStorage, wl_surface::WlSurface,
|
||||
zwlr_screencopy_frame_v1::ZwlrScreencopyFrameV1, zxdg_output_v1::ZxdgOutputV1,
|
||||
},
|
||||
leaks::Tracker,
|
||||
object::Object,
|
||||
|
|
@ -72,6 +72,7 @@ pub struct WlOutputGlobal {
|
|||
pub unused_captures: LinkedList<Rc<ZwlrScreencopyFrameV1>>,
|
||||
pub pending_captures: LinkedList<Rc<ZwlrScreencopyFrameV1>>,
|
||||
pub destroyed: Cell<bool>,
|
||||
pub legacy_scale: Cell<i32>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq)]
|
||||
|
|
@ -117,6 +118,7 @@ impl WlOutputGlobal {
|
|||
unused_captures: Default::default(),
|
||||
pending_captures: Default::default(),
|
||||
destroyed: Cell::new(false),
|
||||
legacy_scale: Cell::new(1),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -124,6 +126,27 @@ impl WlOutputGlobal {
|
|||
self.pos.get()
|
||||
}
|
||||
|
||||
pub fn for_each_binding<F: FnMut(&Rc<WlOutput>)>(&self, client: ClientId, mut f: F) {
|
||||
let bindings = self.bindings.borrow_mut();
|
||||
if let Some(bindings) = bindings.get(&client) {
|
||||
for binding in bindings.values() {
|
||||
f(binding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_enter(&self, surface: &WlSurface) {
|
||||
self.for_each_binding(surface.client.id, |b| {
|
||||
surface.send_enter(b.id);
|
||||
})
|
||||
}
|
||||
|
||||
pub fn send_leave(&self, surface: &WlSurface) {
|
||||
self.for_each_binding(surface.client.id, |b| {
|
||||
surface.send_leave(b.id);
|
||||
})
|
||||
}
|
||||
|
||||
pub fn send_mode(&self) {
|
||||
let bindings = self.bindings.borrow_mut();
|
||||
for binding in bindings.values() {
|
||||
|
|
@ -293,7 +316,7 @@ impl WlOutput {
|
|||
fn send_scale(self: &Rc<Self>) {
|
||||
let event = Scale {
|
||||
self_id: self.id,
|
||||
factor: 1,
|
||||
factor: self.global.legacy_scale.get(),
|
||||
};
|
||||
self.client.event(event);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue