diff options
author | Jeremy Katz <jeremy.katz@nokia.com> | 2010-06-01 13:34:52 (GMT) |
---|---|---|
committer | Jeremy Katz <jeremy.katz@nokia.com> | 2010-06-01 13:34:52 (GMT) |
commit | e17ada56a676c7d87c0803cdc8367065e7aaa317 (patch) | |
tree | 351104754b5263ad4c26835ed69c19e4236b6d93 /src/gui | |
parent | f3a920be362b85d248a9b76c1b15a0b096d7c90e (diff) | |
download | Qt-e17ada56a676c7d87c0803cdc8367065e7aaa317.zip Qt-e17ada56a676c7d87c0803cdc8367065e7aaa317.tar.gz Qt-e17ada56a676c7d87c0803cdc8367065e7aaa317.tar.bz2 |
make reporting screen size/count changes safe before QApplication constructor
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 3 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_lite.cpp | 23 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 1 |
3 files changed, 21 insertions, 6 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 5b294cc..6dbb7f2 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -812,6 +812,9 @@ void QApplicationPrivate::construct( if (qt_is_gui_used) qt_guiPlatformPlugin(); #endif +#ifdef Q_WS_LITE + QApplicationPrivate::qapp_constructed = true; +#endif } #if defined(Q_WS_X11) diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index 6008a9f..2b94102 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -86,6 +86,8 @@ static int mousePressX; static int mousePressY; static int mouse_double_click_distance = 5; +bool QApplicationPrivate::qapp_constructed = false; // QApplication::QApplication completed? + void QApplicationPrivate::processUserEvent(QWindowSystemInterface::UserEvent *e) { switch(e->type) { @@ -830,18 +832,24 @@ void QApplicationPrivate::processTouchEvent(QWindowSystemInterface::TouchEvent * void QApplicationPrivate::reportScreenCount(int count) { + // This operation only makes sense after the QApplication constructor runs + if (!QApplicationPrivate::qapp_constructed) + return; + // signal anything listening for creation or deletion of screens QDesktopWidget *desktop = QApplication::desktop(); - if (desktop) - emit desktop->screenCountChanged(count); + emit desktop->screenCountChanged(count); } void QApplicationPrivate::reportGeometryChange(int screenIndex) { + // This operation only makes sense after the QApplication constructor runs + if (!QApplicationPrivate::qapp_constructed) + return; + // signal anything listening for screen geometry changes QDesktopWidget *desktop = QApplication::desktop(); - if (desktop) - emit desktop->resized(screenIndex); + emit desktop->resized(screenIndex); // make sure maximized and fullscreen windows are updated QWidgetList list = QApplication::topLevelWidgets(); @@ -856,10 +864,13 @@ void QApplicationPrivate::reportGeometryChange(int screenIndex) void QApplicationPrivate::reportAvailableGeometryChange(int screenIndex) { + // This operation only makes sense after the QApplication constructor runs + if (!QApplicationPrivate::qapp_constructed) + return; + // signal anything listening for screen geometry changes QDesktopWidget *desktop = QApplication::desktop(); - if (desktop) - emit desktop->workAreaResized(screenIndex); + emit desktop->workAreaResized(screenIndex); // make sure maximized and fullscreen windows are updated QWidgetList list = QApplication::topLevelWidgets(); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index e272a36..58128c8 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -428,6 +428,7 @@ public: static QString graphics_system_name; #if defined(Q_WS_LITE) static QPlatformIntegration *platform_integration; + static bool qapp_constructed; #endif private: |