summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/gui/openglwindow/main.cpp5
-rw-r--r--examples/gui/openglwindow/openglwindow.cpp11
-rw-r--r--examples/gui/openglwindow/openglwindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm15
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm1
5 files changed, 16 insertions, 17 deletions
diff --git a/examples/gui/openglwindow/main.cpp b/examples/gui/openglwindow/main.cpp
index cd6dca3352..237680a889 100644
--- a/examples/gui/openglwindow/main.cpp
+++ b/examples/gui/openglwindow/main.cpp
@@ -80,7 +80,7 @@ int main(int argc, char **argv)
QGuiApplication app(argc, argv);
QSurfaceFormat format;
- format.setSamples(4);
+ format.setSamples(16);
TriangleWindow window;
window.setFormat(format);
@@ -136,7 +136,8 @@ void TriangleWindow::initialize()
//! [5]
void TriangleWindow::render()
{
- glViewport(0, 0, width(), height());
+ const qreal retinaScale = devicePixelRatio();
+ glViewport(0, 0, width() * retinaScale, height() * retinaScale);
glClear(GL_COLOR_BUFFER_BIT);
diff --git a/examples/gui/openglwindow/openglwindow.cpp b/examples/gui/openglwindow/openglwindow.cpp
index 5b247ebf19..afebf521f3 100644
--- a/examples/gui/openglwindow/openglwindow.cpp
+++ b/examples/gui/openglwindow/openglwindow.cpp
@@ -99,6 +99,7 @@ bool OpenGLWindow::event(QEvent *event)
{
switch (event->type()) {
case QEvent::UpdateRequest:
+ m_update_pending = false;
renderNow();
return true;
default:
@@ -113,14 +114,6 @@ void OpenGLWindow::exposeEvent(QExposeEvent *event)
if (isExposed())
renderNow();
}
-
-void OpenGLWindow::resizeEvent(QResizeEvent *event)
-{
- Q_UNUSED(event);
-
- if (isExposed())
- renderNow();
-}
//! [3]
//! [4]
@@ -129,8 +122,6 @@ void OpenGLWindow::renderNow()
if (!isExposed())
return;
- m_update_pending = false;
-
bool needsInitialize = false;
if (!m_context) {
diff --git a/examples/gui/openglwindow/openglwindow.h b/examples/gui/openglwindow/openglwindow.h
index 21ec033261..f6b53e3b33 100644
--- a/examples/gui/openglwindow/openglwindow.h
+++ b/examples/gui/openglwindow/openglwindow.h
@@ -70,7 +70,6 @@ protected:
bool event(QEvent *event);
void exposeEvent(QExposeEvent *event);
- void resizeEvent(QResizeEvent *event);
private:
bool m_update_pending;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 9466b68bec..a346dc9d4d 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -261,6 +261,9 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
void QCocoaWindow::setVisible(bool visible)
{
QCocoaAutoReleasePool pool;
+ QCocoaWindow *parentCocoaWindow = 0;
+ if (window()->transientParent())
+ parentCocoaWindow = static_cast<QCocoaWindow *>(window()->transientParent()->handle());
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
qDebug() << "QCocoaWindow::setVisible" << window() << visible;
#endif
@@ -268,10 +271,7 @@ void QCocoaWindow::setVisible(bool visible)
// We need to recreate if the modality has changed as the style mask will need updating
if (m_windowModality != window()->modality())
recreateWindow(parent());
- QCocoaWindow *parentCocoaWindow = 0;
- if (window()->transientParent()) {
- parentCocoaWindow = static_cast<QCocoaWindow *>(window()->transientParent()->handle());
-
+ if (parentCocoaWindow) {
// The parent window might have moved while this window was hidden,
// update the window geometry if there is a parent.
setGeometry(window()->geometry());
@@ -281,6 +281,10 @@ void QCocoaWindow::setVisible(bool visible)
if (window()->type() == Qt::Popup) {
// qDebug() << "transientParent and popup" << window()->type() << Qt::Popup << (window()->type() & Qt::Popup);
parentCocoaWindow->m_activePopupWindow = window();
+ // QTBUG-30266: a window should not be resizable while a transient popup is open
+ // Since this isn't a native popup, the window manager doesn't close the popup when you click outside
+ [parentCocoaWindow->m_nsWindow setStyleMask:
+ (parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags) & ~NSResizableWindowMask)];
}
}
@@ -342,6 +346,9 @@ void QCocoaWindow::setVisible(bool visible)
} else {
[m_contentView setHidden:YES];
}
+ if (parentCocoaWindow && window()->type() == Qt::Popup)
+ // QTBUG-30266: a window should not be resizable while a transient popup is open
+ [parentCocoaWindow->m_nsWindow setStyleMask:parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags)];
}
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index e608731cc1..d937ae4507 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -241,6 +241,7 @@ static QTouchDevice *touchDevice = 0;
// Send a geometry change event to Qt, if it's ready to handle events
if (!m_platformWindow->m_inConstructor) {
QWindowSystemInterface::handleGeometryChange(m_window, geometry);
+ QWindowSystemInterface::handleExposeEvent(m_window, geometry);
QWindowSystemInterface::flushWindowSystemEvents();
}
}