diff --git i/src/core_graphics.rs w/src/core_graphics.rs
index 5564fd2..037612f 100644
@@ -347,6 +347,8 @@ extern "C" {
enabled: bool,
) -> CGError;
+ fn SLSSetDisplayRotation(display_id: CGDirectDisplayID, rotation: i32) -> CGError;
+
}
////////////////////////////////////////////////////////////////////////////////
@@ -617,6 +619,14 @@ pub fn cg_display_mirrors_display(display_id: DisplayID) -> Option<DisplayID> {
}
}
+pub fn cgx_set_display_rotation(display_id: DisplayID, rotation: i32) -> CGError {
+ println!(
+ "Setting rotation of display {} to {} degrees",
+ display_id.id, rotation
+ );
+ unsafe { SLSSetDisplayRotation(display_id.id, rotation) }
+}
+
/// Helper to set the rotation of a display via the MPDisplay Objective-C class.
// TODO As this is the only use of Objective-C in this code-base,
// in the future it may be worth investigate the private
diff --git i/src/real_displays.rs w/src/real_displays.rs
index bf30f9b..2fad91f 100644
@@ -295,7 +295,11 @@ impl DisplayConfigTransaction for RealDisplayConfigTransaction {
)?;
for (&display_id, &rotation) in &self.rotations {
- mpd_set_rotation(display_id, rotation.into())
+ cg_error_to_result(
+ cgx_set_display_rotation(display_id, rotation.into()),
+ // TODO FIX!!!
+ format!("While attempting to rotate display {}", "").as_str(),
+ )?
}
self.dropped = true;