diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qdesktopwidget_s60.cpp | 63 |
2 files changed, 65 insertions, 8 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index dd51fcd..5b2c1fb 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -14,6 +14,7 @@ #include "qevent.h" #include "qeventdispatcher_s60_p.h" #include "qwidget.h" +#include "qdesktopwidget.h" #include "private/qbackingstore_p.h" #include "qt_s60_p.h" #include "private/qevent_p.h" @@ -49,6 +50,8 @@ static bool appNoGrab = false; // Grabbing enabled Q_GUI_EXPORT QS60Data *qt_s60Data = 0; extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); +extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp + QWidget *qt_button_down = 0; // widget got last button-down bool qt_nograb() // application no-grab option @@ -988,6 +991,13 @@ int QApplication::s60ProcessEvent(TWsEvent *event) case EEventScreenDeviceChanged: if (S60) S60->updateScreenSize(); + if (qt_desktopWidget) { + QSize oldSize = qt_desktopWidget->size(); + qt_desktopWidget->data->crect.setWidth(S60->screenWidthInPixels); + qt_desktopWidget->data->crect.setHeight(S60->screenHeightInPixels); + QResizeEvent e(qt_desktopWidget->size(), oldSize); + QApplication::sendEvent(qt_desktopWidget, &e); + } return 0; // Propagate to CONE case EEventWindowVisibilityChanged: if (controlInMap) { 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 |