Fixed indexing of control and display screens

Caused problems e.g with podcast mode, where if the control and display
views were swapped in the preferences, the wrong screen would be recorded
when switching to desktop mode during recording of the podcast.
This happened even if only one screen was plugged in, so a black screen
was recorded in that case (at least on OS X 10.10)
preferencesAboutTextFull
Craig Watson 8 years ago
parent e6f6f2e323
commit 5f97b1cf62
  1. 15
      src/core/UBApplication.cpp
  2. 3
      src/core/UBApplication.h
  3. 4
      src/core/UBDisplayManager.cpp
  4. 2
      src/desktop/UBDesktopAnnotationController.cpp
  5. 2
      src/gui/UBScreenMirror.cpp
  6. 4
      src/podcast/UBPodcastController.cpp
  7. 2
      src/web/browser/WBBrowserWindow.cpp

@ -670,3 +670,18 @@ bool UBApplication::isFromWeb(QString url)
return res;
}
QScreen* UBApplication::controlScreen()
{
QList<QScreen*> screenList = screens();
if (screenList.size() == 1)
return screenList.first();
return screenList[controlScreenIndex()];
}
int UBApplication::controlScreenIndex()
{
return applicationController->displayManager()->controleScreenIndex();
}

@ -100,6 +100,9 @@ class UBApplication : public QtSingleApplication
static QString urlFromHtml(QString html);
static bool isFromWeb(QString url);
static QScreen* controlScreen();
static int controlScreenIndex();
signals:
public slots:

@ -71,7 +71,7 @@ void UBDisplayManager::initScreenIndexes()
if (screenCount > 0)
{
mControlScreenIndex = mDesktop->primaryScreen();
if (UBSettings::settings()->swapControlAndDisplayScreens->get().toBool())
if (mDesktop->screenCount() > 1 && UBSettings::settings()->swapControlAndDisplayScreens->get().toBool())
{
mControlScreenIndex = mControlScreenIndex^1;
}
@ -118,7 +118,7 @@ int UBDisplayManager::numScreens()
{
if (mUseMultiScreen)
{
return mDesktop->numScreens();
return mDesktop->screenCount();
}
else
{

@ -500,7 +500,7 @@ void UBDesktopAnnotationController::screenCapture()
QPixmap UBDesktopAnnotationController::getScreenPixmap()
{
QDesktopWidget *desktop = QApplication::desktop();
QScreen * screen = QApplication::primaryScreen();
QScreen * screen = UBApplication::controlScreen();
QRect rect = desktop->screenGeometry(QCursor::pos());

@ -99,7 +99,7 @@ void UBScreenMirror::grabPixmap()
// this is the case we are showing the desktop but the is no widget and we use the last widget rectagle to know
// what we have to grab. Not very good way of doing
QDesktopWidget * desktop = QApplication::desktop();
QScreen * screen = QApplication::primaryScreen();
QScreen * screen = UBApplication::controlScreen();
mLastPixmap = screen->grabWindow(desktop->effectiveWinId(), mRect.x(), mRect.y(), mRect.width(), mRect.height());
}

@ -762,8 +762,8 @@ void UBPodcastController::timerEvent(QTimerEvent *event)
&& mSourceWidget == qApp->desktop())
{
QDesktopWidget * dtop = QApplication::desktop();
QRect dtopRect = dtop->screenGeometry();
QScreen * screen = QApplication::primaryScreen();
QRect dtopRect = dtop->screenGeometry(UBApplication::controlScreenIndex());
QScreen * screen = UBApplication::controlScreen();
QPixmap desktop = screen->grabWindow(dtop->effectiveWinId(),
dtopRect.x(), dtopRect.y(), dtopRect.width(), dtopRect.height());

@ -182,7 +182,7 @@ WBHistoryManager *WBBrowserWindow::historyManager()
QSize WBBrowserWindow::sizeHint() const
{
QRect desktopRect = QApplication::desktop()->screenGeometry();
QRect desktopRect = QApplication::desktop()->screenGeometry(UBApplication::controlScreenIndex());
QSize size = desktopRect.size() * qreal(0.9);
return size;
}

Loading…
Cancel
Save