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>
This commit is contained in:
parent
d8784cd393
commit
37f338e5ed
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 *);
|
||||
|
@ -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;
|
||||
|
@ -343,6 +343,8 @@ void QXcbWindow::setGeometry(const QRect &rect)
|
||||
qBound(1, rect.height(), XCOORD_MAX) };
|
||||
|
||||
Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, values));
|
||||
|
||||
xcb_flush(xcb_connection());
|
||||
}
|
||||
|
||||
QMargins QXcbWindow::frameMargins() const
|
||||
@ -1168,15 +1170,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
|
||||
|
||||
void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event)
|
||||
{
|
||||
int xpos = geometry().x();
|
||||
int ypos = geometry().y();
|
||||
|
||||
if ((event->width == geometry().width() && event->height == geometry().height()) || event->x != 0 || event->y != 0) {
|
||||
xpos = event->x;
|
||||
ypos = event->y;
|
||||
}
|
||||
|
||||
QRect rect(xpos, ypos, event->width, event->height);
|
||||
QRect rect(event->x, event->y, event->width, event->height);
|
||||
|
||||
QPlatformWindow::setGeometry(rect);
|
||||
QWindowSystemInterface::handleGeometryChange(window(), rect);
|
||||
|
Loading…
Reference in New Issue
Block a user