Skip to content
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

When you drag a window under windows, the screen will stop playing #3458

Open
cnuicn opened this issue Aug 19, 2022 · 7 comments
Open

When you drag a window under windows, the screen will stop playing #3458

cnuicn opened this issue Aug 19, 2022 · 7 comments

Comments

@cnuicn
Copy link

cnuicn commented Aug 19, 2022

windows 下拖动窗口的时候,画面会停止播放
When you drag a window under windows, the screen will stop playing

@rom1v
Copy link
Collaborator

rom1v commented Aug 19, 2022

During a resize or a move?

This is probably a SDL issue, but scrcpy uses a workaround:

scrcpy/app/src/screen.c

Lines 310 to 320 in ed84e18

# define CONTINUOUS_RESIZING_WORKAROUND
#endif
#ifdef CONTINUOUS_RESIZING_WORKAROUND
// On Windows and MacOS, resizing blocks the event loop, so resizing events are
// not triggered. As a workaround, handle them in an event handler.
//
// <https://bugzilla.libsdl.org/show_bug.cgi?id=2077>
// <https://stackoverflow.com/a/40693139/1987178>
static int
event_watcher(void *data, SDL_Event *event) {

So both resizing and moving should not freeze the mirroring.

Which scrcpy version do you use? Which windows version?

@cnuicn
Copy link
Author

cnuicn commented Aug 19, 2022

用鼠标拖动和移动窗口的时候,画面都会冻结
When you drag and move the window with the mouse, the screen will freeze
scrcpy1.24 x64 windows11 x64

@rom1v
Copy link
Collaborator

rom1v commented Aug 19, 2022

I have no access to a Windows machine right now. Could someone on Windows could reproduce/confirm?

@rp1231
Copy link

rp1231 commented Aug 22, 2022

@rom1v
I can confirm this.
The same thing happens for me on windows 11.
I thought that was just the way it worked, didn't realize it was a bug.
It would be nice if this could be fixed.

@rom1v
Copy link
Collaborator

rom1v commented Aug 28, 2022

Thank you. Now that I have access to a Windows machine, I can reproduce too, even while resizing.

I thought the workaround for this problem in macOS during resize was also effective for Windows.

It looks like a SDL issue, but I have no workaround for this, I can't make the screen refresh even if I call the code to render from the resize/move callback :/

rom1v added a commit that referenced this issue Dec 21, 2022
It turns out that the workaround only worked for MacOS.

Refs #3458 <#3458>
Refs SDL/#1059 <libsdl-org/SDL#1059>
rom1v added a commit that referenced this issue Dec 26, 2022
This reverts commit 18082f6.

I can't reproduce, but it seems the workaround improves the behavior on
some Windows versions.

Fixes #3640 <#3640>
Refs #3458 <#3458>
@rp1231
Copy link

rp1231 commented Feb 27, 2023

@rom1v would it be possible to use a different windowing method?
For example, When I use qtscrcpy, which is a fork of scrcpy, this issue doesn't occur.

@rom1v
Copy link
Collaborator

rom1v commented Feb 27, 2023

It's a bug in SDL. SDL3 might fix the issue, when it's released.

Migrating to Qt is not a plan currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants