[vlc-commits] [Git][videolan/vlc][master] qt: do not resize the interface during state changes with `qt-video-autoresize`

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Jan 12 15:34:36 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
eafbf0c6 by Fatih Uzunoglu at 2025-01-12T15:22:42+00:00
qt: do not resize the interface during state changes with `qt-video-autoresize`

Otherwise leaving full screen would "forget" the old overridden size.

- - - - -


2 changed files:

- modules/gui/qt/maininterface/video_window_handler.cpp
- modules/gui/qt/maininterface/video_window_handler.hpp


Changes:

=====================================
modules/gui/qt/maininterface/video_window_handler.cpp
=====================================
@@ -62,7 +62,9 @@ void VideoWindowHandler::disable()
 
 void VideoWindowHandler::requestResizeVideo( unsigned i_width, unsigned i_height )
 {
-    emit askVideoToResize( i_width, i_height );
+    if (!m_window)
+        return;
+    emit askVideoToResize( i_width, i_height, m_window->windowStates() );
 }
 
 void VideoWindowHandler::requestVideoWindowed( )
@@ -81,11 +83,24 @@ void VideoWindowHandler::requestVideoState(  unsigned i_arg )
     emit askVideoOnTop( on_top );
 }
 
-void VideoWindowHandler::setVideoSize(unsigned int w, unsigned int h)
+void VideoWindowHandler::setVideoSize(unsigned int w, unsigned int h, Qt::WindowStates currentStates)
 {
     if (!m_window)
         return;
     Qt::WindowStates states = m_window->windowStates();
+
+    // This slot is queued, so by the time it is called
+    // the window states reflect the final states.
+    // `qt-video-autoresize` should not apply during state
+    // transition, that was also the behavior in VLC 3.
+    // Otherwise, when getting disengaged from fullscreen
+    // the interface/video would forget its old (overridden)
+    // size.
+
+    // Do not resize when transitioning between states:
+    if (currentStates != states)
+        return;
+
     if ((states & (Qt::WindowFullScreen | Qt::WindowMaximized)) == 0)
     {
         /* Resize video widget to video size, or keep it at the same


=====================================
modules/gui/qt/maininterface/video_window_handler.hpp
=====================================
@@ -48,13 +48,13 @@ public:
     void requestVideoFullScreen( const char * );
 
 signals:
-    void askVideoToResize( unsigned int, unsigned int );
+    void askVideoToResize( unsigned int, unsigned int, Qt::WindowStates );
     void askVideoSetFullScreen( bool );
     void askVideoOnTop( bool );
 
 protected slots:
     /* Manage the Video Functions from the vout threads */
-    void setVideoSize(unsigned int w, unsigned int h);
+    void setVideoSize(unsigned int w, unsigned int h, Qt::WindowStates states );
     virtual void setVideoFullScreen( bool );
     void setVideoOnTop( bool );
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/eafbf0c65306c3612b66860fb3f1a06eb956e00c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/eafbf0c65306c3612b66860fb3f1a06eb956e00c
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list