From e1b83432c1ea27f8028fd63fe9bc328f6e8b63a9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 29 Aug 2014 15:19:45 +0200 Subject: qwindow-compositor: Rename QOpenGLWindow That's a public class in Qt 5.4. Use the more appropriate CompositorWindow. Change-Id: Id7de20c7e2d5b373f8ef9fe9a836188dc864479e Reviewed-by: Giulio Camuffo --- examples/qwindow-compositor/compositorwindow.cpp | 61 +++++++++++++++++++++ examples/qwindow-compositor/compositorwindow.h | 64 ++++++++++++++++++++++ examples/qwindow-compositor/main.cpp | 4 +- examples/qwindow-compositor/qopenglwindow.cpp | 61 --------------------- examples/qwindow-compositor/qopenglwindow.h | 63 --------------------- examples/qwindow-compositor/qwindow-compositor.pro | 4 +- examples/qwindow-compositor/qwindowcompositor.cpp | 2 +- examples/qwindow-compositor/qwindowcompositor.h | 6 +- 8 files changed, 133 insertions(+), 132 deletions(-) create mode 100644 examples/qwindow-compositor/compositorwindow.cpp create mode 100644 examples/qwindow-compositor/compositorwindow.h delete mode 100644 examples/qwindow-compositor/qopenglwindow.cpp delete mode 100644 examples/qwindow-compositor/qopenglwindow.h diff --git a/examples/qwindow-compositor/compositorwindow.cpp b/examples/qwindow-compositor/compositorwindow.cpp new file mode 100644 index 000000000..6f8f2321d --- /dev/null +++ b/examples/qwindow-compositor/compositorwindow.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Wayland module +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "compositorwindow.h" +#include + +CompositorWindow::CompositorWindow(const QSurfaceFormat &format, const QRect &geometry) + : m_format(format) +{ + setSurfaceType(QWindow::OpenGLSurface); + setGeometry(geometry); + setFormat(format); + create(); + m_context = new QOpenGLContext; + m_context->setFormat(format); + m_context->create(); +} + +void CompositorWindow::touchEvent(QTouchEvent *event) +{ + // Do not want any automatically synthesized mouse events + // so make sure the touch is always accepted. + event->accept(); +} diff --git a/examples/qwindow-compositor/compositorwindow.h b/examples/qwindow-compositor/compositorwindow.h new file mode 100644 index 000000000..dc87b31a3 --- /dev/null +++ b/examples/qwindow-compositor/compositorwindow.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Wayland module +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef COMPOSITORWINDOW_H +#define COMPOSITORWINDOW_H + +#include +#include +#include + +class CompositorWindow : public QWindow +{ +public: + CompositorWindow(const QSurfaceFormat &format, const QRect &geometry); + QOpenGLContext* context() { return m_context; } + bool makeCurrent() { return m_context->makeCurrent(this); } + void swapBuffers() { m_context->swapBuffers(this); } + +protected: + void touchEvent(QTouchEvent *event); + +private: + QOpenGLContext *m_context; + QSurfaceFormat m_format; +}; + +#endif // COMPOSITORWINDOW_H diff --git a/examples/qwindow-compositor/main.cpp b/examples/qwindow-compositor/main.cpp index e82ec6eb0..a0288982e 100644 --- a/examples/qwindow-compositor/main.cpp +++ b/examples/qwindow-compositor/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qopenglwindow.h" +#include "compositorwindow.h" #include "qwindowcompositor.h" #include @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) geom = QRect(screenGeometry.width() / 4, screenGeometry.height() / 4, screenGeometry.width() / 2, screenGeometry.height() / 2); - QOpenGLWindow window(format, geom); + CompositorWindow window(format, geom); QWindowCompositor compositor(&window); window.show(); diff --git a/examples/qwindow-compositor/qopenglwindow.cpp b/examples/qwindow-compositor/qopenglwindow.cpp deleted file mode 100644 index bfd30ddb0..000000000 --- a/examples/qwindow-compositor/qopenglwindow.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qopenglwindow.h" -#include - -QOpenGLWindow::QOpenGLWindow(const QSurfaceFormat &format, const QRect &geometry) - : m_format(format) -{ - setSurfaceType(QWindow::OpenGLSurface); - setGeometry(geometry); - setFormat(format); - create(); - m_context = new QOpenGLContext; - m_context->setFormat(format); - m_context->create(); -} - -void QOpenGLWindow::touchEvent(QTouchEvent *event) -{ - // Do not want any automatically synthesized mouse events - // so make sure the touch is always accepted. - event->accept(); -} diff --git a/examples/qwindow-compositor/qopenglwindow.h b/examples/qwindow-compositor/qopenglwindow.h deleted file mode 100644 index 486b6f01a..000000000 --- a/examples/qwindow-compositor/qopenglwindow.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Compositor. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QOPENGLWINDOW_H -#define QOPENGLWINDOW_H - -#include -#include -#include - -class QOpenGLWindow : public QWindow -{ -public: - QOpenGLWindow(const QSurfaceFormat &format, const QRect &geometry); -public: - QOpenGLContext* context() { return m_context; } - bool makeCurrent() { return m_context->makeCurrent(this); } - void swapBuffers() { m_context->swapBuffers(this); } -protected: - void touchEvent(QTouchEvent *event); -private: - QOpenGLContext *m_context; - QSurfaceFormat m_format; -}; - -#endif // QOPENGLWINDOW_H diff --git a/examples/qwindow-compositor/qwindow-compositor.pro b/examples/qwindow-compositor/qwindow-compositor.pro index 465c0d997..7b0e24c43 100644 --- a/examples/qwindow-compositor/qwindow-compositor.pro +++ b/examples/qwindow-compositor/qwindow-compositor.pro @@ -4,12 +4,12 @@ LIBS += -L ../../lib #include (../../src/qt-compositor/qt-compositor.pri) HEADERS += \ - qopenglwindow.h \ + compositorwindow.h \ qwindowcompositor.h \ textureblitter.h SOURCES += main.cpp \ - qopenglwindow.cpp \ + compositorwindow.cpp \ qwindowcompositor.cpp \ textureblitter.cpp diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp index 73182ba33..c933152d8 100644 --- a/examples/qwindow-compositor/qwindowcompositor.cpp +++ b/examples/qwindow-compositor/qwindowcompositor.cpp @@ -107,7 +107,7 @@ public: GLuint texture; }; -QWindowCompositor::QWindowCompositor(QOpenGLWindow *window) +QWindowCompositor::QWindowCompositor(CompositorWindow *window) : QWaylandCompositor(window, 0, DefaultExtensions | SubSurfaceExtension) , m_window(window) , m_backgroundTexture(0) diff --git a/examples/qwindow-compositor/qwindowcompositor.h b/examples/qwindow-compositor/qwindowcompositor.h index 8b224e6b8..57f3e8536 100644 --- a/examples/qwindow-compositor/qwindowcompositor.h +++ b/examples/qwindow-compositor/qwindowcompositor.h @@ -44,7 +44,7 @@ #include "qwaylandcompositor.h" #include "qwaylandsurface.h" #include "textureblitter.h" -#include "qopenglwindow.h" +#include "compositorwindow.h" #include #include @@ -59,7 +59,7 @@ class QWindowCompositor : public QObject, public QWaylandCompositor { Q_OBJECT public: - QWindowCompositor(QOpenGLWindow *window); + QWindowCompositor(CompositorWindow *window); ~QWindowCompositor(); private slots: @@ -91,7 +91,7 @@ private slots: private: void drawSubSurface(const QPoint &offset, QWaylandSurface *surface); - QOpenGLWindow *m_window; + CompositorWindow *m_window; QImage m_backgroundImage; QOpenGLTexture *m_backgroundTexture; QList m_surfaces; -- cgit v1.2.3