Skip to content

Commit b1dbe16

Browse files
committed
fix: panic when shot on side screen
1 parent 849462b commit b1dbe16

4 files changed

Lines changed: 18 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.7.1] - 2026-03-10
9+
10+
### Changed
11+
12+
- Fixed screenshot cannot been taken on side screen
13+
14+
[0.7.1]: https://github.com/Decodetalkers/haruhishot/compare/v0.7.1-v0.7.0
15+
816
## [0.7.0] - 2026-03-07
917

1018
### Changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace.package]
2-
version = "0.7.0"
2+
version = "0.7.1"
33
edition = "2024"
44
license = "MIT"
55
description = "impl screencopy for wayland"
@@ -43,7 +43,7 @@ nix = { version = "0.31.1", features = ["fs", "mman"] }
4343
memmap2 = "0.9.10"
4444

4545
[dependencies]
46-
libharuhishot = { path = "libharuhishot", version = "0.7.0" }
46+
libharuhishot = { path = "libharuhishot", version = "0.7.1" }
4747

4848
image.workspace = true
4949
memmap2.workspace = true

src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,14 @@ fn capture_area(
149149
let mut min_y = i32::MAX;
150150
let mut max_x = i32::MIN;
151151
let mut max_y = i32::MIN;
152+
let mut start_x = i32::MAX;
153+
let mut start_y = i32::MAX;
152154
for view in &views.areas {
153155
let Position { x, y } = view.region.display_position_real();
154156
let Size { width, height } = view.region.display_logical_size();
155157

158+
start_x = start_x.min(x);
159+
start_y = start_y.min(y);
156160
min_x = min_x.min(x);
157161
min_y = min_y.min(y);
158162
max_x = max_x.max(x + width);
@@ -225,8 +229,8 @@ fn capture_area(
225229
let clip_region = views.region;
226230
let image = combined_image
227231
.view(
228-
clip_region.position.x as u32,
229-
clip_region.position.y as u32,
232+
(clip_region.position.x - start_x) as u32,
233+
(clip_region.position.y - start_y) as u32,
230234
clip_region.size.width as u32,
231235
clip_region.size.height as u32,
232236
)

0 commit comments

Comments
 (0)