[vlc-commits] Qt: prevents the window from resizing to its current size
Benoît Noël du Payrat
git at videolan.org
Mon May 9 17:30:09 CEST 2016
vlc | branch: master | Benoît Noël du Payrat <benoitp at localhost.localdomain> | Mon May 9 16:49:22 2016 +0200| [e9878b8ba42b5dd5c3f66a401d1f017ccc131161] | committer: Jean-Baptiste Kempf
Qt: prevents the window from resizing to its current size
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e9878b8ba42b5dd5c3f66a401d1f017ccc131161
---
modules/gui/qt/components/interface_widgets.cpp | 10 ++++++++++
modules/gui/qt/main_interface.cpp | 18 ++++++++++++++----
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp
index e4f1fc6..db590c5 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -183,6 +183,16 @@ WId VideoWidget::request( struct vout_window_t *p_wnd, unsigned int *pi_width,
Parent has to care about resizing itself */
void VideoWidget::setSize( unsigned int w, unsigned int h )
{
+ /* If the size changed, resizeEvent will be called, otherwise not,
+ * in which case we need to tell the vout what the size actually is
+ */
+ if( (unsigned)size().width() == w && (unsigned)size().height() == h )
+ {
+ if( p_window != NULL )
+ vout_window_ReportSize( p_window, w, h );
+ return;
+ }
+
resize( w, h );
emit sizeChanged( w, h );
/* Work-around a bug?misconception? that would happen when vout core resize
diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 8f91e9a..7c70692 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -215,11 +215,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
{
if( b_autoresize )
{
- CONNECT( this, askVideoToResize( unsigned int, unsigned int ),
- this, setVideoSize( unsigned int, unsigned int ) );
CONNECT( videoWidget, sizeChanged( int, int ),
this, videoSizeChanged( int, int ) );
}
+ CONNECT( this, askVideoToResize( unsigned int, unsigned int ),
+ this, setVideoSize( unsigned int, unsigned int ) );
+
CONNECT( this, askVideoSetFullScreen( bool ),
this, setVideoFullScreen( bool ) );
}
@@ -777,8 +778,17 @@ void MainInterface::releaseVideoSlot( void )
void MainInterface::setVideoSize( unsigned int w, unsigned int h )
{
- if( !isFullScreen() && !isMaximized() )
- videoWidget->setSize( w, h );
+ if (!isFullScreen() && !isMaximized() )
+ {
+ /* Resize video widget to video size, or keep it at the same
+ * size. Call setSize() either way so that vout_window_ReportSize
+ * will always get called.
+ */
+ if (b_autoresize)
+ videoWidget->setSize( w, h );
+ else
+ videoWidget->setSize( videoWidget->width(), videoWidget->height() );
+ }
}
void MainInterface::videoSizeChanged( int w, int h )
More information about the vlc-commits
mailing list