diff options
Diffstat (limited to 'src/utils.rs')
| -rw-r--r-- | src/utils.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils.rs b/src/utils.rs index 7d895530..b7dee6e2 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -7,7 +7,7 @@ use smithay::backend::allocator::Fourcc; use smithay::backend::renderer::element::texture::TextureBuffer; use smithay::backend::renderer::gles::{GlesRenderer, GlesTexture}; use smithay::reexports::nix::time::{clock_gettime, ClockId}; -use smithay::utils::{Physical, Point, Transform}; +use smithay::utils::{Logical, Physical, Point, Rectangle, Transform}; use xcursor::parser::parse_xcursor; use xcursor::CursorTheme; @@ -18,6 +18,10 @@ pub fn get_monotonic_time() -> Duration { Duration::from(clock_gettime(ClockId::CLOCK_MONOTONIC).unwrap()) } +pub fn center(rect: Rectangle<i32, Logical>) -> Point<i32, Logical> { + rect.loc + rect.size.downscale(2).to_point() +} + fn load_xcursor() -> anyhow::Result<xcursor::parser::Image> { let theme = CursorTheme::load("default"); let path = theme |
