Skip to content

Commit

Permalink
Hardcode winit transform for now
Browse files Browse the repository at this point in the history
  • Loading branch information
YaLTeR committed Jan 31, 2024
1 parent 9f75235 commit 9bb37e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/backend/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use smithay::reexports::calloop::LoopHandle;
use smithay::reexports::wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
use smithay::reexports::winit::dpi::LogicalSize;
use smithay::reexports::winit::window::WindowBuilder;
use smithay::utils::Transform;

use super::RenderResult;
use crate::niri::{RedrawState, State};
Expand Down Expand Up @@ -54,7 +53,7 @@ impl Winit {
size: backend.window_size(),
refresh: 60_000,
};
output.change_current_state(Some(mode), Some(Transform::Flipped180), None, None);
output.change_current_state(Some(mode), None, None, None);
output.set_preferred(mode);

let physical_properties = output.physical_properties();
Expand Down
12 changes: 10 additions & 2 deletions src/niri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,13 @@ impl State {
let scale = config.map(|c| c.scale).unwrap_or(1.);
let scale = scale.clamp(1., 10.).ceil() as i32;

let transform = config
let mut transform = config
.map(|c| c.transform.into())
.unwrap_or(Transform::Normal);
// FIXME: fix winit damage on other transforms.
if name == "winit" {
transform = Transform::Flipped180;
}

if output.current_scale().integer_scale() != scale
|| output.current_transform() != transform
Expand Down Expand Up @@ -1179,7 +1183,11 @@ impl Niri {
let c = config.outputs.iter().find(|o| o.name == name);
let scale = c.map(|c| c.scale).unwrap_or(1.);
let scale = scale.clamp(1., 10.).ceil() as i32;
let transform = c.map(|c| c.transform.into()).unwrap_or(Transform::Normal);
let mut transform = c.map(|c| c.transform.into()).unwrap_or(Transform::Normal);
// FIXME: fix winit damage on other transforms.
if name == "winit" {
transform = Transform::Flipped180;
}
drop(config);

// Set scale and transform before adding to the layout since that will read the output size.
Expand Down

0 comments on commit 9bb37e8

Please sign in to comment.