summaryrefslogtreecommitdiffstats
path: root/kcontrol/background
diff options
context:
space:
mode:
Diffstat (limited to 'kcontrol/background')
-rw-r--r--kcontrol/background/bgdialog.cpp33
-rw-r--r--kcontrol/background/bgdialog.h4
-rw-r--r--kcontrol/background/bgrender.cpp24
3 files changed, 45 insertions, 16 deletions
diff --git a/kcontrol/background/bgdialog.cpp b/kcontrol/background/bgdialog.cpp
index 398e30d56..34cff9f53 100644
--- a/kcontrol/background/bgdialog.cpp
+++ b/kcontrol/background/bgdialog.cpp
@@ -53,6 +53,7 @@
#include <kstringhandler.h>
#include <kurlrequester.h>
#include <kwin.h>
+#include <kwinmodule.h>
#include <kimagefilepreview.h>
#include <knewstuff/downloaddialog.h>
@@ -73,7 +74,14 @@ BGDialog::BGDialog(QWidget* parent, KConfig* _config, bool _multidesktop)
m_multidesktop = _multidesktop;
m_previewUpdates = true;
+ KWinModule *m_kwin;
+ m_kwin = new KWinModule(this);
+ m_curDesk = m_kwin->currentDesktop();
+ QSize s(m_kwin->numberOfViewports(m_kwin->currentDesktop()));
+ m_useViewports = s.width() * s.height() > 1;
+
m_numDesks = m_multidesktop ? KWin::numberOfDesktops() : 1;
+ m_numViewports = s.width() * s.height();
m_numScreens = QApplication::desktop()->numScreens();
QCString multiHead = getenv("KDE_MULTIHEAD");
@@ -81,8 +89,19 @@ BGDialog::BGDialog(QWidget* parent, KConfig* _config, bool _multidesktop)
{
m_numScreens = 1;
}
+
+ QPoint vx(m_kwin->currentViewport(m_kwin->currentDesktop()));
+ int t_eViewport = (vx.x() * vx.y());
+ if (t_eViewport < 1) {
+ t_eViewport = 1;
+ }
+ delete m_kwin;
m_desk = m_multidesktop ? KWin::currentDesktop() : 1;
+ //m_desk = m_multidesktop ? (m_useViewports ? (m_desk * m_numViewports) : m_desk) : m_desk;
+ m_desk = m_multidesktop ? (m_useViewports ? (((m_desk - 1) * m_numViewports) + t_eViewport) : m_desk) : m_desk;
+ m_numDesks = m_multidesktop ? (m_useViewports ? (m_numDesks * m_numViewports) : m_numDesks) : m_numDesks;
+
m_screen = QApplication::desktop()->screenNumber(this);
if (m_screen >= (int)m_numScreens)
m_screen = m_numScreens-1;
@@ -416,8 +435,18 @@ void BGDialog::slotIdentifyScreens()
void BGDialog::initUI()
{
// Desktop names
- for (unsigned i = 0; i < m_numDesks; ++i)
- m_comboDesktop->insertItem(m_pGlobals->deskName(i));
+ if (m_useViewports == false) {
+ for (unsigned i = 0; i < m_numDesks; ++i) {
+ m_comboDesktop->insertItem(m_pGlobals->deskName(i));
+ }
+ }
+ else {
+ for (unsigned i = 0; i < (m_numDesks/m_numViewports); ++i) {
+ for (unsigned j = 0; j < m_numViewports; ++j) {
+ m_comboDesktop->insertItem(i18n("Desktop %1 Viewport %2").arg(i+1).arg(j+1));
+ }
+ }
+ }
// Screens
for (unsigned i = 0; i < m_numScreens; ++i)
diff --git a/kcontrol/background/bgdialog.h b/kcontrol/background/bgdialog.h
index 02fbf3f3a..8782b73f7 100644
--- a/kcontrol/background/bgdialog.h
+++ b/kcontrol/background/bgdialog.h
@@ -86,8 +86,10 @@ protected:
KGlobalBackgroundSettings *m_pGlobals;
KStandardDirs *m_pDirs;
bool m_multidesktop;
-
+ bool m_useViewports;
+ int m_curDesk;
unsigned m_numDesks;
+ unsigned m_numViewports;
unsigned m_numScreens;
int m_desk;
int m_screen;
diff --git a/kcontrol/background/bgrender.cpp b/kcontrol/background/bgrender.cpp
index f17892dce..47d52b193 100644
--- a/kcontrol/background/bgrender.cpp
+++ b/kcontrol/background/bgrender.cpp
@@ -54,8 +54,7 @@ KBackgroundRenderer::KBackgroundRenderer(int desk, int screen, bool drawBackgrou
m_isBusyCursor = false;
m_enableBusyCursor = false;
m_pDirs = KGlobal::dirs();
- m_rSize = m_Size = drawBackgroundPerScreen ?
- QApplication::desktop()->screenGeometry(screen).size() : QApplication::desktop()->size();
+ m_rSize = m_Size = drawBackgroundPerScreen ? KApplication::desktop()->screenGeometry(screen).size() : KApplication::desktop()->geometry().size();
m_pProc = 0L;
m_Tempfile = 0L;
m_bPreview = false;
@@ -86,8 +85,7 @@ void KBackgroundRenderer::setSize(const QSize &size)
void KBackgroundRenderer::desktopResized()
{
m_State = 0;
- m_rSize = drawBackgroundPerScreen() ?
- QApplication::desktop()->screenGeometry(screen()).size() : QApplication::desktop()->size();
+ m_rSize = drawBackgroundPerScreen() ? KApplication::desktop()->screenGeometry(screen()).size() : KApplication::desktop()->geometry().size();
if( !m_bPreview )
m_Size = m_rSize;
}
@@ -1048,7 +1046,7 @@ KVirtualBGRenderer::KVirtualBGRenderer( int desk, KConfig *config )
}
initRenderers();
- m_size = QApplication::desktop()->size();
+ m_size = KApplication::desktop()->geometry().size();
}
KVirtualBGRenderer::~KVirtualBGRenderer()
@@ -1155,7 +1153,7 @@ void KVirtualBGRenderer::setEnabled(bool enable)
void KVirtualBGRenderer::desktopResized()
{
- m_size = QApplication::desktop()->size();
+ m_size = KApplication::desktop()->geometry().size();
if (m_pPixmap)
{
@@ -1164,7 +1162,7 @@ void KVirtualBGRenderer::desktopResized()
m_pPixmap->fill(Qt::black);
}
- initRenderers();
+ initRenderers();
}
@@ -1196,8 +1194,7 @@ void KVirtualBGRenderer::setPreview(const QSize & size)
QSize KVirtualBGRenderer::renderSize(int screen)
{
- return m_bDrawBackgroundPerScreen ?
- QApplication::desktop()->screenGeometry(screen).size() : QApplication::desktop()->size();
+ return m_bDrawBackgroundPerScreen ? KApplication::desktop()->screenGeometry(screen).size() : KApplication::desktop()->geometry().size();
}
@@ -1208,7 +1205,7 @@ void KVirtualBGRenderer::initRenderers()
m_bCommonScreen = m_pConfig->readBoolEntry("CommonScreen", _defCommonScreen);
- m_numRenderers = m_bDrawBackgroundPerScreen ? QApplication::desktop()->numScreens() : 1;
+ m_numRenderers = m_bDrawBackgroundPerScreen ? KApplication::desktop()->numScreens() : 1;
m_bFinished.resize(m_numRenderers);
m_bFinished.fill(false);
@@ -1267,10 +1264,11 @@ void KVirtualBGRenderer::screenDone(int _desk, int _screen)
// There's more than one renderer, so we are drawing each output to our own pixmap
QRect overallGeometry;
- for (int i=0; i < QApplication::desktop()->numScreens(); ++i)
- overallGeometry |= QApplication::desktop()->screenGeometry(i);
+ for (int i=0; i < KApplication::desktop()->numScreens(); ++i) {
+ overallGeometry |= KApplication::desktop()->screenGeometry(i);
+ }
- QPoint drawPos = QApplication::desktop()->screenGeometry(screen).topLeft() - overallGeometry.topLeft();
+ QPoint drawPos = KApplication::desktop()->screenGeometry(screen).topLeft() - overallGeometry.topLeft();
drawPos.setX( int(drawPos.x() * m_scaleX) );
drawPos.setY( int(drawPos.y() * m_scaleY) );