Correct screen indexing in some cases

Several issues remain with multi-screen mode on Linux. The behavior is
inconsistent from one desktop evironment to the next, making it hard to
work around these problems. Among the known issues at this stage:

On Ubuntu 14.04, a call to QWidget::setGeometry requires the widget to
be hidden on KDE, but visible on MATE, for the geometry changes to take
effect.
Despite the widget's geometry being updated by this call, the windows
aren't necessarily moved. Meaning that the control and display widgets
will tend to be displayed on the same monitor, even though their
positions are correctly set to different areas on the extended screen.

In the current state, this behavior is observed on MATE. Unity works
fine and KDE only has transient positioning issues (for example,
swapping control and display windows in multi-screen mode leads to both
windows being placed on the same monitor, until multi-screen mode is
turned off then on again).

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch dev
# Your branch is ahead of 'origin/dev' by 29 commits.
#   (use "git push" to publish your local commits)
#
# Changes to be committed:
#	modified:   src/core/UBApplicationController.cpp
#	modified:   src/core/UBDisplayManager.cpp
#	modified:   src/core/UBDisplayManager.h
#
# Changes not staged for commit:
#	modified:   release_scripts/linux/build.sh
#	modified:   release_scripts/linux/package.sh
#
# Untracked files:
#	release_scripts/linux/generateDependencies.sh
#
preferencesAboutTextFull
Craig Watson 8 years ago
parent c41ed06a9c
commit 6d35a5a3f8
  1. 2
      src/core/UBApplicationController.cpp
  2. 8
      src/core/UBDisplayManager.cpp
  3. 2
      src/core/UBDisplayManager.h

@ -113,7 +113,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView,
mBlackScene = new UBGraphicsScene(0); // deleted by UBApplicationController::destructor mBlackScene = new UBGraphicsScene(0); // deleted by UBApplicationController::destructor
mBlackScene->setBackground(true, false); mBlackScene->setBackground(true, false);
if (mDisplayManager->numScreens() >= 2) if (mDisplayManager->numScreens() >= 2 && mDisplayManager->useMultiScreen())
{ {
mMirror = new UBScreenMirror(); mMirror = new UBScreenMirror();
} }

@ -73,7 +73,7 @@ void UBDisplayManager::initScreenIndexes()
if (screenCount > 0) if (screenCount > 0)
{ {
mControlScreenIndex = mDesktop->primaryScreen(); mControlScreenIndex = mDesktop->primaryScreen();
if (mDesktop->screenCount() > 1 && UBSettings::settings()->swapControlAndDisplayScreens->get().toBool()) if (screenCount > 1 && UBSettings::settings()->swapControlAndDisplayScreens->get().toBool())
{ {
mControlScreenIndex = mControlScreenIndex^1; mControlScreenIndex = mControlScreenIndex^1;
} }
@ -85,7 +85,7 @@ void UBDisplayManager::initScreenIndexes()
mControlScreenIndex = -1; mControlScreenIndex = -1;
} }
if (screenCount > 1) if (screenCount > 1 && mUseMultiScreen)
{ {
mDisplayScreenIndex = mControlScreenIndex != 0 ? 0 : 1; mDisplayScreenIndex = mControlScreenIndex != 0 ? 0 : 1;
mScreenIndexesRoles << Display; mScreenIndexesRoles << Display;
@ -118,7 +118,6 @@ UBDisplayManager::~UBDisplayManager()
int UBDisplayManager::numScreens() int UBDisplayManager::numScreens()
{ {
if (mUseMultiScreen) {
int screenCount = mDesktop->screenCount(); int screenCount = mDesktop->screenCount();
// Some window managers report two screens when the two monitors are in "cloned" mode; this hack ensures // Some window managers report two screens when the two monitors are in "cloned" mode; this hack ensures
// that we consider this as just one screen. On most desktops, at least one of the following conditions is // that we consider this as just one screen. On most desktops, at least one of the following conditions is
@ -131,9 +130,6 @@ int UBDisplayManager::numScreens()
#endif #endif
return screenCount; return screenCount;
} }
else
return 1;
}
int UBDisplayManager::numPreviousViews() int UBDisplayManager::numPreviousViews()

@ -76,6 +76,8 @@ class UBDisplayManager : public QObject
None = 0, Control, Display, Previous1, Previous2, Previous3, Previous4, Previous5 None = 0, Control, Display, Previous1, Previous2, Previous3, Previous4, Previous5
}; };
bool useMultiScreen() { return mUseMultiScreen; }
void setUseMultiScreen(bool pUse); void setUseMultiScreen(bool pUse);
int controleScreenIndex() int controleScreenIndex()

Loading…
Cancel
Save