[vlc-devel] commit: Calculate fullscreen controllers position on showtime ( Ilkka Ollakka )
git version control
git at videolan.org
Wed Oct 15 20:22:24 CEST 2008
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Oct 15 21:20:55 2008 +0300| [9a51f390108b2770592886c4e3ea81ae0d64dda5] | committer: Ilkka Ollakka
Calculate fullscreen controllers position on showtime
Take multiple-screens into account when trying to get fullscreen controller
into center of current physical screen.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9a51f390108b2770592886c4e3ea81ae0d64dda5
---
modules/gui/qt4/components/controller.cpp | 36 +++++++++++++++++++---------
1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index e6d8f9a..219ff9d 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -818,17 +818,6 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
adjustSize (); /* need to get real width and height for moving */
- /* center down */
- QRect desktopRect = QApplication::desktop()->
- screenGeometry( p_intf->p_sys->p_mi );
-
- QPoint pos = QPoint( desktopRect.width() / 2 - width() / 2,
- desktopRect.height() - height() );
-
- getSettings()->beginGroup( "FullScreen" );
- move( getSettings()->value( "pos", pos ).toPoint() );
- getSettings()->endGroup();
-
#ifdef WIN32TRICK
setWindowOpacity( 0.0 );
b_fscHidden = true;
@@ -854,11 +843,34 @@ FullscreenControllerWidget::~FullscreenControllerWidget()
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++)
+ {
+ 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 );
#ifdef WIN32TRICK
// after quiting and going to fs, we need to call show()
if( isHidden() )
show();
-
if( b_fscHidden )
{
b_fscHidden = false;
More information about the vlc-devel
mailing list