summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/eglfs')
-rw-r--r--src/plugins/platforms/eglfs/qeglfsbackingstore.cpp6
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp17
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h2
3 files changed, 13 insertions, 12 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
index 1898cde886..e09154bb59 100644
--- a/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp
@@ -79,6 +79,9 @@ void QEglFSBackingStore::flush(QWindow *window, const QRegion &region, const QPo
makeCurrent();
+ QRectF sr = window->screen()->geometry();
+ glViewport(0, 0, sr.width(), sr.height());
+
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglBackingStore::flush %p", window);
#endif
@@ -120,7 +123,6 @@ void QEglFSBackingStore::flush(QWindow *window, const QRegion &region, const QPo
};
QRectF r = window->geometry();
- QRectF sr = window->screen()->geometry();
GLfloat x1 = (r.left() / sr.width()) * 2 - 1;
GLfloat x2 = (r.right() / sr.width()) * 2 - 1;
@@ -192,8 +194,6 @@ void QEglFSBackingStore::flush(QWindow *window, const QRegion &region, const QPo
void QEglFSBackingStore::makeCurrent()
{
- // needed to prevent QOpenGLContext::makeCurrent() from failing
- window()->setSurfaceType(QSurface::OpenGLSurface);
(static_cast<QEglFSWindow *>(window()->handle()))->create();
m_context->makeCurrent(window());
}
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index 1cc252d285..bf6e375ac0 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -55,12 +55,12 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
: QPlatformWindow(w)
, m_surface(0)
, m_window(0)
+ , has_window(false)
{
- static int serialNo = 0;
- m_winid = ++serialNo;
#ifdef QEGL_EXTRA_DEBUG
- qWarning("QEglWindow %p: %p 0x%x\n", this, w, uint(m_winid));
+ qWarning("QEglWindow %p: %p 0x%x\n", this, w, uint(m_window));
#endif
+ w->setSurfaceType(QSurface::OpenGLSurface);
}
QEglFSWindow::~QEglFSWindow()
@@ -75,7 +75,7 @@ static inline bool supportsMultipleWindows()
void QEglFSWindow::create()
{
- if (m_window)
+ if (has_window)
return;
setWindowState(Qt::WindowFullScreen);
@@ -100,7 +100,7 @@ void QEglFSWindow::create()
void QEglFSWindow::invalidateSurface()
{
// Native surface has been deleted behind our backs
- m_window = 0;
+ has_window = false;
if (m_surface != 0) {
EGLDisplay display = (static_cast<QEglFSScreen *>(window()->screen()->handle()))->display();
eglDestroySurface(display, m_surface);
@@ -113,6 +113,7 @@ void QEglFSWindow::resetSurface()
EGLDisplay display = static_cast<QEglFSScreen *>(screen())->display();
m_window = QEglFSHooks::hooks()->createNativeWindow(QEglFSHooks::hooks()->screenSize(), m_format);
+ has_window = true;
m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL);
if (m_surface == EGL_NO_SURFACE) {
@@ -138,9 +139,9 @@ void QEglFSWindow::destroy()
m_surface = 0;
}
- if (m_window) {
+ if (has_window) {
QEglFSHooks::hooks()->destroyNativeWindow(m_window);
- m_window = 0;
+ has_window = false;
}
}
@@ -160,7 +161,7 @@ void QEglFSWindow::setWindowState(Qt::WindowState)
WId QEglFSWindow::winId() const
{
- return m_winid;
+ return WId(m_window);
}
EGLSurface QEglFSWindow::surface() const
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
index ff360962ed..936537807a 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -75,9 +75,9 @@ protected:
EGLNativeWindowType m_window;
private:
- WId m_winid;
EGLConfig m_config;
QSurfaceFormat m_format;
+ bool has_window;
};
QT_END_NAMESPACE
#endif // QEGLFSWINDOW_H