Skip to content

Commit

Permalink
make max size calculation work universally
Browse files Browse the repository at this point in the history
  • Loading branch information
0xk1f0 committed Feb 24, 2023
1 parent b02b628 commit d9f09cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ rwpspread /some/path/wallpaper.png
- [ ] splitting for any screen layout (two or more screens)
- [x] Hyprland Integration
- [ ] wpaperd Integration
- [ ] restore standalone support
15 changes: 8 additions & 7 deletions src/splitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ pub fn split_image(config: Config) -> Result<Vec<ResultPaper>, &'static str> {
| |
+--------------+
@TODO:
-> max height is defined by primary or secondary
-> max width is defined as sum of all
^ This will most likely fail if monitors are
stacked or negatively aligned to root
Assuming a monitor can never be negatively offset
from root, we can say that max width will be the biggest monitor
with the greatest x-offset, max height will be defined in the same
way except using y-offset
Should we ever get a negative offset, this will definitely panic ¯\_(ツ)_/¯
*/
let mut overall_width = 0;
let mut overall_height = 0;
for monitor in &config.mon_list {
overall_height = cmp::max(monitor.height, overall_height);
overall_width += monitor.width;
overall_width = cmp::max(monitor.width + monitor.x as u32, overall_width);
overall_height = cmp::max(monitor.height + monitor.y as u32, overall_height);
}

// check if we need to upscale
Expand Down

0 comments on commit d9f09cc

Please sign in to comment.