[vlc-devel] commit: Calculate fullscreencotnrollers position only when screen has changed ( Ilkka Ollakka )

git version control git at videolan.org
Wed Oct 15 20:32:36 CEST 2008


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Oct 15 21:31:56 2008 +0300| [977910dbcebdcee47b53551bc252d5294d1da80f] | committer: Ilkka Ollakka 

Calculate fullscreencotnrollers position only when screen has changed

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=977910dbcebdcee47b53551bc252d5294d1da80f
---

 modules/gui/qt4/components/controller.cpp |   47 ++++++++++++++++------------
 modules/gui/qt4/components/controller.hpp |    1 +
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index 219ff9d..e0f0d1f 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -769,6 +769,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
     b_fullscreen        = false;
     i_hide_timeout      = 1;
     p_vout              = NULL;
+    i_screennumber      = -1;
 
     setWindowFlags( Qt::ToolTip );
     setMinimumWidth( 600 );
@@ -845,28 +846,34 @@ void FullscreenControllerWidget::showFSC()
     adjustSize();
     /* center down */
     int number = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
-    int totalCount = QApplication::desktop()->numScreens();
-    QRect screenRes = QApplication::desktop()->screenGeometry(number);
-    int offset_x = 0;
-    int offset_y = 0;
-    /* Loop all screens to get needed offset_x/y for
-     * physical screen center.
-     */
-    for(int i=0; i <= totalCount ; i++)
+    if( number != i_screennumber )
     {
-         QRect displayRect = QApplication::desktop()->screenGeometry(i);
-         if (displayRect.width()+offset_x <= screenRes.x())
-         {
-              offset_x += displayRect.width();
-         }
-         if ( displayRect.height()+offset_y <= screenRes.y())
-         {
-              offset_y += displayRect.height();
-         }
+        msg_Dbg( p_intf, "Calculation fullscreen controllers center");
+        /* screen has changed, calculate new position */
+        i_screennumber = number;
+        int totalCount = QApplication::desktop()->numScreens();
+        QRect screenRes = QApplication::desktop()->screenGeometry(number);
+        int offset_x = 0;
+        int offset_y = 0;
+        /* Loop all screens to get needed offset_x/y for
+         * physical screen center.
+         */
+        for(int i=0; i <= totalCount ; i++)
+        {
+             QRect displayRect = QApplication::desktop()->screenGeometry(i);
+             if (displayRect.width()+offset_x <= screenRes.x())
+             {
+                  offset_x += displayRect.width();
+             }
+             if ( displayRect.height()+offset_y <= screenRes.y())
+             {
+                  offset_y += displayRect.height();
+             }
+        }
+        QPoint pos = QPoint( offset_x + (screenRes.width() / 2) - (width() / 2),
+                             offset_y + screenRes.height() - height());
+        move( pos );
     }
-    QPoint pos = QPoint( offset_x + (screenRes.width() / 2) - (width() / 2),
-                         offset_y + screenRes.height() - height());
-    move( pos );
 #ifdef WIN32TRICK
     // after quiting and going to fs, we need to call show()
     if( isHidden() )
diff --git a/modules/gui/qt4/components/controller.hpp b/modules/gui/qt4/components/controller.hpp
index 8464751..bfd5362 100644
--- a/modules/gui/qt4/components/controller.hpp
+++ b/modules/gui/qt4/components/controller.hpp
@@ -286,6 +286,7 @@ private:
 
     int i_mouse_last_x, i_mouse_last_y;
     bool b_mouse_over;
+    int i_screennumber;
 
 #ifdef WIN32TRICK
     bool b_fscHidden;




More information about the vlc-devel mailing list