summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-09-21 17:39:34 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-23 11:30:38 +0200
commit37f338e5edc6d7b70b5a4eaf63326f2a22d7bfbd (patch)
treeb6569abeaead0044fcb9c5dca331bbfc9c02f827 /src/gui
parentd8784cd3930eca664009bbccdbb4fa0ebd42b3a0 (diff)
Fixed geometry issues.
We need to compare against the window's currently known geometry to know when to send resize and move events. Also make sure at least one resize event is sent, instead of sending one before each expose. Change-Id: Id7ebe4c1c0e723af9198c668a0c736d64efdbf3e Reviewed-on: http://codereview.qt-project.org/5364 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qguiapplication.cpp9
-rw-r--r--src/gui/kernel/qwindow.cpp8
-rw-r--r--src/gui/kernel/qwindow.h2
-rw-r--r--src/gui/kernel/qwindow_p.h2
4 files changed, 16 insertions, 5 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index a19ae4824f..2aaa2e65f8 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -701,16 +701,18 @@ void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePr
return;
QRect newRect = e->newGeometry;
- QRect cr = window->geometry();
+ QRect cr = window->d_func()->geometry;
bool isResize = cr.size() != newRect.size();
bool isMove = cr.topLeft() != newRect.topLeft();
window->d_func()->geometry = newRect;
- if (isResize) {
+ if (isResize || window->d_func()->resizeEventPending) {
QResizeEvent e(newRect.size(), cr.size());
QGuiApplication::sendSpontaneousEvent(window, &e);
+
+ window->d_func()->resizeEventPending = false;
}
if (isMove) {
@@ -925,9 +927,6 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E
QWindow *window = e->exposed.data();
- QResizeEvent resizeEvent(window->handle()->geometry().size(), window->size());
- QGuiApplication::sendSpontaneousEvent(window, &resizeEvent);
-
QExposeEvent exposeEvent(e->region);
QCoreApplication::sendSpontaneousEvent(window, &exposeEvent);
}
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index b0faed7992..759ee8dbc4 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -537,6 +537,10 @@ void QWindow::exposeEvent(QExposeEvent *)
{
}
+void QWindow::moveEvent(QMoveEvent *)
+{
+}
+
void QWindow::resizeEvent(QResizeEvent *)
{
}
@@ -568,6 +572,10 @@ bool QWindow::event(QEvent *event)
mouseDoubleClickEvent(static_cast<QMouseEvent*>(event));
break;
+ case QEvent::Move:
+ moveEvent(static_cast<QMoveEvent*>(event));
+ break;
+
case QEvent::Resize:
resizeEvent(static_cast<QResizeEvent*>(event));
break;
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 0a74e64300..4bb1ff77a5 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -60,6 +60,7 @@ QT_MODULE(Gui)
class QWindowPrivate;
class QExposeEvent;
+class QMoveEvent;
class QResizeEvent;
class QShowEvent;
class QHideEvent;
@@ -195,6 +196,7 @@ Q_SIGNALS:
protected:
virtual void exposeEvent(QExposeEvent *);
virtual void resizeEvent(QResizeEvent *);
+ virtual void moveEvent(QMoveEvent *);
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 38b90fdd73..8a3bc0d7fe 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -67,6 +67,7 @@ public:
, platformWindow(0)
, visible(false)
, windowState(Qt::WindowNoState)
+ , resizeEventPending(true)
, maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX)
, modality(Qt::NonModal)
, transientParent(0)
@@ -99,6 +100,7 @@ public:
QString windowTitle;
QRect geometry;
Qt::WindowState windowState;
+ bool resizeEventPending;
QSize minimumSize;
QSize maximumSize;