diff options
Diffstat (limited to 'src/gui/kernel/qdesktopwidget_s60.cpp')
-rw-r--r-- | src/gui/kernel/qdesktopwidget_s60.cpp | 63 |
1 files changed, 55 insertions, 8 deletions
diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 029892e..d57d289 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -32,34 +32,58 @@ public: static int screenCount; static int primaryScreen; + + static QVector<QRect> *rects; + static QVector<QRect> *workrects; + + static int refcount; }; int QDesktopWidgetPrivate::screenCount = 1; int QDesktopWidgetPrivate::primaryScreen = 0; +QVector<QRect> *QDesktopWidgetPrivate::rects = 0; +QVector<QRect> *QDesktopWidgetPrivate::workrects = 0; +int QDesktopWidgetPrivate::refcount = 0; QDesktopWidgetPrivate::QDesktopWidgetPrivate() { + ++refcount; } QDesktopWidgetPrivate::~QDesktopWidgetPrivate() { + if (!--refcount) + cleanup(); } void QDesktopWidgetPrivate::init(QDesktopWidget *that) { - TInt screenCount=0; - TInt result=0; + int screenCount=0; + + if (HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount) == KErrNone) + QDesktopWidgetPrivate::screenCount = screenCount; + else + QDesktopWidgetPrivate::screenCount = 0; - result = HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount); - QDesktopWidgetPrivate::screenCount = screenCount; - if( result != KErrNone) - { - // ### What to do if no screens found? - } + rects = new QVector<QRect>(); + workrects = new QVector<QRect>(); + + rects->resize(QDesktopWidgetPrivate::screenCount); + workrects->resize(QDesktopWidgetPrivate::screenCount); + + // ### TODO: Implement proper multi-display support + rects->resize(1); + rects->replace(0, that->rect()); + workrects->resize(1); + workrects->replace(0, that->rect()); } void QDesktopWidgetPrivate::cleanup() { + delete rects; + rects = 0; + delete workrects; + workrects = 0; } @@ -120,6 +144,29 @@ int QDesktopWidget::screenNumber(const QPoint &point) const void QDesktopWidget::resizeEvent(QResizeEvent *) { + Q_D(QDesktopWidget); + QVector<QRect> oldrects; + oldrects = *d->rects; + QVector<QRect> oldworkrects; + oldworkrects = *d->workrects; + int oldscreencount = d->screenCount; + + QDesktopWidgetPrivate::cleanup(); + QDesktopWidgetPrivate::init(this); + + for (int i = 0; i < qMin(oldscreencount, d->screenCount); ++i) { + QRect oldrect = oldrects[i]; + QRect newrect = d->rects->at(i); + if (oldrect != newrect) + emit resized(i); + } + + for (int j = 0; j < qMin(oldscreencount, d->screenCount); ++j) { + QRect oldrect = oldworkrects[j]; + QRect newrect = d->workrects->at(j); + if (oldrect != newrect) + emit workAreaResized(j); + } } QT_END_NAMESPACE |