Skip to content

Commit

Permalink
Merge pull request #160 from l4l/release-0.2.2
Browse files Browse the repository at this point in the history
Release 0.2.2
  • Loading branch information
l4l committed Mar 11, 2024
2 parents a762ded + 1a25ba8 commit be3e9dc
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

## Fixes

# 0.2.2 - 2024-03-10

## Fixes

- Invalid scale handling

# 0.2.1 - 2024-03-10

## Features
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yofi"
version = "0.2.1"
version = "0.2.2"
authors = ["Kitsu <[email protected]>"]
edition = "2021"

Expand Down
7 changes: 3 additions & 4 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl Window {
let width = self.width().try_into().expect("width overflow");
let height = self.height().try_into().expect("height overflow");
let stride = width * 4;
self.surface.set_buffer_scale(self.scale.into());

if self
.buffer
Expand Down Expand Up @@ -239,10 +240,9 @@ impl Window {
};
let mut point = Point::new(0., 0.);

let scale = self.scale;
let mut drawables = crate::draw::make_drawables(&self.config, &mut self.state);
while let Some(d) = drawables.borrowed_next() {
let occupied = d.draw(&mut dt, scale, space_left, point);
let occupied = d.draw(&mut dt, self.scale, space_left, point);
debug_assert!(
occupied.width <= space_left.width && occupied.height <= space_left.height
);
Expand All @@ -251,8 +251,7 @@ impl Window {
space_left.height -= occupied.height;
}

self.surface
.damage_buffer(0, 0, self.width as i32, self.height as i32);
self.surface.damage_buffer(0, 0, width, height);
self.surface.frame(qh, self.surface.clone());
buffer.attach_to(&self.surface).expect("buffer attach");
self.buffer = Some(buffer);
Expand Down
Empty file removed src/window/1Window
Empty file.
14 changes: 14 additions & 0 deletions src/window/compositor.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use anyhow::Context;
use sctk::{
compositor::CompositorHandler,
reexports::client::{
Expand All @@ -16,7 +17,20 @@ impl CompositorHandler for Window {
_surface: &WlSurface,
new_factor: i32,
) {
let old_scale = self.scale;
self.scale = new_factor.try_into().expect("invalid surface scale factor");
if old_scale != self.scale {
let size = (4 * self.width() * self.height())
.try_into()
.expect("pixel buffer overflow");
if let Err(err) = self
.pool
.resize(size)
.with_context(|| format!("on pool resize to {size}"))
{
self.error = Some(err);
}
}
}

fn transform_changed(
Expand Down

0 comments on commit be3e9dc

Please sign in to comment.