summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qdesktopwidget_x11.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@nokia.com>2009-07-17 13:40:49 (GMT)
committerVolker Hilsheimer <volker.hilsheimer@nokia.com>2009-07-17 13:43:50 (GMT)
commit13254da6c3192937812983f44ce95fe8e1bc602c (patch)
tree72a1959c25a9ee9f133fad81bf9ee9f3d5b90696 /src/gui/kernel/qdesktopwidget_x11.cpp
parent83d9c5978fd5089457a28f16be6d26b047d80b7d (diff)
downloadQt-13254da6c3192937812983f44ce95fe8e1bc602c.zip
Qt-13254da6c3192937812983f44ce95fe8e1bc602c.tar.gz
Qt-13254da6c3192937812983f44ce95fe8e1bc602c.tar.bz2
Implement QDesktopWidget::screenCountChanged signal on desktop platforms,
and add manual testcase. Provide replacement "screenCount" for numScreens and document numScreens as obsolete to be more consistent with other APIs.
Diffstat (limited to 'src/gui/kernel/qdesktopwidget_x11.cpp')
-rw-r--r--src/gui/kernel/qdesktopwidget_x11.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp
index 59d3239..1555fc0 100644
--- a/src/gui/kernel/qdesktopwidget_x11.cpp
+++ b/src/gui/kernel/qdesktopwidget_x11.cpp
@@ -372,7 +372,32 @@ int QDesktopWidget::screenNumber(const QPoint &point) const
void QDesktopWidget::resizeEvent(QResizeEvent *event)
{
Q_D(QDesktopWidget);
+ int oldScreenCount = d->screenCount;
+ QVector<QRect> oldRects(oldScreenCount);
+ QVector<QRect> oldWorks(oldScreenCount);
+ for (int i = 0; i < oldScreenCount; ++i) {
+ oldRects[i] = d->rects[i];
+ oldWorks[i] = d->workareas[i];
+ }
+
d->init();
+
+ for (int i = 0; i < qMin(oldScreenCount, d->screenCount); ++i) {
+ if (oldRects.at(i) != d->rects[i])
+ emit resized(i);
+ }
+
+ // ### workareas are just reset by init, not filled with new values
+ // ### so this will not work correctly
+ for (int j = 0; j < qMin(oldScreenCount, d->screenCount); ++j) {
+ if (oldWorks.at(j) != d->workareas[j])
+ emit workAreaResized(j);
+ }
+
+ if (oldScreenCount != d->screenCount) {
+ emit screenCountChanged(d->screenCount);
+ }
+
qt_desktopwidget_workarea_dirty = true;
QWidget::resizeEvent(event);
}