]> git.sesse.net Git - vlc/commitdiff
Qt4: move fullscreen window on current viewport
authorIlkka Ollakka <ileoo@videolan.org>
Thu, 13 Aug 2009 19:47:07 +0000 (22:47 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Thu, 13 Aug 2009 19:52:13 +0000 (22:52 +0300)
This restores functionality, that video goes fullscreen on same screen
that vlc player is. For somereason it didn't work correctly when
reparented to QDesktop-screen( num ) widget.

modules/gui/qt4/components/interface_widgets.cpp

index c0369d1f5511bb75eb5be05a2e7b95e029aaf509..603f0a186e4117233c4471139cc61c2fa2d361be 100644 (file)
@@ -41,6 +41,7 @@
 #include <QDate>
 #include <QMenu>
 #include <QWidgetAction>
+#include <QDesktopWidget>
 
 #ifdef Q_WS_X11
 # include <X11/Xlib.h>
@@ -160,6 +161,7 @@ void VideoWidget::SetFullScreen( bool b_fs )
     Qt::WindowStates newstate = curstate;
     Qt::WindowFlags  newflags = reparentable->windowFlags();
 
+
     if( b_fs )
     {
         newstate |= Qt::WindowFullScreen;
@@ -175,9 +177,18 @@ void VideoWidget::SetFullScreen( bool b_fs )
 
     if( b_fs )
     {   /* Go full-screen */
-        reparentable->setWindowState( newstate );
+        int numscreen = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
+        QRect screenres = QApplication::desktop()->screenGeometry( numscreen );
+
         reparentable->setParent( NULL );
+        reparentable->setWindowState( newstate );
         reparentable->setWindowFlags( newflags );
+        /* To be sure window is on proper-screen in xinerama */
+        if( !screenres.contains( reparentable->pos() ) )
+        {
+            msg_Dbg( p_intf, "Moving video to correct screen");
+            reparentable->move( QPoint( screenres.x(), screenres.y() ) );
+        }
         reparentable->show();
     }
     else