Skip to content

Orientation/aspect ratio might get corrupted for streamed content after rearranging display layout #4345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
madsb opened this issue May 12, 2025 · 12 comments
Assignees
Labels
bug Something isn't working done All tasks are completed PIP/Stream PIP or full screen streaming released Released
Milestone

Comments

@madsb
Copy link

madsb commented May 12, 2025

I have an iPad set up with SideCar. I'm using BetterDisplay to change the orientation of the iPad to portrait mode as macOS doesn't support that natively.

The issue is that when my Macbook Pro goes to sleep with the display enabled, more often than not the orientation is set to landscape when it wakes up again, which means the screen is stretched and in the wrong orientation. See images for examples.

MacBook Pro M3 Max, 36 GB of RAM
macOS 15.4.1
BetterDisplay 3.5.5

Image

Image

Image

Image

@madsb madsb changed the title Wrong orientation/aspect ration when returning from sleep Wrong orientation/aspect ratio when returning from sleep May 12, 2025
@waydabber
Copy link
Owner

Hi there - sorry for responding late to this. So when the iPad is in landscape mode after wake, is virtual screen streaming (to the iPad) in effect? What does the app menu say?

@waydabber waydabber added the awaiting response from reporter Needs further info label May 14, 2025
@madsb
Copy link
Author

madsb commented May 16, 2025

No worries, @waydabber! Just debugged some more. The issue flow is this:

  1. I leave the computer, it goes to sleep
  2. I return, wake the computer up. I have an external monitor (the huge curved one you see on the photo) and the iPad connected.
  3. The iPad shows the correct orientation/aspect ratio for a second, then all screens go black for a couple of seconds while macOS discovers the other monitor
  4. External monitor comes on, iPad comes back on, but this time the orientation and aspect ratio is wrong (like in the photo).

The virtual display via BetterDisplay is in effect. It's not totally clear in the photo, but the screen is distorted, like it's stretching /squishing the portrait image to be landscape.

Edit: Sometimes it works... just returned now and it restored fine 🫠

@waydabber
Copy link
Owner

waydabber commented May 16, 2025

Oh. So the streaming is in effect it's just that the rotation is wrong? If you use the app's controls to rotate the screen or turn free aspect ratio on/off, does it reset the image temporarily?

Or: is it the iPad's Screen Sharing app that is being rotated (which sometimes happens due to a bug), so if you try to fix the rotation on your iPad, things look better?

@waydabber waydabber changed the title Wrong orientation/aspect ratio when returning from sleep Wrong orientation/aspect ratio for streamed content when returning from sleep or rearranging display layout May 17, 2025
@waydabber waydabber self-assigned this May 17, 2025
@waydabber waydabber added bug Something isn't working in progress Implementing unreleased Still baking in the oven labels May 17, 2025
@waydabber waydabber added this to the TBD milestone May 17, 2025
@waydabber waydabber added PIP/Stream PIP or full screen streaming and removed awaiting response from reporter Needs further info labels May 17, 2025
@waydabber
Copy link
Owner

Ok, I think I was able to reproduce the issue:

  1. rotate a streamed content
  2. rearrange displays
  3. observe the rotated content appear unrotated/stretched

The issue only happens when the virtual screen is left to the main display and is smaller than the main display. It is not related to sleep but to layout changes.

I will look into this problem.

@waydabber waydabber changed the title Wrong orientation/aspect ratio for streamed content when returning from sleep or rearranging display layout Orientation/aspect ratio might get corrupted for streamed content after rearranging display layout May 17, 2025
@madsb
Copy link
Author

madsb commented May 17, 2025

Awesome that you were able to reproduce. Looking forward to the fix!

@waydabber
Copy link
Owner

Well, spent a few hours on this as the code is solid, but seemingly the transformation just does not apply to the window properly. I fixed it by making it an asynchronous event which fixes this for me, but I am not entirely sure how solid the fix is. I'll provide an internal pre-release, can you please check if this works?

@waydabber waydabber added done All tasks are completed internal pre-release Enable internal pre-releases under Settings/Applications/Updates and removed in progress Implementing unreleased Still baking in the oven labels May 18, 2025
@waydabber
Copy link
Owner

(you can update to this version under Settings/Application/Update and enable Pre-release and Internal pre-release).

@madsb
Copy link
Author

madsb commented May 19, 2025

Thanks, tried the new version - unfortunately not fixed here. Came back to this after I woke up my mac from sleep.

Image

@waydabber
Copy link
Owner

waydabber commented May 19, 2025

Hmm. But this does not seem to be the same issue. In this screenshot apparently the image might be right, but the Sidecar app itself (on the iPad) is rotated, as evident from the iPad handle bar position. The Sidecar app should be in landscape mode, but sometimes (due to an iPad bug) it gets into a portrait orientation.

(Note: note you can fix this by locking the iPad rotation in landscape).

@madsb
Copy link
Author

madsb commented May 19, 2025

Alright, nice to know - thanks! Well, then the original bug might have been fixed.

@madsb
Copy link
Author

madsb commented May 20, 2025

Just checking in to let you know that I haven't experienced the bug for the past day. I think you might have crushed it, thank you!

@waydabber
Copy link
Owner

Thanks @madsb - let me know if the issue resurfaces.

Note: the fix is a bit shaky, as the root cause of the problem is not entirely near - the window content is properly transformed (rotated etc) but occasionally it still does not render accordingly when there is a display layout change in progress, unless I apply the transformation with a minor delay asynchronously - so there is some kind of timing issue or race condition when the display layout is changing.

@waydabber waydabber added released Released and removed internal pre-release Enable internal pre-releases under Settings/Applications/Updates labels Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done All tasks are completed PIP/Stream PIP or full screen streaming released Released
Projects
None yet
Development

No branches or pull requests

2 participants