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

Check if window size changed and resize it #1037

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

jonata
Copy link
Contributor

@jonata jonata commented Oct 10, 2024

Fixes #1036.

Can I add PySide6/PyQt/PyGtk script sample together with play.py?

@ddennedy
Copy link
Member

Yes please do add your player sample to help me verify this before merge.

@ddennedy
Copy link
Member

I am using Pop!_OS 22.04. play_gtk.py crashes on me for some reason deep inside GTK3 libs. OK, that might just be my system. I installed pyqt6 and pyside6 using pip3. The Qt 6 examples get into a cycle where the resizeEvent updates sdl2, which calls SDL_SetWindowSize, but that causes another smaller resizeEvent until the size diminishes to not visible. I have to do something like this prevent it:

                self.blockResize = False
            
            def resizeEvent(self, event):
                if not self.blockResize:
                    self.blockResize = True
                    self.window().consumer.set('window_width', self.width())
                    self.window().consumer.set('window_height', self.height())
                    event.accept()
                else:
                    self.blockResize = False

This results in the player not filling the window:
image

Not a big deal, but I wonder if you have the same event cycle problem and have a better way to prevent it?

@jonata
Copy link
Contributor Author

jonata commented Oct 10, 2024

It would not work on Wayland. Are you using X11?

In any case, the problem on my side is what I put on the bug report, where the sdl render rect would not update when the window is resized. SDL_SetWindowSize with window_width and window_height is a workaround for this.

@ddennedy
Copy link
Member

I am on X11.

the sdl render rect would not update when the window is resized

Well, that is confirmed working. I just want to head off any future bug report that these pyqt6 examples do not show video. For me, they only do for a fraction of a second because the size decreases very quickly. I can add my workaround to the examples.

@ddennedy ddennedy added this to the v7.28.0 milestone Oct 10, 2024
@ddennedy ddennedy merged commit d688641 into mltframework:master Oct 10, 2024
6 checks passed
@jonata
Copy link
Contributor Author

jonata commented Oct 10, 2024

Sure, yes, I agree. Thanks!

@ddennedy ddennedy modified the milestones: v7.28.0, v7.30.0 Jan 19, 2025
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

Successfully merging this pull request may close these issues.

Using consumer sdl2 with window_id wont resize rendered area
2 participants