diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-01-16 09:45:47 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-01-16 11:34:34 +0400 |
| commit | 69907f123d2f17bc1f9a04c0bda7430f250404de (patch) | |
| tree | 6cf3d21538ec2e3002a2562ed51ccb392645ca67 /src/screenshot_ui.rs | |
| parent | 6ca3b6ddb564d34e50881faefec6e06e11b9fcb9 (diff) | |
| download | niri-69907f123d2f17bc1f9a04c0bda7430f250404de.tar.gz niri-69907f123d2f17bc1f9a04c0bda7430f250404de.tar.bz2 niri-69907f123d2f17bc1f9a04c0bda7430f250404de.zip | |
Add live-reload of output scales
Diffstat (limited to 'src/screenshot_ui.rs')
| -rw-r--r-- | src/screenshot_ui.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/screenshot_ui.rs b/src/screenshot_ui.rs index 57993800..2d097a24 100644 --- a/src/screenshot_ui.rs +++ b/src/screenshot_ui.rs @@ -41,6 +41,7 @@ pub enum ScreenshotUi { pub struct OutputData { size: Size<i32, Physical>, + scale: i32, texture: GlesTexture, texture_buffer: TextureBuffer<GlesTexture>, buffers: [SolidColorBuffer; 8], @@ -106,10 +107,11 @@ impl ScreenshotUi { let output_transform = output.current_transform(); let output_mode = output.current_mode().unwrap(); let size = output_transform.transform_size(output_mode.size); + let scale = output.current_scale().integer_scale(); let texture_buffer = TextureBuffer::from_texture( renderer, texture.clone(), - output.current_scale().integer_scale(), + scale, Transform::Normal, None, ); @@ -126,6 +128,7 @@ impl ScreenshotUi { let locations = [Default::default(); 8]; let data = OutputData { size, + scale, texture, texture_buffer, buffers, @@ -330,9 +333,10 @@ impl ScreenshotUi { } } - pub fn output_size(&self, output: &Output) -> Option<Size<i32, Physical>> { + pub fn output_size(&self, output: &Output) -> Option<(Size<i32, Physical>, i32)> { if let Self::Open { output_data, .. } = self { - Some(output_data.get(output)?.size) + let data = output_data.get(output)?; + Some((data.size, data.scale)) } else { None } |
