From 474bf7b1870c55f53a628aead3eb7a32d80844bb Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 27 Feb 2014 13:49:49 +0100 Subject: [PATCH 001/172] Protect against malicious SPDY messages Add handling of invalid stream-ids and buffer overflow in header parsing. Change-Id: I712af189d72612639d25890a8861a8f4fe084ce3 Reviewed-by: Peter Hartmann --- src/network/access/qspdyprotocolhandler.cpp | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index 098b3e9ab0f..e87738be467 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 BlackBerry Limited. All rights reserved. +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtNetwork module of the Qt Toolkit. @@ -694,6 +695,10 @@ void QSpdyProtocolHandler::sendPING(quint32 pingID) bool QSpdyProtocolHandler::uploadData(qint32 streamID) { // we only rely on SPDY flow control here and don't care about TCP buffers + if (!m_inFlightStreams.contains(streamID)) { + sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM); + return false; + } HttpMessagePair messagePair = m_inFlightStreams.value(streamID); QHttpNetworkRequest request = messagePair.first; @@ -874,6 +879,10 @@ void QSpdyProtocolHandler::handleSYN_REPLY(char flags, quint32 /*length*/, const void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameData) { qint32 streamID = getStreamID(frameData.constData()); + if (!m_inFlightStreams.contains(streamID)) { + sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM); + return; + } flags &= 0x3f; bool flag_fin = flags & 0x01; @@ -891,16 +900,31 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD } qint32 headerCount = fourBytesToInt(uncompressedHeader.constData()); + if (headerCount * 8 > uncompressedHeader.size()) { + qWarning() << Q_FUNC_INFO << "error parsing header from SYN_REPLY message"; + sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR); + return; + } qint32 readPointer = 4; for (qint32 a = 0; a < headerCount; ++a) { qint32 count = fourBytesToInt(uncompressedHeader.constData() + readPointer); readPointer += 4; QByteArray name = uncompressedHeader.mid(readPointer, count); readPointer += count; + if (readPointer > uncompressedHeader.size()) { + qWarning() << Q_FUNC_INFO << "error parsing header from SYN_REPLY message"; + sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR); + return; + } count = fourBytesToInt(uncompressedHeader.constData() + readPointer); readPointer += 4; QByteArray value = uncompressedHeader.mid(readPointer, count); readPointer += count; + if (readPointer > uncompressedHeader.size()) { + qWarning() << Q_FUNC_INFO << "error parsing header from SYN_REPLY message"; + sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR); + return; + } if (name == ":status") { httpReply->setStatusCode(value.left(3).toInt()); httpReply->d_func()->reasonPhrase = QString::fromLatin1(value.mid(4)); @@ -1143,6 +1167,11 @@ void QSpdyProtocolHandler::handleWINDOW_UPDATE(char /*flags*/, quint32 /*length* qint32 streamID = getStreamID(frameData.constData()); qint32 deltaWindowSize = fourBytesToInt(frameData.constData() + 4); + if (!m_inFlightStreams.contains(streamID)) { + sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM); + return; + } + QHttpNetworkReply *reply = m_inFlightStreams.value(streamID).second; Q_ASSERT(reply); QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); @@ -1158,6 +1187,11 @@ void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders) Q_ASSERT(frameHeaders.count() >= 8); qint32 streamID = getStreamID(frameHeaders.constData()); + if (!m_inFlightStreams.contains(streamID)) { + sendRST_STREAM(streamID, RST_STREAM_INVALID_STREAM); + return; + } + unsigned char flags = static_cast(frameHeaders.at(4)); flags &= 0x3f; bool flag_fin = flags & 0x01; From e8ed514e354755e34a1343070483371e37394b3b Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Thu, 27 Feb 2014 13:50:38 +0100 Subject: [PATCH 002/172] tests: Remove superfluous gui additions to QT by default QT contains both core and gui already Change-Id: I6f5b551104e40a024468e7cb62e302134e9472ec Reviewed-by: Frederik Gladhorn --- .../itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro | 2 +- tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro | 2 +- .../qfileopeneventexternal/qfileopeneventexternal.pro | 1 - tests/auto/gui/kernel/qguiapplication/qguiapplication.pro | 2 +- tests/auto/gui/qopengl/qopengl.pro | 2 +- tests/auto/gui/text/qstatictext/qstatictext.pro | 2 +- tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro | 2 +- .../auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro | 2 +- 8 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro index 44957bcb574..25947990a77 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro @@ -2,7 +2,7 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qsortfilterproxymodel -QT += gui widgets testlib +QT += widgets testlib mtdir = ../../../other/modeltest INCLUDEPATH += $$PWD/$${mtdir} diff --git a/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro b/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro index 282737ed7d8..b85d475e97a 100644 --- a/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro +++ b/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro @@ -1,7 +1,7 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qstandarditem -QT += gui testlib +QT += testlib SOURCES += tst_qstandarditem.cpp diff --git a/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro index b84ff760ca9..a4abaeedc6e 100644 --- a/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro +++ b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro @@ -1,4 +1,3 @@ TEMPLATE = app TARGET = qfileopeneventexternal -QT += core gui SOURCES += qfileopeneventexternal.cpp diff --git a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro index 79acb9e5f10..cd363bab314 100644 --- a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro +++ b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro @@ -5,5 +5,5 @@ include($${CORE_TEST_PATH}/qcoreapplication.pro) INCLUDEPATH += $$CORE_TEST_PATH TARGET = tst_qguiapplication -QT += gui gui-private +QT += gui-private SOURCES += tst_qguiapplication.cpp diff --git a/tests/auto/gui/qopengl/qopengl.pro b/tests/auto/gui/qopengl/qopengl.pro index 34af962d361..12429bbeed2 100644 --- a/tests/auto/gui/qopengl/qopengl.pro +++ b/tests/auto/gui/qopengl/qopengl.pro @@ -5,7 +5,7 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qopengl -QT += gui gui-private core-private testlib +QT += gui-private core-private testlib SOURCES += tst_qopengl.cpp diff --git a/tests/auto/gui/text/qstatictext/qstatictext.pro b/tests/auto/gui/text/qstatictext/qstatictext.pro index 55b218deb78..435b132ffd4 100644 --- a/tests/auto/gui/text/qstatictext/qstatictext.pro +++ b/tests/auto/gui/text/qstatictext/qstatictext.pro @@ -3,5 +3,5 @@ CONFIG += parallel_test linux: CONFIG += insignificant_test TARGET = tst_qstatictext QT += testlib -QT += core core-private gui gui-private +QT += core-private gui-private SOURCES += tst_qstatictext.cpp diff --git a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro index a9705453e95..cb5bc04c1d7 100644 --- a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro +++ b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro @@ -10,5 +10,5 @@ SOURCES += tst_qaccessibilitylinux.cpp CONFIG += gui -QT += gui gui-private widgets dbus testlib +QT += gui-private widgets dbus testlib diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro index 1f60cd5ca41..bc4671f60cf 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro @@ -4,7 +4,7 @@ win32:testcase.timeout = 900 macx:testcase.timeout = 900 QT += widgets widgets-private -QT += core-private gui testlib +QT += core-private testlib SOURCES += tst_qfilesystemmodel.cpp TARGET = tst_qfilesystemmodel From 24040ca43cf0b8bff9a2283aed79b578fcdd6cdc Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Fri, 28 Feb 2014 14:42:11 +0100 Subject: [PATCH 003/172] SPDY: Fix compiler warning about unused variable Change-Id: Ib3dcd8616ab8167de31a01b3e6f0188d384ff244 Reviewed-by: Peter Hartmann --- src/network/access/qspdyprotocolhandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index e87738be467..7c5d1c3d8f0 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -276,6 +276,7 @@ QSpdyProtocolHandler::QSpdyProtocolHandler(QHttpNetworkConnectionChannel *channe // when sending the headers because of the CRIME attack zlibRet = deflateInit(&m_deflateStream, /* compression level = */ 0); Q_ASSERT(zlibRet == Z_OK); + Q_UNUSED(zlibRet); // silence -Wunused-variable } QSpdyProtocolHandler::~QSpdyProtocolHandler() @@ -619,6 +620,7 @@ void QSpdyProtocolHandler::sendControlFrame(FrameType type, Q_ASSERT(written == 8); written = m_socket->write(data, length); Q_ASSERT(written == length); + Q_UNUSED(written); // silence -Wunused-variable } void QSpdyProtocolHandler::sendSYN_STREAM(HttpMessagePair messagePair, From 40519146419cccf30e392b08fcf3db755ad288a1 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 26 Feb 2014 22:33:29 +0100 Subject: [PATCH 004/172] QPalette: optimize move assignment operator Instead of assigning the various bit-fields manually, use the quint32 union field, which is already present to avoid slow bit-field operations in the member-swap function. Verifed that the generated assembly for move-assignment is significantly better than before on GCC. Change-Id: If4e0ef678bf3a496c6eb369ad3f639f5a9bc79fc Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/gui/kernel/qpalette.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index 9abca30f127..8d9754d3887 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -72,8 +72,7 @@ public: #ifdef Q_COMPILER_RVALUE_REFS inline QPalette &operator=(QPalette &&other) { - data.resolve_mask = other.data.resolve_mask; - data.current_group = other.data.current_group; + for_faster_swapping_dont_use = other.for_faster_swapping_dont_use; qSwap(d, other.d); return *this; } #endif From 1219dbe543eb91a52645cd96e6b7eccfd60b5be7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 26 Feb 2014 15:21:18 +0100 Subject: [PATCH 005/172] Add an example for creating OpenGL contexts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Besides serving as an example for performing OpenGL rendering inside a window container in a way that it works across all GL versions, this is an extremely useful tool for developers and users alike since it allows quick and easy checking of what sort of context a particular driver returns for a particular QSurfaceFormat. NB! Depending on the OpenGL driver, some surprises can be expected. The handling of core/compatibility profiles, the fwdcompat bit, the supported GLSL versions, etc. tend to be somewhat different across the different OpenGL implementations. Task-number: QTBUG-37071 Change-Id: Iae4328e66cd0bb19f74a77fefef93ea5a3221e31 Reviewed-by: Jørgen Lind Reviewed-by: Gunnar Sletta Reviewed-by: Sean Harmer --- examples/opengl/contextinfo/contextinfo.pro | 9 + examples/opengl/contextinfo/main.cpp | 53 +++ examples/opengl/contextinfo/renderwindow.cpp | 218 +++++++++++ examples/opengl/contextinfo/renderwindow.h | 82 +++++ examples/opengl/contextinfo/widget.cpp | 357 +++++++++++++++++++ examples/opengl/contextinfo/widget.h | 79 ++++ examples/opengl/opengl.pro | 3 +- 7 files changed, 800 insertions(+), 1 deletion(-) create mode 100644 examples/opengl/contextinfo/contextinfo.pro create mode 100644 examples/opengl/contextinfo/main.cpp create mode 100644 examples/opengl/contextinfo/renderwindow.cpp create mode 100644 examples/opengl/contextinfo/renderwindow.h create mode 100644 examples/opengl/contextinfo/widget.cpp create mode 100644 examples/opengl/contextinfo/widget.h diff --git a/examples/opengl/contextinfo/contextinfo.pro b/examples/opengl/contextinfo/contextinfo.pro new file mode 100644 index 00000000000..ddaa084f384 --- /dev/null +++ b/examples/opengl/contextinfo/contextinfo.pro @@ -0,0 +1,9 @@ +TEMPLATE = app +QT += widgets + +SOURCES += main.cpp \ + widget.cpp \ + renderwindow.cpp + +HEADERS += widget.h \ + renderwindow.h diff --git a/examples/opengl/contextinfo/main.cpp b/examples/opengl/contextinfo/main.cpp new file mode 100644 index 00000000000..bc6363b31aa --- /dev/null +++ b/examples/opengl/contextinfo/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** 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 Toolkit. +** +** $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 +#include "widget.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + + Widget w; + w.resize(700, 800); + w.show(); + + return app.exec(); +} diff --git a/examples/opengl/contextinfo/renderwindow.cpp b/examples/opengl/contextinfo/renderwindow.cpp new file mode 100644 index 00000000000..ab8e89fab83 --- /dev/null +++ b/examples/opengl/contextinfo/renderwindow.cpp @@ -0,0 +1,218 @@ +/**************************************************************************** +** +** 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 Toolkit. +** +** $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 "renderwindow.h" +#include +#include +#include +#include + +RenderWindow::RenderWindow(const QSurfaceFormat &format) + : m_context(0), + m_initialized(false), + m_forceGLSL110(false), + m_angle(0.0f) +{ + setSurfaceType(QWindow::OpenGLSurface); + setFormat(format); + m_context = new QOpenGLContext(this); + m_context->setFormat(requestedFormat()); + if (!m_context->create()) { + delete m_context; + m_context = 0; + } +} + +void RenderWindow::exposeEvent(QExposeEvent *) +{ + if (isExposed()) + render(); +} + +// ES needs the precision qualifiers. +// On desktop GL QOpenGLShaderProgram inserts dummy defines for highp/mediump/lowp. +static const char *vertexShaderSource110 = + "attribute highp vec4 posAttr;\n" + "attribute lowp vec4 colAttr;\n" + "varying lowp vec4 col;\n" + "uniform highp mat4 matrix;\n" + "void main() {\n" + " col = colAttr;\n" + " gl_Position = matrix * posAttr;\n" + "}\n"; + +static const char *fragmentShaderSource110 = + "varying lowp vec4 col;\n" + "void main() {\n" + " gl_FragColor = col;\n" + "}\n"; + +static const char *vertexShaderSource = + "#version 150\n" + "in vec4 posAttr;\n" + "in vec4 colAttr;\n" + "out vec4 col;\n" + "uniform mat4 matrix;\n" + "void main() {\n" + " col = colAttr;\n" + " gl_Position = matrix * posAttr;\n" + "}\n"; + +static const char *fragmentShaderSource = + "#version 150\n" + "in vec4 col;\n" + "out vec4 fragColor;\n" + "void main() {\n" + " fragColor = col;\n" + "}\n"; + +static GLfloat vertices[] = { + 0.0f, 0.707f, + -0.5f, -0.5f, + 0.5f, -0.5f +}; + +static GLfloat colors[] = { + 1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f +}; + +void RenderWindow::init() +{ + m_program = new QOpenGLShaderProgram(this); + + QSurfaceFormat format = m_context->format(); + bool useNewStyleShader = format.profile() == QSurfaceFormat::CoreProfile; + // Try to handle 3.0 & 3.1 that do not have the core/compatibility profile concept 3.2+ has. + // This may still fail since version 150 (3.2) is specified in the sources but it's worth a try. + if (format.renderableType() == QSurfaceFormat::OpenGL && format.majorVersion() == 3 && format.minorVersion() <= 1) + useNewStyleShader = !format.testOption(QSurfaceFormat::DeprecatedFunctions); + if (m_forceGLSL110) + useNewStyleShader = false; + + const char *vsrc = useNewStyleShader ? vertexShaderSource : vertexShaderSource110; + const char *fsrc = useNewStyleShader ? fragmentShaderSource : fragmentShaderSource110; + qDebug("Using version %s shader", useNewStyleShader ? "150" : "110"); + + if (!m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vsrc)) { + emit error(m_program->log()); + return; + } + if (!m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, fsrc)) { + emit error(m_program->log()); + return; + } + if (!m_program->link()) { + emit error(m_program->log()); + return; + } + + m_posAttr = m_program->attributeLocation("posAttr"); + m_colAttr = m_program->attributeLocation("colAttr"); + m_matrixUniform = m_program->uniformLocation("matrix"); + + m_vbo.create(); + m_vbo.bind(); + m_vbo.allocate(vertices, sizeof(vertices) + sizeof(colors)); + m_vbo.write(sizeof(vertices), colors, sizeof(colors)); + m_vbo.release(); + + QOpenGLVertexArrayObject::Binder vaoBinder(&m_vao); + if (m_vao.isCreated()) // have VAO support, use it + setupVertexAttribs(); +} + +void RenderWindow::setupVertexAttribs() +{ + m_vbo.bind(); + m_program->setAttributeBuffer(m_posAttr, GL_FLOAT, 0, 2); + m_program->setAttributeBuffer(m_colAttr, GL_FLOAT, sizeof(vertices), 3); + m_program->enableAttributeArray(m_posAttr); + m_program->enableAttributeArray(m_colAttr); + m_vbo.release(); +} + +void RenderWindow::render() +{ + if (!m_context->makeCurrent(this)) { + qWarning("makeCurrent() failed"); + return; + } + + if (!m_initialized) { + m_initialized = true; + glEnable(GL_DEPTH_TEST); + glClearColor(0, 0, 0, 1); + init(); + emit ready(); + } + + if (!m_vbo.isCreated()) // init() failed, don't bother with trying to render + return; + + const qreal retinaScale = devicePixelRatio(); + glViewport(0, 0, width() * retinaScale, height() * retinaScale); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + m_program->bind(); + QMatrix4x4 matrix; + matrix.perspective(60.0f, 4.0f / 3.0f, 0.1f, 100.0f); + matrix.translate(0.0f, 0.0f, -2.0f); + matrix.rotate(m_angle, 0.0f, 1.0f, 0.0f); + m_program->setUniformValue(m_matrixUniform, matrix); + + if (m_vao.isCreated()) + m_vao.bind(); + else // no VAO support, set the vertex attribute arrays now + setupVertexAttribs(); + + glDrawArrays(GL_TRIANGLES, 0, 3); + + m_vao.release(); + m_program->release(); + + // swapInterval is 1 by default which means that swapBuffers() will (hopefully) block + // and wait for vsync. + m_context->swapBuffers(this); + + m_angle += 1.0f; + QTimer::singleShot(0, this, SLOT(render())); +} diff --git a/examples/opengl/contextinfo/renderwindow.h b/examples/opengl/contextinfo/renderwindow.h new file mode 100644 index 00000000000..36b15fd22ba --- /dev/null +++ b/examples/opengl/contextinfo/renderwindow.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** 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 Toolkit. +** +** $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 RENDERWINDOW_H +#define RENDERWINDOW_H + +#include +#include +#include + +QT_FORWARD_DECLARE_CLASS(QOpenGLContext) +QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram) + +class RenderWindow : public QWindow +{ + Q_OBJECT + +public: + RenderWindow(const QSurfaceFormat &format); + QOpenGLContext *context() { return m_context; } + void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE; + void setForceGLSL110(bool enable) { m_forceGLSL110 = enable; } + +signals: + void ready(); + void error(const QString &msg); + +private slots: + void render(); + +private: + void init(); + void setupVertexAttribs(); + + QOpenGLContext *m_context; + bool m_initialized; + bool m_forceGLSL110; + QOpenGLShaderProgram *m_program; + int m_posAttr, m_colAttr, m_matrixUniform; + QOpenGLVertexArrayObject m_vao; + QOpenGLBuffer m_vbo; + float m_angle; +}; + +#endif // RENDERWINDOW_H diff --git a/examples/opengl/contextinfo/widget.cpp b/examples/opengl/contextinfo/widget.cpp new file mode 100644 index 00000000000..13cec3b3f8e --- /dev/null +++ b/examples/opengl/contextinfo/widget.cpp @@ -0,0 +1,357 @@ +/**************************************************************************** +** +** 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 Toolkit. +** +** $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 "widget.h" +#include "renderwindow.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct Version { + const char *str; + int major; + int minor; +}; + +static struct Version versions[] = { + { "1.0", 1, 0 }, + { "1.1", 1, 1 }, + { "1.2", 1, 2 }, + { "1.3", 1, 3 }, + { "1.4", 1, 4 }, + { "1.5", 1, 5 }, + { "2.0", 2, 0 }, + { "2.1", 2, 1 }, + { "3.0", 3, 0 }, + { "3.1", 3, 1 }, + { "3.2", 3, 2 }, + { "3.3", 3, 3 }, + { "4.0", 4, 0 }, + { "4.1", 4, 1 }, + { "4.2", 4, 2 }, + { "4.3", 4, 3 }, + { "4.4", 4, 4 } +}; + +struct Profile { + const char *str; + QSurfaceFormat::OpenGLContextProfile profile; +}; + +static struct Profile profiles[] = { + { "none", QSurfaceFormat::NoProfile }, + { "core", QSurfaceFormat::CoreProfile }, + { "compatibility", QSurfaceFormat::CompatibilityProfile } +}; + +struct Option { + const char *str; + QSurfaceFormat::FormatOption option; +}; + +static struct Option options[] = { + { "deprecated functions (not forward compatible)", QSurfaceFormat::DeprecatedFunctions }, + { "debug context", QSurfaceFormat::DebugContext }, + { "stereo buffers", QSurfaceFormat::StereoBuffers }, + // This is not a QSurfaceFormat option but is helpful to determine if the driver + // allows compiling old-style shaders with core profile. + { "force version 110 shaders", QSurfaceFormat::FormatOption(0) } +}; + +struct Renderable { + const char *str; + QSurfaceFormat::RenderableType renderable; +}; + +static struct Renderable renderables[] = { + { "default", QSurfaceFormat::DefaultRenderableType }, + { "OpenGL", QSurfaceFormat::OpenGL }, + { "OpenGL ES", QSurfaceFormat::OpenGLES } +}; + +void Widget::addVersions(QLayout *layout) +{ + QHBoxLayout *hbox = new QHBoxLayout; + hbox->setSpacing(20); + QLabel *label = new QLabel(tr("Context &version: ")); + hbox->addWidget(label); + m_version = new QComboBox; + m_version->setMinimumWidth(60); + label->setBuddy(m_version); + hbox->addWidget(m_version); + for (size_t i = 0; i < sizeof(versions) / sizeof(Version); ++i) { + m_version->addItem(QString::fromLatin1(versions[i].str)); + if (versions[i].major == 2 && versions[i].minor == 0) + m_version->setCurrentIndex(m_version->count() - 1); + } + + QPushButton *btn = new QPushButton(tr("Create context")); + connect(btn, &QPushButton::clicked, this, &Widget::start); + btn->setMinimumSize(120, 40); + hbox->addWidget(btn); + + layout->addItem(hbox); +} + +void Widget::addProfiles(QLayout *layout) +{ + QGroupBox *groupBox = new QGroupBox(tr("Profile")); + QVBoxLayout *vbox = new QVBoxLayout; + for (size_t i = 0; i < sizeof(profiles) / sizeof(Profile); ++i) + vbox->addWidget(new QRadioButton(QString::fromLatin1(profiles[i].str))); + static_cast(vbox->itemAt(0)->widget())->setChecked(true); + groupBox->setLayout(vbox); + layout->addWidget(groupBox); + m_profiles = vbox; +} + +void Widget::addOptions(QLayout *layout) +{ + QGroupBox *groupBox = new QGroupBox(tr("Options")); + QVBoxLayout *vbox = new QVBoxLayout; + for (size_t i = 0; i < sizeof(options) / sizeof(Option); ++i) + vbox->addWidget(new QCheckBox(QString::fromLatin1(options[i].str))); + groupBox->setLayout(vbox); + layout->addWidget(groupBox); + m_options = vbox; +} + +void Widget::addRenderableTypes(QLayout *layout) +{ + QGroupBox *groupBox = new QGroupBox(tr("Renderable type")); + QVBoxLayout *vbox = new QVBoxLayout; + for (size_t i = 0; i < sizeof(renderables) / sizeof(Renderable); ++i) + vbox->addWidget(new QRadioButton(QString::fromLatin1(renderables[i].str))); + static_cast(vbox->itemAt(0)->widget())->setChecked(true); + groupBox->setLayout(vbox); + layout->addWidget(groupBox); + m_renderables = vbox; +} + +void Widget::addRenderWindow() +{ + m_renderWindowLayout->addWidget(m_renderWindowContainer); +} + +static QWidget *widgetWithLayout(QLayout *layout) +{ + QWidget *w = new QWidget; + w->setLayout(layout); + return w; +} + +Widget::Widget(QWidget *parent) + : QWidget(parent) +{ + QVBoxLayout *layout = new QVBoxLayout; + QSplitter *vsplit = new QSplitter(Qt::Vertical); + layout->addWidget(vsplit); + + QSplitter *hsplit = new QSplitter; + + QVBoxLayout *settingsLayout = new QVBoxLayout; + addVersions(settingsLayout); + addProfiles(settingsLayout); + addOptions(settingsLayout); + addRenderableTypes(settingsLayout); + hsplit->addWidget(widgetWithLayout(settingsLayout)); + + QVBoxLayout *outputLayout = new QVBoxLayout; + m_output = new QTextEdit; + m_output->setReadOnly(true); + outputLayout->addWidget(m_output); + m_extensions = new QTextEdit; + m_extensions->setReadOnly(true); + outputLayout->addWidget(m_extensions); + hsplit->addWidget(widgetWithLayout(outputLayout)); + + hsplit->setStretchFactor(0, 4); + hsplit->setStretchFactor(1, 6); + vsplit->addWidget(hsplit); + + m_renderWindowLayout = new QVBoxLayout; + vsplit->addWidget(widgetWithLayout(m_renderWindowLayout)); + vsplit->setStretchFactor(1, 5); + + m_renderWindowContainer = new QWidget; + addRenderWindow(); + + setLayout(layout); +} + +void Widget::start() +{ + QSurfaceFormat fmt; + + int idx = m_version->currentIndex(); + if (idx < 0) + return; + fmt.setVersion(versions[idx].major, versions[idx].minor); + + for (size_t i = 0; i < sizeof(profiles) / sizeof(Profile); ++i) + if (static_cast(m_profiles->itemAt(int(i))->widget())->isChecked()) { + fmt.setProfile(profiles[i].profile); + break; + } + + bool forceGLSL110 = false; + for (size_t i = 0; i < sizeof(options) / sizeof(Option); ++i) + if (static_cast(m_options->itemAt(int(i))->widget())->isChecked()) { + if (options[i].option) + fmt.setOption(options[i].option); + else if (i == 3) + forceGLSL110 = true; + } + + for (size_t i = 0; i < sizeof(renderables) / sizeof(Renderable); ++i) + if (static_cast(m_renderables->itemAt(int(i))->widget())->isChecked()) { + fmt.setRenderableType(renderables[i].renderable); + break; + } + + // The example rendering will need a depth buffer. + fmt.setDepthBufferSize(16); + + m_output->clear(); + m_extensions->clear(); + qDebug() << "Requesting surface format" << fmt; + + m_renderWindowLayout->removeWidget(m_renderWindowContainer); + delete m_renderWindowContainer; + + RenderWindow *renderWindow = new RenderWindow(fmt); + if (!renderWindow->context()) { + m_output->append(tr("Failed to create context")); + delete renderWindow; + m_renderWindowContainer = new QWidget; + addRenderWindow(); + return; + } + + renderWindow->setForceGLSL110(forceGLSL110); + connect(renderWindow, &RenderWindow::ready, this, &Widget::renderWindowReady); + connect(renderWindow, &RenderWindow::error, this, &Widget::renderWindowError); + + m_renderWindowContainer = QWidget::createWindowContainer(renderWindow); + addRenderWindow(); +} + +void Widget::renderWindowReady() +{ + QOpenGLContext *context = QOpenGLContext::currentContext(); + Q_ASSERT(context); + const QSurfaceFormat format = context->format(); + + m_output->append(tr("OpenGL version: %1.%2").arg(format.majorVersion()).arg(format.minorVersion())); + + for (size_t i = 0; i < sizeof(profiles) / sizeof(Profile); ++i) + if (profiles[i].profile == format.profile()) { + m_output->append(tr("Profile: %1").arg(QString::fromLatin1(profiles[i].str))); + break; + } + + QString opts; + for (size_t i = 0; i < sizeof(options) / sizeof(Option); ++i) + if (format.testOption(options[i].option)) + opts += QString::fromLatin1(options[i].str) + QStringLiteral(" "); + m_output->append(tr("Options: %1").arg(opts)); + + for (size_t i = 0; i < sizeof(renderables) / sizeof(Renderable); ++i) + if (renderables[i].renderable == format.renderableType()) { + m_output->append(tr("Renderable type: %1").arg(QString::fromLatin1(renderables[i].str))); + break; + } + + QString vendor, renderer, version, glslVersion; + const GLubyte *p; + if ((p = glGetString(GL_VENDOR))) + vendor = QString::fromLatin1(reinterpret_cast(p)); + if ((p = glGetString(GL_RENDERER))) + renderer = QString::fromLatin1(reinterpret_cast(p)); + if ((p = glGetString(GL_VERSION))) + version = QString::fromLatin1(reinterpret_cast(p)); + if ((p = glGetString(GL_SHADING_LANGUAGE_VERSION))) + glslVersion = QString::fromLatin1(reinterpret_cast(p)); + + m_output->append(tr("\nVendor: %1").arg(vendor)); + m_output->append(tr("Renderer: %1").arg(renderer)); + m_output->append(tr("OpenGL version: %1").arg(version)); + m_output->append(tr("GLSL version: %1").arg(glslVersion)); + + m_output->append(tr("\nDepth buffer size: %1").arg(QString::number(format.depthBufferSize()))); + m_output->append(tr("Stencil buffer size: %1").arg(QString::number(format.stencilBufferSize()))); + m_output->append(tr("Samples: %1").arg(QString::number(format.samples()))); + m_output->append(tr("Red buffer size: %1").arg(QString::number(format.redBufferSize()))); + m_output->append(tr("Green buffer size: %1").arg(QString::number(format.greenBufferSize()))); + m_output->append(tr("Blue buffer size: %1").arg(QString::number(format.blueBufferSize()))); + m_output->append(tr("Alpha buffer size: %1").arg(QString::number(format.alphaBufferSize()))); + m_output->append(tr("Swap interval: %1").arg(QString::number(format.swapInterval()))); + + const char *gltype[] = { "Desktop", "GLES 2", "GLES 1" }; + m_output->append(tr("\nQt OpenGL configuration: %1") + .arg(QString::fromLatin1(gltype[QOpenGLFunctions::platformGLType()]))); + m_output->append(tr("Qt OpenGL library handle: %1") + .arg(QString::number(qintptr(QOpenGLFunctions::platformGLHandle()), 16))); + + QList extensionList = context->extensions().toList(); + std::sort(extensionList.begin(), extensionList.end()); + m_extensions->append(tr("Found %1 extensions:").arg(extensionList.count())); + Q_FOREACH (const QByteArray &ext, extensionList) + m_extensions->append(QString::fromLatin1(ext)); + + m_output->moveCursor(QTextCursor::Start); + m_extensions->moveCursor(QTextCursor::Start); +} + +void Widget::renderWindowError(const QString &msg) +{ + m_output->append(tr("An error has occurred:\n%1").arg(msg)); +} diff --git a/examples/opengl/contextinfo/widget.h b/examples/opengl/contextinfo/widget.h new file mode 100644 index 00000000000..dcae66dac05 --- /dev/null +++ b/examples/opengl/contextinfo/widget.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** 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 Toolkit. +** +** $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 WIDGET_H +#define WIDGET_H + +#include + +QT_FORWARD_DECLARE_CLASS(QComboBox) +QT_FORWARD_DECLARE_CLASS(QTextEdit) +QT_FORWARD_DECLARE_CLASS(QVBoxLayout) + +class Widget : public QWidget +{ + Q_OBJECT + +public: + explicit Widget(QWidget *parent = 0); + +private slots: + void start(); + void renderWindowReady(); + void renderWindowError(const QString &msg); + +private: + void addVersions(QLayout *layout); + void addProfiles(QLayout *layout); + void addOptions(QLayout *layout); + void addRenderableTypes(QLayout *layout); + void addRenderWindow(); + + QComboBox *m_version; + QLayout *m_profiles; + QLayout *m_options; + QLayout *m_renderables; + QTextEdit *m_output; + QTextEdit *m_extensions; + QVBoxLayout *m_renderWindowLayout; + QWidget *m_renderWindowContainer; +}; + +#endif // WIDGET_H diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro index 54b0321b264..3d12d8707f4 100644 --- a/examples/opengl/opengl.pro +++ b/examples/opengl/opengl.pro @@ -25,6 +25,7 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){ } SUBDIRS += hellowindow \ - paintedwindow + paintedwindow \ + contextinfo EXAMPLE_FILES = shared From 5119bbc6424742860abafe7a371fa5234f03eabb Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 26 Feb 2014 17:32:33 +0100 Subject: [PATCH 006/172] Add core profile versions of the glyph cache shaders The last step to make QOpenGLTextureGlyphCache working with OpenGL core profiles. [ChangeLog] Native (that is, not distance field based) text rendering is now functional on OpenGL 3.2+ core profiles too. Task-number: QTBUG-36993 Change-Id: Ic6c0db4806cea623ca7a19ab77b0329155824877 Reviewed-by: Gunnar Sletta Reviewed-by: Sean Harmer --- src/gui/opengl/qopenglengineshadersource_p.h | 35 ++++++++++++++++++++ src/gui/opengl/qopengltextureglyphcache.cpp | 9 ++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h index 5bb0bc4704b..02a23193a8a 100644 --- a/src/gui/opengl/qopenglengineshadersource_p.h +++ b/src/gui/opengl/qopenglengineshadersource_p.h @@ -517,6 +517,41 @@ static const char* const qopenglslRgbMaskFragmentShaderPass2 = "\n\ ExclusionCompositionModeFragmentShader, */ +// OpenGL 3.2 core profile versions of shaders that are used by QOpenGLTextureGlyphCache + +static const char* const qopenglslMainWithTexCoordsVertexShader_core = "#version 150 core \n\ + in vec2 textureCoordArray; \n\ + out vec2 textureCoords; \n\ + void setPosition(); \n\ + void main(void) \n\ + { \n\ + setPosition(); \n\ + textureCoords = textureCoordArray; \n\ + }\n"; + +static const char* const qopenglslUntransformedPositionVertexShader_core = "\n\ + in vec4 vertexCoordsArray; \n\ + void setPosition(void) \n\ + { \n\ + gl_Position = vertexCoordsArray; \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader_core = "#version 150 core \n\ + vec4 srcPixel(); \n\ + out vec4 fragColor; \n\ + void main() \n\ + { \n\ + fragColor = srcPixel(); \n\ + }\n"; + +static const char* const qopenglslImageSrcFragmentShader_core = "\n\ + in vec2 textureCoords; \n\ + uniform sampler2D imageTexture; \n\ + vec4 srcPixel() \n\ + { \n" + "return texture(imageTexture, textureCoords); \n" + "}\n"; + QT_END_NAMESPACE #endif // GLGC_SHADER_SOURCE_H diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 3524c1cb1a2..356f68b49b7 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -248,11 +248,12 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) if (pex == 0) { if (m_blitProgram == 0) { m_blitProgram = new QOpenGLShaderProgram(ctx); + const bool isCoreProfile = ctx->format().profile() == QSurfaceFormat::CoreProfile; { QString source; - source.append(QLatin1String(qopenglslMainWithTexCoordsVertexShader)); - source.append(QLatin1String(qopenglslUntransformedPositionVertexShader)); + source.append(QLatin1String(isCoreProfile ? qopenglslMainWithTexCoordsVertexShader_core : qopenglslMainWithTexCoordsVertexShader)); + source.append(QLatin1String(isCoreProfile ? qopenglslUntransformedPositionVertexShader_core : qopenglslUntransformedPositionVertexShader)); QOpenGLShader *vertexShader = new QOpenGLShader(QOpenGLShader::Vertex, m_blitProgram); vertexShader->compileSourceCode(source); @@ -262,8 +263,8 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) { QString source; - source.append(QLatin1String(qopenglslMainFragmentShader)); - source.append(QLatin1String(qopenglslImageSrcFragmentShader)); + source.append(QLatin1String(isCoreProfile ? qopenglslMainFragmentShader_core : qopenglslMainFragmentShader)); + source.append(QLatin1String(isCoreProfile ? qopenglslImageSrcFragmentShader_core : qopenglslImageSrcFragmentShader)); QOpenGLShader *fragmentShader = new QOpenGLShader(QOpenGLShader::Fragment, m_blitProgram); fragmentShader->compileSourceCode(source); From 0de55b6c9f5d266f891b746e2d63e6a45d3b3c32 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Mon, 3 Feb 2014 20:33:48 +0000 Subject: [PATCH 007/172] Honor the value of the PlatformToolset environment variable. The Windows SDK 7.1 command prompt sets this value to "WindowsSDK7.1" through its SetEnv.cmd batch script. The MSVC Express Editions do not include a 64bit compiler toolchain, but the Windows SDK does, so this change makes it easier to build qmake projects for x86_64 when using the Express Editions, by running qmake from the SDK command prompt. See also: http://msdn.microsoft.com/en-us/library/9yb4317s%28v=vs.100%29.aspx http://msdn.microsoft.com/en-us/library/ff660764%28v=vs.100%29.aspx Task-number: QTBUG-31185 Change-Id: I49d3e159ed67f64490a3d57c5471d540d76ae13f Reviewed-by: Oswald Buddenhagen Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msbuild_objectmodel.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 7702496f3cb..51cb73f0ce1 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -2195,6 +2195,16 @@ QString VCXProjectWriter::generateCondition(const VCConfiguration &config) QString VCXProjectWriter::platformToolSetVersion(const DotNET version, bool winphoneBuild) { + // The PlatformToolset string corresponds to the name of a directory in + // $(VCTargetsPath)\Platforms\{Win32,x64,...}\PlatformToolsets + // e.g. v90, v100, v110, v110_xp, v120_CTP_Nov, v120, or WindowsSDK7.1 + + // This environment variable may be set by a commandline build + // environment such as the Windows SDK command prompt + QByteArray envVar = qgetenv("PlatformToolset"); + if (!envVar.isEmpty()) + return envVar; + switch (version) { case NET2012: From 4bf27a24c088a36ba53f006f34c3f66e4d0369b9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 27 Feb 2014 15:19:14 +0100 Subject: [PATCH 008/172] Do not upload on closed SPDY streams We should never upload on a SPDY stream in a closed or half-closed state. To avoid it we need to stop listening for readyRead on the upload device, and ignore WINDOW_UPDATE on completed streams. This fixes SPDY access of facebook.com. Change-Id: Icad45ffc109b2c14b921f1571e114b70a30f40a9 Reviewed-by: Peter Hartmann --- src/network/access/qspdyprotocolhandler.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index 7c5d1c3d8f0..ce8a2d2b1d9 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -709,6 +709,11 @@ bool QSpdyProtocolHandler::uploadData(qint32 streamID) QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); Q_ASSERT(replyPrivate); + if (reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYHalfClosed || reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed) { + qWarning() << Q_FUNC_INFO << "Trying to upload to closed stream"; + return false; + } + qint32 dataLeftInWindow = replyPrivate->windowSizeUpload - replyPrivate->currentlyUploadedDataInWindow; @@ -754,6 +759,8 @@ bool QSpdyProtocolHandler::uploadData(qint32 streamID) Q_ASSERT(writeSize == 0); Q_UNUSED(writeSize); // silence -Wunused-variable replyPrivate->state = QHttpNetworkReplyPrivate::SPDYHalfClosed; + if (reply->request().uploadByteDevice()) + reply->request().uploadByteDevice()->disconnect(this); // ### this will not work if the content length is not known, but // then again many servers will fail in this case anyhow according // to the SPDY RFC @@ -1179,6 +1186,10 @@ void QSpdyProtocolHandler::handleWINDOW_UPDATE(char /*flags*/, quint32 /*length* QHttpNetworkReplyPrivate *replyPrivate = reply->d_func(); Q_ASSERT(replyPrivate); + // Ignore WINDOW_UPDATE if we are already done. + if (replyPrivate->state == QHttpNetworkReplyPrivate::SPDYHalfClosed || replyPrivate->state == QHttpNetworkReplyPrivate::SPDYClosed) + return; + replyPrivate->currentlyUploadedDataInWindow = replyPrivate->windowSizeUpload - deltaWindowSize; uploadData(streamID); // we hopefully can continue to upload } @@ -1293,6 +1304,9 @@ void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders) void QSpdyProtocolHandler::replyFinished(QHttpNetworkReply *httpReply, qint32 streamID) { httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed; + httpReply->disconnect(this); + if (httpReply->request().uploadByteDevice()) + httpReply->request().uploadByteDevice()->disconnect(this); int streamsRemoved = m_inFlightStreams.remove(streamID); Q_ASSERT(streamsRemoved == 1); Q_UNUSED(streamsRemoved); // silence -Wunused-variable @@ -1304,6 +1318,9 @@ void QSpdyProtocolHandler::replyFinishedWithError(QHttpNetworkReply *httpReply, { Q_ASSERT(httpReply); httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYClosed; + httpReply->disconnect(this); + if (httpReply->request().uploadByteDevice()) + httpReply->request().uploadByteDevice()->disconnect(this); int streamsRemoved = m_inFlightStreams.remove(streamID); Q_ASSERT(streamsRemoved == 1); Q_UNUSED(streamsRemoved); // silence -Wunused-variable From d4a4ef9e3877e4824d2c9190456be71ab826609d Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Fri, 28 Feb 2014 09:39:58 +0100 Subject: [PATCH 009/172] Make bool arguments to QWidgetBackingStore::markDirty enums This is so we get some typesafty when refactoring, and I think it makes the code more readable Change-Id: Ia7531950d5f780dc98f4eb435c1e0050d76cdb5f Reviewed-by: Paul Olav Tvete --- src/widgets/kernel/qwidget.cpp | 4 +- src/widgets/kernel/qwidgetbackingstore.cpp | 105 +++++++++++---------- src/widgets/kernel/qwidgetbackingstore_p.h | 20 +++- 3 files changed, 73 insertions(+), 56 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index ba8147c4a6b..e2c766ea4c1 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9888,7 +9888,7 @@ void QWidget::repaint(const QRect &rect) QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { tlwExtra->inRepaint = true; - tlwExtra->backingStoreTracker->markDirty(rect, this, true); + tlwExtra->backingStoreTracker->markDirty(rect, this, QWidgetBackingStore::UpdateNow); tlwExtra->inRepaint = false; } } else { @@ -9917,7 +9917,7 @@ void QWidget::repaint(const QRegion &rgn) QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { tlwExtra->inRepaint = true; - tlwExtra->backingStoreTracker->markDirty(rgn, this, true); + tlwExtra->backingStoreTracker->markDirty(rgn, this, QWidgetBackingStore::UpdateNow); tlwExtra->inRepaint = false; } } else { diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 43e2ccdf0ba..fe877758ef9 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -443,17 +443,21 @@ QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &within return region; } -void QWidgetBackingStore::sendUpdateRequest(QWidget *widget, bool updateImmediately) +void QWidgetBackingStore::sendUpdateRequest(QWidget *widget, UpdateTime updateTime) { if (!widget) return; - if (updateImmediately) { - QEvent event(QEvent::UpdateRequest); - QApplication::sendEvent(widget, &event); - } else { + switch (updateTime) { + case UpdateLater: updateRequestSent = true; QApplication::postEvent(widget, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority); + break; + case UpdateNow: { + QEvent event(QEvent::UpdateRequest); + QApplication::sendEvent(widget, &event); + break; + } } } @@ -461,17 +465,17 @@ void QWidgetBackingStore::sendUpdateRequest(QWidget *widget, bool updateImmediat Marks the region of the widget as dirty (if not already marked as dirty) and posts an UpdateRequest event to the top-level widget (if not already posted). - If updateImmediately is true, the event is sent immediately instead of posted. + If updateTime is UpdateNow, the event is sent immediately instead of posted. - If invalidateBuffer is true, all widgets intersecting with the region will be dirty. + If bufferState is BufferInvalid, all widgets intersecting with the region will be dirty. If the widget paints directly on screen, the event is sent to the widget - instead of the top-level widget, and invalidateBuffer is completely ignored. + instead of the top-level widget, and bufferState is completely ignored. ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). */ -void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately, - bool invalidateBuffer) +void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, + UpdateTime updateTime, BufferState bufferState) { Q_ASSERT(tlw->d_func()->extra); Q_ASSERT(tlw->d_func()->extra->topextra); @@ -487,44 +491,44 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { widget->d_func()->dirty = rgn; - sendUpdateRequest(widget, updateImmediately); + sendUpdateRequest(widget, updateTime); return; } else if (qt_region_strictContains(widget->d_func()->dirty, widget->rect())) { - if (updateImmediately) - sendUpdateRequest(widget, updateImmediately); + if (updateTime == UpdateNow) + sendUpdateRequest(widget, updateTime); return; // Already dirty. } const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty(); widget->d_func()->dirty += rgn; - if (!eventAlreadyPosted || updateImmediately) - sendUpdateRequest(widget, updateImmediately); + if (!eventAlreadyPosted || updateTime == UpdateNow) + sendUpdateRequest(widget, updateTime); return; } //### FIXME fullUpdatePending seems to be always false???? if (fullUpdatePending) { - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); return; } const QPoint offset = widget->mapTo(tlw, QPoint()); if (QWidgetPrivate::get(widget)->renderToTexture) { - if (!updateRequestSent || updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (!updateRequestSent || updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); return; } const QRect widgetRect = widget->d_func()->effectiveRectFor(widget->rect()); if (qt_region_strictContains(dirty, widgetRect.translated(offset))) { - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); return; // Already dirty. } - if (invalidateBuffer) { + if (bufferState == BufferInvalid) { const bool eventAlreadyPosted = !dirty.isEmpty() || updateRequestSent; #ifndef QT_NO_GRAPHICSEFFECT if (widget->d_func()->graphicsEffect) @@ -532,14 +536,14 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up else #endif //QT_NO_GRAPHICSEFFECT dirty += rgn.translated(offset); - if (!eventAlreadyPosted || updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (!eventAlreadyPosted || updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); return; } if (dirtyWidgets.isEmpty()) { addDirtyWidget(widget, rgn); - sendUpdateRequest(tlw, updateImmediately); + sendUpdateRequest(tlw, updateTime); return; } @@ -556,8 +560,8 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up addDirtyWidget(widget, rgn); } - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); } /*! @@ -567,8 +571,8 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). */ -void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool updateImmediately, - bool invalidateBuffer) +void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, + UpdateTime updateTime, BufferState bufferState) { Q_ASSERT(tlw->d_func()->extra); Q_ASSERT(tlw->d_func()->extra->topextra); @@ -584,30 +588,30 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd if (widget->d_func()->paintOnScreen()) { if (widget->d_func()->dirty.isEmpty()) { widget->d_func()->dirty = QRegion(rect); - sendUpdateRequest(widget, updateImmediately); + sendUpdateRequest(widget, updateTime); return; } else if (qt_region_strictContains(widget->d_func()->dirty, rect)) { - if (updateImmediately) - sendUpdateRequest(widget, updateImmediately); + if (updateTime == UpdateNow) + sendUpdateRequest(widget, updateTime); return; // Already dirty. } const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty(); widget->d_func()->dirty += rect; - if (!eventAlreadyPosted || updateImmediately) - sendUpdateRequest(widget, updateImmediately); + if (!eventAlreadyPosted || updateTime == UpdateNow) + sendUpdateRequest(widget, updateTime); return; } if (fullUpdatePending) { - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); return; } if (QWidgetPrivate::get(widget)->renderToTexture) { - if (!updateRequestSent || updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (!updateRequestSent || updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); return; } @@ -615,22 +619,22 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd const QRect widgetRect = widget->d_func()->effectiveRectFor(rect); const QRect translatedRect(widgetRect.translated(widget->mapTo(tlw, QPoint()))); if (qt_region_strictContains(dirty, translatedRect)) { - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); return; // Already dirty } - if (invalidateBuffer) { + if (bufferState == BufferInvalid) { const bool eventAlreadyPosted = !dirty.isEmpty(); dirty += translatedRect; - if (!eventAlreadyPosted || updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (!eventAlreadyPosted || updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); return; } if (dirtyWidgets.isEmpty()) { addDirtyWidget(widget, rect); - sendUpdateRequest(tlw, updateImmediately); + sendUpdateRequest(tlw, updateTime); return; } @@ -641,8 +645,8 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd addDirtyWidget(widget, rect); } - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + if (updateTime == UpdateNow) + sendUpdateRequest(tlw, updateTime); } /*! @@ -1346,7 +1350,8 @@ void QWidgetPrivate::invalidateBuffer(const QRegion &rgn) if (wrgn.isEmpty()) return; - tlwExtra->backingStoreTracker->markDirty(wrgn, q, false, true); + tlwExtra->backingStoreTracker->markDirty(wrgn, q, + QWidgetBackingStore::UpdateLater, QWidgetBackingStore::BufferInvalid); } /*! @@ -1370,7 +1375,8 @@ void QWidgetPrivate::invalidateBuffer(const QRect &rect) return; if (graphicsEffect || !extra || !extra->hasMask) { - tlwExtra->backingStoreTracker->markDirty(wRect, q, false, true); + tlwExtra->backingStoreTracker->markDirty(wRect, q, + QWidgetBackingStore::UpdateLater, QWidgetBackingStore::BufferInvalid); return; } @@ -1379,7 +1385,8 @@ void QWidgetPrivate::invalidateBuffer(const QRect &rect) if (wRgn.isEmpty()) return; - tlwExtra->backingStoreTracker->markDirty(wRgn, q, false, true); + tlwExtra->backingStoreTracker->markDirty(wRgn, q, + QWidgetBackingStore::UpdateLater, QWidgetBackingStore::BufferInvalid); } void QWidgetPrivate::repaint_sys(const QRegion &rgn) diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h index e362ee4ac10..473e9deef4f 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -93,6 +93,16 @@ private: class Q_AUTOTEST_EXPORT QWidgetBackingStore { public: + enum UpdateTime { + UpdateNow, + UpdateLater + }; + + enum BufferState{ + BufferValid, + BufferInvalid + }; + QWidgetBackingStore(QWidget *t); ~QWidgetBackingStore(); @@ -112,10 +122,10 @@ public: } // ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). - void markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately = false, - bool invalidateBuffer = false); - void markDirty(const QRect &rect, QWidget *widget, bool updateImmediately = false, - bool invalidateBuffer = false); + void markDirty(const QRegion &rgn, QWidget *widget, UpdateTime updateTime = UpdateLater, + BufferState bufferState = BufferValid); + void markDirty(const QRect &rect, QWidget *widget, UpdateTime updateTime = UpdateLater, + BufferState bufferState = BufferValid); private: QWidget *tlw; @@ -134,7 +144,7 @@ private: QPlatformTextureListWatcher *textureListWatcher; - void sendUpdateRequest(QWidget *widget, bool updateImmediately); + void sendUpdateRequest(QWidget *widget, UpdateTime updateTime); static bool flushPaint(QWidget *widget, const QRegion &rgn); static void unflushPaint(QWidget *widget, const QRegion &rgn); From fdd8a1b42c2e51057b37d9b3d75f30e82a89a6bf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 28 Feb 2014 12:40:11 +0100 Subject: [PATCH 010/172] Add source to debug output of QMouseEvent. Change-Id: Ibf55a2697ca0ac85624097299be92c1055dcb8aa Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/kernel/qevent.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 7759e812cb5..295380a93cd 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3295,11 +3295,14 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { n = "MouseButtonDblClick"; break; } - dbg.nospace() << "QMouseEvent(" << n + QDebug nsp = dbg.nospace(); + nsp << "QMouseEvent(" << n << ", " << me->button() << ", " << hex << (int)me->buttons() - << ", " << hex << (int)me->modifiers() - << ')'; + << ", " << hex << (int)me->modifiers() << dec; + if (const Qt::MouseEventSource source = me->source()) + nsp << ", source = " << source; + nsp << ')'; } return dbg.space(); From 58b928aca8029a4ebc63b0120a7afb93db4e8691 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 28 Feb 2014 11:59:30 +0100 Subject: [PATCH 011/172] Windows: Fix return value of WM_QUERYENDSESSION for bogus messages. LRESULT should be non-zero if the application can quit, and it is always handled. Improves 97d8e3b2007abf7b14b4ccbfbbc4abdeef712bcf . Task-number: QTBUG-35986 Change-Id: I0ad95bc20a5d9e2a52c76bdcdfa986595f6a08d8 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowscontext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index f67fb9bc19c..6462cb8d3ea 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -971,8 +971,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, #if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) case QtWindows::QueryEndSessionApplicationEvent: { QWindowsSessionManager *sessionManager = platformSessionManager(); - if (sessionManager->isActive()) // bogus message from windows + if (sessionManager->isActive()) { // bogus message from windows + *result = sessionManager->wasCanceled() ? 0 : 1; return true; + } sessionManager->setActive(true); sessionManager->blocksInteraction(); From e2d21a0483530d3d306a9f3505834b71f84236fb Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Fri, 21 Feb 2014 17:37:11 +0100 Subject: [PATCH 012/172] QNX: Report if GL context is shared This fixes the tst_qopengl sharedResourceCleanup auto test Change-Id: I0ac6f45797f656b637254f01c2cb8073436b45b2 Reviewed-by: Kevin Krammer Reviewed-by: Fabian Bumberger Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxglcontext.cpp | 17 +++++++++-------- src/plugins/platforms/qnx/qqnxglcontext.h | 2 ++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index 3a365be4084..23db7f09f3e 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -124,15 +124,11 @@ QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext) if (m_eglConfig == 0) qFatal("QQnxGLContext: failed to find EGL config"); - EGLContext shareContext = EGL_NO_CONTEXT; - if (m_glContext) { - QQnxGLContext *qshareContext = dynamic_cast(m_glContext->shareHandle()); - if (qshareContext) { - shareContext = qshareContext->m_eglContext; - } - } + QQnxGLContext *glShareContext = static_cast(m_glContext->shareHandle()); + m_eglShareContext = glShareContext ? glShareContext->m_eglContext : EGL_NO_CONTEXT; - m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, shareContext, contextAttrs(format)); + m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, m_eglShareContext, + contextAttrs(format)); if (m_eglContext == EGL_NO_CONTEXT) { checkEGLError("eglCreateContext"); qFatal("QQnxGLContext: failed to create EGL context, err=%d", eglGetError()); @@ -271,6 +267,11 @@ QFunctionPointer QQnxGLContext::getProcAddress(const QByteArray &procName) return static_cast(eglGetProcAddress(procName.constData())); } +bool QQnxGLContext::isSharing() const +{ + return m_eglShareContext != EGL_NO_CONTEXT; +} + EGLDisplay QQnxGLContext::getEglDisplay() { return ms_eglDisplay; } diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h index af89586bd53..d12de7342b7 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.h +++ b/src/plugins/platforms/qnx/qqnxglcontext.h @@ -72,6 +72,7 @@ public: QFunctionPointer getProcAddress(const QByteArray &procName); virtual QSurfaceFormat format() const { return m_windowFormat; } + bool isSharing() const; static EGLDisplay getEglDisplay(); EGLConfig getEglConfig() const { return m_eglConfig;} @@ -86,6 +87,7 @@ private: EGLConfig m_eglConfig; EGLContext m_eglContext; + EGLContext m_eglShareContext; EGLSurface m_currentEglSurface; static EGLint *contextAttrs(const QSurfaceFormat &format); From d30778538159498caad491ba1d74ed2f5bb10b0c Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 27 Feb 2014 14:08:06 +0100 Subject: [PATCH 013/172] Android: avoid crash with toplevel QGLWidget Task-number: QTBUG-37096 Change-Id: I14db37a78314782d7b5897db946283bd0063e348 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/android/qandroidplatformbackingstore.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/android/qandroidplatformbackingstore.cpp b/src/plugins/platforms/android/qandroidplatformbackingstore.cpp index 1df7ce31798..b85b1157a8a 100644 --- a/src/plugins/platforms/android/qandroidplatformbackingstore.cpp +++ b/src/plugins/platforms/android/qandroidplatformbackingstore.cpp @@ -51,7 +51,10 @@ QAndroidPlatformBackingStore::QAndroidPlatformBackingStore(QWindow *window) : QPlatformBackingStore(window) { Q_ASSERT(window->handle()); - (static_cast(window->handle()))->setBackingStore(this); + if (window->surfaceType() == QSurface::RasterSurface) + (static_cast(window->handle()))->setBackingStore(this); + else + qWarning("QAndroidPlatformBackingStore does not support GL windows."); } QPaintDevice *QAndroidPlatformBackingStore::paintDevice() From 5cd7390ba91702efb2a978a438896d713f5a3abc Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 28 Feb 2014 12:50:48 +0100 Subject: [PATCH 014/172] QQuickWidget show/hide/raise fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure the alphamask in the backingstore is updated whenever the state of a QQuickWidget/QOpenGLWidget child changes. Task-number: QTBUG-37062 Change-Id: Iffa80fc8993499a15bc9e773a162a3f98b81ae03 Reviewed-by: Jørgen Lind --- src/widgets/kernel/qwidget_qpa.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index c2260b6e7dc..acd80afddbe 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -524,7 +524,10 @@ void QWidgetPrivate::show_sys() return; } - QApplication::postEvent(q, new QUpdateLaterEvent(q->rect())); + if (renderToTexture && !q->isWindow()) + QApplication::postEvent(q->parentWidget(), new QUpdateLaterEvent(q->geometry())); + else + QApplication::postEvent(q, new QUpdateLaterEvent(q->rect())); if (!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow)) return; @@ -588,7 +591,10 @@ void QWidgetPrivate::hide_sys() if (!q->isWindow()) { QWidget *p = q->parentWidget(); if (p &&p->isVisible()) { - invalidateBuffer(q->rect()); + if (renderToTexture) + p->d_func()->invalidateBuffer(q->geometry()); + else + invalidateBuffer(q->rect()); } } else { invalidateBuffer(q->rect()); @@ -663,6 +669,11 @@ void QWidgetPrivate::raise_sys() Q_Q(QWidget); if (q->isWindow() || q->testAttribute(Qt::WA_NativeWindow)) { q->windowHandle()->raise(); + } else if (renderToTexture) { + if (QWidget *p = q->parentWidget()) { + setDirtyOpaqueRegion(); + p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); + } } } From 4c7082162dd2192f535c1e524f966199883f53db Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 2 Mar 2014 01:52:52 +0200 Subject: [PATCH 015/172] Unify QFontEngine::getSfntTableData() behavior on all platforms Being a most significant method in the font API, getSfntTableData() must behave in exactly the same way on all platforms. Briefly, it must return true if the table exists in the font, despite the other params, and always stores the table data length in 'length' param, thus reporting the amount of bytes actually needed to store the table data in a buffer. Change-Id: I7a15465020c1ea818ea46a05ea3b9b7e1cd60d14 Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 21 +++++++++++++++++-- src/gui/text/qfontengine_ft.cpp | 1 + src/gui/text/qfontengine_p.h | 4 ++-- src/gui/text/qharfbuzzng.cpp | 2 +- .../fontdatabases/mac/qfontengine_coretext.mm | 11 ++++------ .../platforms/windows/qwindowsfontengine.cpp | 1 + .../windows/qwindowsfontenginedirectwrite.cpp | 4 ++-- 7 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 83e64a51a65..d654772e866 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -937,14 +937,31 @@ void QFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metr addGlyphsToPath(&glyph, &p, 1, path, QFlag(0)); } +/*! + Returns \c true if the font table idetified by \a tag exists in the font; + returns \c false otherwise. + + If \a buffer is NULL, stores the size of the buffer required for the font table data, + in bytes, in \a length. If \a buffer is not NULL and the capacity + of the buffer, passed in \a length, is sufficient to store the font table data, + also copies the font table data to \a buffer. + + Note: returning \c false when the font table exists could lead to an undefined behavior. +*/ +bool QFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) const +{ + Q_UNUSED(tag) + Q_UNUSED(buffer) + Q_UNUSED(length) + return false; +} + QByteArray QFontEngine::getSfntTable(uint tag) const { QByteArray table; uint len = 0; if (!getSfntTableData(tag, 0, &len)) return table; - if (!len) - return table; table.resize(len); if (!getSfntTableData(tag, reinterpret_cast(table.data()), &len)) return QByteArray(); diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index c13f60ff690..43e24b39432 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -125,6 +125,7 @@ static bool ft_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *leng FT_ULong len = *length; result = FT_Load_Sfnt_Table(face, tag, 0, buffer, &len) == FT_Err_Ok; *length = len; + Q_ASSERT(!result || int(*length) > 0); } return result; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 0bfb9e70e2d..72f5c092dd3 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -144,8 +144,8 @@ public: }; virtual Properties properties() const; virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics); - QByteArray getSfntTable(uint /*tag*/) const; - virtual bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const { return false; } + QByteArray getSfntTable(uint tag) const; + virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; struct FaceId { FaceId() : index(0), encoding(0) {} diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp index c09f27b6658..31bb6f38f20 100644 --- a/src/gui/text/qharfbuzzng.cpp +++ b/src/gui/text/qharfbuzzng.cpp @@ -625,7 +625,7 @@ _hb_qt_reference_table(hb_face_t * /*face*/, hb_tag_t tag, void *user_data) Q_ASSERT(get_font_table); uint length = 0; - if (Q_UNLIKELY(!get_font_table(data->user_data, tag, 0, &length) || length == 0)) + if (Q_UNLIKELY(!get_font_table(data->user_data, tag, 0, &length))) return hb_blob_get_empty(); char *buffer = (char *)malloc(length); diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 4fe78cb568c..7ec59f552fa 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -659,16 +659,13 @@ bool QCoreTextFontEngine::canRender(const QChar *string, int len) bool QCoreTextFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) const { QCFType table = CTFontCopyTable(ctfont, tag, 0); - if (!table || !length) + if (!table) return false; CFIndex tableLength = CFDataGetLength(table); - int availableLength = *length; - *length = tableLength; - if (buffer) { - if (tableLength > availableLength) - return false; + if (buffer && int(*length) >= tableLength) CFDataGetBytes(table, CFRangeMake(0, tableLength), buffer); - } + *length = tableLength; + Q_ASSERT(int(*length) > 0); return true; } diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 86fcb666b02..79615e79ecd 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1032,6 +1032,7 @@ bool QWindowsFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) SelectObject(hdc, hfont); DWORD t = qbswap(tag); *length = GetFontData(hdc, t, 0, buffer, *length); + Q_ASSERT(*length == GDI_ERROR || int(*length) > 0); return *length != GDI_ERROR; } diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 1c5e4508ac4..158eee6b38d 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -282,8 +282,8 @@ bool QWindowsFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, ui ret = true; if (buffer && *length >= tableSize) memcpy(buffer, tableData, tableSize); - else - *length = tableSize; + *length = tableSize; + Q_ASSERT(int(*length) > 0); } m_directWriteFontFace->ReleaseFontTable(tableContext); } else { From ead6cc40df7d6cede49c58bc9ce3c461a068afce Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 2 Mar 2014 02:04:39 +0200 Subject: [PATCH 016/172] Fix retreiving the 'head' table in QPAGenerator The 'head' table is usually of 54 bytes length. Passing the buffer of 4 bytes capacity for the 'head' table is expected to return false, thus skipping the FontRevision tag in QPAGenerator::writeHeader(). Change-Id: I02c0b13f3cbf13579a845fe78fcbc8a437ae22bf Reviewed-by: Lars Knoll --- src/gui/text/qfontengine_qpa.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index cb40a5388a0..eb6a97c5f1f 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -563,11 +563,9 @@ void QPAGenerator::writeHeader() writeTaggedUInt32(QFontEngineQPA::Tag_FileIndex, face.index); { - uchar data[4]; - uint len = 4; - bool ok = fe->getSfntTableData(MAKE_TAG('h', 'e', 'a', 'd'), data, &len); - if (ok) { - const quint32 revision = qFromBigEndian(data); + const QByteArray head = fe->getSfntTable(MAKE_TAG('h', 'e', 'a', 'd')); + if (head.size() >= 4) { + const quint32 revision = qFromBigEndian(reinterpret_cast(head.constData())); writeTaggedUInt32(QFontEngineQPA::Tag_FontRevision, revision); } } From 25e34dadabe844099885045c0e53c8136508698a Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Tue, 11 Feb 2014 02:26:57 +0200 Subject: [PATCH 017/172] Hide the justification algorithm implementation details The justification "classes" stored in the glyph attributes are actually a justification priorities suitable for a particular language (script). The external API only uses the justification metrics array calculated on top of these priorities. Change-Id: I5b0a39e35954084c63a798b632fd6108f9ae7608 Reviewed-by: Lars Knoll --- src/gui/text/qtextengine.cpp | 60 +++++++++++++++++++++++------------- src/gui/text/qtextengine_p.h | 28 +++++------------ 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 63e2af8d155..e2c45f9bab3 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -839,6 +839,22 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd #endif } + +enum JustificationClass { + Justification_Prohibited = 0, // Justification can not be applied after this glyph + Justification_Arabic_Space = 1, // This glyph represents a space inside arabic text + Justification_Character = 2, // Inter-character justification point follows this glyph + Justification_Space = 4, // This glyph represents a blank outside an Arabic run + Justification_Arabic_Normal = 7, // Normal Middle-Of-Word glyph that connects to the right (begin) + Justification_Arabic_Waw = 8, // Next character is final form of Waw/Ain/Qaf/Feh + Justification_Arabic_BaRa = 9, // Next two characters are Ba + Ra/Ya/AlefMaksura + Justification_Arabic_Alef = 10, // Next character is final form of Alef/Tah/Lam/Kaf/Gaf + Justification_Arabic_HahDal = 11, // Next character is final form of Hah/Dal/Teh Marbuta + Justification_Arabic_Seen = 12, // Initial or medial form of Seen/Sad + Justification_Arabic_Kashida = 13 // User-inserted Kashida(U+0640) +}; + + // shape all the items that intersect with the line, taking tab widths into account to find out what text actually fits in the line. void QTextEngine::shapeLine(const QScriptLine &line) { @@ -1018,12 +1034,12 @@ void QTextEngine::shapeText(int item) const } if (wordSpacing != 0) { for (int i = 0; i < si.num_glyphs; ++i) { - if (glyphs.attributes[i].justification == QGlyphAttributes::Space - || glyphs.attributes[i].justification == QGlyphAttributes::Arabic_Space) { + if (glyphs.attributes[i].justification == Justification_Space + || glyphs.attributes[i].justification == Justification_Arabic_Space) { // word spacing only gets added once to a consecutive run of spaces (see CSS spec) if (i + 1 == si.num_glyphs - ||(glyphs.attributes[i+1].justification != QGlyphAttributes::Space - && glyphs.attributes[i+1].justification != QGlyphAttributes::Arabic_Space)) + ||(glyphs.attributes[i+1].justification != Justification_Space + && glyphs.attributes[i+1].justification != Justification_Arabic_Space)) glyphs.advances[i] += wordSpacing; } } @@ -1980,7 +1996,7 @@ static void set(QJustificationPoint *point, int type, const QGlyphLayout &glyph, point->type = type; point->glyph = glyph; - if (type >= QGlyphAttributes::Arabic_Normal) { + if (type >= Justification_Arabic_Normal) { QChar ch(0x640); // Kashida character glyph_t kashidaGlyph; @@ -1999,7 +2015,7 @@ static void set(QJustificationPoint *point, int type, const QGlyphLayout &glyph, if (kashidaGlyph != 0 && kashidaWidth != 0) { point->kashidaWidth = kashidaWidth; } else { - point->type = QGlyphAttributes::NoJustification; + point->type = Justification_Prohibited; point->kashidaWidth = 0; } } @@ -2067,7 +2083,7 @@ void QTextEngine::justify(const QScriptLine &line) for (int i = 0; i < nItems; ++i) { QScriptItem &si = layoutData->items[firstItem + i]; - int kashida_type = QGlyphAttributes::Arabic_Normal; + int kashida_type = Justification_Arabic_Normal; int kashida_pos = -1; int start = qMax(line.from - si.position, 0); @@ -2091,11 +2107,11 @@ void QTextEngine::justify(const QScriptLine &line) int justification = g.attributes[i].justification; switch(justification) { - case QGlyphAttributes::NoJustification: + case Justification_Prohibited: break; - case QGlyphAttributes::Space : + case Justification_Space: // fall through - case QGlyphAttributes::Arabic_Space : + case Justification_Arabic_Space: if (kashida_pos >= 0) { // qDebug("kashida position at %d in word", kashida_pos); set(&justificationPoints[nPoints], kashida_type, g.mid(kashida_pos), fontEngine(si)); @@ -2106,19 +2122,19 @@ void QTextEngine::justify(const QScriptLine &line) } } kashida_pos = -1; - kashida_type = QGlyphAttributes::Arabic_Normal; + kashida_type = Justification_Arabic_Normal; // fall through - case QGlyphAttributes::Character : + case Justification_Character: set(&justificationPoints[nPoints++], justification, g.mid(i), fontEngine(si)); maxJustify = qMax(maxJustify, justification); break; - case QGlyphAttributes::Arabic_Normal : - case QGlyphAttributes::Arabic_Waw : - case QGlyphAttributes::Arabic_BaRa : - case QGlyphAttributes::Arabic_Alef : - case QGlyphAttributes::Arabic_HaaDal : - case QGlyphAttributes::Arabic_Seen : - case QGlyphAttributes::Arabic_Kashida : + case Justification_Arabic_Normal: + case Justification_Arabic_Waw: + case Justification_Arabic_BaRa: + case Justification_Arabic_Alef: + case Justification_Arabic_HahDal: + case Justification_Arabic_Seen: + case Justification_Arabic_Kashida: if (justification >= kashida_type) { kashida_pos = i; kashida_type = justification; @@ -2147,9 +2163,9 @@ void QTextEngine::justify(const QScriptLine &line) // qDebug(" minKashida=%f, need=%f", minKashida.toReal(), need.toReal()); // distribute in priority order - if (maxJustify >= QGlyphAttributes::Arabic_Normal) { + if (maxJustify >= Justification_Arabic_Normal) { while (need >= minKashida) { - for (int type = maxJustify; need >= minKashida && type >= QGlyphAttributes::Arabic_Normal; --type) { + for (int type = maxJustify; need >= minKashida && type >= Justification_Arabic_Normal; --type) { for (int i = 0; need >= minKashida && i < nPoints; ++i) { if (justificationPoints[i].type == type && justificationPoints[i].kashidaWidth <= need) { justificationPoints[i].glyph.justifications->nKashidas++; @@ -2166,7 +2182,7 @@ void QTextEngine::justify(const QScriptLine &line) if (!need) goto end; - maxJustify = qMin(maxJustify, int(QGlyphAttributes::Space)); + maxJustify = qMin(maxJustify, int(Justification_Space)); for (int type = maxJustify; need != 0 && type > 0; --type) { int n = 0; for (int i = 0; i < nPoints; ++i) { diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 1616a789379..06075eb9926 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -95,28 +95,14 @@ typedef unsigned q_hb_bitfield; typedef quint8 q_hb_bitfield; #endif -typedef struct { - typedef enum { - NoJustification= 0, /* Justification can't be applied after this glyph */ - Arabic_Space = 1, /* This glyph represents a space inside arabic text */ - Character = 2, /* Inter-character justification point follows this glyph */ - Space = 4, /* This glyph represents a blank outside an Arabic run */ - Arabic_Normal = 7, /* Normal Middle-Of-Word glyph that connects to the right (begin) */ - Arabic_Waw = 8, /* Next character is final form of Waw/Ain/Qaf/Fa */ - Arabic_BaRa = 9, /* Next two chars are Ba + Ra/Ya/AlefMaksura */ - Arabic_Alef = 10, /* Next character is final form of Alef/Tah/Lam/Kaf/Gaf */ - Arabic_HaaDal = 11, /* Next character is final form of Haa/Dal/Taa Marbutah */ - Arabic_Seen = 12, /* Initial or Medial form Of Seen/Sad */ - Arabic_Kashida = 13 /* Kashida(U+640) in middle of word */ - } JustificationClass; - - q_hb_bitfield justification :4; /* Justification class */ - q_hb_bitfield clusterStart :1; /* First glyph of representation of cluster */ - q_hb_bitfield mark :1; /* needs to be positioned around base char */ - q_hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ +struct QGlyphAttributes { + q_hb_bitfield justification :4; + q_hb_bitfield clusterStart :1; + q_hb_bitfield unused1 :1; + q_hb_bitfield unused2 :1; q_hb_bitfield dontPrint :1; - q_hb_bitfield combiningClass :8; -} QGlyphAttributes; + q_hb_bitfield unused3 :8; +}; // this uses the same coordinate system as Qt, but a different one to freetype. // * y is usually negative, and is equal to the ascent. From fd498ad1c0f331a42b8c9ee18f5bb48647d13df1 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Tue, 11 Feb 2014 02:50:30 +0200 Subject: [PATCH 018/172] Make QGlyphLayout consume one byte less per glyph Change-Id: Iddcc2e1f284dcf13ae98b57ea2d5854e57c83530 Reviewed-by: Lars Knoll --- src/gui/text/qtextengine.cpp | 16 ++++++++++++++-- src/gui/text/qtextengine_p.h | 25 +++++++++---------------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index e2c45f9bab3..45894d27b69 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1206,7 +1206,6 @@ QT_BEGIN_INCLUDE_NAMESPACE QT_END_INCLUDE_NAMESPACE Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t)); -Q_STATIC_ASSERT(sizeof(HB_GlyphAttributes) == sizeof(QGlyphAttributes)); Q_STATIC_ASSERT(sizeof(HB_Fixed) == sizeof(QFixed)); Q_STATIC_ASSERT(sizeof(HB_FixedPoint) == sizeof(QFixedPoint)); @@ -1272,18 +1271,23 @@ int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *stri remaining_glyphs -= shaper_item.initialGlyphCount; + QVarLengthArray hbGlyphAttributes; do { if (!ensureSpace(glyph_pos + shaper_item.num_glyphs + remaining_glyphs)) return 0; + if (hbGlyphAttributes.size() < int(shaper_item.num_glyphs)) { + hbGlyphAttributes.resize(shaper_item.num_glyphs); + memset(hbGlyphAttributes.data(), 0, hbGlyphAttributes.size() * sizeof(HB_GlyphAttributes)); + } const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos); if (fontEngine->type() == QFontEngine::Multi && shaper_item.num_glyphs > shaper_item.item.length) moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); shaper_item.glyphs = reinterpret_cast(g.glyphs); - shaper_item.attributes = reinterpret_cast(g.attributes); shaper_item.advances = reinterpret_cast(g.advances); shaper_item.offsets = reinterpret_cast(g.offsets); + shaper_item.attributes = hbGlyphAttributes.data(); if (engineIdx != 0 && shaper_item.glyphIndicesPresent) { for (quint32 i = 0; i < shaper_item.initialGlyphCount; ++i) @@ -1297,6 +1301,14 @@ int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *stri if (fontEngine->type() == QFontEngine::Multi) moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); + for (quint32 i = 0; i < shaper_item.num_glyphs; ++i) { + HB_GlyphAttributes hbAttrs = hbGlyphAttributes.at(i); + QGlyphAttributes &attrs = g.attributes[i]; + attrs.clusterStart = hbAttrs.clusterStart; + attrs.dontPrint = hbAttrs.dontPrint; + attrs.justification = hbAttrs.justification; + } + for (quint32 i = 0; i < shaper_item.item.length; ++i) shaper_item.log_clusters[i] += glyph_pos; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 06075eb9926..342a94de661 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -89,21 +89,6 @@ class QAbstractTextDocumentLayout; typedef quint32 glyph_t; -#ifdef __xlC__ -typedef unsigned q_hb_bitfield; -#else -typedef quint8 q_hb_bitfield; -#endif - -struct QGlyphAttributes { - q_hb_bitfield justification :4; - q_hb_bitfield clusterStart :1; - q_hb_bitfield unused1 :1; - q_hb_bitfield unused2 :1; - q_hb_bitfield dontPrint :1; - q_hb_bitfield unused3 :8; -}; - // this uses the same coordinate system as Qt, but a different one to freetype. // * y is usually negative, and is equal to the ascent. // * negative yoff means the following stuff is drawn higher up. @@ -174,6 +159,14 @@ struct QGlyphJustification }; Q_DECLARE_TYPEINFO(QGlyphJustification, Q_PRIMITIVE_TYPE); +struct QGlyphAttributes { + uchar clusterStart : 1; + uchar dontPrint : 1; + uchar justification : 4; + uchar reserved : 2; +}; +Q_STATIC_ASSERT(sizeof(QGlyphAttributes) == 1); + struct QGlyphLayout { enum { @@ -186,7 +179,7 @@ struct QGlyphLayout glyph_t *glyphs; // 4 bytes per element QFixed *advances; // 4 bytes per element QGlyphJustification *justifications; // 4 bytes per element - QGlyphAttributes *attributes; // 2 bytes per element + QGlyphAttributes *attributes; // 1 byte per element int numGlyphs; From 5a7bf123ea7b85f8f3000d274d07df1da1a63413 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 3 Mar 2014 06:19:25 +0200 Subject: [PATCH 019/172] Fix QFontEngineQPA::recalcAdvances() in case of missing glyph Modifying the glyph indexes array in recalcAdvances() could lead to undefined behavior. Change-Id: Ibbb6642f381a5fe01b285dc8d2001c167dc66f46 Reviewed-by: Lars Knoll --- src/gui/text/qfontengine_qpa.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index eb6a97c5f1f..3ffc809f75a 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -390,10 +390,8 @@ void QFontEngineQPA::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFla { for (int i = 0; i < glyphs->numGlyphs; ++i) { const Glyph *g = findGlyph(glyphs->glyphs[i]); - if (!g) { - glyphs->glyphs[i] = 0; + if (!g) continue; - } glyphs->advances[i] = g->advance; } } From 3567d62ed347fa70ad7e9ef424f675b33ec646e7 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 3 Mar 2014 05:49:07 +0200 Subject: [PATCH 020/172] Get rid of unused variable Change-Id: Ie90914c2110d32e573108a355a44dd459097a755 Reviewed-by: Lars Knoll --- src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 7ec59f552fa..2553cabe2bf 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -195,8 +195,6 @@ void QCoreTextFontEngine::init() bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { - QCFType cfstring; - QVarLengthArray cgGlyphs(len); CTFontGetGlyphsForCharacters(ctfont, (const UniChar*)str, cgGlyphs.data(), len); From 78d115f8f28a7e3f15c0280e8d87d7041ecff793 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 3 Mar 2014 05:57:40 +0200 Subject: [PATCH 021/172] Unify QFontEngine*::stringToCMap() behavior Ensure the params are valid and make QCoreTextFontEngine::stringToCMap() handle the unsufficient buffer case exactly like the other engines does. Change-Id: I078af37da917cf2bac709b12aa827ed4128e5f30 Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 1 + src/gui/text/qfontengine_ft.cpp | 1 + src/gui/text/qfontengine_qpa.cpp | 1 + .../fontdatabases/mac/qfontengine_coretext.mm | 6 ++++++ src/plugins/platforms/windows/qwindowsfontengine.cpp | 1 + .../platforms/windows/qwindowsfontenginedirectwrite.cpp | 1 + 6 files changed, 11 insertions(+) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index d654772e866..6f62d24f1e1 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1410,6 +1410,7 @@ QFontEngineBox::~QFontEngineBox() bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 43e24b39432..140bf163947 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1528,6 +1528,7 @@ void QFontEngineFT::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index 3ffc809f75a..c12cb37edf9 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -342,6 +342,7 @@ bool QFontEngineQPA::getSfntTableData(uint tag, uchar *buffer, uint *length) con bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 2553cabe2bf..4e50d6c53f4 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -195,6 +195,12 @@ void QCoreTextFontEngine::init() bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); + if (*nglyphs < len) { + *nglyphs = len; + return false; + } + QVarLengthArray cgGlyphs(len); CTFontGetGlyphsForCharacters(ctfont, (const UniChar*)str, cgGlyphs.data(), len); diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 79615e79ecd..87eca98e446 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -351,6 +351,7 @@ HGDIOBJ QWindowsFontEngine::selectDesignFont() const bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 158eee6b38d..a4e4dd38d44 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -318,6 +318,7 @@ inline unsigned int getChar(const QChar *str, int &i, const int len) bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; From af74201edbb9dc344419ed3f8ebc35f8e8f05617 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 3 Mar 2014 03:01:14 +0200 Subject: [PATCH 022/172] Introduce QFontEngine::glyphIndex(uint) ...an optimized drop-in replacement for the code like this: `stringToCMap(&uc, 1, &g, &numGlyphs, QFontEngine::GlyphIndicesOnly)` (aka "get the glyph index for exactly one Unicode character"). Change-Id: I22babf49f7cf28892d27533a5ac51ad449779f75 Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 35 +++++++++++++++++++ src/gui/text/qfontengine_ft.cpp | 30 ++++++++++++++++ src/gui/text/qfontengine_ft_p.h | 1 + src/gui/text/qfontengine_p.h | 3 ++ src/gui/text/qfontengine_qpa.cpp | 13 +++++++ src/gui/text/qfontengine_qpa_p.h | 1 + .../fontdatabases/mac/qfontengine_coretext.mm | 19 ++++++++++ .../mac/qfontengine_coretext_p.h | 1 + .../platforms/windows/qwindowsfontengine.cpp | 24 +++++++++++++ .../platforms/windows/qwindowsfontengine.h | 1 + .../windows/qwindowsfontenginedirectwrite.cpp | 13 +++++++ .../windows/qwindowsfontenginedirectwrite.h | 1 + 12 files changed, 142 insertions(+) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 6f62d24f1e1..61816c83fbf 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1408,6 +1408,12 @@ QFontEngineBox::~QFontEngineBox() { } +glyph_t QFontEngineBox::glyphIndex(uint ucs4) const +{ + Q_UNUSED(ucs4) + return 0; +} + bool QFontEngineBox::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { Q_ASSERT(glyphs->numGlyphs >= *nglyphs); @@ -1582,6 +1588,35 @@ QFontEngineMulti::~QFontEngineMulti() } } +glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const +{ + glyph_t glyph = engine(0)->glyphIndex(ucs4); + if (glyph == 0 && ucs4 != QChar::LineSeparator) { + const_cast(this)->ensureFallbackFamiliesQueried(); + for (int x = 1, n = qMin(engines.size(), 256); x < n; ++x) { + QFontEngine *engine = engines.at(x); + if (!engine) { + if (!shouldLoadFontEngineForCharacter(x, ucs4)) + continue; + const_cast(this)->loadEngine(x); + engine = engines.at(x); + } + Q_ASSERT(engine != 0); + if (engine->type() == Box) + continue; + + glyph = engine->glyphIndex(ucs4); + if (glyph != 0) { + // set the high byte to indicate which engine the glyph came from + glyph |= (x << 24); + break; + } + } + } + + return glyph; +} + bool QFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 140bf163947..b50c8fd95a0 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1525,6 +1525,36 @@ void QFontEngineFT::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int unlockFace(); } +glyph_t QFontEngineFT::glyphIndex(uint ucs4) const +{ + glyph_t glyph = ucs4 < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[ucs4] : 0; + if (glyph == 0) { + FT_Face face = freetype->face; + glyph = FT_Get_Char_Index(face, ucs4); + if (glyph == 0) { + // Certain fonts don't have no-break space and tab, + // while we usually want to render them as space + if (ucs4 == QChar::Nbsp || ucs4 == QChar::Tabulation) { + glyph = FT_Get_Char_Index(face, QChar::Space); + } else if (freetype->symbol_map) { + // Symbol fonts can have more than one CMAPs, FreeType should take the + // correct one for us by default, so we always try FT_Get_Char_Index + // first. If it didn't work (returns 0), we will explicitly set the + // CMAP to symbol font one and try again. symbol_map is not always the + // correct one because in certain fonts like Wingdings symbol_map only + // contains PUA codepoints instead of the common ones. + FT_Set_Charmap(face, freetype->symbol_map); + glyph = FT_Get_Char_Index(face, ucs4); + FT_Set_Charmap(face, freetype->unicode_map); + } + } + if (ucs4 < QFreetypeFace::cmapCacheSize) + freetype->cmapCache[ucs4] = glyph; + } + + return glyph; +} + bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index ad1598ba6d1..7fc73c816d7 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -225,6 +225,7 @@ private: virtual QFixed lineThickness() const; virtual QFixed underlinePosition() const; + virtual glyph_t glyphIndex(uint ucs4) const; void doKerning(QGlyphLayout *, ShaperFlags) const; inline virtual Type type() const diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 72f5c092dd3..f497085ce2b 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -167,6 +167,7 @@ public: virtual QFixed emSquareSize() const { return ascent(); } /* returns 0 as glyph index for non existent glyphs */ + virtual glyph_t glyphIndex(uint ucs4) const = 0; virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const = 0; virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const {} virtual void doKerning(QGlyphLayout *, ShaperFlags) const; @@ -352,6 +353,7 @@ public: QFontEngineBox(int size); ~QFontEngineBox(); + virtual glyph_t glyphIndex(uint ucs4) const; virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const; @@ -388,6 +390,7 @@ public: explicit QFontEngineMulti(int engineCount); ~QFontEngineMulti(); + virtual glyph_t glyphIndex(uint ucs4) const; virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index c12cb37edf9..f48b44374ea 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -340,6 +340,19 @@ bool QFontEngineQPA::getSfntTableData(uint tag, uchar *buffer, uint *length) con return false; } +glyph_t QFontEngineQPA::glyphIndex(uint ucs4) const +{ + const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset); + + glyph_t glyph = getTrueTypeGlyphIndex(cmap, ucs4); + if (glyph == 0 && symbol && ucs4 < 0x100) + glyph = getTrueTypeGlyphIndex(cmap, ucs4 + 0xf000); + if (!findGlyph(glyph)) + glyph = 0; + + return glyph; +} + bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { Q_ASSERT(glyphs->numGlyphs >= *nglyphs); diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h index c8b40abd7fb..bcd48ca6905 100644 --- a/src/gui/text/qfontengine_qpa_p.h +++ b/src/gui/text/qfontengine_qpa_p.h @@ -163,6 +163,7 @@ public: FaceId faceId() const { return face_id; } bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; + virtual glyph_t glyphIndex(uint ucs4) const; bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; void recalcAdvances(QGlyphLayout *, ShaperFlags) const; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 4e50d6c53f4..2ea7e6f00d3 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -192,6 +192,25 @@ void QCoreTextFontEngine::init() setUserData(QVariant::fromValue((void *)cgFont)); } +glyph_t QCoreTextFontEngine::glyphIndex(uint ucs4) const +{ + int len = 0; + + QChar str[2]; + if (Q_UNLIKELY(QChar::requiresSurrogates(ucs4))) { + str[len++] = QChar(QChar::highSurrogate(ucs4)); + str[len++] = QChar(QChar::lowSurrogate(ucs4)); + } else { + str[len++] = QChar(ucs4); + } + + CGGlyph glyphIndices[2]; + + CTFontGetGlyphsForCharacters(ctfont, (const UniChar *)str, glyphIndices, len); + + return glyphIndices[0]; +} + bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index 1cdac820b6e..0070aede24e 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -62,6 +62,7 @@ public: QCoreTextFontEngine(CGFontRef font, const QFontDef &def); ~QCoreTextFontEngine(); + virtual glyph_t glyphIndex(uint ucs4) const; virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const; diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 87eca98e446..a2f65c766d2 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -340,6 +340,30 @@ QWindowsFontEngine::~QWindowsFontEngine() } } +glyph_t QWindowsFontEngine::glyphIndex(uint ucs4) const +{ + glyph_t glyph; + +#if !defined(Q_OS_WINCE) + if (symbol) { + glyph = getTrueTypeGlyphIndex(cmap, ucs4); + if (glyph == 0 && ucs4 < 0x100) + glyph = getTrueTypeGlyphIndex(cmap, ucs4 + 0xf000); + } else if (ttf) { + glyph = getTrueTypeGlyphIndex(cmap, ucs4); +#else + if (tm.tmFirstChar > 60000) { + glyph = ucs4; +#endif + } else if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) { + glyph = ucs4; + } else { + glyph = 0; + } + + return glyph; +} + HGDIOBJ QWindowsFontEngine::selectDesignFont() const { LOGFONT f = m_logfont; diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index e3fb3281a39..390de1d16eb 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -86,6 +86,7 @@ public: virtual int synthesized() const; virtual QFixed emSquareSize() const; + virtual glyph_t glyphIndex(uint ucs4) const; virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; virtual void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const; diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index a4e4dd38d44..cd5defdfea3 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -301,6 +301,19 @@ QFixed QWindowsFontEngineDirectWrite::emSquareSize() const return QFontEngine::emSquareSize(); } +glyph_t QWindowsFontEngineDirectWrite::glyphIndex(uint ucs4) const +{ + UINT16 glyphIndex; + + HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(&ucs4, 1, &glyphIndex); + if (FAILED(hr)) { + qErrnoWarning("%s: glyphIndex failed", __FUNCTION__); + glyphIndex = 0; + } + + return glyphIndex; +} + // ### Qt 5.1: replace with QStringIterator inline unsigned int getChar(const QChar *str, int &i, const int len) { diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index 399bb5f5adf..aacdcd5a89e 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -74,6 +74,7 @@ public: bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; QFixed emSquareSize() const; + virtual glyph_t glyphIndex(uint ucs4) const; bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const; From 2b15c9c256e5be597cfc3e8165d9b1a9047cfa7c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 3 Mar 2014 06:37:29 +0200 Subject: [PATCH 023/172] Introduce a generic QFontEngine::canRender() implementation ...which uses the recently introduced glyphIndex() method; get rid of re-implementations that did almost the same. Change-Id: I6d32d2cee6a31f57de6aee05ed8d120d4a1f4e9c Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 15 ++++++++-- src/gui/text/qfontengine_ft.cpp | 13 --------- src/gui/text/qfontengine_ft_p.h | 2 -- src/gui/text/qfontengine_p.h | 19 +++--------- src/gui/text/qfontengine_qpa.cpp | 23 --------------- src/gui/text/qfontengine_qpa_p.h | 1 - .../fontdatabases/mac/qfontengine_coretext.mm | 2 +- .../mac/qfontengine_coretext_p.h | 2 +- .../platforms/windows/qwindowsfontengine.cpp | 29 ------------------- .../platforms/windows/qwindowsfontengine.h | 2 -- .../windows/qwindowsfontenginedirectwrite.cpp | 23 --------------- .../windows/qwindowsfontenginedirectwrite.h | 1 - 12 files changed, 19 insertions(+), 113 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 61816c83fbf..ed758f6f0f5 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -385,6 +385,17 @@ bool QFontEngine::supportsScript(QChar::Script script) const return hbFace->supported_scripts[script_to_hbscript(script)]; } +bool QFontEngine::canRender(const QChar *str, int len) const +{ + QStringIterator it(str, str + len); + while (it.hasNext()) { + if (glyphIndex(it.next()) == 0) + return false; + } + + return true; +} + glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix) { glyph_metrics_t metrics = boundingBox(glyph); @@ -1533,7 +1544,7 @@ const char *QFontEngineBox::name() const return "null"; } -bool QFontEngineBox::canRender(const QChar *, int) +bool QFontEngineBox::canRender(const QChar *, int) const { return true; } @@ -1951,7 +1962,7 @@ qreal QFontEngineMulti::minRightBearing() const return engine(0)->minRightBearing(); } -bool QFontEngineMulti::canRender(const QChar *string, int len) +bool QFontEngineMulti::canRender(const QChar *string, int len) const { if (engine(0)->canRender(string, len)) return true; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index b50c8fd95a0..04cf6bfdcb5 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1468,19 +1468,6 @@ static inline unsigned int getChar(const QChar *str, int &i, const int len) return ucs4; } -bool QFontEngineFT::canRender(const QChar *string, int len) -{ - FT_Face face = freetype->face; - { - for ( int i = 0; i < len; i++ ) { - unsigned int uc = getChar(string, i, len); - if (!FT_Get_Char_Index(face, uc)) - return false; - } - } - return true; -} - void QFontEngineFT::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) { if (!glyphs.numGlyphs) diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 7fc73c816d7..fa6ef6f4220 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -237,8 +237,6 @@ private: virtual bool supportsTransformation(const QTransform &transform) const; - virtual bool canRender(const QChar *string, int len); - virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags); virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index f497085ce2b..f5e4ae98faf 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -227,19 +227,8 @@ public: virtual const char *name() const = 0; - virtual bool canRender(const QChar *string, int len) = 0; - inline bool canRender(uint ucs4) { - QChar utf16[2]; - int utf16len = 1; - if (QChar::requiresSurrogates(ucs4)) { - utf16[0] = QChar::highSurrogate(ucs4); - utf16[1] = QChar::lowSurrogate(ucs4); - ++utf16len; - } else { - utf16[0] = QChar(ucs4); - } - return canRender(utf16, utf16len); - } + inline bool canRender(uint ucs4) const { return glyphIndex(ucs4) != 0; } + virtual bool canRender(const QChar *str, int len) const; virtual bool supportsTransformation(const QTransform &transform) const; @@ -374,7 +363,7 @@ public: virtual const char *name() const; - virtual bool canRender(const QChar *string, int len); + virtual bool canRender(const QChar *string, int len) const; virtual Type type() const; inline int size() const { return _size; } @@ -421,7 +410,7 @@ public: virtual inline Type type() const { return QFontEngine::Multi; } - virtual bool canRender(const QChar *string, int len); + virtual bool canRender(const QChar *string, int len) const; inline virtual const char *name() const { return "Multi"; } diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index f48b44374ea..b0bfd024480 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -515,29 +515,6 @@ QFontEngine::Type QFontEngineQPA::type() const return QFontEngine::QPF2; } -bool QFontEngineQPA::canRender(const QChar *string, int len) -{ - const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset); - - if (symbol) { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(string, i, len); - glyph_t g = getTrueTypeGlyphIndex(cmap, uc); - if(!g && uc < 0x100) - g = getTrueTypeGlyphIndex(cmap, uc + 0xf000); - if (!g) - return false; - } - } else { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(string, i, len); - if (!getTrueTypeGlyphIndex(cmap, uc)) - return false; - } - } - return true; -} - bool QFontEngineQPA::isValid() const { return fontData && dataSize && (cmapOffset || externalCMap) diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h index bcd48ca6905..9d9140b8423 100644 --- a/src/gui/text/qfontengine_qpa_p.h +++ b/src/gui/text/qfontengine_qpa_p.h @@ -184,7 +184,6 @@ public: Type type() const; - bool canRender(const QChar *string, int len); inline const char *name() const { return "QPF2"; } virtual int glyphCount() const { return glyphMapEntries; } diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 2ea7e6f00d3..53c4c01a73e 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -673,7 +673,7 @@ QFontEngine::FaceId QCoreTextFontEngine::faceId() const return QFontEngine::FaceId(); } -bool QCoreTextFontEngine::canRender(const QChar *string, int len) +bool QCoreTextFontEngine::canRender(const QChar *string, int len) const { QVarLengthArray cgGlyphs(len); return CTFontGetGlyphsForCharacters(ctfont, (const UniChar *) string, cgGlyphs.data(), len); diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index 0070aede24e..aefe495c37b 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -81,7 +81,7 @@ public: virtual const char *name() const { return "QCoreTextFontEngine"; } - virtual bool canRender(const QChar *string, int len); + virtual bool canRender(const QChar *string, int len) const; virtual int synthesized() const { return synthesisFlags; } virtual bool supportsSubPixelPositions() const { return true; } diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index a2f65c766d2..264c22f47e6 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -777,35 +777,6 @@ const char *QWindowsFontEngine::name() const return 0; } -bool QWindowsFontEngine::canRender(const QChar *string, int len) -{ - if (symbol) { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(string, i, len); - if (getTrueTypeGlyphIndex(cmap, uc) == 0) { - if (uc < 0x100) { - if (getTrueTypeGlyphIndex(cmap, uc + 0xf000) == 0) - return false; - } else { - return false; - } - } - } - } else if (ttf) { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(string, i, len); - if (getTrueTypeGlyphIndex(cmap, uc) == 0) - return false; - } - } else { - while(len--) { - if (tm.tmFirstChar > string->unicode() || tm.tmLastChar < string->unicode()) - return false; - } - } - return true; -} - QFontEngine::Type QWindowsFontEngine::type() const { return QFontEngine::Win; diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index 390de1d16eb..89ad08f6895 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -112,8 +112,6 @@ public: virtual const char *name() const; - bool canRender(const QChar *string, int len); - Type type() const; virtual QImage alphaMapForGlyph(glyph_t t) { return alphaMapForGlyph(t, QTransform()); } diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index cd5defdfea3..744058279e6 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -647,29 +647,6 @@ const char *QWindowsFontEngineDirectWrite::name() const return 0; } -bool QWindowsFontEngineDirectWrite::canRender(const QChar *string, int len) -{ - QVarLengthArray codePoints(len); - int actualLength = 0; - for (int i=0; i glyphIndices(actualLength); - HRESULT hr = m_directWriteFontFace->GetGlyphIndices(codePoints.data(), actualLength, - glyphIndices.data()); - if (FAILED(hr)) { - qErrnoWarning("%s: GetGlyphIndices failed", __FUNCTION__); - return false; - } - - for (int i = 0; i < actualLength; ++i) { - if (glyphIndices.at(i) == 0) - return false; - } - - return true; -} - QFontEngine::Type QWindowsFontEngineDirectWrite::type() const { return QFontEngine::DirectWrite; diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index aacdcd5a89e..070adfcbdec 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -99,7 +99,6 @@ public: QFontEngine *cloneWithSize(qreal pixelSize) const; - bool canRender(const QChar *string, int len); Type type() const; const QSharedPointer &fontEngineData() const { return m_fontEngineData; } From 7e872de76ee0591d4fea72f4ef07637ca5f7ca0d Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 1 Mar 2014 15:39:53 +0100 Subject: [PATCH 024/172] Fix some typos Change-Id: I7dbe938bff5ac3ab50a0197f94bdb2f6c22fbd16 Reviewed-by: Kevin Krammer Reviewed-by: Mitch Curtis --- src/corelib/doc/src/eventsandfilters.qdoc | 2 +- src/corelib/tools/qdatetimeparser_p.h | 2 +- src/gui/opengl/qopenglengineshadermanager_p.h | 2 +- src/gui/opengl/qopengltimerquery.cpp | 2 +- src/gui/painting/qpaintengine_blitter.cpp | 2 +- src/network/ssl/qsslcontext.cpp | 2 +- src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 2 +- src/platformsupport/eglconvenience/qeglplatformcursor_p.h | 2 +- src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm | 2 +- src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm | 2 +- src/sql/models/qsqltablemodel.cpp | 2 +- src/tools/qdoc/doc/qdoc-guide/qtwritingstyle-cpp.qdoc | 2 +- src/widgets/graphicsview/qgraphicsscene.cpp | 2 +- src/widgets/styles/qfusionstyle.cpp | 2 +- src/widgets/styles/qgtkstyle.cpp | 2 +- src/widgets/styles/qmacstyle_mac.mm | 2 +- tests/manual/qgraphicsitem/main.cpp | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/corelib/doc/src/eventsandfilters.qdoc b/src/corelib/doc/src/eventsandfilters.qdoc index cd31e36dee5..a880cc81874 100644 --- a/src/corelib/doc/src/eventsandfilters.qdoc +++ b/src/corelib/doc/src/eventsandfilters.qdoc @@ -208,7 +208,7 @@ \l{QCoreApplication::}{postEvent()} is also used during object initialization, since the posted event will typically be dispatched very soon after the initialization of the object is complete. - When implementing a widget, it is important to realise that events + When implementing a widget, it is important to realize that events can be delivered very early in its lifetime so, in its constructor, be sure to initialize member variables early on, before there's any chance that it might receive an event. diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index 2b4f59a23a8..e2513b43a53 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -241,7 +241,7 @@ public: 3. User increments month: 31/03/2000 At step 1, cachedDay stores 31. At step 2, the 31 is invalid for February, so the cachedDay is not updated. - At step 3, the the month is changed to March, for which 31 is a valid day. Since 29 < 31, the day is set to cachedDay. + At step 3, the month is changed to March, for which 31 is a valid day. Since 29 < 31, the day is set to cachedDay. This is good for when users have selected their desired day and are scrolling up or down in the month or year section and do not want smaller months (or non-leap years) to alter the day that they chose. */ diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h index 49c03a7fee6..893574a6e5e 100644 --- a/src/gui/opengl/qopenglengineshadermanager_p.h +++ b/src/gui/opengl/qopenglengineshadermanager_p.h @@ -90,7 +90,7 @@ qopenglslMainVertexShader qopenglslMainWithTexCoordsVertexShader - And the the following position vertex shaders: + And the following position vertex shaders: qopenglslPositionOnlyVertexShader qopenglslPositionWithTextureBrushVertexShader qopenglslPositionWithPatternBrushVertexShader diff --git a/src/gui/opengl/qopengltimerquery.cpp b/src/gui/opengl/qopengltimerquery.cpp index deb88b77788..c756e3f5270 100644 --- a/src/gui/opengl/qopengltimerquery.cpp +++ b/src/gui/opengl/qopengltimerquery.cpp @@ -283,7 +283,7 @@ GLuint64 QOpenGLTimerQueryPrivate::result() const As this function's name implies, it blocks CPU execution until OpenGL notifies that the timer query result is available. To avoid blocking, you can check if the query result is available by calling isResultAvailable(). Note that - modern GPUs are deeply pipelined and query results may not become availble for + modern GPUs are deeply pipelined and query results may not become available for between 1-5 frames after they were issued. Note that OpenGL does not permit nesting or interleaving of multiple timer queries diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 76b6084d0ec..e356a3a36a1 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -690,7 +690,7 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q } } -// Overriden methods to lock the graphics memory +// Overridden methods to lock the graphics memory void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) { Q_D(QBlitterPaintEngine); diff --git a/src/network/ssl/qsslcontext.cpp b/src/network/ssl/qsslcontext.cpp index 551804ec794..1634ba0649b 100644 --- a/src/network/ssl/qsslcontext.cpp +++ b/src/network/ssl/qsslcontext.cpp @@ -349,7 +349,7 @@ SSL* QSslContext::createSsl() // We cache exactly one session here bool QSslContext::cacheSession(SSL* ssl) { - // dont cache the same session again + // don't cache the same session again if (session && session == q_SSL_get_session(ssl)) return true; diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index eff33d6da03..bbd9d867738 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -90,7 +90,7 @@ qglslMainVertexShader qglslMainWithTexCoordsVertexShader - And the the following position vertex shaders: + And the following position vertex shaders: qglslPositionOnlyVertexShader qglslPositionWithTextureBrushVertexShader qglslPositionWithPatternBrushVertexShader diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h b/src/platformsupport/eglconvenience/qeglplatformcursor_p.h index d1402d14574..c9ff9a11981 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcursor_p.h @@ -117,7 +117,7 @@ private: CursorAtlas() : cursorsPerRow(0), texture(0), cursorWidth(0), cursorHeight(0) { } int cursorsPerRow; uint texture; - int width, height; // width and height of the the atlas + int width, height; // width and height of the atlas int cursorWidth, cursorHeight; // width and height of cursors inside the atlas QList hotSpots; QImage image; // valid until it's uploaded diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm index 1e15a9f4660..5e311c99b1c 100644 --- a/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_cf.mm @@ -469,7 +469,7 @@ bool QEventDispatcherCoreFoundation::hasPendingEvents() // assume that if the run-loop is currently blocking and waiting for a // source to signal then there are no system-events pending. If this // function is called from the main thread then the second clause - // of the condition will always be true, as the the run loop is + // of the condition will always be true, as the run loop is // never waiting in that case. The function would be more aptly named // 'maybeHasPendingEvents' in our case. diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 29eed73535c..91b631bff92 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -681,7 +681,7 @@ void QCocoaEventDispatcherPrivate::cleanupModalSessions() { // Go through the list of modal sessions, and end those // that no longer has a window assosiated; no window means - // the the session has logically ended. The reason we wait like + // the session has logically ended. The reason we wait like // this to actually end the sessions for real (rather than at the // point they were marked as stopped), is that ending a session // when no other session runs below it on the stack will make cocoa diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 7367f6e7f4f..5c73705d4c4 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -737,7 +737,7 @@ bool QSqlTableModel::submitAll() bool success = true; foreach (int row, d->cache.keys()) { - // be sure cache *still* contains the row since overriden selectRow() could have called select() + // be sure cache *still* contains the row since overridden selectRow() could have called select() QSqlTableModelPrivate::CacheMap::iterator it = d->cache.find(row); if (it == d->cache.end()) continue; diff --git a/src/tools/qdoc/doc/qdoc-guide/qtwritingstyle-cpp.qdoc b/src/tools/qdoc/doc/qdoc-guide/qtwritingstyle-cpp.qdoc index f8e96f0ee4c..304a736860f 100644 --- a/src/tools/qdoc/doc/qdoc-guide/qtwritingstyle-cpp.qdoc +++ b/src/tools/qdoc/doc/qdoc-guide/qtwritingstyle-cpp.qdoc @@ -160,7 +160,7 @@ a signal should be documented. \endlist For properties that have overloaded signals, QDoc groups the overloaded -notifiers together. To refer to a specifc version of a notifier or signal, +notifiers together. To refer to a specific version of a notifier or signal, simply refer to the property and mention that there are different versions of the notifier. diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 41d4fc925a3..8a2437f8636 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -5457,7 +5457,7 @@ bool QGraphicsScene::focusNextPrevChild(bool next) scene (i.e., when an item gains or loses input focus, or when focus passes from one item to another). You can connect to this signal if you need to keep track of when other items gain input focus. It is - particularily useful for implementing virtual keyboards, input methods, + particularly useful for implementing virtual keyboards, input methods, and cursor items. \a oldFocusItem is a pointer to the item that previously had focus, or diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 149a5c66744..c4bc5a5e961 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1026,7 +1026,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio break; case CE_Splitter: { - // Dont draw handle for single pixel splitters + // Don't draw handle for single pixel splitters if (option->rect.width() > 1 && option->rect.height() > 1) { //draw grips if (option->state & State_Horizontal) { diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp index 105aefb14c0..9ad0484bc2a 100644 --- a/src/widgets/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -1032,7 +1032,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, case PE_FrameFocusRect: { QRect frameRect = option->rect.adjusted(1, 1, -2, -2); // ### this mess should move to subcontrolrect if (qobject_cast(widget)) { - // Dont draw anything + // Don't draw anything } else if (qobject_cast(widget)) { GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); style = d->gtk_widget_get_style(gtkNotebook); diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index d8530bca1e8..a8926e0ad0c 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -5024,7 +5024,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex int oldState = styleObject->property("_q_stylestate").toInt(); uint oldActiveControls = styleObject->property("_q_stylecontrols").toUInt(); - // a scrollbar is transient when the the scrollbar itself and + // a scrollbar is transient when the scrollbar itself and // its sibling are both inactive (ie. not pressed/hovered/moved) bool transient = !opt->activeSubControls && !(slider->state & State_On); diff --git a/tests/manual/qgraphicsitem/main.cpp b/tests/manual/qgraphicsitem/main.cpp index e21baa3d187..c00afa92b97 100644 --- a/tests/manual/qgraphicsitem/main.cpp +++ b/tests/manual/qgraphicsitem/main.cpp @@ -76,6 +76,6 @@ int main(int argc, char *argv[]) gv.show(); MyObject o(rect); QMessageBox::information(0, "What you should see", - "The red rectangle should toggle visiblity, so you should see it flash on and off"); + "The red rectangle should toggle visibility, so you should see it flash on and off"); return a.exec(); } From 380de7f8e70cfa5f335a065e446dc707d416c1a6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 1 Mar 2014 10:18:56 -0800 Subject: [PATCH 025/172] Fix use uninitialized, detected by GCC 4.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the widget \a field is not present on this form, getWidgetPosition might not fill in the role variable. GCC is correct. qformlayout.cpp:1690:19: error: ‘role’ may be used uninitialized in this function [-Werror=maybe-uninitialized] Change-Id: Ia67991a71e8f1ceacb9d6370c7028c454ef630c6 Reviewed-by: Marc Mutz --- src/widgets/kernel/qformlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index c1d3e95e7a1..239e1ce1e2c 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1683,7 +1683,7 @@ QWidget *QFormLayout::labelForField(QWidget *field) const Q_D(const QFormLayout); int row; - ItemRole role; + ItemRole role = LabelRole; getWidgetPosition(field, &row, &role); From e7f685002bb0facb222ac13c21ff4a2257ab76cc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 24 Feb 2014 15:23:39 -0800 Subject: [PATCH 026/172] Atomics: implement fetchAndSub on top of fetchAndAdd Instead of looping unnecessarily on top of testAndSet. Task-number: QTBUG-37031 Change-Id: I8120f8405eb76dccc9066749cee0a92b0f2da20e Reviewed-by: Olivier Goffart Reviewed-by: Sergio Ahumada --- src/corelib/thread/qgenericatomic.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/corelib/thread/qgenericatomic.h b/src/corelib/thread/qgenericatomic.h index 0c66d458559..aeed199c977 100644 --- a/src/corelib/thread/qgenericatomic.h +++ b/src/corelib/thread/qgenericatomic.h @@ -264,12 +264,8 @@ template struct QGenericAtomicOps template static inline always_inline T fetchAndSubRelaxed(T &_q_value, typename QAtomicAdditiveType::AdditiveT operand) Q_DECL_NOTHROW { - // implement fetchAndSub on top of testAndSet - Q_FOREVER { - T tmp = BaseClass::load(_q_value); - if (BaseClass::testAndSetRelaxed(_q_value, tmp, T(tmp - operand))) - return tmp; - } + // implement fetchAndSub on top of fetchAndAdd + return fetchAndAddRelaxed(_q_value, -operand); } template static inline always_inline From bcf5ea28c19102430f0dc879e8efb2d895dcea3c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 27 Feb 2014 12:17:12 +0100 Subject: [PATCH 027/172] Remove deleted QNetworkReplies from SPDY queues We already remove QNetworkReply from most queues, but we also need to remove it from the SPDY queue. Otherwise we might end up trying to send an already deleted message. Change-Id: Ib39bf8f26315b66179755a6f66dbd657576cbbe3 Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 6d568220e2c..87511076d3d 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -864,6 +864,19 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) return; } } +#ifndef QT_NO_SSL + // is the reply inside the SPDY pipeline of this channel already? + QMultiMap::iterator it = channels[i].spdyRequestsToSend.begin(); + QMultiMap::iterator end = channels[i].spdyRequestsToSend.end(); + for (; it != end; ++it) { + if (it.value().second == reply) { + channels[i].spdyRequestsToSend.remove(it.key()); + + QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); + return; + } + } +#endif } // remove from the high priority queue if (!highPriorityQueue.isEmpty()) { From a83498299ab02b3706dfbe5867378cad6ca80cce Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 1 Mar 2014 11:06:58 -0800 Subject: [PATCH 028/172] Remove the header precompilation for QtXml and QtOpenGLExtensions Respectively, those modules have 2 and 1 source files. Precompilation costs more than the benefit of using precompiled headers. Change-Id: I15ababd9ba7cce2e1510454da49010456ff0597a Reviewed-by: Oswald Buddenhagen --- src/openglextensions/openglextensions.pro | 2 +- src/xml/xml.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openglextensions/openglextensions.pro b/src/openglextensions/openglextensions.pro index 5ab750bee86..e303dea5e84 100644 --- a/src/openglextensions/openglextensions.pro +++ b/src/openglextensions/openglextensions.pro @@ -8,7 +8,7 @@ contains(QT_CONFIG, opengles2):CONFIG += opengles2 load(qt_module) DEFINES += QT_NO_CAST_FROM_ASCII -PRECOMPILED_HEADER = ../corelib/global/qt_pch.h +PRECOMPILED_HEADER = HEADERS = qopenglextensions.h diff --git a/src/xml/xml.pro b/src/xml/xml.pro index c4b8b5b229a..57bf11e5aa2 100644 --- a/src/xml/xml.pro +++ b/src/xml/xml.pro @@ -10,7 +10,7 @@ load(qt_module) HEADERS += qtxmlglobal.h -PRECOMPILED_HEADER = ../corelib/global/qt_pch.h +PRECOMPILED_HEADER = include(dom/dom.pri) include(sax/sax.pri) From ce909a138ab486c1ec5cf4b13232ef8d73ab5816 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 27 Feb 2014 15:23:20 +0100 Subject: [PATCH 029/172] SPDY must handle destoyed QNetworkReply A QNetworkReply may be deleted before it is closed by the protocol. Since QSpdyProtocolHandler tracks pointers to QNetworkReplies it must keep track of their destruction as well to avoid links to deleted objects. This fixes the last issue with SPDY access of Google Mail in QtWebKit. Change-Id: I2c56dc080fdcb249b6ed9189fef84cbbc1220cbd Reviewed-by: Peter Hartmann --- src/network/access/qspdyprotocolhandler.cpp | 9 +++++++++ src/network/access/qspdyprotocolhandler_p.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index ce8a2d2b1d9..6d5885eb680 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -309,11 +309,13 @@ bool QSpdyProtocolHandler::sendRequest() currentReply->setSpdyWasUsed(true); qint32 streamID = generateNextStreamID(); + currentReply->setProperty("SPDYStreamID", streamID); currentReply->setRequest(currentRequest); currentReply->d_func()->connection = m_connection; currentReply->d_func()->connectionChannel = m_channel; m_inFlightStreams.insert(streamID, currentPair); + connect(currentReply, SIGNAL(destroyed(QObject*)), this, SLOT(_q_replyDestroyed(QObject*))); sendSYN_STREAM(currentPair, streamID, /* associatedToStreamID = */ 0); int requestsRemoved = m_channel->spdyRequestsToSend.remove( @@ -325,6 +327,13 @@ bool QSpdyProtocolHandler::sendRequest() return true; } +void QSpdyProtocolHandler::_q_replyDestroyed(QObject* reply) +{ + qint32 streamID = reply->property("SPDYStreamID").toInt(); + if (m_inFlightStreams.remove(streamID)) + sendRST_STREAM(streamID, RST_STREAM_CANCEL); +} + void QSpdyProtocolHandler::_q_receiveReply() { Q_ASSERT(m_socket); diff --git a/src/network/access/qspdyprotocolhandler_p.h b/src/network/access/qspdyprotocolhandler_p.h index 8cbfbdda86f..50c5ed52a12 100644 --- a/src/network/access/qspdyprotocolhandler_p.h +++ b/src/network/access/qspdyprotocolhandler_p.h @@ -108,6 +108,7 @@ public: private slots: void _q_uploadDataReadyRead(); + void _q_replyDestroyed(QObject*); private: From 018d1ca5f3209949cb7e8e1306250ec030fee929 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 25 Feb 2014 20:33:39 +0100 Subject: [PATCH 030/172] Cocoa: Use helper class for event handling in native windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QNSWindow and QNSPanel duplicate some code when it comes to event handling, which can be refactored. Also, it's currently not possible to keep an NSWindow derived instance temporarily alive as QCocoaWindow is not designed to keep track of more than one NSWindow. Finally, we can reduce the size of (and eventually remove) the QCocoaWindowCategory which polutes the NSWindow namespace. We move QNSWindow and QNSPanel specific API into QNSWindowProtocol, and define QCocoaNSWindow as NSWindow extended by that protocol. This gives us a type we can refer to any of the native windows QCocoaWindow instanciates. We introduce QNSWindowHelper which gathers the common code between QNSWindow and QNSPanel. This is a one-to-one mapping that keeps a weak (non-retaining) reference to the NSWindow and a weak reference to the QCocoaWindow. It has the same life span as its associated NSWindow. Task-number: QTBUG-33082 Reviewed-by: Morten Johan Sørvig Change-Id: I38d001bf13f64a1ba4f1439291c5103c3f755183 Reviewed-by: Liang Qi --- src/plugins/platforms/cocoa/qcocoawindow.h | 60 +++-- src/plugins/platforms/cocoa/qcocoawindow.mm | 233 +++++++++++--------- 2 files changed, 178 insertions(+), 115 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 748280af6a5..0f08cd18fba 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -52,27 +52,57 @@ QT_FORWARD_DECLARE_CLASS(QCocoaWindow) -@interface QNSWindow : NSWindow -{ - @public QCocoaWindow *m_cocoaPlatformWindow; -} -- (id)initWithContentRect:(NSRect)contentRect - styleMask:(NSUInteger)windowStyle - qPlatformWindow:(QCocoaWindow *)qpw; +@class QNSWindowHelper; + +@protocol QNSWindowProtocol + +@property (nonatomic, readonly) QNSWindowHelper *helper; + +- (void)superSendEvent:(NSEvent *)theEvent; +- (void)closeAndRelease; -- (void)clearPlatformWindow; @end -@interface QNSPanel : NSPanel +typedef NSWindow QCocoaNSWindow; + +@interface QNSWindowHelper : NSObject { - @public QCocoaWindow *m_cocoaPlatformWindow; + QCocoaNSWindow *_window; + QCocoaWindow *_platformWindow; } +@property (nonatomic, readonly) QCocoaNSWindow *window; +@property (nonatomic, readonly) QCocoaWindow *platformWindow; + +- (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow; +- (void)handleWindowEvent:(NSEvent *)theEvent; + +@end + +@interface QNSWindow : NSWindow +{ + QNSWindowHelper *_helper; +} + +@property (nonatomic, readonly) QNSWindowHelper *helper; + +- (id)initWithContentRect:(NSRect)contentRect + styleMask:(NSUInteger)windowStyle + qPlatformWindow:(QCocoaWindow *)qpw; + +@end + +@interface QNSPanel : NSPanel +{ + QNSWindowHelper *_helper; +} + +@property (nonatomic, readonly) QNSWindowHelper *helper; + - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle qPlatformWindow:(QCocoaWindow *)qpw; -- (void)clearPlatformWindow; @end @class QNSWindowDelegate; @@ -183,9 +213,8 @@ public: QWindow *childWindowAt(QPoint windowPoint); protected: void recreateWindow(const QPlatformWindow *parentWindow); - NSWindow *createNSWindow(); - void setNSWindow(NSWindow *window); - void clearNSWindow(NSWindow *window); + QCocoaNSWindow *createNSWindow(); + void setNSWindow(QCocoaNSWindow *window); bool shouldUseNSPanel(); @@ -202,7 +231,7 @@ public: // for QNSView NSView *m_contentView; QNSView *m_qtView; - NSWindow *m_nsWindow; + QCocoaNSWindow *m_nsWindow; QCocoaWindow *m_forwardWindow; // TODO merge to one variable if possible @@ -213,7 +242,6 @@ public: // for QNSView bool m_isNSWindowChild; // this window is a non-top level QWindow with a NSWindow. QList m_childWindows; - QNSWindowDelegate *m_nsWindowDelegate; Qt::WindowFlags m_windowFlags; Qt::WindowState m_synchedWindowState; Qt::WindowModality m_windowModality; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index bf41270d120..65e2a15cec2 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -81,15 +81,10 @@ static bool isMouseEvent(NSEvent *ev) } @interface NSWindow (CocoaWindowCategory) -- (void) clearPlatformWindow; - (NSRect) legacyConvertRectFromScreen:(NSRect) rect; @end @implementation NSWindow (CocoaWindowCategory) -- (void) clearPlatformWindow -{ -} - - (NSRect) legacyConvertRectFromScreen:(NSRect) rect { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 @@ -103,8 +98,87 @@ static bool isMouseEvent(NSEvent *ev) } @end + +@implementation QNSWindowHelper + +@synthesize window = _window; +@synthesize platformWindow = _platformWindow; + +- (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow +{ + self = [super init]; + if (self) { + _window = window; + _platformWindow = platformWindow; + + _window.delegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:_platformWindow]; + + // Prevent Cocoa from releasing the window on close. Qt + // handles the close event asynchronously and we want to + // make sure that m_nsWindow stays valid until the + // QCocoaWindow is deleted by Qt. + [_window setReleasedWhenClosed:NO]; + } + + return self; +} + +- (void)handleWindowEvent:(NSEvent *)theEvent +{ + QCocoaWindow *pw = self.platformWindow; + if (pw && pw->m_forwardWindow) { + if (theEvent.type == NSLeftMouseUp || theEvent.type == NSLeftMouseDragged) { + QNSView *forwardView = pw->m_qtView; + if (theEvent.type == NSLeftMouseUp) { + [forwardView mouseUp:theEvent]; + pw->m_forwardWindow = 0; + } else { + [forwardView mouseDragged:theEvent]; + } + } + + if (!pw->m_isNSWindowChild && theEvent.type == NSLeftMouseDown) { + pw->m_forwardWindow = 0; + } + } + + [self.window superSendEvent:theEvent]; + + if (!self.window.delegate) + return; // Already detached, pending NSAppKitDefined event + + if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { + NSPoint loc = [theEvent locationInWindow]; + NSRect windowFrame = [self.window legacyConvertRectFromScreen:[self.window frame]]; + NSRect contentFrame = [[self.window contentView] frame]; + if (NSMouseInRect(loc, windowFrame, NO) && + !NSMouseInRect(loc, contentFrame, NO)) + { + QNSView *contentView = (QNSView *)pw->contentView(); + [contentView handleFrameStrutMouseEvent: theEvent]; + } + } +} + +- (void)detachFromPlatformWindow +{ + [self.window.delegate release]; + self.window.delegate = nil; +} + +- (void)dealloc +{ + _window = nil; + _platformWindow = 0; + [super dealloc]; +} + +@end + @implementation QNSWindow +@synthesize helper = _helper; + - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle qPlatformWindow:(QCocoaWindow *)qpw @@ -116,7 +190,7 @@ static bool isMouseEvent(NSEvent *ev) // set up before the window is shown and needs a proper window) if (self) { - m_cocoaPlatformWindow = qpw; + _helper = [[QNSWindowHelper alloc] initWithNSWindow:self platformWindow:qpw]; } return self; } @@ -125,7 +199,8 @@ static bool isMouseEvent(NSEvent *ev) { // Prevent child NSWindows from becoming the key window in // order keep the active apperance of the top-level window. - if (!m_cocoaPlatformWindow || m_cocoaPlatformWindow->m_isNSWindowChild) + QCocoaWindow *pw = self.helper.platformWindow; + if (!pw || pw->m_isNSWindowChild) return NO; // The default implementation returns NO for title-bar less windows, @@ -140,8 +215,8 @@ static bool isMouseEvent(NSEvent *ev) // Windows with a transient parent (such as combobox popup windows) // cannot become the main window: - if (!m_cocoaPlatformWindow || m_cocoaPlatformWindow->m_isNSWindowChild - || m_cocoaPlatformWindow->window()->transientParent()) + QCocoaWindow *pw = self.helper.platformWindow; + if (!pw || pw->m_isNSWindowChild || pw->window()->transientParent()) canBecomeMain = NO; return canBecomeMain; @@ -149,51 +224,34 @@ static bool isMouseEvent(NSEvent *ev) - (void) sendEvent: (NSEvent*) theEvent { - if (m_cocoaPlatformWindow && m_cocoaPlatformWindow->m_forwardWindow) { - if (theEvent.type == NSLeftMouseUp || theEvent.type == NSLeftMouseDragged) { - QNSView *forwardView = m_cocoaPlatformWindow->m_qtView; - if (theEvent.type == NSLeftMouseUp) { - [forwardView mouseUp:theEvent]; - m_cocoaPlatformWindow->m_forwardWindow = 0; - } else { - [forwardView mouseDragged:theEvent]; - } - - return; - } - - if (theEvent.type == NSLeftMouseDown) { - m_cocoaPlatformWindow->m_forwardWindow = 0; - } - } - - [super sendEvent: theEvent]; - - if (!m_cocoaPlatformWindow) - return; - - if (m_cocoaPlatformWindow->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { - NSPoint loc = [theEvent locationInWindow]; - NSRect windowFrame = [self legacyConvertRectFromScreen:[self frame]]; - NSRect contentFrame = [[self contentView] frame]; - if (NSMouseInRect(loc, windowFrame, NO) && - !NSMouseInRect(loc, contentFrame, NO)) - { - QNSView *contentView = (QNSView *) m_cocoaPlatformWindow->contentView(); - [contentView handleFrameStrutMouseEvent: theEvent]; - } - } + [self.helper handleWindowEvent:theEvent]; } -- (void)clearPlatformWindow +- (void)superSendEvent:(NSEvent *)theEvent { - m_cocoaPlatformWindow = 0; + [super sendEvent:theEvent]; +} + +- (void)closeAndRelease +{ + [self.helper detachFromPlatformWindow]; + [self close]; + [self release]; +} + +- (void)dealloc +{ + [_helper release]; + _helper = nil; + [super dealloc]; } @end @implementation QNSPanel +@synthesize helper = _helper; + - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle qPlatformWindow:(QCocoaWindow *)qpw @@ -205,47 +263,47 @@ static bool isMouseEvent(NSEvent *ev) // set up before the window is shown and needs a proper window) if (self) { - m_cocoaPlatformWindow = qpw; + _helper = [[QNSWindowHelper alloc] initWithNSWindow:self platformWindow:qpw]; } return self; } - (BOOL)canBecomeKeyWindow { - if (!m_cocoaPlatformWindow) + QCocoaWindow *pw = self.helper.platformWindow; + if (!pw) return NO; // Only tool or dialog windows should become key: - if (m_cocoaPlatformWindow - && (m_cocoaPlatformWindow->window()->type() == Qt::Tool || - m_cocoaPlatformWindow->window()->type() == Qt::Dialog)) + Qt::WindowType type = pw->window()->type(); + if (type == Qt::Tool || type == Qt::Dialog) return YES; + return NO; } - (void) sendEvent: (NSEvent*) theEvent { - [super sendEvent: theEvent]; - - if (!m_cocoaPlatformWindow) - return; - - if (m_cocoaPlatformWindow->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { - NSPoint loc = [theEvent locationInWindow]; - NSRect windowFrame = [self legacyConvertRectFromScreen:[self frame]]; - NSRect contentFrame = [[self contentView] frame]; - if (NSMouseInRect(loc, windowFrame, NO) && - !NSMouseInRect(loc, contentFrame, NO)) - { - QNSView *contentView = (QNSView *) m_cocoaPlatformWindow->contentView(); - [contentView handleFrameStrutMouseEvent: theEvent]; - } - } + [self.helper handleWindowEvent:theEvent]; } -- (void)clearPlatformWindow +- (void)superSendEvent:(NSEvent *)theEvent { - m_cocoaPlatformWindow = 0; + [super sendEvent:theEvent]; +} + +- (void)closeAndRelease +{ + [self.helper detachFromPlatformWindow]; + [self close]; + [self release]; +} + +- (void)dealloc +{ + [_helper release]; + _helper = nil; + [super dealloc]; } @end @@ -262,7 +320,6 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_contentViewIsToBeEmbedded(false) , m_parentCocoaWindow(0) , m_isNSWindowChild(false) - , m_nsWindowDelegate(0) , m_synchedWindowState(Qt::WindowActive) , m_windowModality(Qt::NonModal) , m_windowUnderMouse(false) @@ -328,7 +385,8 @@ QCocoaWindow::~QCocoaWindow() #endif QCocoaAutoReleasePool pool; - clearNSWindow(m_nsWindow); + [m_nsWindow setContentView:nil]; + [m_nsWindow.helper detachFromPlatformWindow]; if (m_isNSWindowChild) { if (m_parentCocoaWindow) m_parentCocoaWindow->removeChildWindow(this); @@ -346,7 +404,6 @@ QCocoaWindow::~QCocoaWindow() [m_contentView release]; [m_nsWindow release]; - [m_nsWindowDelegate release]; [m_windowCursor release]; } @@ -1090,12 +1147,10 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow) // Remove current window (if any) if ((m_nsWindow && !needsNSWindow) || (usesNSPanel != shouldUseNSPanel())) { - clearNSWindow(m_nsWindow); - [m_nsWindow close]; - [m_nsWindow release]; + [m_nsWindow closeAndRelease]; + if (wasNSWindowChild && oldParentCocoaWindow) + oldParentCocoaWindow->removeChildWindow(this); m_nsWindow = 0; - [m_nsWindowDelegate release]; - m_nsWindowDelegate = 0; } if (needsNSWindow) { @@ -1203,7 +1258,7 @@ bool QCocoaWindow::shouldUseNSPanel() ((type & Qt::Popup) == Qt::Popup || (type & Qt::Dialog) == Qt::Dialog); } -NSWindow * QCocoaWindow::createNSWindow() +QCocoaNSWindow * QCocoaWindow::createNSWindow() { QCocoaAutoReleasePool pool; @@ -1219,7 +1274,7 @@ NSWindow * QCocoaWindow::createNSWindow() } else { styleMask = windowStyleMask(flags); } - NSWindow *createdWindow = 0; + QCocoaNSWindow *createdWindow = 0; // Use NSPanel for popup-type windows. (Popup, Tool, ToolTip, SplashScreen) // and dialogs @@ -1270,17 +1325,8 @@ NSWindow * QCocoaWindow::createNSWindow() return createdWindow; } -void QCocoaWindow::setNSWindow(NSWindow *window) +void QCocoaWindow::setNSWindow(QCocoaNSWindow *window) { - m_nsWindowDelegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:this]; - [window setDelegate:m_nsWindowDelegate]; - - // Prevent Cocoa from releasing the window on close. Qt - // handles the close event asynchronously and we want to - // make sure that m_nsWindow stays valid until the - // QCocoaWindow is deleted by Qt. - [window setReleasedWhenClosed : NO]; - if (window.contentView != m_contentView) { [m_contentView setPostsFrameChangedNotifications: NO]; [window setContentView:m_contentView]; @@ -1288,17 +1334,6 @@ void QCocoaWindow::setNSWindow(NSWindow *window) } } -void QCocoaWindow::clearNSWindow(NSWindow *window) -{ - [window setContentView:nil]; - [window setDelegate:nil]; - [window clearPlatformWindow]; - - if (m_isNSWindowChild) { - m_parentCocoaWindow->removeChildWindow(this); - } -} - void QCocoaWindow::removeChildWindow(QCocoaWindow *child) { m_childWindows.removeOne(child); From 28c9c2ea50e54236d5975f263ee1d28d831223aa Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 26 Feb 2014 20:05:00 +0100 Subject: [PATCH 031/172] Cocoa: Keep child NSWindow alive while it grabs the mouse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise, Cocoa loses sight on which window to send the dragging mouse event. If the window is kept alive (but hidden) Cocoa will send the events to it, and we can forward them to the actual QWindow. This is the expected use-case: 1. Start dragging a QWindow and change its flags. 2. This triggers a call to QCocoaWindow::recreateWindow(), which will get rid of the old NSWindow and create a new one (the QNSView is moved to the new NSWindow). 3. When we stop dragging, the NSWindow is finally destroyed. QNSView Pointer References Remarks: In QNSView, m_window points to the QWindow which remains unchanged until deleted. Similarly m_platformWindow remains valid until deleted, in which case we delete the QNSView, the NSWindow and its helper (see QCocoaWindow destructor). This fixes undocking QToolBars when they are a child NSWindow. Task-number: QTBUG-33082 Reviewed-by: Morten Johan Sørvig Change-Id: I6fc53292cd96586cfdf401481c5442d759f1fae5 Reviewed-by: Liang Qi --- src/plugins/platforms/cocoa/qcocoawindow.h | 4 ++++ src/plugins/platforms/cocoa/qcocoawindow.mm | 22 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 0f08cd18fba..67cac413835 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -69,10 +69,14 @@ typedef NSWindow QCocoaNSWindow; { QCocoaNSWindow *_window; QCocoaWindow *_platformWindow; + BOOL _grabbingMouse; + BOOL _releaseOnMouseUp; } @property (nonatomic, readonly) QCocoaNSWindow *window; @property (nonatomic, readonly) QCocoaWindow *platformWindow; +@property (nonatomic) BOOL grabbingMouse; +@property (nonatomic) BOOL releaseOnMouseUp; - (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow; - (void)handleWindowEvent:(NSEvent *)theEvent; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 65e2a15cec2..f1f88a13dd9 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -103,6 +103,8 @@ static bool isMouseEvent(NSEvent *ev) @synthesize window = _window; @synthesize platformWindow = _platformWindow; +@synthesize grabbingMouse = _grabbingMouse; +@synthesize releaseOnMouseUp = _releaseOnMouseUp; - (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow { @@ -142,6 +144,17 @@ static bool isMouseEvent(NSEvent *ev) } } + if (theEvent.type == NSLeftMouseDown) { + self.grabbingMouse = YES; + } else if (theEvent.type == NSLeftMouseUp) { + self.grabbingMouse = NO; + if (self.releaseOnMouseUp) { + [self detachFromPlatformWindow]; + [self.window release]; + return; + } + } + [self.window superSendEvent:theEvent]; if (!self.window.delegate) @@ -234,9 +247,14 @@ static bool isMouseEvent(NSEvent *ev) - (void)closeAndRelease { - [self.helper detachFromPlatformWindow]; [self close]; - [self release]; + + if (self.helper.grabbingMouse) { + self.helper.releaseOnMouseUp = YES; + } else { + [self.helper detachFromPlatformWindow]; + [self release]; + } } - (void)dealloc From e7874563e402030433e9b96b11b14bb38cdad3a8 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 3 Mar 2014 16:43:58 +0100 Subject: [PATCH 032/172] Windows Vista Style: Don't draw menubar item background for QQ Controls In QtQuick Controls, we draw the full menubar background and the menubar items on top. Unless in a particular state, there's no need to draw the background or it may overlap with the menubar edge. Change-Id: Ia35a73274cc10b3b5a3f55573c92919f99555db0 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qwindowsvistastyle.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 6c7b71bd741..f93e9312dee 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1206,11 +1206,13 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget)) alignment |= Qt::TextHideMnemonic; - //The rect adjustment is a workaround for the menu not really filling its background. - XPThemeData theme(widget, painter, - QWindowsXPStylePrivate::MenuTheme, - MENU_BARBACKGROUND, 0, option->rect.adjusted(-1, 0, 2, 1)); - d->drawBackground(theme); + if (widget) { // Not needed for QtQuick Controls + //The rect adjustment is a workaround for the menu not really filling its background. + XPThemeData theme(widget, painter, + QWindowsXPStylePrivate::MenuTheme, + MENU_BARBACKGROUND, 0, option->rect.adjusted(-1, 0, 2, 1)); + d->drawBackground(theme); + } int stateId = MBI_NORMAL; if (disabled) From e531b46bed9377c66fcffc650c5b39e676f43e5d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 3 Mar 2014 12:12:26 +0100 Subject: [PATCH 033/172] Turn off compiler optimization in tst_qtendian for MSVC2008. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This causes frequent compiler errors on Windows CE. tests\auto\corelib\global\qtendian\tst_qtendian.cpp(140) : fatal error C1001: An internal error has occurred in the compiler. (compiler file 'd:\orcas\compiler\utc\src\P2\main.c[0xCCCCCCCC:0xCCCCCCCC]', line 243) Task-number: QTBUG-37194 Change-Id: I2adbc1e3b1896fbe86780aa26a15e918333a09f2 Reviewed-by: Oliver Wolff Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/global/qtendian/qtendian.pro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/corelib/global/qtendian/qtendian.pro b/tests/auto/corelib/global/qtendian/qtendian.pro index 470a363c095..363b86988dc 100644 --- a/tests/auto/corelib/global/qtendian/qtendian.pro +++ b/tests/auto/corelib/global/qtendian/qtendian.pro @@ -2,4 +2,8 @@ CONFIG += testcase parallel_test TARGET = tst_qtendian QT = core testlib SOURCES = tst_qtendian.cpp +wince* { # QTBUG-37194 , internal compiler errors with MSVC2008 for Windows CE + QMAKE_CFLAGS_RELEASE -= -O2 + QMAKE_CXXFLAGS_RELEASE -= -O2 +} DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 From f59083636b89fc9b7983f9a0758a79f2980826dc Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 4 Mar 2014 10:56:51 +0100 Subject: [PATCH 034/172] Win32: define _HAS_EXCEPTIONS as 0 when exceptions are off. When this macro is not defined, a number of inline methods in the MSVC stl will throw exceptions. This in turn generates a warning when exceptions are not enabled on the compiler command-line. Change-Id: I5a57ec544bda0c75f04fdea9412b03107f9ff531 Reviewed-by: Joerg Bornemann --- mkspecs/win32-msvc2010/qmake.conf | 2 +- mkspecs/win32-msvc2012/qmake.conf | 2 +- mkspecs/win32-msvc2013/qmake.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mkspecs/win32-msvc2010/qmake.conf b/mkspecs/win32-msvc2010/qmake.conf index 7a06fe7aeed..ff4de22a95e 100644 --- a/mkspecs/win32-msvc2010/qmake.conf +++ b/mkspecs/win32-msvc2010/qmake.conf @@ -55,7 +55,7 @@ QMAKE_CXXFLAGS_STL_OFF = QMAKE_CXXFLAGS_RTTI_ON = -GR QMAKE_CXXFLAGS_RTTI_OFF = QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc -QMAKE_CXXFLAGS_EXCEPTIONS_OFF = +QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0 QMAKE_INCDIR = diff --git a/mkspecs/win32-msvc2012/qmake.conf b/mkspecs/win32-msvc2012/qmake.conf index 7582117f22f..7585c3300b3 100644 --- a/mkspecs/win32-msvc2012/qmake.conf +++ b/mkspecs/win32-msvc2012/qmake.conf @@ -55,7 +55,7 @@ QMAKE_CXXFLAGS_STL_OFF = QMAKE_CXXFLAGS_RTTI_ON = -GR QMAKE_CXXFLAGS_RTTI_OFF = QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc -QMAKE_CXXFLAGS_EXCEPTIONS_OFF = +QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0 QMAKE_INCDIR = diff --git a/mkspecs/win32-msvc2013/qmake.conf b/mkspecs/win32-msvc2013/qmake.conf index 61e4f48d6b2..5ce41b730b2 100644 --- a/mkspecs/win32-msvc2013/qmake.conf +++ b/mkspecs/win32-msvc2013/qmake.conf @@ -55,7 +55,7 @@ QMAKE_CXXFLAGS_STL_OFF = QMAKE_CXXFLAGS_RTTI_ON = -GR QMAKE_CXXFLAGS_RTTI_OFF = QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc -QMAKE_CXXFLAGS_EXCEPTIONS_OFF = +QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -D_HAS_EXCEPTIONS=0 QMAKE_INCDIR = From 10a5a0d7771a56462fe153d98dacbf862693ada4 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 4 Mar 2014 09:29:15 +0100 Subject: [PATCH 035/172] Doc: fix documentation of QProgressDialog::open The slot is connected to the canceled() signal and not to the accepted() signal since the introduction of the open method. Task-number: QTBUG-37210 Change-Id: I0604c612f6054611a69876d53908bb58ec048b09 Reviewed-by: Friedemann Kleint Reviewed-by: Oliver Wolff --- src/widgets/dialogs/qprogressdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index b5cc630bfe5..662504fc251 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -849,7 +849,7 @@ void QProgressDialog::forceShow() \since 4.5 \overload - Opens the dialog and connects its accepted() signal to the slot specified + Opens the dialog and connects its canceled() signal to the slot specified by \a receiver and \a member. The signal will be disconnected from the slot when the dialog is closed. From c85222304030a41ebf13f5947c16e5d779aafcc6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 4 Mar 2014 09:41:13 +0100 Subject: [PATCH 036/172] Doc: fix Q_ASSERT example Task-number: QTBUG-37162 Change-Id: Ifef8a976d29125251d7d87028c29deee4353e10a Reviewed-by: Friedemann Kleint Reviewed-by: Oliver Wolff --- src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp index 3a18eb8007e..b907c9acb10 100644 --- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp @@ -195,7 +195,7 @@ int divide(int a, int b) //! [18] -ASSERT: "b == 0" in file div.cpp, line 7 +ASSERT: "b != 0" in file div.cpp, line 7 //! [18] From bd2ef8028dbe25ae0fbd36bb99600e9136238425 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 28 Feb 2014 09:33:56 +0100 Subject: [PATCH 037/172] Android: Add commercial license to BSD-licensed files These files should also be usable under the commercial license terms as an alternative to the BSD license. Change-Id: If211bb63789722f655843831073ed05ee69811ea Reviewed-by: BogDan Vatra Reviewed-by: Lars Knoll --- .../src/org/kde/necessitas/ministro/IMinistro.aidl | 10 ++++++++++ .../org/kde/necessitas/ministro/IMinistroCallback.aidl | 10 ++++++++++ .../org/qtproject/qt5/android/bindings/QtActivity.java | 10 ++++++++++ .../qtproject/qt5/android/bindings/QtApplication.java | 10 ++++++++++ 4 files changed, 40 insertions(+) diff --git a/src/android/java/src/org/kde/necessitas/ministro/IMinistro.aidl b/src/android/java/src/org/kde/necessitas/ministro/IMinistro.aidl index 236a62f63e4..6c8af4f1395 100644 --- a/src/android/java/src/org/kde/necessitas/ministro/IMinistro.aidl +++ b/src/android/java/src/org/kde/necessitas/ministro/IMinistro.aidl @@ -2,6 +2,16 @@ Copyright (c) 2011-2013, BogDan Vatra Contact: http://www.qt-project.org/legal + Commercial License Usage + Licensees holding valid commercial Qt licenses may use this file in + accordance with the commercial license agreement provided with the + Software or, alternatively, in accordance with the terms contained in + a written agreement between you and Digia. For licensing terms and + conditions see http://qt.digia.com/licensing. For further information + use the contact form at http://qt.digia.com/contact-us. + + BSD License Usage + Alternatively, this file may be used under 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: diff --git a/src/android/java/src/org/kde/necessitas/ministro/IMinistroCallback.aidl b/src/android/java/src/org/kde/necessitas/ministro/IMinistroCallback.aidl index 0bcb5285b8b..82a18bb568e 100644 --- a/src/android/java/src/org/kde/necessitas/ministro/IMinistroCallback.aidl +++ b/src/android/java/src/org/kde/necessitas/ministro/IMinistroCallback.aidl @@ -2,6 +2,16 @@ Copyright (c) 2011-2013, BogDan Vatra Contact: http://www.qt-project.org/legal + Commercial License Usage + Licensees holding valid commercial Qt licenses may use this file in + accordance with the commercial license agreement provided with the + Software or, alternatively, in accordance with the terms contained in + a written agreement between you and Digia. For licensing terms and + conditions see http://qt.digia.com/licensing. For further information + use the contact form at http://qt.digia.com/contact-us. + + BSD License Usage + Alternatively, this file may be used under 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: diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index 3a0eaa77d62..edfd2d606d9 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -2,6 +2,16 @@ Copyright (c) 2012-2013, BogDan Vatra Contact: http://www.qt-project.org/legal + Commercial License Usage + Licensees holding valid commercial Qt licenses may use this file in + accordance with the commercial license agreement provided with the + Software or, alternatively, in accordance with the terms contained in + a written agreement between you and Digia. For licensing terms and + conditions see http://qt.digia.com/licensing. For further information + use the contact form at http://qt.digia.com/contact-us. + + BSD License Usage + Alternatively, this file may be used under 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: diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java index 4de1c833f5e..33485ac27bf 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtApplication.java @@ -2,6 +2,16 @@ Copyright (c) 2012-2013, BogDan Vatra Contact: http://www.qt-project.org/legal + Commercial License Usage + Licensees holding valid commercial Qt licenses may use this file in + accordance with the commercial license agreement provided with the + Software or, alternatively, in accordance with the terms contained in + a written agreement between you and Digia. For licensing terms and + conditions see http://qt.digia.com/licensing. For further information + use the contact form at http://qt.digia.com/contact-us. + + BSD License Usage + Alternatively, this file may be used under 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: From 0b4ea1ca9cff5eb398a6e473e9577b4de7d3b7c9 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 28 Feb 2014 11:08:48 +0100 Subject: [PATCH 038/172] Revert "Propagate synthesized mouse events in parallel (lock-step) with touch" This reverts commit 7808ec795c5831d56dae9c4f9f7e1306489864aa. The commit interferes with the mouse event synthesizing which was introduced in e50416066cab4be7df8382bd224d9e4ddd7a903a, and which claims to solve the same original problem: Synthesizing mouse events should be moved out from the platform plugin. The issue with 7808ec795c5831d56dae9c4f9f7e1306489864aa is that mouse events which are stolen by event filters will never get composed double click events (this is done in the QGuiApplication code), so double clicking on item views does not work with synthesized mouse events. This makes e.g.directory pickers unusable on a touch display. The test cases introduced in the original patch still pass. Task-number: QTBUG-36974 Change-Id: I0ec7c65d2a77589e60408623c2c0b20d427f0cfa Reviewed-by: Sean Harmer Reviewed-by: Friedemann Kleint Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qapplication.cpp | 94 ----------------------------- src/widgets/kernel/qapplication_p.h | 1 - 2 files changed, 95 deletions(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index c01b5350678..9e221c1bf41 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3277,30 +3277,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; #endif - - case QEvent::TouchUpdate: - case QEvent::TouchEnd: - { - QWidget *widget = static_cast(receiver); - QTouchEvent *touchEvent = static_cast(e); - const bool acceptTouchEvents = widget->testAttribute(Qt::WA_AcceptTouchEvents); - - if (e->type() != QEvent::TouchUpdate && acceptTouchEvents && e->spontaneous()) { - const QPoint localPos = touchEvent->touchPoints()[0].pos().toPoint(); - QApplicationPrivate::giveFocusAccordingToFocusPolicy(widget, e, localPos); - } - - touchEvent->setTarget(widget); - touchEvent->setAccepted(acceptTouchEvents); - - res = acceptTouchEvents && d->notify_helper(widget, touchEvent); - - // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. - if (!touchEvent->isAccepted() && QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled()) - res = d->translateTouchToMouse(widget, touchEvent); - break; - } - case QEvent::TouchBegin: // Note: TouchUpdate and TouchEnd events are never propagated { @@ -3321,15 +3297,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e) touchEvent->setAccepted(acceptTouchEvents); QPointer p = widget; res = acceptTouchEvents && d->notify_helper(widget, touchEvent); - - // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. - if (!touchEvent->isAccepted() && QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled()) { - res = d->translateTouchToMouse(widget, touchEvent); - eventAccepted = touchEvent->isAccepted(); - if (eventAccepted) - break; - } - eventAccepted = touchEvent->isAccepted(); if (p.isNull()) { // widget was deleted @@ -3892,67 +3859,6 @@ QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, return static_cast(closestTarget); } -class WidgetAttributeSaver -{ -public: - explicit WidgetAttributeSaver(QWidget *widget, Qt::WidgetAttribute attribute, bool forcedValue) - : m_widget(widget), - m_attribute(attribute), - m_savedValue(widget->testAttribute(attribute)) - { - widget->setAttribute(attribute, forcedValue); - } - - ~WidgetAttributeSaver() - { - m_widget->setAttribute(m_attribute, m_savedValue); - } - -private: - QWidget * const m_widget; - const Qt::WidgetAttribute m_attribute; - const bool m_savedValue; -}; - -bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *event) -{ - Q_FOREACH (const QTouchEvent::TouchPoint &p, event->touchPoints()) { - const QEvent::Type eventType = (p.state() & Qt::TouchPointPressed) ? QEvent::MouseButtonPress - : (p.state() & Qt::TouchPointReleased) ? QEvent::MouseButtonRelease - : (p.state() & Qt::TouchPointMoved) ? QEvent::MouseMove - : QEvent::None; - - if (eventType == QEvent::None) - continue; - - const QPoint pos = widget->mapFromGlobal(p.screenPos().toPoint()); - - QMouseEvent mouseEvent(eventType, pos, p.screenPos().toPoint(), - Qt::LeftButton, - (eventType == QEvent::MouseButtonRelease) ? Qt::NoButton : Qt::LeftButton, - event->modifiers()); - mouseEvent.setAccepted(true); - mouseEvent.setTimestamp(event->timestamp()); - - // Make sure our synthesized mouse event doesn't propagate - // we want to control the propagation ourself to get a chance to - // deliver a proper touch event higher up in the hierarchy if that - // widget doesn't pick up the mouse event either. - WidgetAttributeSaver saver(widget, Qt::WA_NoMousePropagation, true); - - // Note it has to be a spontaneous event if we want the focus management - // and input method support to behave properly. Quite some of the code - // related to those aspect check for the spontaneous flag. - const bool res = QCoreApplication::sendSpontaneousEvent(widget, &mouseEvent); - event->setAccepted(mouseEvent.isAccepted()); - - if (mouseEvent.isAccepted()) - return res; - } - - return false; -} - bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, QTouchDevice *device, const QList &touchPoints, diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 93c9ffe0024..0284a613d47 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -285,7 +285,6 @@ public: QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QPointF &screenPos); void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint); void removeTouchPoint(int touchPointId); - bool translateTouchToMouse(QWidget *widget, QTouchEvent *event); static bool translateRawTouchEvent(QWidget *widget, QTouchDevice *device, const QList &touchPoints, From 003a52cc4d37836f87712379a6819f8bf31bbce5 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 2 Mar 2014 04:11:27 +0200 Subject: [PATCH 039/172] Disable 'gsub' table check for AAT fonts on Mac In AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table. Change-Id: Ifa044c8e28c3f2aab0f57ba5e3e6b99ada84d37c Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index ed758f6f0f5..316b491e185 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -359,6 +359,15 @@ bool QFontEngine::supportsScript(QChar::Script script) const return true; } +#ifdef Q_OS_MAC + { + // in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table + uint len; + if (getSfntTableData(MAKE_TAG('m','o','r','t'), 0, &len) || getSfntTableData(MAKE_TAG('m','o','r','x'), 0, &len)) + return true; + } +#endif + #ifdef QT_ENABLE_HARFBUZZ_NG if (useHarfbuzzNG) { bool ret = false; From 57fbb550b14f25d42a6cf4b2d64937de1a4efdee Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 1 Mar 2014 11:58:03 +0100 Subject: [PATCH 040/172] Doc: fix documentation for QGraphicsScene::focusItemChanged() The name was misspelled in \fn. Change-Id: I09824b72423b116612ee6e1069793de95d76f883 Reviewed-by: Friedemann Kleint --- src/widgets/graphicsview/qgraphicsscene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 8a2437f8636..bccdb1fbaae 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -5451,7 +5451,7 @@ bool QGraphicsScene::focusNextPrevChild(bool next) */ /*! - \fn QGraphicsScene::focusChanged(QGraphicsItem *newFocusItem, QGraphicsItem *oldFocusItem, Qt::FocusReason reason) + \fn QGraphicsScene::focusItemChanged(QGraphicsItem *newFocusItem, QGraphicsItem *oldFocusItem, Qt::FocusReason reason) This signal is emitted by QGraphicsScene whenever focus changes in the scene (i.e., when an item gains or loses input focus, or when focus From f0d411cfbbfd463819e5456ec8ab695e990b56e4 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 1 Mar 2014 13:38:12 +0100 Subject: [PATCH 041/172] Doc: fix warning: No documentation for 'QApplication::palette()' Hide the forwarder function from QDoc. Change-Id: I2ea5cce0e68a5803cd4a24cefbbd50fc6c5ffb94 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qapplication.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index 9cd18d5cd9c..e72fe29bdb8 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -112,7 +112,7 @@ public: QT_DEPRECATED static inline void setGraphicsSystem(const QString &) {} #endif -#ifdef Q_NO_USING_KEYWORD +#if defined(Q_NO_USING_KEYWORD) && !defined(Q_QDOC) static QPalette palette() { return QGuiApplication::palette(); } #else using QGuiApplication::palette; From b22ef5966360b36d17cc38df16927d1637f05d08 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 3 Mar 2014 11:57:20 +0100 Subject: [PATCH 042/172] Remove use of templates in tst_qatomicinteger. MSVC 2008 is confused by TypeInStruct being a template, resulting in \tst_qatomicinteger.cpp(189) : error C2027: use of undefined type 'QStaticAssertFailure' with [ Test=false ] for int (and thus for all unsupported types). This appears to be a real Heisenbug-nature compiler bug as it can also be fixed by adding qDebug() << Q_ALIGNOF(TypeInStruct) before the static assert. Task-number: QTBUG-37195 Change-Id: Ib2b60f3c1ffeb0b8bdeb1fb0c659655ce4ab10d8 Reviewed-by: Thiago Macieira --- .../auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp index 6ddd2ff2335..6f8dc133251 100644 --- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp +++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp @@ -181,12 +181,12 @@ private Q_SLOTS: }; template inline void booleanHelper() { } -template struct TypeInStruct { T type; }; +struct TypeInStruct { TEST_TYPE type; }; void tst_QAtomicIntegerXX::static_checks() { Q_STATIC_ASSERT(sizeof(QAtomicInteger) == sizeof(T)); - Q_STATIC_ASSERT(Q_ALIGNOF(QAtomicInteger) == Q_ALIGNOF(TypeInStruct)); + Q_STATIC_ASSERT(Q_ALIGNOF(QAtomicInteger) == Q_ALIGNOF(TypeInStruct)); // statements with no effect (void) QAtomicInteger::isReferenceCountingNative(); From 21114bcc1f58696eef1164e6638d9f1bf7b700e2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 28 Feb 2014 17:10:55 +0100 Subject: [PATCH 043/172] Support QQuickWidget on Windows. Task-number: QTBUG-36887 Change-Id: Ifb03804e21fd82d7eae2942b9e8ca83f1bdb776c Reviewed-by: Paul Olav Tvete --- .../platforms/windows/qwindowsbackingstore.cpp | 13 +++++++++++++ .../platforms/windows/qwindowsbackingstore.h | 4 ++++ .../platforms/windows/qwindowsintegration.cpp | 2 ++ .../platforms/windows/qwindowsnativeinterface.cpp | 7 ++++++- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index f12c828d8a6..1abf4477098 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -203,4 +203,17 @@ HDC QWindowsBackingStore::getDC() const return 0; } +#ifndef QT_NO_OPENGL + +QImage QWindowsBackingStore::toImage() const +{ + if (m_image.isNull()) { + qCWarning(lcQpaBackingStore) <<__FUNCTION__ << "Image is null."; + return QImage(); + } + return m_image.data()->image(); +} + +#endif // !QT_NO_OPENGL + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.h b/src/plugins/platforms/windows/qwindowsbackingstore.h index b655aca8351..758f6c941f2 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.h +++ b/src/plugins/platforms/windows/qwindowsbackingstore.h @@ -67,6 +67,10 @@ public: HDC getDC() const; +#ifndef QT_NO_OPENGL + QImage toImage() const Q_DECL_OVERRIDE; +#endif + private: QScopedPointer m_image; }; diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 37358658458..2a7a275060f 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -245,6 +245,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case ForeignWindows: return true; + case RasterGLSurface: + return true; default: return QPlatformIntegration::hasCapability(cap); } diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index fb1b63084fb..f6d01d7ef7a 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -69,13 +69,18 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc QWindowsWindow *bw = static_cast(window->handle()); if (resource == "handle") return bw->handle(); - if (window->surfaceType() == QWindow::RasterSurface) { + switch (window->surfaceType()) { + case QWindow::RasterSurface: + case QWindow::RasterGLSurface: if (resource == "getDC") return bw->getDC(); if (resource == "releaseDC") { bw->releaseDC(); return 0; } + break; + case QWindow::OpenGLSurface: + break; } qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData()); return 0; From 26cf0f0d5a81907b5ee5c4ffb3aeb13c6d681d89 Mon Sep 17 00:00:00 2001 From: hjk Date: Sat, 23 Nov 2013 01:39:30 +0100 Subject: [PATCH 044/172] xcb: Rename main.cpp to xcbmain.cpp Files with same base name cause extra trouble for debuggers. It can be avoided here. Change-Id: I1b7a6f28ac41bacbfd2603feb8b786c31d3769e3 Reviewed-by: Friedemann Kleint Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/{main.cpp => qxcbmain.cpp} | 2 +- src/plugins/platforms/xcb/xcb-plugin.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/plugins/platforms/xcb/{main.cpp => qxcbmain.cpp} (99%) diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/qxcbmain.cpp similarity index 99% rename from src/plugins/platforms/xcb/main.cpp rename to src/plugins/platforms/xcb/qxcbmain.cpp index f21ea03cf53..54c1629bf08 100644 --- a/src/plugins/platforms/xcb/main.cpp +++ b/src/plugins/platforms/xcb/qxcbmain.cpp @@ -62,4 +62,4 @@ QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QT_END_NAMESPACE -#include "main.moc" +#include "qxcbmain.moc" diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 4727262f3f1..a2ae7e908cf 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -17,7 +17,7 @@ SOURCES = \ qxcbwindow.cpp \ qxcbbackingstore.cpp \ qxcbwmsupport.cpp \ - main.cpp \ + qxcbmain.cpp \ qxcbnativeinterface.cpp \ qxcbcursor.cpp \ qxcbimage.cpp \ From 6060dab13a3b3d0c3c5c3d45a1eb3273fb753313 Mon Sep 17 00:00:00 2001 From: Chris Colbert Date: Sun, 1 Dec 2013 16:47:30 -0500 Subject: [PATCH 045/172] Fix issue where revealed widget children do not receive paint event. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a child of a widget is spontaneously revealed due to a call to the parent 'resize' method, the child will not receive a paint event if it has the WA_StaticContents and WA_OpaquePaintEvent flags set. This is caused by the backing store being pre-emptively resized by the call to setGeometry_sys, which causes QWidgetBackingStore::sync to skip the block which handles the static contents. There doesn't appear to be any reason to preemptively resize the backing store, since it is always resized as-needed during the the 'sync' method. This change-set removes the code which preemptively resizes the backing store. Task-number: QTBUG-35282 Change-Id: Ie9942854ca5322dfe0f98ed8100810161576be80 Reviewed-by: Jørgen Lind Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidget_qpa.cpp | 11 --------- src/widgets/kernel/qwidgetbackingstore.cpp | 4 ++-- .../widgets/kernel/qwidget/tst_qwidget.cpp | 23 +++++++++++++++++++ 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index acd80afddbe..174b7eb5d54 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -549,12 +549,6 @@ void QWidgetPrivate::show_sys() window->resize(geomRect.size()); } - if (QBackingStore *store = q->backingStore()) { - if (store->size() != geomRect.size()) { - store->resize(geomRect.size()); - } - } - #ifndef QT_NO_CURSOR qt_qpa_set_cursor(q, false); // Needed in case cursor was set before show #endif @@ -762,11 +756,6 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); q->windowHandle()->setGeometry(QRect(posInNativeParent,r.size())); } - const QWidgetBackingStore *bs = maybeBackingStore(); - if (bs && bs->store) { - if (isResize) - bs->store->resize(r.size()); - } if (needsShow) show_sys(); diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index fe877758ef9..221e6825ed4 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -940,7 +940,7 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg } // Nothing to repaint. - if (!isDirty()) { + if (!isDirty() && store->size().isValid()) { qt_flush(exposedWidget, exposedRegion, store, tlw, tlwOffset, widgetTextures); return; } @@ -1035,7 +1035,7 @@ void QWidgetBackingStore::doSync() const QRect tlwRect(topLevelRect()); const QRect surfaceGeometry(tlwRect.topLeft(), store->size()); if ((fullUpdatePending || inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) { - if (hasStaticContents()) { + if (hasStaticContents() && !store->size().isEmpty() ) { // Repaint existing dirty area and newly visible area. const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); const QRegion staticRegion(staticContents(0, clipRect)); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 21e02860865..dd3d041f562 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -441,6 +441,8 @@ private slots: void mouseDoubleClickBubbling_QTBUG29680(); void largerThanScreen_QTBUG30142(); + void resizeStaticContentsChildWidget_QTBUG35282(); + private: bool ensureScreenSize(int width, int height); QWidget *testWidget; @@ -10220,5 +10222,26 @@ void tst_QWidget::largerThanScreen_QTBUG30142() QVERIFY(widget2.frameGeometry().x() >= 0); } +void tst_QWidget::resizeStaticContentsChildWidget_QTBUG35282() +{ + QWidget widget; + widget.resize(200,200); + + UpdateWidget childWidget(&widget); + childWidget.setAttribute(Qt::WA_StaticContents); + childWidget.setAttribute(Qt::WA_OpaquePaintEvent); + childWidget.setGeometry(250, 250, 500, 500); + + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QVERIFY(childWidget.numPaintEvents == 0); + childWidget.reset(); + + widget.resize(1000,1000); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QGuiApplication::sync(); + QVERIFY(childWidget.numPaintEvents >= 1); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" From 2a6c50aa26da831253bef6c623073a80e672d457 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 26 Feb 2014 15:07:10 +0100 Subject: [PATCH 046/172] Fix QDateEdit popup appearance on mac The WS/OS was obviously incorrect and the hack seems not to be needed any more. [ChangeLog][QtWidgets][Mac] Fixed incorrect appearance of QDateEdit with calendarPopup enabled. Task-number: QTBUG-36692 Change-Id: Ic62c9993dc13e783c00fcb56f75d92967eb5074d Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qmacstyle_mac.mm | 6 ------ src/widgets/widgets/qdatetimeedit.cpp | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index a8926e0ad0c..53568f3c53e 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -5827,12 +5827,6 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op switch (sc) { case SC_ComboBoxEditField:{ ret = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi); - // hack to posistion the edit feld correctly for QDateTimeEdits - // in calendarPopup mode. - if (qobject_cast(widget)) { - ret.moveTop(ret.top() - 2); - ret.setHeight(ret.height() +1); - } break; } case SC_ComboBoxArrow:{ ret = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi); diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 7a723c5f1f2..770c954c2a0 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -993,7 +993,7 @@ QSize QDateTimeEdit::sizeHint() const QSize hint(w, h); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if (d->calendarPopupEnabled()) { QStyleOptionComboBox opt; d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_ComboBox, &opt, hint, this); From d32a80dbee061a4842fcc3bd2a0208d521af4d9d Mon Sep 17 00:00:00 2001 From: David Fries Date: Tue, 4 Mar 2014 00:28:18 -0600 Subject: [PATCH 047/172] QTouchDevice Documentation grammar correction. Change-Id: I3b378f1c3df7210029cf82208c23b67b75c47021 Signed-off-by: David Fries Reviewed-by: Laszlo Agocs --- src/gui/kernel/qtouchdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp index 3ad4b4161e3..117f2c5e764 100644 --- a/src/gui/kernel/qtouchdevice.cpp +++ b/src/gui/kernel/qtouchdevice.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE /*! \class QTouchDevice - \brief The QTouchDevice class describes the device from with touch events originate. + \brief The QTouchDevice class describes the device from which touch events originate. \since 5.0 \ingroup touch \inmodule QtGui From 903953d69e490392031f7d04b2fbe96a0a17ac95 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 20 Feb 2014 16:49:29 +0100 Subject: [PATCH 048/172] iOS: prevent crash on iOS 5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some reason, the [] access into NSDictionary causes a crash on iOS 5. So instead use the API as listed in the documentation: objectForKey. Task-number: QTBUG-36532 Change-Id: I19fdf0f4ba1aebaf9477e2bd45040c389923605d Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index d426028c465..4fe2cae15e5 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -120,7 +120,7 @@ // For Qt applications we rotate the keyboard rect to align with the screen // orientation (which is the interface orientation of the root view controller). // For hybrid apps we follow native behavior, and return the rect unmodified: - CGRect keyboardFrame = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue]; + CGRect keyboardFrame = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; if (isQtApplication()) { UIView *view = m_viewController.view; return fromCGRect(CGRectOffset([view convertRect:keyboardFrame fromView:view.window], 0, -view.bounds.origin.y)); @@ -156,8 +156,8 @@ m_keyboardVisibleAndDocked = YES; m_keyboardEndRect = [self getKeyboardRect:notification]; if (!m_duration) { - m_duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; - m_curve = UIViewAnimationCurve([notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue] << 16); + m_duration = [[notification.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; + m_curve = UIViewAnimationCurve([[notification.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue] << 16); } m_context->scrollToCursor(); } From 14aae25d038d76cb650630d840fb52777f4fba25 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 4 Mar 2014 12:51:14 +0100 Subject: [PATCH 049/172] Vista Style: Fix menu item checkmark offset for QQuick Controls Change-Id: I8d4a8f0d3a079a5569f9442f8d6d523f05daca60 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qwindowsvistastyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index f93e9312dee..3d77e39ce80 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1283,7 +1283,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption } QRect vCheckRect = visualRect(option->direction, menuitem->rect, QRect(menuitem->rect.x(), - menuitem->rect.y(), checkcol - 6, menuitem->rect.height())); + menuitem->rect.y(), checkcol - (3 + menuitem->rect.x()), menuitem->rect.height())); if (act) { stateId = dis ? MBI_DISABLED : MBI_HOT; From 02b18343e104512979edcc5d9ffa97cc16fe5123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 28 Feb 2014 16:24:32 +0100 Subject: [PATCH 050/172] Fix crash in QSimpleDrag if drag wasn't started over a QWindow The code in QSimpleDrag::startDrag() checks for the validity of the current window before passing it on to QWindowSystemInterface::handleDrag(), and so should QSimpleDrag::cancel(). Change-Id: I2228d86ede2a0b8379a55000a5c1d830cab44d45 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qsimpledrag.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index f6912a2d577..dcf476e4fe0 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -324,9 +324,10 @@ void QSimpleDrag::startDrag() void QSimpleDrag::cancel() { QBasicDrag::cancel(); - if (drag()) + if (drag() && m_current_window) { QWindowSystemInterface::handleDrag(m_current_window, 0, QPoint(), Qt::IgnoreAction); - m_current_window = 0; + m_current_window = 0; + } } void QSimpleDrag::move(const QMouseEvent *me) From 276d633626ea9a52dc5d28b9dafbfa5345f35521 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Fri, 21 Feb 2014 22:31:51 +0800 Subject: [PATCH 051/172] Doc: Clarify QJsonValue::fromVariant() type conversions It wasn't obvious before that many QMetaType types get converted to the same QJsonValue type. Change-Id: I7bb02cb10b6c8a873e291cdf1e16c6c821d51208 Reviewed-by: Jerome Pasion Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/corelib/json/qjsonvalue.cpp | 52 +++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index 487a431b8f4..e5194f73367 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -343,18 +343,46 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other) The conversion will convert QVariant types as follows: - \list - \li QMetaType::Bool to Bool - \li QMetaType::Int - \li QMetaType::Double - \li QMetaType::LongLong - \li QMetaType::ULongLong - \li QMetaType::UInt to Double - \li QMetaType::QString to String - \li QMetaType::QStringList - \li QMetaType::QVariantList to Array - \li QMetaType::QVariantMap to Object - \endlist + \table + \header + \li Source type + \li Destination type + \row + \li + \list + \li QMetaType::Bool + \endlist + \li QJsonValue::Bool + \row + \li + \list + \li QMetaType::Int + \li QMetaType::UInt + \li QMetaType::LongLong + \li QMetaType::ULongLong + \li QMetaType::Double + \endlist + \li QJsonValue::Double + \row + \li + \list + \li QMetaType::QString + \endlist + \li QJsonValue::String + \row + \li + \list + \li QMetaType::QStringList + \li QMetaType::QVariantList + \endlist + \li QJsonValue::Array + \row + \li + \list + \li QMetaType::QVariantMap + \endlist + \li QJsonValue::Object + \endtable For all other QVariant types a conversion to a QString will be attempted. If the returned string is empty, a Null QJsonValue will be stored, otherwise a String value using the returned QString. From 10ad84d22350b19b1185ed2754eb3a2339504518 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Wed, 26 Feb 2014 22:54:54 +0800 Subject: [PATCH 052/172] Doc: Mention that QSortFilterProxyModel::lessThan() handles floats Change-Id: Iaf97d22fad3724d1910b18b6d38a06eae4c909ca Reviewed-by: Friedemann Kleint Reviewed-by: Jerome Pasion --- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 1e377abf3ea..55c4885d92c 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -2610,6 +2610,7 @@ void QSortFilterProxyModel::invalidateFilter() \li QMetaType::UInt \li QMetaType::LongLong \li QMetaType::ULongLong + \li QMetaType::Float \li QMetaType::Double \li QMetaType::QChar \li QMetaType::QDate From fe2ce05d23a52d27e50270d22eb9fff9ab091dd4 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Mon, 3 Mar 2014 10:47:49 +0800 Subject: [PATCH 053/172] Remove duplicated tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tst_QtJson::testValueSimple() tested bool and double values twice Change-Id: Ie6e58aab729c6ee20cb53d3b85746a05f7571f5e Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/json/tst_qtjson.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 6736a33405c..589978e1a4a 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -200,20 +200,6 @@ void tst_QtJson::testValueSimple() QCOMPARE(value.toBool(), false); QCOMPARE(value.toObject(), QJsonObject()); QCOMPARE(value.toArray(), QJsonArray()); - - value = true; - QCOMPARE(value.toDouble(), 0.); - QCOMPARE(value.toString(), QString()); - QCOMPARE(value.toBool(), true); - QCOMPARE(value.toObject(), QJsonObject()); - QCOMPARE(value.toArray(), QJsonArray()); - - value = 999.; - QCOMPARE(value.toDouble(), 999.); - QCOMPARE(value.toString(), QString()); - QCOMPARE(value.toBool(), false); - QCOMPARE(value.toObject(), QJsonObject()); - QCOMPARE(value.toArray(), QJsonArray()); } void tst_QtJson::testNumbers() From 4b2f35d04ca3c2e037b4d0edd8b2350051cc572c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 28 Feb 2014 17:03:57 +0100 Subject: [PATCH 054/172] Dynamic GL: remove exporting symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the opengl proxy for now. Later it will either be moved into a separate library or replaced by a QOpenGLFunctions-based approach. This means that the -opengl dynamic configuration is not usable for the time being. The rest of the enablers remain in place. The convenience function QOpenGLFunctions::isES() is now moved to QOpenGLContext and is changed to check the renderable type. This is extremely useful since besides supporting dynamic GL it solves also the problem of GL_ARB_ES2_compatibility (i.e. it triggers the real ES path when creating an ES-compatible context with a desktop OpenGL implementation). Task-number: QTBUG-36483 Task-number: QTBUG-37172 Change-Id: I045be3fc16e9043e1528cf48e6bf0903da4fa7ca Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- examples/opengl/contextinfo/widget.cpp | 4 +- src/gui/kernel/qopenglcontext.cpp | 76 +- src/gui/kernel/qopenglcontext.h | 12 + src/gui/opengl/qopenglbuffer.cpp | 2 +- src/gui/opengl/qopengldebug.cpp | 3 +- src/gui/opengl/qopenglengineshadermanager.cpp | 2 +- src/gui/opengl/qopenglframebufferobject.cpp | 14 +- src/gui/opengl/qopenglframebufferobject_p.h | 7 +- src/gui/opengl/qopenglfunctions.cpp | 94 +- src/gui/opengl/qopenglfunctions.h | 9 - src/gui/opengl/qopenglpaintengine.cpp | 10 +- src/gui/opengl/qopenglproxy_win.cpp | 4597 ----------------- src/gui/opengl/qopenglshaderprogram.cpp | 10 +- src/gui/opengl/qopengltexture.cpp | 32 +- src/gui/opengl/qopengltextureglyphcache.cpp | 6 +- src/gui/opengl/qopengltexturehelper.cpp | 9 +- src/gui/opengl/qopengltimerquery.cpp | 10 +- src/gui/opengl/qopenglvertexarrayobject.cpp | 4 +- src/gui/painting/qplatformbackingstore.cpp | 2 +- .../qglengineshadermanager.cpp | 2 +- .../qpaintengineex_opengl2.cpp | 12 +- .../qtextureglyphcache_gl.cpp | 4 +- src/opengl/qgl.cpp | 79 +- src/opengl/qgl_qpa.cpp | 2 +- src/opengl/qglbuffer.cpp | 2 +- src/opengl/qglframebufferobject.cpp | 14 +- src/opengl/qglframebufferobject_p.h | 4 +- src/opengl/qglfunctions.cpp | 8 +- src/opengl/qglpixelbuffer.cpp | 6 +- src/opengl/qglshaderprogram.cpp | 14 +- .../eglconvenience/qeglconvenience.cpp | 10 +- .../eglconvenience/qeglplatformcontext.cpp | 6 +- .../platforms/windows/qwindowsintegration.cpp | 7 +- .../windows/qwindowsnativeinterface.cpp | 4 +- .../platforms/windows/qwindowswindow.cpp | 2 +- tests/auto/opengl/qgl/tst_qgl.cpp | 8 +- .../opengl/qglfunctions/tst_qglfunctions.cpp | 2 +- .../auto/opengl/qglthreads/tst_qglthreads.cpp | 2 +- .../widgets/widgets/qmdiarea/tst_qmdiarea.cpp | 5 +- 39 files changed, 255 insertions(+), 4841 deletions(-) delete mode 100644 src/gui/opengl/qopenglproxy_win.cpp diff --git a/examples/opengl/contextinfo/widget.cpp b/examples/opengl/contextinfo/widget.cpp index 13cec3b3f8e..6d4b97ca8f0 100644 --- a/examples/opengl/contextinfo/widget.cpp +++ b/examples/opengl/contextinfo/widget.cpp @@ -337,9 +337,9 @@ void Widget::renderWindowReady() const char *gltype[] = { "Desktop", "GLES 2", "GLES 1" }; m_output->append(tr("\nQt OpenGL configuration: %1") - .arg(QString::fromLatin1(gltype[QOpenGLFunctions::platformGLType()]))); + .arg(QString::fromLatin1(gltype[QOpenGLContext::openGLModuleType()]))); m_output->append(tr("Qt OpenGL library handle: %1") - .arg(QString::number(qintptr(QOpenGLFunctions::platformGLHandle()), 16))); + .arg(QString::number(qintptr(QOpenGLContext::openGLModuleHandle()), 16))); QList extensionList = context->extensions().toList(); std::sort(extensionList.begin(), extensionList.end()); diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 72576637995..357beb4e245 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -338,7 +338,8 @@ int QOpenGLContextPrivate::maxTextureSize() glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + Q_Q(QOpenGLContext); + if (!q->isES()) { GLenum proxy = GL_PROXY_TEXTURE_2D; GLint size; @@ -643,8 +644,8 @@ QOpenGLFunctions *QOpenGLContext::functions() const QAbstractOpenGLFunctions *QOpenGLContext::versionFunctions(const QOpenGLVersionProfile &versionProfile) const { #ifndef QT_OPENGL_ES_2 - if (QOpenGLFunctions::isES()) { - qWarning("versionFunctions: Not supported on dynamic GL ES"); + if (isES()) { + qWarning("versionFunctions: Not supported on OpenGL ES"); return 0; } #endif // QT_OPENGL_ES_2 @@ -959,6 +960,75 @@ void QOpenGLContext::deleteQGLContext() } } +/*! + Returns the platform-specific handle for the OpenGL implementation that + is currently in use. (for example, a HMODULE on Windows) + + On platforms that do not use dynamic GL switch the return value is null. + + The library might be GL-only, meaning that windowing system interface + functions (for example EGL) may live in another, separate library. + + \sa openGLModuleType() + + \since 5.3 + */ +void *QOpenGLContext::openGLModuleHandle() +{ + return 0; +} + +/*! + \enum QOpenGLContext::OpenGLModuleType + This enum defines the type of the underlying OpenGL implementation. + + \value DesktopGL Desktop OpenGL + \value GLES2 OpenGL ES 2.0 or higher + \value GLES1 OpenGL ES 1.x + + \since 5.3 +*/ + +/*! + Returns the underlying OpenGL implementation type. + + On platforms where the OpenGL implementation is not dynamically + loaded, the return value is determined during compile time and never + changes. + + \note A desktop OpenGL implementation may be capable of creating + ES-compatible contexts too. Therefore in most cases it is more + appropriate to check QSurfaceFormat::renderableType() or using the + the convenience function isES(). + + \since 5.3 + */ +QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType() +{ +#if defined(QT_OPENGL_ES_2) + return GLES2; +#elif defined(QT_OPENGL_ES) + return GLES1; +#else + return DesktopGL; +#endif +} + +/*! + Returns true if the context is an OpenGL ES context. + + If the context has not yet been created, the result is based on the + requested format set via setFormat(). + + \sa create(), format(), setFormat() + + \since 5.3 + */ +bool QOpenGLContext::isES() const +{ + return format().renderableType() == QSurfaceFormat::OpenGLES; +} + /*! \internal */ diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index ce34a2d5a58..06a7b723b4a 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -192,6 +192,18 @@ public: QSet extensions() const; bool hasExtension(const QByteArray &extension) const; + static void *openGLModuleHandle(); + + enum OpenGLModuleType { + DesktopGL, + GLES2, + GLES1 + }; + + static OpenGLModuleType openGLModuleType(); + + bool isES() const; + Q_SIGNALS: void aboutToBeDestroyed(); diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp index a4c1e538ee8..fe121f126f3 100644 --- a/src/gui/opengl/qopenglbuffer.cpp +++ b/src/gui/opengl/qopenglbuffer.cpp @@ -333,7 +333,7 @@ void QOpenGLBuffer::destroy() bool QOpenGLBuffer::read(int offset, void *data, int count) { #if !defined(QT_OPENGL_ES) - if (QOpenGLFunctions::platformGLType() != QOpenGLFunctions::GLES1) { + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) { Q_D(QOpenGLBuffer); if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) return false; diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp index 2355d0a8a7c..cc6e945954e 100644 --- a/src/gui/opengl/qopengldebug.cpp +++ b/src/gui/opengl/qopengldebug.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include "qopengldebug.h" @@ -1370,7 +1369,7 @@ bool QOpenGLDebugLogger::initialize() // through wglGetProcAddress #if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2) { - HMODULE handle = static_cast(QOpenGLFunctions::platformGLHandle()); + HMODULE handle = static_cast(QOpenGLContext::openGLModuleHandle()); if (!handle) handle = GetModuleHandleA("opengl32.dll"); d->glGetPointerv = reinterpret_cast(GetProcAddress(handle, QByteArrayLiteral("glGetPointerv"))); diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp index 95bafb07d93..a1215acb7e6 100644 --- a/src/gui/opengl/qopenglengineshadermanager.cpp +++ b/src/gui/opengl/qopenglengineshadermanager.cpp @@ -164,7 +164,7 @@ QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context) code[NonPremultipliedImageSrcFragmentShader] = qopenglslNonPremultipliedImageSrcFragmentShader; code[CustomImageSrcFragmentShader] = qopenglslCustomSrcFragmentShader; // Calls "customShader", which must be appended code[SolidBrushSrcFragmentShader] = qopenglslSolidBrushSrcFragmentShader; - if (QOpenGLFunctions::isES()) + if (context->isES()) code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_ES; else code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader_desktop; diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 9953b4e889b..db1ea1b1a1f 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -590,7 +590,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer); Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer)); if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) { - if (QOpenGLFunctions::isES()) { + if (ctx->isES()) { if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_DEPTH_COMPONENT24, size.width(), size.height()); @@ -602,7 +602,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen GL_DEPTH_COMPONENT, size.width(), size.height()); } } else { - if (QOpenGLFunctions::isES()) { + if (ctx->isES()) { if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) { funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size.width(), size.height()); @@ -631,7 +631,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen #ifdef QT_OPENGL_ES GLenum storage = GL_STENCIL_INDEX8; #else - GLenum storage = QOpenGLFunctions::isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX; + GLenum storage = ctx->isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX; #endif if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) @@ -773,7 +773,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar Q_D(QOpenGLFramebufferObject); d->init(this, size, NoAttachment, target, #ifndef QT_OPENGL_ES_2 - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 + QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8 #else GL_RGBA #endif @@ -793,7 +793,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum Q_D(QOpenGLFramebufferObject); d->init(this, QSize(width, height), NoAttachment, target, #ifndef QT_OPENGL_ES_2 - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 + QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8 #else GL_RGBA #endif @@ -850,7 +850,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, Attach #ifdef QT_OPENGL_ES_2 internal_format = GL_RGBA; #else - internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8; #endif d->init(this, QSize(width, height), attachment, target, internal_format); } @@ -877,7 +877,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment #ifdef QT_OPENGL_ES_2 internal_format = GL_RGBA; #else - internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8; #endif d->init(this, size, attachment, target, internal_format); } diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h index f0e07f21195..bd830b38e98 100644 --- a/src/gui/opengl/qopenglframebufferobject_p.h +++ b/src/gui/opengl/qopenglframebufferobject_p.h @@ -70,7 +70,12 @@ public: mipmap(false) { #ifndef QT_OPENGL_ES_2 - internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + // There is nothing that says QOpenGLFramebufferObjectFormat needs a current + // context, so we need a fallback just to be safe, even though in pratice there + // will usually be a context current. + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + const bool isES = ctx ? ctx->isES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL; + internal_format = isES ? GL_RGBA : GL_RGBA8; #else internal_format = GL_RGBA; #endif diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 60743b3a277..9a52ae2a9f7 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -249,7 +249,9 @@ QOpenGLExtensions::QOpenGLExtensions(QOpenGLContext *context) static int qt_gl_resolve_features() { - if (QOpenGLFunctions::platformGLType() == QOpenGLFunctions::GLES2) { + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx->isES() && QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) { + // OpenGL ES 2 int features = QOpenGLFunctions::Multitexture | QOpenGLFunctions::Shaders | QOpenGLFunctions::Buffers | @@ -269,7 +271,8 @@ static int qt_gl_resolve_features() features |= QOpenGLFunctions::NPOTTextures | QOpenGLFunctions::NPOTTextureRepeat; return features; - } else if (QOpenGLFunctions::platformGLType() == QOpenGLFunctions::GLES1) { + } else if (ctx->isES()) { + // OpenGL ES 1 int features = QOpenGLFunctions::Multitexture | QOpenGLFunctions::Buffers | QOpenGLFunctions::CompressedTextures | @@ -289,6 +292,7 @@ static int qt_gl_resolve_features() features |= QOpenGLFunctions::NPOTTextures; return features; } else { + // OpenGL int features = 0; QSurfaceFormat format = QOpenGLContext::currentContext()->format(); QOpenGLExtensionMatcher extensions; @@ -352,7 +356,7 @@ static int qt_gl_resolve_extensions() if (extensionMatcher.match("GL_EXT_bgra")) extensions |= QOpenGLExtensions::BGRATextureFormat; - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::currentContext()->isES()) { if (extensionMatcher.match("GL_OES_mapbuffer")) extensions |= QOpenGLExtensions::MapBuffer; if (extensionMatcher.match("GL_OES_packed_depth_stencil")) @@ -2511,88 +2515,4 @@ QOpenGLExtensionsPrivate::QOpenGLExtensionsPrivate(QOpenGLContext *ctx) GetBufferSubData = qopenglfResolveGetBufferSubData; } -#if defined(QT_OPENGL_DYNAMIC) -extern int qgl_proxyLibraryType(void); -extern HMODULE qgl_glHandle(void); -#endif - -/*! - \enum QOpenGLFunctions::PlatformGLType - This enum defines the type of the underlying GL implementation. - - \value DesktopGL Desktop OpenGL - \value GLES2 OpenGL ES 2.0 or higher - \value GLES1 OpenGL ES 1.x - - \since 5.3 - */ - -/*! - \fn QOpenGLFunctions::isES() - - On platforms where the OpenGL implementation is dynamically loaded - this function returns true if the underlying GL implementation is - Open GL ES. - - On platforms that do not use runtime loading of the GL the return - value is based on Qt's compile-time configuration and will never - change during runtime. - - \sa platformGLType() - - \since 5.3 - */ - -/*! - Returns the underlying GL implementation type. - - On platforms where the OpenGL implementation is not dynamically - loaded, the return value is determined during compile time and never - changes. - - Platforms that use dynamic GL loading (e.g. Windows) cannot rely on - compile-time defines for differentiating between desktop and ES - OpenGL code. Instead, they rely on this function to query, during - runtime, the type of the loaded graphics library. - - \since 5.3 - */ -QOpenGLFunctions::PlatformGLType QOpenGLFunctions::platformGLType() -{ -#if defined(QT_OPENGL_DYNAMIC) - return PlatformGLType(qgl_proxyLibraryType()); -#elif defined(QT_OPENGL_ES_2) - return GLES2; -#elif defined(QT_OPENGL_ES) - return GLES1; -#else - return DesktopGL; -#endif -} - -/*! - Returns the platform-specific handle for the OpenGL implementation that - is currently in use. (for example, a HMODULE on Windows) - - On platforms that do not use dynamic GL switch the return value is null. - - The library might be GL-only, meaning that windowing system interface - functions (for example EGL) may live in another, separate library. - - Always use platformGLType() before resolving any functions to check if the - library implements desktop OpenGL or OpenGL ES. - - \sa platformGLType() - - \since 5.3 - */ -void *QOpenGLFunctions::platformGLHandle() -{ -#if defined(QT_OPENGL_DYNAMIC) - return qgl_glHandle(); -#else - return 0; -#endif -} - QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index 6d3f038004e..8b84a460a33 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -311,15 +311,6 @@ public: void glVertexAttrib4fv(GLuint indx, const GLfloat* values); void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); - enum PlatformGLType { - DesktopGL = 0, - GLES2, - GLES1 - }; - static PlatformGLType platformGLType(); - static void *platformGLHandle(); - static bool isES() { return platformGLType() != DesktopGL; } - protected: QOpenGLFunctionsPrivate *d_ptr; static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; } diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 63127668a5f..7fa80c5343c 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -221,7 +221,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture() currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); GLuint wrapMode = GL_REPEAT; - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::currentContext()->isES()) { // OpenGL ES does not support GL_REPEAT wrap modes for NPOT textures. So instead, // we emulate GL_REPEAT by only taking the fractional part of the texture coords // in the qopenglslTextureBrushSrcFragmentShader program. @@ -542,7 +542,7 @@ void QOpenGL2PaintEngineEx::beginNativePainting() d->funcs.glDisableVertexAttribArray(i); #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_ASSERT(QOpenGLContext::currentContext()); const QOpenGLContext *ctx = d->ctx; const QSurfaceFormat &fmt = d->device->context()->format(); @@ -600,7 +600,7 @@ void QOpenGL2PaintEngineExPrivate::resetGLState() setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false); setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false); setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { // gl_Color, corresponding to vertex attribute 3, may have been changed float color[] = { 1.0f, 1.0f, 1.0f, 1.0f }; funcs.glVertexAttrib4fv(3, color); @@ -1335,7 +1335,7 @@ void QOpenGL2PaintEngineEx::renderHintsChanged() state()->renderHintsChanged = true; #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { if ((state()->renderHints & QPainter::Antialiasing) || (state()->renderHints & QPainter::HighQualityAntialiasing)) glEnable(GL_MULTISAMPLE); @@ -2012,7 +2012,7 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev) d->glyphCacheFormat = QFontEngine::Format_A8; #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { glDisable(GL_MULTISAMPLE); d->glyphCacheFormat = QFontEngine::Format_A32; d->multisamplingAlwaysEnabled = false; diff --git a/src/gui/opengl/qopenglproxy_win.cpp b/src/gui/opengl/qopenglproxy_win.cpp deleted file mode 100644 index 88f3a1d11d4..00000000000 --- a/src/gui/opengl/qopenglproxy_win.cpp +++ /dev/null @@ -1,4597 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -// Must not include QOpenGLFunctions or anything that pulls in qopengl.h. -// Otherwise we end up with errors about inconsistent linkage. -#include -#include - -#if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) -# error "Proxy GL is not compatible with static ES builds" -#endif - -// This should not be an issue with the compilers used on Windows, but just in case: -#ifndef Q_COMPILER_VARIADIC_MACROS -# error "Proxy GL requires variadic macro support" -#endif - -// Disable inconsistent dll linkage warnings. gl.h and egl.h are included and these mark -// the egl and (w)gl functions as imported. We will mark them as exported. -#if defined(Q_CC_MSVC) -# pragma warning(disable : 4273) -#elif defined(Q_CC_MINGW) -# pragma GCC diagnostic ignored "-Wattributes" -#endif - -#ifdef Q_OS_WIN64 -typedef signed long long int khronos_intptr_t; -typedef signed long long int khronos_ssize_t; -#else -typedef signed long int khronos_intptr_t; -typedef signed long int khronos_ssize_t; -#endif - -typedef char GLchar; -typedef khronos_intptr_t GLintptr; -typedef khronos_ssize_t GLsizeiptr; - -Q_LOGGING_CATEGORY(qglLc, "qt.gui.openglproxy") - -class QAbstractWindowsOpenGL -{ -public: - QAbstractWindowsOpenGL(); - virtual ~QAbstractWindowsOpenGL() { } - - enum LibType { // must match QOpenGLFunctions::PlatformGLType - DesktopGL = 0, - GLES2 - }; - - LibType libraryType() const { return m_libraryType; } - HMODULE libraryHandle() const { return m_lib; } - bool functionsReady() const { return m_loaded; } - - // WGL - BOOL (WINAPI * CopyContext)(HGLRC src, HGLRC dst, UINT mask); - HGLRC (WINAPI * CreateContext)(HDC dc); - HGLRC (WINAPI * CreateLayerContext)(HDC dc, int plane); - BOOL (WINAPI * DeleteContext)(HGLRC context); - HGLRC (WINAPI * GetCurrentContext)(); - HDC (WINAPI * GetCurrentDC)(); - PROC (WINAPI * GetProcAddress)(LPCSTR name); - BOOL (WINAPI * MakeCurrent)(HDC dc, HGLRC context); - BOOL (WINAPI * ShareLists)(HGLRC context1, HGLRC context2); - BOOL (WINAPI * UseFontBitmapsW)(HDC dc, DWORD first, DWORD count, DWORD base); - BOOL (WINAPI * UseFontOutlinesW)(HDC dc, DWORD first, DWORD count, DWORD base, FLOAT deviation, - FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT gmf); - BOOL (WINAPI * DescribeLayerPlane)(HDC dc, int pixelFormat, int plane, UINT n, - LPLAYERPLANEDESCRIPTOR planeDescriptor); - int (WINAPI * SetLayerPaletteEntries)(HDC dc, int plane, int start, int entries, - CONST COLORREF *colors); - int (WINAPI * GetLayerPaletteEntries)(HDC dc, int plane, int start, int entries, - COLORREF *color); - BOOL (WINAPI * RealizeLayerPalette)(HDC dc, int plane, BOOL realize); - BOOL (WINAPI * SwapLayerBuffers)(HDC dc, UINT planes); - DWORD (WINAPI * SwapMultipleBuffers)(UINT n, CONST WGLSWAP *buffers); - - // EGL - EGLint (EGLAPIENTRY * EGL_GetError)(void); - EGLDisplay (EGLAPIENTRY * EGL_GetDisplay)(EGLNativeDisplayType display_id); - EGLBoolean (EGLAPIENTRY * EGL_Initialize)(EGLDisplay dpy, EGLint *major, EGLint *minor); - EGLBoolean (EGLAPIENTRY * EGL_Terminate)(EGLDisplay dpy); - const char * (EGLAPIENTRY * EGL_QueryString)(EGLDisplay dpy, EGLint name); - EGLBoolean (EGLAPIENTRY * EGL_GetConfigs)(EGLDisplay dpy, EGLConfig *configs, - EGLint config_size, EGLint *num_config); - EGLBoolean (EGLAPIENTRY * EGL_ChooseConfig)(EGLDisplay dpy, const EGLint *attrib_list, - EGLConfig *configs, EGLint config_size, - EGLint *num_config); - EGLBoolean (EGLAPIENTRY * EGL_GetConfigAttrib)(EGLDisplay dpy, EGLConfig config, - EGLint attribute, EGLint *value); - EGLSurface (EGLAPIENTRY * EGL_CreateWindowSurface)(EGLDisplay dpy, EGLConfig config, - EGLNativeWindowType win, - const EGLint *attrib_list); - EGLSurface (EGLAPIENTRY * EGL_CreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list); - EGLSurface (EGLAPIENTRY * EGL_CreatePixmapSurface)(EGLDisplay dpy, EGLConfig config, - EGLNativePixmapType pixmap, - const EGLint *attrib_list); - EGLBoolean (EGLAPIENTRY * EGL_DestroySurface)(EGLDisplay dpy, EGLSurface surface); - EGLBoolean (EGLAPIENTRY * EGL_QuerySurface)(EGLDisplay dpy, EGLSurface surface, - EGLint attribute, EGLint *value); - EGLBoolean (EGLAPIENTRY * EGL_BindAPI)(EGLenum api); - EGLenum (EGLAPIENTRY * EGL_QueryAPI)(void); - EGLBoolean (EGLAPIENTRY * EGL_WaitClient)(void); - EGLBoolean (EGLAPIENTRY * EGL_ReleaseThread)(void); - EGLSurface (EGLAPIENTRY * EGL_CreatePbufferFromClientBuffer)(EGLDisplay dpy, EGLenum buftype, - EGLClientBuffer buffer, - EGLConfig config, const EGLint *attrib_list); - EGLBoolean (EGLAPIENTRY * EGL_SurfaceAttrib)(EGLDisplay dpy, EGLSurface surface, - EGLint attribute, EGLint value); - EGLBoolean (EGLAPIENTRY * EGL_BindTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer); - EGLBoolean (EGLAPIENTRY * EGL_ReleaseTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer); - EGLBoolean (EGLAPIENTRY * EGL_SwapInterval)(EGLDisplay dpy, EGLint interval); - EGLContext (EGLAPIENTRY * EGL_CreateContext)(EGLDisplay dpy, EGLConfig config, - EGLContext share_context, - const EGLint *attrib_list); - EGLBoolean (EGLAPIENTRY * EGL_DestroyContext)(EGLDisplay dpy, EGLContext ctx); - EGLBoolean (EGLAPIENTRY * EGL_MakeCurrent)(EGLDisplay dpy, EGLSurface draw, - EGLSurface read, EGLContext ctx); - EGLContext (EGLAPIENTRY * EGL_GetCurrentContext)(void); - EGLSurface (EGLAPIENTRY * EGL_GetCurrentSurface)(EGLint readdraw); - EGLDisplay (EGLAPIENTRY * EGL_GetCurrentDisplay)(void); - EGLBoolean (EGLAPIENTRY * EGL_QueryContext)(EGLDisplay dpy, EGLContext ctx, - EGLint attribute, EGLint *value); - EGLBoolean (EGLAPIENTRY * EGL_WaitGL)(void); - EGLBoolean (EGLAPIENTRY * EGL_WaitNative)(EGLint engine); - EGLBoolean (EGLAPIENTRY * EGL_SwapBuffers)(EGLDisplay dpy, EGLSurface surface); - EGLBoolean (EGLAPIENTRY * EGL_CopyBuffers)(EGLDisplay dpy, EGLSurface surface, - EGLNativePixmapType target); - __eglMustCastToProperFunctionPointerType (EGLAPIENTRY * EGL_GetProcAddress)(const char *procname); - - // OpenGL 1.0 - void (APIENTRY * Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY * DepthRange)(GLdouble nearVal, GLdouble farVal); - GLboolean (APIENTRY * IsEnabled)(GLenum cap); - void (APIENTRY * GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params); - void (APIENTRY * GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat *params); - void (APIENTRY * GetTexParameteriv)(GLenum target, GLenum pname, GLint *params); - void (APIENTRY * GetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY * GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); - const GLubyte * (APIENTRY * GetString)(GLenum name); - void (APIENTRY * GetIntegerv)(GLenum pname, GLint *params); - void (APIENTRY * GetFloatv)(GLenum pname, GLfloat *params); - GLenum (APIENTRY * GetError)(); - void (APIENTRY * GetDoublev)(GLenum pname, GLdouble *params); - void (APIENTRY * GetBooleanv)(GLenum pname, GLboolean *params); - void (APIENTRY * ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); - void (APIENTRY * ReadBuffer)(GLenum mode); - void (APIENTRY * PixelStorei)(GLenum pname, GLint param); - void (APIENTRY * PixelStoref)(GLenum pname, GLfloat param); - void (APIENTRY * DepthFunc)(GLenum func); - void (APIENTRY * StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); - void (APIENTRY * StencilFunc)(GLenum func, GLint ref, GLuint mask); - void (APIENTRY * LogicOp)(GLenum opcode); - void (APIENTRY * BlendFunc)(GLenum sfactor, GLenum dfactor); - void (APIENTRY * Flush)(); - void (APIENTRY * Finish)(); - void (APIENTRY * Enable)(GLenum cap); - void (APIENTRY * Disable)(GLenum cap); - void (APIENTRY * DepthMask)(GLboolean flag); - void (APIENTRY * ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - void (APIENTRY * StencilMask)(GLuint mask); - void (APIENTRY * ClearDepth)(GLdouble depth); - void (APIENTRY * ClearStencil)(GLint s); - void (APIENTRY * ClearColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - void (APIENTRY * Clear)(GLbitfield mask); - void (APIENTRY * DrawBuffer)(GLenum mode); - void (APIENTRY * TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY * TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY * TexParameteriv)(GLenum target, GLenum pname, const GLint *params); - void (APIENTRY * TexParameteri)(GLenum target, GLenum pname, GLint param); - void (APIENTRY * TexParameterfv)(GLenum target, GLenum pname, const GLfloat *params); - void (APIENTRY * TexParameterf)(GLenum target, GLenum pname, GLfloat param); - void (APIENTRY * Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY * PolygonMode)(GLenum face, GLenum mode); - void (APIENTRY * PointSize)(GLfloat size); - void (APIENTRY * LineWidth)(GLfloat width); - void (APIENTRY * Hint)(GLenum target, GLenum mode); - void (APIENTRY * FrontFace)(GLenum mode); - void (APIENTRY * CullFace)(GLenum mode); - - void (APIENTRY * Translatef)(GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * Translated)(GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY * Scalef)(GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * Scaled)(GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY * Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY * PushMatrix)(); - void (APIENTRY * PopMatrix)(); - void (APIENTRY * Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); - void (APIENTRY * MultMatrixd)(const GLdouble *m); - void (APIENTRY * MultMatrixf)(const GLfloat *m); - void (APIENTRY * MatrixMode)(GLenum mode); - void (APIENTRY * LoadMatrixd)(const GLdouble *m); - void (APIENTRY * LoadMatrixf)(const GLfloat *m); - void (APIENTRY * LoadIdentity)(); - void (APIENTRY * Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); - GLboolean (APIENTRY * IsList)(GLuint list); - void (APIENTRY * GetTexGeniv)(GLenum coord, GLenum pname, GLint *params); - void (APIENTRY * GetTexGenfv)(GLenum coord, GLenum pname, GLfloat *params); - void (APIENTRY * GetTexGendv)(GLenum coord, GLenum pname, GLdouble *params); - void (APIENTRY * GetTexEnviv)(GLenum target, GLenum pname, GLint *params); - void (APIENTRY * GetTexEnvfv)(GLenum target, GLenum pname, GLfloat *params); - void (APIENTRY * GetPolygonStipple)(GLubyte *mask); - void (APIENTRY * GetPixelMapusv)(GLenum map, GLushort *values); - void (APIENTRY * GetPixelMapuiv)(GLenum map, GLuint *values); - void (APIENTRY * GetPixelMapfv)(GLenum map, GLfloat *values); - void (APIENTRY * GetMaterialiv)(GLenum face, GLenum pname, GLint *params); - void (APIENTRY * GetMaterialfv)(GLenum face, GLenum pname, GLfloat *params); - void (APIENTRY * GetMapiv)(GLenum target, GLenum query, GLint *v); - void (APIENTRY * GetMapfv)(GLenum target, GLenum query, GLfloat *v); - void (APIENTRY * GetMapdv)(GLenum target, GLenum query, GLdouble *v); - void (APIENTRY * GetLightiv)(GLenum light, GLenum pname, GLint *params); - void (APIENTRY * GetLightfv)(GLenum light, GLenum pname, GLfloat *params); - void (APIENTRY * GetClipPlane)(GLenum plane, GLdouble *equation); - void (APIENTRY * DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY * CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); - void (APIENTRY * PixelMapusv)(GLenum map, GLint mapsize, const GLushort *values); - void (APIENTRY * PixelMapuiv)(GLenum map, GLint mapsize, const GLuint *values); - void (APIENTRY * PixelMapfv)(GLenum map, GLint mapsize, const GLfloat *values); - void (APIENTRY * PixelTransferi)(GLenum pname, GLint param); - void (APIENTRY * PixelTransferf)(GLenum pname, GLfloat param); - void (APIENTRY * PixelZoom)(GLfloat xfactor, GLfloat yfactor); - void (APIENTRY * AlphaFunc)(GLenum func, GLfloat ref); - void (APIENTRY * EvalPoint2)(GLint i, GLint j); - void (APIENTRY * EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); - void (APIENTRY * EvalPoint1)(GLint i); - void (APIENTRY * EvalMesh1)(GLenum mode, GLint i1, GLint i2); - void (APIENTRY * EvalCoord2fv)(const GLfloat *u); - void (APIENTRY * EvalCoord2f)(GLfloat u, GLfloat v); - void (APIENTRY * EvalCoord2dv)(const GLdouble *u); - void (APIENTRY * EvalCoord2d)(GLdouble u, GLdouble v); - void (APIENTRY * EvalCoord1fv)(const GLfloat *u); - void (APIENTRY * EvalCoord1f)(GLfloat u); - void (APIENTRY * EvalCoord1dv)(const GLdouble *u); - void (APIENTRY * EvalCoord1d)(GLdouble u); - void (APIENTRY * MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); - void (APIENTRY * MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); - void (APIENTRY * MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); - void (APIENTRY * MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); - void (APIENTRY * Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); - void (APIENTRY * Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); - void (APIENTRY * Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); - void (APIENTRY * Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); - void (APIENTRY * PushAttrib)(GLbitfield mask); - void (APIENTRY * PopAttrib)(); - void (APIENTRY * Accum)(GLenum op, GLfloat value); - void (APIENTRY * IndexMask)(GLuint mask); - void (APIENTRY * ClearIndex)(GLfloat c); - void (APIENTRY * ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - void (APIENTRY * PushName)(GLuint name); - void (APIENTRY * PopName)(); - void (APIENTRY * PassThrough)(GLfloat token); - void (APIENTRY * LoadName)(GLuint name); - void (APIENTRY * InitNames)(); - GLint (APIENTRY * RenderMode)(GLenum mode); - void (APIENTRY * SelectBuffer)(GLsizei size, GLuint *buffer); - void (APIENTRY * FeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer); - void (APIENTRY * TexGeniv)(GLenum coord, GLenum pname, const GLint *params); - void (APIENTRY * TexGeni)(GLenum coord, GLenum pname, GLint param); - void (APIENTRY * TexGenfv)(GLenum coord, GLenum pname, const GLfloat *params); - void (APIENTRY * TexGenf)(GLenum coord, GLenum pname, GLfloat param); - void (APIENTRY * TexGendv)(GLenum coord, GLenum pname, const GLdouble *params); - void (APIENTRY * TexGend)(GLenum coord, GLenum pname, GLdouble param); - void (APIENTRY * TexEnviv)(GLenum target, GLenum pname, const GLint *params); - void (APIENTRY * TexEnvi)(GLenum target, GLenum pname, GLint param); - void (APIENTRY * TexEnvfv)(GLenum target, GLenum pname, const GLfloat *params); - void (APIENTRY * TexEnvf)(GLenum target, GLenum pname, GLfloat param); - void (APIENTRY * ShadeModel)(GLenum mode); - void (APIENTRY * PolygonStipple)(const GLubyte *mask); - void (APIENTRY * Materialiv)(GLenum face, GLenum pname, const GLint *params); - void (APIENTRY * Materiali)(GLenum face, GLenum pname, GLint param); - void (APIENTRY * Materialfv)(GLenum face, GLenum pname, const GLfloat *params); - void (APIENTRY * Materialf)(GLenum face, GLenum pname, GLfloat param); - void (APIENTRY * LineStipple)(GLint factor, GLushort pattern); - void (APIENTRY * LightModeliv)(GLenum pname, const GLint *params); - void (APIENTRY * LightModeli)(GLenum pname, GLint param); - void (APIENTRY * LightModelfv)(GLenum pname, const GLfloat *params); - void (APIENTRY * LightModelf)(GLenum pname, GLfloat param); - void (APIENTRY * Lightiv)(GLenum light, GLenum pname, const GLint *params); - void (APIENTRY * Lighti)(GLenum light, GLenum pname, GLint param); - void (APIENTRY * Lightfv)(GLenum light, GLenum pname, const GLfloat *params); - void (APIENTRY * Lightf)(GLenum light, GLenum pname, GLfloat param); - void (APIENTRY * Fogiv)(GLenum pname, const GLint *params); - void (APIENTRY * Fogi)(GLenum pname, GLint param); - void (APIENTRY * Fogfv)(GLenum pname, const GLfloat *params); - void (APIENTRY * Fogf)(GLenum pname, GLfloat param); - void (APIENTRY * ColorMaterial)(GLenum face, GLenum mode); - void (APIENTRY * ClipPlane)(GLenum plane, const GLdouble *equation); - void (APIENTRY * Vertex4sv)(const GLshort *v); - void (APIENTRY * Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); - void (APIENTRY * Vertex4iv)(const GLint *v); - void (APIENTRY * Vertex4i)(GLint x, GLint y, GLint z, GLint w); - void (APIENTRY * Vertex4fv)(const GLfloat *v); - void (APIENTRY * Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY * Vertex4dv)(const GLdouble *v); - void (APIENTRY * Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY * Vertex3sv)(const GLshort *v); - void (APIENTRY * Vertex3s)(GLshort x, GLshort y, GLshort z); - void (APIENTRY * Vertex3iv)(const GLint *v); - void (APIENTRY * Vertex3i)(GLint x, GLint y, GLint z); - void (APIENTRY * Vertex3fv)(const GLfloat *v); - void (APIENTRY * Vertex3f)(GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * Vertex3dv)(const GLdouble *v); - void (APIENTRY * Vertex3d)(GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY * Vertex2sv)(const GLshort *v); - void (APIENTRY * Vertex2s)(GLshort x, GLshort y); - void (APIENTRY * Vertex2iv)(const GLint *v); - void (APIENTRY * Vertex2i)(GLint x, GLint y); - void (APIENTRY * Vertex2fv)(const GLfloat *v); - void (APIENTRY * Vertex2f)(GLfloat x, GLfloat y); - void (APIENTRY * Vertex2dv)(const GLdouble *v); - void (APIENTRY * Vertex2d)(GLdouble x, GLdouble y); - void (APIENTRY * TexCoord4sv)(const GLshort *v); - void (APIENTRY * TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); - void (APIENTRY * TexCoord4iv)(const GLint *v); - void (APIENTRY * TexCoord4i)(GLint s, GLint t, GLint r, GLint q); - void (APIENTRY * TexCoord4fv)(const GLfloat *v); - void (APIENTRY * TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); - void (APIENTRY * TexCoord4dv)(const GLdouble *v); - void (APIENTRY * TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); - void (APIENTRY * TexCoord3sv)(const GLshort *v); - void (APIENTRY * TexCoord3s)(GLshort s, GLshort t, GLshort r); - void (APIENTRY * TexCoord3iv)(const GLint *v); - void (APIENTRY * TexCoord3i)(GLint s, GLint t, GLint r); - void (APIENTRY * TexCoord3fv)(const GLfloat *v); - void (APIENTRY * TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); - void (APIENTRY * TexCoord3dv)(const GLdouble *v); - void (APIENTRY * TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); - void (APIENTRY * TexCoord2sv)(const GLshort *v); - void (APIENTRY * TexCoord2s)(GLshort s, GLshort t); - void (APIENTRY * TexCoord2iv)(const GLint *v); - void (APIENTRY * TexCoord2i)(GLint s, GLint t); - void (APIENTRY * TexCoord2fv)(const GLfloat *v); - void (APIENTRY * TexCoord2f)(GLfloat s, GLfloat t); - void (APIENTRY * TexCoord2dv)(const GLdouble *v); - void (APIENTRY * TexCoord2d)(GLdouble s, GLdouble t); - void (APIENTRY * TexCoord1sv)(const GLshort *v); - void (APIENTRY * TexCoord1s)(GLshort s); - void (APIENTRY * TexCoord1iv)(const GLint *v); - void (APIENTRY * TexCoord1i)(GLint s); - void (APIENTRY * TexCoord1fv)(const GLfloat *v); - void (APIENTRY * TexCoord1f)(GLfloat s); - void (APIENTRY * TexCoord1dv)(const GLdouble *v); - void (APIENTRY * TexCoord1d)(GLdouble s); - void (APIENTRY * Rectsv)(const GLshort *v1, const GLshort *v2); - void (APIENTRY * Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); - void (APIENTRY * Rectiv)(const GLint *v1, const GLint *v2); - void (APIENTRY * Recti)(GLint x1, GLint y1, GLint x2, GLint y2); - void (APIENTRY * Rectfv)(const GLfloat *v1, const GLfloat *v2); - void (APIENTRY * Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); - void (APIENTRY * Rectdv)(const GLdouble *v1, const GLdouble *v2); - void (APIENTRY * Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); - void (APIENTRY * RasterPos4sv)(const GLshort *v); - void (APIENTRY * RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); - void (APIENTRY * RasterPos4iv)(const GLint *v); - void (APIENTRY * RasterPos4i)(GLint x, GLint y, GLint z, GLint w); - void (APIENTRY * RasterPos4fv)(const GLfloat *v); - void (APIENTRY * RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY * RasterPos4dv)(const GLdouble *v); - void (APIENTRY * RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void (APIENTRY * RasterPos3sv)(const GLshort *v); - void (APIENTRY * RasterPos3s)(GLshort x, GLshort y, GLshort z); - void (APIENTRY * RasterPos3iv)(const GLint *v); - void (APIENTRY * RasterPos3i)(GLint x, GLint y, GLint z); - void (APIENTRY * RasterPos3fv)(const GLfloat *v); - void (APIENTRY * RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * RasterPos3dv)(const GLdouble *v); - void (APIENTRY * RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); - void (APIENTRY * RasterPos2sv)(const GLshort *v); - void (APIENTRY * RasterPos2s)(GLshort x, GLshort y); - void (APIENTRY * RasterPos2iv)(const GLint *v); - void (APIENTRY * RasterPos2i)(GLint x, GLint y); - void (APIENTRY * RasterPos2fv)(const GLfloat *v); - void (APIENTRY * RasterPos2f)(GLfloat x, GLfloat y); - void (APIENTRY * RasterPos2dv)(const GLdouble *v); - void (APIENTRY * RasterPos2d)(GLdouble x, GLdouble y); - void (APIENTRY * Normal3sv)(const GLshort *v); - void (APIENTRY * Normal3s)(GLshort nx, GLshort ny, GLshort nz); - void (APIENTRY * Normal3iv)(const GLint *v); - void (APIENTRY * Normal3i)(GLint nx, GLint ny, GLint nz); - void (APIENTRY * Normal3fv)(const GLfloat *v); - void (APIENTRY * Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); - void (APIENTRY * Normal3dv)(const GLdouble *v); - void (APIENTRY * Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); - void (APIENTRY * Normal3bv)(const GLbyte *v); - void (APIENTRY * Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); - void (APIENTRY * Indexsv)(const GLshort *c); - void (APIENTRY * Indexs)(GLshort c); - void (APIENTRY * Indexiv)(const GLint *c); - void (APIENTRY * Indexi)(GLint c); - void (APIENTRY * Indexfv)(const GLfloat *c); - void (APIENTRY * Indexf)(GLfloat c); - void (APIENTRY * Indexdv)(const GLdouble *c); - void (APIENTRY * Indexd)(GLdouble c); - void (APIENTRY * End)(); - void (APIENTRY * EdgeFlagv)(const GLboolean *flag); - void (APIENTRY * EdgeFlag)(GLboolean flag); - void (APIENTRY * Color4usv)(const GLushort *v); - void (APIENTRY * Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); - void (APIENTRY * Color4uiv)(const GLuint *v); - void (APIENTRY * Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); - void (APIENTRY * Color4ubv)(const GLubyte *v); - void (APIENTRY * Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); - void (APIENTRY * Color4sv)(const GLshort *v); - void (APIENTRY * Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); - void (APIENTRY * Color4iv)(const GLint *v); - void (APIENTRY * Color4i)(GLint red, GLint green, GLint blue, GLint alpha); - void (APIENTRY * Color4fv)(const GLfloat *v); - void (APIENTRY * Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - void (APIENTRY * Color4dv)(const GLdouble *v); - void (APIENTRY * Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); - void (APIENTRY * Color4bv)(const GLbyte *v); - void (APIENTRY * Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); - void (APIENTRY * Color3usv)(const GLushort *v); - void (APIENTRY * Color3us)(GLushort red, GLushort green, GLushort blue); - void (APIENTRY * Color3uiv)(const GLuint *v); - void (APIENTRY * Color3ui)(GLuint red, GLuint green, GLuint blue); - void (APIENTRY * Color3ubv)(const GLubyte *v); - void (APIENTRY * Color3ub)(GLubyte red, GLubyte green, GLubyte blue); - void (APIENTRY * Color3sv)(const GLshort *v); - void (APIENTRY * Color3s)(GLshort red, GLshort green, GLshort blue); - void (APIENTRY * Color3iv)(const GLint *v); - void (APIENTRY * Color3i)(GLint red, GLint green, GLint blue); - void (APIENTRY * Color3fv)(const GLfloat *v); - void (APIENTRY * Color3f)(GLfloat red, GLfloat green, GLfloat blue); - void (APIENTRY * Color3dv)(const GLdouble *v); - void (APIENTRY * Color3d)(GLdouble red, GLdouble green, GLdouble blue); - void (APIENTRY * Color3bv)(const GLbyte *v); - void (APIENTRY * Color3b)(GLbyte red, GLbyte green, GLbyte blue); - void (APIENTRY * Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); - void (APIENTRY * Begin)(GLenum mode); - void (APIENTRY * ListBase)(GLuint base); - GLuint (APIENTRY * GenLists)(GLsizei range); - void (APIENTRY * DeleteLists)(GLuint list, GLsizei range); - void (APIENTRY * CallLists)(GLsizei n, GLenum type, const GLvoid *lists); - void (APIENTRY * CallList)(GLuint list); - void (APIENTRY * EndList)(); - void (APIENTRY * NewList)(GLuint list, GLenum mode); - - // OpenGL 1.1 - void (APIENTRY * Indexubv)(const GLubyte *c); - void (APIENTRY * Indexub)(GLubyte c); - GLboolean (APIENTRY * IsTexture)(GLuint texture); - void (APIENTRY * GenTextures)(GLsizei n, GLuint *textures); - void (APIENTRY * DeleteTextures)(GLsizei n, const GLuint *textures); - void (APIENTRY * BindTexture)(GLenum target, GLuint texture); - void (APIENTRY * TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY * TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); - void (APIENTRY * CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); - void (APIENTRY * CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); - void (APIENTRY * CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); - void (APIENTRY * CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); - void (APIENTRY * PolygonOffset)(GLfloat factor, GLfloat units); - void (APIENTRY * GetPointerv)(GLenum pname, GLvoid* *params); - void (APIENTRY * DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); - void (APIENTRY * DrawArrays)(GLenum mode, GLint first, GLsizei count); - - void (APIENTRY * PushClientAttrib)(GLbitfield mask); - void (APIENTRY * PopClientAttrib)(); - void (APIENTRY * PrioritizeTextures)(GLsizei n, const GLuint *textures, const GLfloat *priorities); - GLboolean (APIENTRY * AreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences); - void (APIENTRY * VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY * TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY * NormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY * InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer); - void (APIENTRY * IndexPointer)(GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY * EnableClientState)(GLenum array); - void (APIENTRY * EdgeFlagPointer)(GLsizei stride, const GLvoid *pointer); - void (APIENTRY * DisableClientState)(GLenum array); - void (APIENTRY * ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - void (APIENTRY * ArrayElement)(GLint i); - - // OpenGL ES 2.0 - void (APIENTRY * ActiveTexture)(GLenum texture); - void (APIENTRY * AttachShader)(GLuint program, GLuint shader); - void (APIENTRY * BindAttribLocation)(GLuint program, GLuint index, const GLchar* name); - void (APIENTRY * BindBuffer)(GLenum target, GLuint buffer); - void (APIENTRY * BindFramebuffer)(GLenum target, GLuint framebuffer); - void (APIENTRY * BindRenderbuffer)(GLenum target, GLuint renderbuffer); - void (APIENTRY * BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void (APIENTRY * BlendEquation)(GLenum mode); - void (APIENTRY * BlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha); - void (APIENTRY * BlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); - void (APIENTRY * BufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); - void (APIENTRY * BufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); - GLenum (APIENTRY * CheckFramebufferStatus)(GLenum target); - void (APIENTRY * ClearDepthf)(GLclampf depth); - void (APIENTRY * CompileShader)(GLuint shader); - void (APIENTRY * CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); - void (APIENTRY * CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); - GLuint (APIENTRY * CreateProgram)(void); - GLuint (APIENTRY * CreateShader)(GLenum type); - void (APIENTRY * DeleteBuffers)(GLsizei n, const GLuint* buffers); - void (APIENTRY * DeleteFramebuffers)(GLsizei n, const GLuint* framebuffers); - void (APIENTRY * DeleteProgram)(GLuint program); - void (APIENTRY * DeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers); - void (APIENTRY * DeleteShader)(GLuint shader); - void (APIENTRY * DepthRangef)(GLclampf zNear, GLclampf zFar); - void (APIENTRY * DetachShader)(GLuint program, GLuint shader); - void (APIENTRY * DisableVertexAttribArray)(GLuint index); - void (APIENTRY * EnableVertexAttribArray)(GLuint index); - void (APIENTRY * FramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); - void (APIENTRY * FramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); - void (APIENTRY * GenBuffers)(GLsizei n, GLuint* buffers); - void (APIENTRY * GenerateMipmap)(GLenum target); - void (APIENTRY * GenFramebuffers)(GLsizei n, GLuint* framebuffers); - void (APIENTRY * GenRenderbuffers)(GLsizei n, GLuint* renderbuffers); - void (APIENTRY * GetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); - void (APIENTRY * GetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); - void (APIENTRY * GetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); - int (APIENTRY * GetAttribLocation)(GLuint program, const GLchar* name); - void (APIENTRY * GetBufferParameteriv)(GLenum target, GLenum pname, GLint* params); - void (APIENTRY * GetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params); - void (APIENTRY * GetProgramiv)(GLuint program, GLenum pname, GLint* params); - void (APIENTRY * GetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); - void (APIENTRY * GetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params); - void (APIENTRY * GetShaderiv)(GLuint shader, GLenum pname, GLint* params); - void (APIENTRY * GetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); - void (APIENTRY * GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); - void (APIENTRY * GetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); - void (APIENTRY * GetUniformfv)(GLuint program, GLint location, GLfloat* params); - void (APIENTRY * GetUniformiv)(GLuint program, GLint location, GLint* params); - int (APIENTRY * GetUniformLocation)(GLuint program, const GLchar* name); - void (APIENTRY * GetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params); - void (APIENTRY * GetVertexAttribiv)(GLuint index, GLenum pname, GLint* params); - void (APIENTRY * GetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid** pointer); - GLboolean (APIENTRY * IsBuffer)(GLuint buffer); - GLboolean (APIENTRY * IsFramebuffer)(GLuint framebuffer); - GLboolean (APIENTRY * IsProgram)(GLuint program); - GLboolean (APIENTRY * IsRenderbuffer)(GLuint renderbuffer); - GLboolean (APIENTRY * IsShader)(GLuint shader); - void (APIENTRY * LinkProgram)(GLuint program); - void (APIENTRY * ReleaseShaderCompiler)(void); - void (APIENTRY * RenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); - void (APIENTRY * SampleCoverage)(GLclampf value, GLboolean invert); - void (APIENTRY * ShaderBinary)(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); - void (APIENTRY * ShaderSource)(GLuint shader, GLsizei count, const GLchar* *string, const GLint* length); - void (APIENTRY * StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); - void (APIENTRY * StencilMaskSeparate)(GLenum face, GLuint mask); - void (APIENTRY * StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); - void (APIENTRY * Uniform1f)(GLint location, GLfloat x); - void (APIENTRY * Uniform1fv)(GLint location, GLsizei count, const GLfloat* v); - void (APIENTRY * Uniform1i)(GLint location, GLint x); - void (APIENTRY * Uniform1iv)(GLint location, GLsizei count, const GLint* v); - void (APIENTRY * Uniform2f)(GLint location, GLfloat x, GLfloat y); - void (APIENTRY * Uniform2fv)(GLint location, GLsizei count, const GLfloat* v); - void (APIENTRY * Uniform2i)(GLint location, GLint x, GLint y); - void (APIENTRY * Uniform2iv)(GLint location, GLsizei count, const GLint* v); - void (APIENTRY * Uniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * Uniform3fv)(GLint location, GLsizei count, const GLfloat* v); - void (APIENTRY * Uniform3i)(GLint location, GLint x, GLint y, GLint z); - void (APIENTRY * Uniform3iv)(GLint location, GLsizei count, const GLint* v); - void (APIENTRY * Uniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY * Uniform4fv)(GLint location, GLsizei count, const GLfloat* v); - void (APIENTRY * Uniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w); - void (APIENTRY * Uniform4iv)(GLint location, GLsizei count, const GLint* v); - void (APIENTRY * UniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - void (APIENTRY * UniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - void (APIENTRY * UniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - void (APIENTRY * UseProgram)(GLuint program); - void (APIENTRY * ValidateProgram)(GLuint program); - void (APIENTRY * VertexAttrib1f)(GLuint indx, GLfloat x); - void (APIENTRY * VertexAttrib1fv)(GLuint indx, const GLfloat* values); - void (APIENTRY * VertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y); - void (APIENTRY * VertexAttrib2fv)(GLuint indx, const GLfloat* values); - void (APIENTRY * VertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z); - void (APIENTRY * VertexAttrib3fv)(GLuint indx, const GLfloat* values); - void (APIENTRY * VertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (APIENTRY * VertexAttrib4fv)(GLuint indx, const GLfloat* values); - void (APIENTRY * VertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); - -protected: - HMODULE m_lib; - LibType m_libraryType; - bool m_loaded; -}; - -class QWindowsOpenGL : public QAbstractWindowsOpenGL -{ -public: - QWindowsOpenGL(); - ~QWindowsOpenGL(); - -private: - bool load(const char *glName, const char *eglName); - void unload(); - - void resolve(); - - void resolveWGL(); - void resolveEGL(); - void resolveGLCommon(); - void resolveGL11(); - void resolveGLES2(); - - FARPROC resolveFunc(const char *name); - FARPROC resolveEglFunc(const char *name); - - bool testDesktopGL(); - - HMODULE m_eglLib; -}; - -static QString qgl_windowsErrorMessage(unsigned long errorCode) -{ - QString rc = QString::fromLatin1("#%1: ").arg(errorCode); - ushort *lpMsgBuf; - - const int len = FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, errorCode, 0, (LPTSTR)&lpMsgBuf, 0, NULL); - if (len) { - rc += QString::fromUtf16(lpMsgBuf, len); - LocalFree(lpMsgBuf); - } else { - rc += QString::fromLatin1(""); - } - return rc; -} - -static HMODULE qgl_loadLib(const char *name, bool warnOnFail = true) -{ - HMODULE lib = LoadLibraryA(name); - - if (lib) - return lib; - - if (warnOnFail) { - QString msg = qgl_windowsErrorMessage(GetLastError()); - qCWarning(qglLc, "Failed to load %s: %s", name, qPrintable(msg)); - } - - return 0; -} - -QWindowsOpenGL::QWindowsOpenGL() - : m_eglLib(0) -{ - enum RequestedLib { - Unknown, - Desktop, - GLES - } req = Unknown; - - // Check if the application has requested a certain implementation. - if (QCoreApplication::testAttribute(Qt::AA_UseDesktopOpenGL)) - req = Desktop; - else if (QCoreApplication::testAttribute(Qt::AA_UseOpenGLES)) - req = GLES; - - // Check if an implementation is forced through the environment variable. - QByteArray requested = qgetenv("QT_OPENGL"); - if (requested == QByteArrayLiteral("desktop")) - req = Desktop; - else if (requested == QByteArrayLiteral("angle")) - req = GLES; - - bool desktopTested = false; - if (req == Unknown) { - // No explicit request. Start testing. opengl32.dll is preferred. Angle is the fallback. - desktopTested = true; - if (testDesktopGL()) - req = Desktop; - else - req = GLES; - } - - Q_ASSERT(req != Unknown); - - if (req == GLES) { - qCDebug(qglLc, "Using Angle"); -#ifdef QT_DEBUG - m_loaded = load("libglesv2d.dll", "libegld.dll"); -#else - m_loaded = load("libglesv2.dll", "libegl.dll"); -#endif - if (m_loaded) { - m_libraryType = QWindowsOpenGL::GLES2; - } else { - // Could not load Angle. Try opengl32.dll. - if (!desktopTested && testDesktopGL()) - req = Desktop; - } - } - - if (req == Desktop) { - qCDebug(qglLc, "Using desktop OpenGL"); - m_loaded = load("opengl32.dll", 0); - if (m_loaded) - m_libraryType = QWindowsOpenGL::DesktopGL; - } - - if (m_loaded) - resolve(); - - // When no library is loaded, keep on running. All EGL/WGL/GL functions will - // return 0 in this case without further errors. It is up to the clients - // (application code, Qt Quick, etc.) to act when eglInitialize() and - // friends fail, i.e. when QOpenGLContext::create() returns false due to the - // platform plugin's failure to create a platform context. -} - -QWindowsOpenGL::~QWindowsOpenGL() -{ - unload(); -} - -bool QWindowsOpenGL::load(const char *glName, const char *eglName) -{ - qCDebug(qglLc, "Loading %s %s", glName, eglName ? eglName : ""); - - bool result = true; - - if (glName) { - m_lib = qgl_loadLib(glName); - result &= m_lib != 0; - } - - if (eglName) { - m_eglLib = qgl_loadLib(eglName); - result &= m_eglLib != 0; - } - - if (!result) - unload(); - - return result; -} - -void QWindowsOpenGL::unload() -{ - if (m_lib) { - FreeLibrary(m_lib); - m_lib = 0; - } - if (m_eglLib) { - FreeLibrary(m_eglLib); - m_eglLib = 0; - } - m_loaded = false; -} - -FARPROC QWindowsOpenGL::resolveFunc(const char *name) -{ - FARPROC proc = m_lib ? ::GetProcAddress(m_lib, name) : 0; - if (!proc) - qCDebug(qglLc, "Failed to resolve GL function %s", name); - return proc; -} - -FARPROC QWindowsOpenGL::resolveEglFunc(const char *name) -{ - FARPROC proc = m_eglLib ? ::GetProcAddress(m_eglLib, name) : 0; - if (!proc) - qCDebug(qglLc, "Failed to resolve EGL function %s", name); - return proc; -} - -void QWindowsOpenGL::resolveWGL() -{ - CopyContext = reinterpret_cast(resolveFunc("wglCopyContext")); - CreateContext = reinterpret_cast(resolveFunc("wglCreateContext")); - CreateLayerContext = reinterpret_cast(resolveFunc("wglCreateLayerContext")); - DeleteContext = reinterpret_cast(resolveFunc("wglDeleteContext")); - GetCurrentContext = reinterpret_cast(resolveFunc("wglGetCurrentContext")); - GetCurrentDC = reinterpret_cast(resolveFunc("wglGetCurrentDC")); - GetProcAddress = reinterpret_cast(resolveFunc("wglGetProcAddress")); - MakeCurrent = reinterpret_cast(resolveFunc("wglMakeCurrent")); - ShareLists = reinterpret_cast(resolveFunc("wglShareLists")); - UseFontBitmapsW = reinterpret_cast(resolveFunc("wglUseFontBitmapsW")); - UseFontOutlinesW = reinterpret_cast(resolveFunc("wglUseFontOutlinesW")); - DescribeLayerPlane = reinterpret_cast(resolveFunc("wglDescribeLayerPlane")); - SetLayerPaletteEntries = reinterpret_cast(resolveFunc("wglSetLayerPaletteEntries")); - GetLayerPaletteEntries = reinterpret_cast(resolveFunc("wglGetLayerPaletteEntries")); - RealizeLayerPalette = reinterpret_cast(resolveFunc("wglRealizeLayerPalette")); - SwapLayerBuffers = reinterpret_cast(resolveFunc("wglSwapLayerBuffers")); - SwapMultipleBuffers = reinterpret_cast(resolveFunc("wglSwapMultipleBuffers")); -} - -void QWindowsOpenGL::resolveEGL() -{ - EGL_GetError = reinterpret_cast(resolveEglFunc("eglGetError")); - EGL_GetDisplay = reinterpret_cast(resolveEglFunc("eglGetDisplay")); - EGL_Initialize = reinterpret_cast(resolveEglFunc("eglInitialize")); - EGL_Terminate = reinterpret_cast(resolveEglFunc("eglTerminate")); - EGL_QueryString = reinterpret_cast(resolveEglFunc("eglQueryString")); - EGL_GetConfigs = reinterpret_cast(resolveEglFunc("eglGetConfigs")); - EGL_ChooseConfig = reinterpret_cast(resolveEglFunc("eglChooseConfig")); - EGL_GetConfigAttrib = reinterpret_cast(resolveEglFunc("eglGetConfigAttrib")); - EGL_CreateWindowSurface = reinterpret_cast(resolveEglFunc("eglCreateWindowSurface")); - EGL_CreatePbufferSurface = reinterpret_cast(resolveEglFunc("eglCreatePbufferSurface")); - EGL_CreatePixmapSurface = reinterpret_cast(resolveEglFunc("eglCreatePixmapSurface")); - EGL_DestroySurface = reinterpret_cast(resolveEglFunc("eglDestroySurface")); - EGL_QuerySurface = reinterpret_cast(resolveEglFunc("eglQuerySurface")); - EGL_BindAPI = reinterpret_cast(resolveEglFunc("eglBindAPI")); - EGL_QueryAPI = reinterpret_cast(resolveEglFunc("eglQueryAPI")); - EGL_WaitClient = reinterpret_cast(resolveEglFunc("eglWaitClient")); - EGL_ReleaseThread = reinterpret_cast(resolveEglFunc("eglReleaseThread")); - EGL_CreatePbufferFromClientBuffer = reinterpret_cast(resolveEglFunc("eglCreatePbufferFromClientBuffer")); - EGL_SurfaceAttrib = reinterpret_cast(resolveEglFunc("eglSurfaceAttrib")); - EGL_BindTexImage = reinterpret_cast(resolveEglFunc("eglBindTexImage")); - EGL_ReleaseTexImage = reinterpret_cast(resolveEglFunc("eglReleaseTexImage")); - EGL_SwapInterval = reinterpret_cast(resolveEglFunc("eglSwapInterval")); - EGL_CreateContext = reinterpret_cast(resolveEglFunc("eglCreateContext")); - EGL_DestroyContext = reinterpret_cast(resolveEglFunc("eglDestroyContext")); - EGL_MakeCurrent = reinterpret_cast(resolveEglFunc("eglMakeCurrent")); - EGL_GetCurrentContext = reinterpret_cast(resolveEglFunc("eglGetCurrentContext")); - EGL_GetCurrentSurface = reinterpret_cast(resolveEglFunc("eglGetCurrentSurface")); - EGL_GetCurrentDisplay = reinterpret_cast(resolveEglFunc("eglGetCurrentDisplay")); - EGL_QueryContext = reinterpret_cast(resolveEglFunc("eglQueryContext")); - EGL_WaitGL = reinterpret_cast(resolveEglFunc("eglWaitGL")); - EGL_WaitNative = reinterpret_cast(resolveEglFunc("eglWaitNative")); - EGL_SwapBuffers = reinterpret_cast(resolveEglFunc("eglSwapBuffers")); - EGL_CopyBuffers = reinterpret_cast(resolveEglFunc("eglCopyBuffers")); - EGL_GetProcAddress = reinterpret_cast<__eglMustCastToProperFunctionPointerType (EGLAPIENTRY * )(const char *)>(resolveEglFunc("eglGetProcAddress")); -} - -void QWindowsOpenGL::resolveGLCommon() -{ - Viewport = reinterpret_cast(resolveFunc("glViewport")); - IsEnabled = reinterpret_cast(resolveFunc("glIsEnabled")); - GetTexParameteriv = reinterpret_cast(resolveFunc("glGetTexParameteriv")); - GetTexParameterfv = reinterpret_cast(resolveFunc("glGetTexParameterfv")); - GetString = reinterpret_cast(resolveFunc("glGetString")); - GetIntegerv = reinterpret_cast(resolveFunc("glGetIntegerv")); - GetFloatv = reinterpret_cast(resolveFunc("glGetFloatv")); - GetError = reinterpret_cast(resolveFunc("glGetError")); - GetBooleanv = reinterpret_cast(resolveFunc("glGetBooleanv")); - ReadPixels = reinterpret_cast(resolveFunc("glReadPixels")); - PixelStorei = reinterpret_cast(resolveFunc("glPixelStorei")); - DepthFunc = reinterpret_cast(resolveFunc("glDepthFunc")); - StencilOp = reinterpret_cast(resolveFunc("glStencilOp")); - StencilFunc = reinterpret_cast(resolveFunc("glStencilFunc")); - BlendFunc = reinterpret_cast(resolveFunc("glBlendFunc")); - Flush = reinterpret_cast(resolveFunc("glFlush")); - Finish = reinterpret_cast(resolveFunc("glFinish")); - Enable = reinterpret_cast(resolveFunc("glEnable")); - Disable = reinterpret_cast(resolveFunc("glDisable")); - DepthMask = reinterpret_cast(resolveFunc("glDepthMask")); - ColorMask = reinterpret_cast(resolveFunc("glColorMask")); - StencilMask = reinterpret_cast(resolveFunc("glStencilMask")); - ClearStencil = reinterpret_cast(resolveFunc("glClearStencil")); - ClearColor = reinterpret_cast(resolveFunc("glClearColor")); - Clear = reinterpret_cast(resolveFunc("glClear")); - TexImage2D = reinterpret_cast(resolveFunc("glTexImage2D")); - TexParameteriv = reinterpret_cast(resolveFunc("glTexParameteriv")); - TexParameteri = reinterpret_cast(resolveFunc("glTexParameteri")); - TexParameterfv = reinterpret_cast(resolveFunc("glTexParameterfv")); - TexParameterf = reinterpret_cast(resolveFunc("glTexParameterf")); - Scissor = reinterpret_cast(resolveFunc("glScissor")); - LineWidth = reinterpret_cast(resolveFunc("glLineWidth")); - Hint = reinterpret_cast(resolveFunc("glHint")); - FrontFace = reinterpret_cast(resolveFunc("glFrontFace")); - CullFace = reinterpret_cast(resolveFunc("glCullFace")); - - IsTexture = reinterpret_cast(resolveFunc("glIsTexture")); - GenTextures = reinterpret_cast(resolveFunc("glGenTextures")); - DeleteTextures = reinterpret_cast(resolveFunc("glDeleteTextures")); - BindTexture = reinterpret_cast(resolveFunc("glBindTexture")); - TexSubImage2D = reinterpret_cast(resolveFunc("glTexSubImage2D")); - CopyTexSubImage2D = reinterpret_cast(resolveFunc("glCopyTexSubImage2D")); - CopyTexImage2D = reinterpret_cast(resolveFunc("glCopyTexImage2D")); - PolygonOffset = reinterpret_cast(resolveFunc("glPolygonOffset")); - DrawElements = reinterpret_cast(resolveFunc("glDrawElements")); - DrawArrays = reinterpret_cast(resolveFunc("glDrawArrays")); -} - -void QWindowsOpenGL::resolveGL11() -{ - DepthRange = reinterpret_cast(resolveFunc("glDepthRange")); - GetTexImage = reinterpret_cast(resolveFunc("glGetTexImage")); - LogicOp = reinterpret_cast(resolveFunc("glLogicOp")); - ClearDepth = reinterpret_cast(resolveFunc("glClearDepth")); - PolygonMode = reinterpret_cast(resolveFunc("glPolygonMode")); - PointSize = reinterpret_cast(resolveFunc("glPointSize")); - GetTexLevelParameteriv = reinterpret_cast(resolveFunc("glGetTexLevelParameteriv")); - GetTexLevelParameterfv = reinterpret_cast(resolveFunc("glGetTexLevelParameterfv")); - GetDoublev = reinterpret_cast(resolveFunc("glGetDoublev")); - PixelStoref = reinterpret_cast(resolveFunc("glPixelStoref")); - ReadBuffer = reinterpret_cast(resolveFunc("glReadBuffer")); - DrawBuffer = reinterpret_cast(resolveFunc("glDrawBuffer")); - TexImage1D = reinterpret_cast(resolveFunc("glTexImage1D")); - - Translatef = reinterpret_cast(resolveFunc("glTranslatef")); - Translated = reinterpret_cast(resolveFunc("glTranslated")); - Scalef = reinterpret_cast(resolveFunc("glScalef")); - Scaled = reinterpret_cast(resolveFunc("glScaled")); - Rotatef = reinterpret_cast(resolveFunc("glRotatef")); - Rotated = reinterpret_cast(resolveFunc("glRotated")); - PushMatrix = reinterpret_cast(resolveFunc("glPushMatrix")); - PopMatrix = reinterpret_cast(resolveFunc("glPopMatrix")); - Ortho = reinterpret_cast(resolveFunc("glOrtho")); - MultMatrixd = reinterpret_cast(resolveFunc("glMultMatrixd")); - MultMatrixf = reinterpret_cast(resolveFunc("glMultMatrixf")); - MatrixMode = reinterpret_cast(resolveFunc("glMatrixMode")); - LoadMatrixd = reinterpret_cast(resolveFunc("glLoadMatrixd")); - LoadMatrixf = reinterpret_cast(resolveFunc("glLoadMatrixf")); - LoadIdentity = reinterpret_cast(resolveFunc("glLoadIdentity")); - Frustum = reinterpret_cast(resolveFunc("glFrustum")); - IsList = reinterpret_cast(resolveFunc("glIsList")); - GetTexGeniv = reinterpret_cast(resolveFunc("glGetTexGeniv")); - GetTexGenfv = reinterpret_cast(resolveFunc("glGetTexGenfv")); - GetTexGendv = reinterpret_cast(resolveFunc("glGetTexGendv")); - GetTexEnviv = reinterpret_cast(resolveFunc("glGetTexEnviv")); - GetTexEnvfv = reinterpret_cast(resolveFunc("glGetTexEnvfv")); - GetPolygonStipple = reinterpret_cast(resolveFunc("glGetPolygonStipple")); - GetPixelMapusv = reinterpret_cast(resolveFunc("glGetPixelMapusv")); - GetPixelMapuiv = reinterpret_cast(resolveFunc("glGetPixelMapuiv")); - GetPixelMapfv = reinterpret_cast(resolveFunc("glGetPixelMapfv")); - GetMaterialiv = reinterpret_cast(resolveFunc("glGetMaterialiv")); - GetMaterialfv = reinterpret_cast(resolveFunc("glGetMaterialfv")); - GetMapiv = reinterpret_cast(resolveFunc("glGetMapiv")); - GetMapfv = reinterpret_cast(resolveFunc("glGetMapfv")); - GetMapdv = reinterpret_cast(resolveFunc("glGetMapdv")); - GetLightiv = reinterpret_cast(resolveFunc("glGetLightiv")); - GetLightfv = reinterpret_cast(resolveFunc("glGetLightfv")); - GetClipPlane = reinterpret_cast(resolveFunc("glGetClipPlane")); - DrawPixels = reinterpret_cast(resolveFunc("glDrawPixels")); - CopyPixels = reinterpret_cast(resolveFunc("glCopyPixels")); - PixelMapusv = reinterpret_cast(resolveFunc("glPixelMapusv")); - PixelMapuiv = reinterpret_cast(resolveFunc("glPixelMapuiv")); - PixelMapfv = reinterpret_cast(resolveFunc("glPixelMapfv")); - PixelTransferi = reinterpret_cast(resolveFunc("glPixelTransferi")); - PixelTransferf = reinterpret_cast(resolveFunc("glPixelTransferf")); - PixelZoom = reinterpret_cast(resolveFunc("glPixelZoom")); - AlphaFunc = reinterpret_cast(resolveFunc("glAlphaFunc")); - EvalPoint2 = reinterpret_cast(resolveFunc("glEvalPoint2")); - EvalMesh2 = reinterpret_cast(resolveFunc("glEvalMesh2")); - EvalPoint1 = reinterpret_cast(resolveFunc("glEvalPoint1")); - EvalMesh1 = reinterpret_cast(resolveFunc("glEvalMesh1")); - EvalCoord2fv = reinterpret_cast(resolveFunc("glEvalCoord2fv")); - EvalCoord2f = reinterpret_cast(resolveFunc("glEvalCoord2f")); - EvalCoord2dv = reinterpret_cast(resolveFunc("glEvalCoord2dv")); - EvalCoord2d = reinterpret_cast(resolveFunc("glEvalCoord2d")); - EvalCoord1fv = reinterpret_cast(resolveFunc("glEvalCoord1fv")); - EvalCoord1f = reinterpret_cast(resolveFunc("glEvalCoord1f")); - EvalCoord1dv = reinterpret_cast(resolveFunc("glEvalCoord1dv")); - EvalCoord1d = reinterpret_cast(resolveFunc("glEvalCoord1d")); - MapGrid2f = reinterpret_cast(resolveFunc("glMapGrid2f")); - MapGrid2d = reinterpret_cast(resolveFunc("glMapGrid2d")); - MapGrid1f = reinterpret_cast(resolveFunc("glMapGrid1f")); - MapGrid1d = reinterpret_cast(resolveFunc("glMapGrid1d")); - Map2f = reinterpret_cast(resolveFunc("glMap2f")); - Map2d = reinterpret_cast(resolveFunc("glMap2d")); - Map1f = reinterpret_cast(resolveFunc("glMap1f")); - Map1d = reinterpret_cast(resolveFunc("glMap1d")); - PushAttrib = reinterpret_cast(resolveFunc("glPushAttrib")); - PopAttrib = reinterpret_cast(resolveFunc("glPopAttrib")); - Accum = reinterpret_cast(resolveFunc("glAccum")); - IndexMask = reinterpret_cast(resolveFunc("glIndexMask")); - ClearIndex = reinterpret_cast(resolveFunc("glClearIndex")); - ClearAccum = reinterpret_cast(resolveFunc("glClearAccum")); - PushName = reinterpret_cast(resolveFunc("glPushName")); - PopName = reinterpret_cast(resolveFunc("glPopName")); - PassThrough = reinterpret_cast(resolveFunc("glPassThrough")); - LoadName = reinterpret_cast(resolveFunc("glLoadName")); - InitNames = reinterpret_cast(resolveFunc("glInitNames")); - RenderMode = reinterpret_cast(resolveFunc("glRenderMode")); - SelectBuffer = reinterpret_cast(resolveFunc("glSelectBuffer")); - FeedbackBuffer = reinterpret_cast(resolveFunc("glFeedbackBuffer")); - TexGeniv = reinterpret_cast(resolveFunc("glTexGeniv")); - TexGeni = reinterpret_cast(resolveFunc("glTexGeni")); - TexGenfv = reinterpret_cast(resolveFunc("glTexGenfv")); - TexGenf = reinterpret_cast(resolveFunc("glTexGenf")); - TexGendv = reinterpret_cast(resolveFunc("glTexGendv")); - TexGend = reinterpret_cast(resolveFunc("glTexGend")); - TexEnviv = reinterpret_cast(resolveFunc("glTexEnviv")); - TexEnvi = reinterpret_cast(resolveFunc("glTexEnvi")); - TexEnvfv = reinterpret_cast(resolveFunc("glTexEnvfv")); - TexEnvf = reinterpret_cast(resolveFunc("glTexEnvf")); - ShadeModel = reinterpret_cast(resolveFunc("glShadeModel")); - PolygonStipple = reinterpret_cast(resolveFunc("glPolygonStipple")); - Materialiv = reinterpret_cast(resolveFunc("glMaterialiv")); - Materiali = reinterpret_cast(resolveFunc("glMateriali")); - Materialfv = reinterpret_cast(resolveFunc("glMaterialfv")); - Materialf = reinterpret_cast(resolveFunc("glMaterialf")); - LineStipple = reinterpret_cast(resolveFunc("glLineStipple")); - LightModeliv = reinterpret_cast(resolveFunc("glLightModeliv")); - LightModeli = reinterpret_cast(resolveFunc("glLightModeli")); - LightModelfv = reinterpret_cast(resolveFunc("glLightModelfv")); - LightModelf = reinterpret_cast(resolveFunc("glLightModelf")); - Lightiv = reinterpret_cast(resolveFunc("glLightiv")); - Lighti = reinterpret_cast(resolveFunc("glLighti")); - Lightfv = reinterpret_cast(resolveFunc("glLightfv")); - Lightf = reinterpret_cast(resolveFunc("glLightf")); - Fogiv = reinterpret_cast(resolveFunc("glFogiv")); - Fogi = reinterpret_cast(resolveFunc("glFogi")); - Fogfv = reinterpret_cast(resolveFunc("glFogfv")); - Fogf = reinterpret_cast(resolveFunc("glFogf")); - ColorMaterial = reinterpret_cast(resolveFunc("glColorMaterial")); - ClipPlane = reinterpret_cast(resolveFunc("glClipPlane")); - Vertex4sv = reinterpret_cast(resolveFunc("glVertex4sv")); - Vertex4s = reinterpret_cast(resolveFunc("glVertex4s")); - Vertex4iv = reinterpret_cast(resolveFunc("glVertex4iv")); - Vertex4i = reinterpret_cast(resolveFunc("glVertex4i")); - Vertex4fv = reinterpret_cast(resolveFunc("glVertex4fv")); - Vertex4f = reinterpret_cast(resolveFunc("glVertex4f")); - Vertex4dv = reinterpret_cast(resolveFunc("glVertex4dv")); - Vertex4d = reinterpret_cast(resolveFunc("glVertex4d")); - Vertex3sv = reinterpret_cast(resolveFunc("glVertex3sv")); - Vertex3s = reinterpret_cast(resolveFunc("glVertex3s")); - Vertex3iv = reinterpret_cast(resolveFunc("glVertex3iv")); - Vertex3i = reinterpret_cast(resolveFunc("glVertex3i")); - Vertex3fv = reinterpret_cast(resolveFunc("glVertex3fv")); - Vertex3f = reinterpret_cast(resolveFunc("glVertex3f")); - Vertex3dv = reinterpret_cast(resolveFunc("glVertex3dv")); - Vertex3d = reinterpret_cast(resolveFunc("glVertex3d")); - Vertex2sv = reinterpret_cast(resolveFunc("glVertex2sv")); - Vertex2s = reinterpret_cast(resolveFunc("glVertex2s")); - Vertex2iv = reinterpret_cast(resolveFunc("glVertex2iv")); - Vertex2i = reinterpret_cast(resolveFunc("glVertex2i")); - Vertex2fv = reinterpret_cast(resolveFunc("glVertex2fv")); - Vertex2f = reinterpret_cast(resolveFunc("glVertex2f")); - Vertex2dv = reinterpret_cast(resolveFunc("glVertex2dv")); - Vertex2d = reinterpret_cast(resolveFunc("glVertex2d")); - TexCoord4sv = reinterpret_cast(resolveFunc("glTexCoord4sv")); - TexCoord4s = reinterpret_cast(resolveFunc("glTexCoord4s")); - TexCoord4iv = reinterpret_cast(resolveFunc("glTexCoord4iv")); - TexCoord4i = reinterpret_cast(resolveFunc("glTexCoord4i")); - TexCoord4fv = reinterpret_cast(resolveFunc("glTexCoord4fv")); - TexCoord4f = reinterpret_cast(resolveFunc("glTexCoord4f")); - TexCoord4dv = reinterpret_cast(resolveFunc("glTexCoord4dv")); - TexCoord4d = reinterpret_cast(resolveFunc("glTexCoord4d")); - TexCoord3sv = reinterpret_cast(resolveFunc("glTexCoord3sv")); - TexCoord3s = reinterpret_cast(resolveFunc("glTexCoord3s")); - TexCoord3iv = reinterpret_cast(resolveFunc("glTexCoord3iv")); - TexCoord3i = reinterpret_cast(resolveFunc("glTexCoord3i")); - TexCoord3fv = reinterpret_cast(resolveFunc("glTexCoord3fv")); - TexCoord3f = reinterpret_cast(resolveFunc("glTexCoord3f")); - TexCoord3dv = reinterpret_cast(resolveFunc("glTexCoord3dv")); - TexCoord3d = reinterpret_cast(resolveFunc("glTexCoord3d")); - TexCoord2sv = reinterpret_cast(resolveFunc("glTexCoord2sv")); - TexCoord2s = reinterpret_cast(resolveFunc("glTexCoord2s")); - TexCoord2iv = reinterpret_cast(resolveFunc("glTexCoord2iv")); - TexCoord2i = reinterpret_cast(resolveFunc("glTexCoord2i")); - TexCoord2fv = reinterpret_cast(resolveFunc("glTexCoord2fv")); - TexCoord2f = reinterpret_cast(resolveFunc("glTexCoord2f")); - TexCoord2dv = reinterpret_cast(resolveFunc("glTexCoord2dv")); - TexCoord2d = reinterpret_cast(resolveFunc("glTexCoord2d")); - TexCoord1sv = reinterpret_cast(resolveFunc("glTexCoord1sv")); - TexCoord1s = reinterpret_cast(resolveFunc("glTexCoord1s")); - TexCoord1iv = reinterpret_cast(resolveFunc("glTexCoord1iv")); - TexCoord1i = reinterpret_cast(resolveFunc("glTexCoord1i")); - TexCoord1fv = reinterpret_cast(resolveFunc("glTexCoord1fv")); - TexCoord1f = reinterpret_cast(resolveFunc("glTexCoord1f")); - TexCoord1dv = reinterpret_cast(resolveFunc("glTexCoord1dv")); - TexCoord1d = reinterpret_cast(resolveFunc("glTexCoord1d")); - Rectsv = reinterpret_cast(resolveFunc("glRectsv")); - Rects = reinterpret_cast(resolveFunc("glRects")); - Rectiv = reinterpret_cast(resolveFunc("glRectiv")); - Recti = reinterpret_cast(resolveFunc("glRecti")); - Rectfv = reinterpret_cast(resolveFunc("glRectfv")); - Rectf = reinterpret_cast(resolveFunc("glRectf")); - Rectdv = reinterpret_cast(resolveFunc("glRectdv")); - Rectd = reinterpret_cast(resolveFunc("glRectd")); - RasterPos4sv = reinterpret_cast(resolveFunc("glRasterPos4sv")); - RasterPos4s = reinterpret_cast(resolveFunc("glRasterPos4s")); - RasterPos4iv = reinterpret_cast(resolveFunc("glRasterPos4iv")); - RasterPos4i = reinterpret_cast(resolveFunc("glRasterPos4i")); - RasterPos4fv = reinterpret_cast(resolveFunc("glRasterPos4fv")); - RasterPos4f = reinterpret_cast(resolveFunc("glRasterPos4f")); - RasterPos4dv = reinterpret_cast(resolveFunc("glRasterPos4dv")); - RasterPos4d = reinterpret_cast(resolveFunc("glRasterPos4d")); - RasterPos3sv = reinterpret_cast(resolveFunc("glRasterPos3sv")); - RasterPos3s = reinterpret_cast(resolveFunc("glRasterPos3s")); - RasterPos3iv = reinterpret_cast(resolveFunc("glRasterPos3iv")); - RasterPos3i = reinterpret_cast(resolveFunc("glRasterPos3i")); - RasterPos3fv = reinterpret_cast(resolveFunc("glRasterPos3fv")); - RasterPos3f = reinterpret_cast(resolveFunc("glRasterPos3f")); - RasterPos3dv = reinterpret_cast(resolveFunc("glRasterPos3dv")); - RasterPos3d = reinterpret_cast(resolveFunc("glRasterPos3d")); - RasterPos2sv = reinterpret_cast(resolveFunc("glRasterPos2sv")); - RasterPos2s = reinterpret_cast(resolveFunc("glRasterPos2s")); - RasterPos2iv = reinterpret_cast(resolveFunc("glRasterPos2iv")); - RasterPos2i = reinterpret_cast(resolveFunc("glRasterPos2i")); - RasterPos2fv = reinterpret_cast(resolveFunc("glRasterPos2fv")); - RasterPos2f = reinterpret_cast(resolveFunc("glRasterPos2f")); - RasterPos2dv = reinterpret_cast(resolveFunc("glRasterPos2dv")); - RasterPos2d = reinterpret_cast(resolveFunc("glRasterPos2d")); - Normal3sv = reinterpret_cast(resolveFunc("glNormal3sv")); - Normal3s = reinterpret_cast(resolveFunc("glNormal3s")); - Normal3iv = reinterpret_cast(resolveFunc("glNormal3iv")); - Normal3i = reinterpret_cast(resolveFunc("glNormal3i")); - Normal3fv = reinterpret_cast(resolveFunc("glNormal3fv")); - Normal3f = reinterpret_cast(resolveFunc("glNormal3f")); - Normal3dv = reinterpret_cast(resolveFunc("glNormal3dv")); - Normal3d = reinterpret_cast(resolveFunc("glNormal3d")); - Normal3bv = reinterpret_cast(resolveFunc("glNormal3bv")); - Normal3b = reinterpret_cast(resolveFunc("glNormal3b")); - Indexsv = reinterpret_cast(resolveFunc("glIndexsv")); - Indexs = reinterpret_cast(resolveFunc("glIndexs")); - Indexiv = reinterpret_cast(resolveFunc("glIndexiv")); - Indexi = reinterpret_cast(resolveFunc("glIndexi")); - Indexfv = reinterpret_cast(resolveFunc("glIndexfv")); - Indexf = reinterpret_cast(resolveFunc("glIndexf")); - Indexdv = reinterpret_cast(resolveFunc("glIndexdv")); - Indexd = reinterpret_cast(resolveFunc("glIndexd")); - End = reinterpret_cast(resolveFunc("glEnd")); - EdgeFlagv = reinterpret_cast(resolveFunc("glEdgeFlagv")); - EdgeFlag = reinterpret_cast(resolveFunc("glEdgeFlag")); - Color4usv = reinterpret_cast(resolveFunc("glColor4usv")); - Color4us = reinterpret_cast(resolveFunc("glColor4us")); - Color4uiv = reinterpret_cast(resolveFunc("glColor4uiv")); - Color4ui = reinterpret_cast(resolveFunc("glColor4ui")); - Color4ubv = reinterpret_cast(resolveFunc("glColor4ubv")); - Color4ub = reinterpret_cast(resolveFunc("glColor4ub")); - Color4sv = reinterpret_cast(resolveFunc("glColor4sv")); - Color4s = reinterpret_cast(resolveFunc("glColor4s")); - Color4iv = reinterpret_cast(resolveFunc("glColor4iv")); - Color4i = reinterpret_cast(resolveFunc("glColor4i")); - Color4fv = reinterpret_cast(resolveFunc("glColor4fv")); - Color4f = reinterpret_cast(resolveFunc("glColor4f")); - Color4dv = reinterpret_cast(resolveFunc("glColor4dv")); - Color4d = reinterpret_cast(resolveFunc("glColor4d")); - Color4bv = reinterpret_cast(resolveFunc("glColor4bv")); - Color4b = reinterpret_cast(resolveFunc("glColor4b")); - Color3usv = reinterpret_cast(resolveFunc("glColor3usv")); - Color3us = reinterpret_cast(resolveFunc("glColor3us")); - Color3uiv = reinterpret_cast(resolveFunc("glColor3uiv")); - Color3ui = reinterpret_cast(resolveFunc("glColor3ui")); - Color3ubv = reinterpret_cast(resolveFunc("glColor3ubv")); - Color3ub = reinterpret_cast(resolveFunc("glColor3ub")); - Color3sv = reinterpret_cast(resolveFunc("glColor3sv")); - Color3s = reinterpret_cast(resolveFunc("glColor3s")); - Color3iv = reinterpret_cast(resolveFunc("glColor3iv")); - Color3i = reinterpret_cast(resolveFunc("glColor3i")); - Color3fv = reinterpret_cast(resolveFunc("glColor3fv")); - Color3f = reinterpret_cast(resolveFunc("glColor3f")); - Color3dv = reinterpret_cast(resolveFunc("glColor3dv")); - Color3d = reinterpret_cast(resolveFunc("glColor3d")); - Color3bv = reinterpret_cast(resolveFunc("glColor3bv")); - Color3b = reinterpret_cast(resolveFunc("glColor3b")); - Bitmap = reinterpret_cast(resolveFunc("glBitmap")); - Begin = reinterpret_cast(resolveFunc("glBegin")); - ListBase = reinterpret_cast(resolveFunc("glListBase")); - GenLists = reinterpret_cast(resolveFunc("glGenLists")); - DeleteLists = reinterpret_cast(resolveFunc("glDeleteLists")); - CallLists = reinterpret_cast(resolveFunc("glCallLists")); - CallList = reinterpret_cast(resolveFunc("glCallList")); - EndList = reinterpret_cast(resolveFunc("glEndList")); - NewList = reinterpret_cast(resolveFunc("glNewList")); - - Indexubv = reinterpret_cast(resolveFunc("glIndexubv")); - Indexub = reinterpret_cast(resolveFunc("glIndexub")); - TexSubImage1D = reinterpret_cast(resolveFunc("glTexSubImage1D")); - CopyTexSubImage1D = reinterpret_cast(resolveFunc("glCopyTexSubImage1D")); - CopyTexImage1D = reinterpret_cast(resolveFunc("glCopyTexImage1D")); - GetPointerv = reinterpret_cast(resolveFunc("glGetPointerv")); - - PushClientAttrib = reinterpret_cast(resolveFunc("glPushClientAttrib")); - PopClientAttrib = reinterpret_cast(resolveFunc("glPopClientAttrib")); - PrioritizeTextures = reinterpret_cast(resolveFunc("glPrioritizeTextures")); - AreTexturesResident = reinterpret_cast(resolveFunc("glAreTexturesResident")); - VertexPointer = reinterpret_cast(resolveFunc("glVertexPointer")); - TexCoordPointer = reinterpret_cast(resolveFunc("glTexCoordPointer")); - NormalPointer = reinterpret_cast(resolveFunc("glNormalPointer")); - InterleavedArrays = reinterpret_cast(resolveFunc("glInterleavedArrays")); - IndexPointer = reinterpret_cast(resolveFunc("glIndexPointer")); - EnableClientState = reinterpret_cast(resolveFunc("glEnableClientState")); - EdgeFlagPointer = reinterpret_cast(resolveFunc("glEdgeFlagPointer")); - DisableClientState = reinterpret_cast(resolveFunc("glDisableClientState")); - ColorPointer = reinterpret_cast(resolveFunc("glColorPointer")); - ArrayElement = reinterpret_cast(resolveFunc("glArrayElement")); -} - -void QWindowsOpenGL::resolveGLES2() -{ - ActiveTexture = reinterpret_cast(resolveFunc("glActiveTexture")); - AttachShader = reinterpret_cast(resolveFunc("glAttachShader")); - BindAttribLocation = reinterpret_cast(resolveFunc("glBindAttribLocation")); - BindBuffer = reinterpret_cast(resolveFunc("glBindBuffer")); - BindFramebuffer = reinterpret_cast(resolveFunc("glBindFramebuffer")); - BindRenderbuffer = reinterpret_cast(resolveFunc("glBindRenderbuffer")); - BlendColor = reinterpret_cast(resolveFunc("glBlendColor")); - BlendEquation = reinterpret_cast(resolveFunc("glBlendEquation")); - BlendEquationSeparate = reinterpret_cast(resolveFunc("glBlendEquationSeparate")); - BlendFuncSeparate = reinterpret_cast(resolveFunc("glBlendFuncSeparate")); - BufferData = reinterpret_cast(resolveFunc("glBufferData")); - BufferSubData = reinterpret_cast(resolveFunc("glBufferSubData")); - CheckFramebufferStatus = reinterpret_cast(resolveFunc("glCheckFramebufferStatus")); - ClearDepthf = reinterpret_cast(resolveFunc("glClearDepthf")); - CompileShader = reinterpret_cast(resolveFunc("glCompileShader")); - CompressedTexImage2D = reinterpret_cast(resolveFunc("glCompressedTexImage2D")); - CompressedTexSubImage2D = reinterpret_cast(resolveFunc("glCompressedTexSubImage2D")); - CreateProgram = reinterpret_cast(resolveFunc("glCreateProgram")); - CreateShader = reinterpret_cast(resolveFunc("glCreateShader")); - DeleteBuffers = reinterpret_cast(resolveFunc("glDeleteBuffers")); - DeleteFramebuffers = reinterpret_cast(resolveFunc("glDeleteFramebuffers")); - DeleteProgram = reinterpret_cast(resolveFunc("glDeleteProgram")); - DeleteRenderbuffers = reinterpret_cast(resolveFunc("glDeleteRenderbuffers")); - DeleteShader = reinterpret_cast(resolveFunc("glDeleteShader")); - DepthRangef = reinterpret_cast(resolveFunc("glDepthRangef")); - DetachShader = reinterpret_cast(resolveFunc("glDetachShader")); - DisableVertexAttribArray = reinterpret_cast(resolveFunc("glDisableVertexAttribArray")); - EnableVertexAttribArray = reinterpret_cast(resolveFunc("glEnableVertexAttribArray")); - FramebufferRenderbuffer = reinterpret_cast(resolveFunc("glFramebufferRenderbuffer")); - FramebufferTexture2D = reinterpret_cast(resolveFunc("glFramebufferTexture2D")); - GenBuffers = reinterpret_cast(resolveFunc("glGenBuffers")); - GenerateMipmap = reinterpret_cast(resolveFunc("glGenerateMipmap")); - GenFramebuffers = reinterpret_cast(resolveFunc("glGenFramebuffers")); - GenRenderbuffers = reinterpret_cast(resolveFunc("glGenRenderbuffers")); - GetActiveAttrib = reinterpret_cast(resolveFunc("glGetActiveAttrib")); - GetActiveUniform = reinterpret_cast(resolveFunc("glGetActiveUniform")); - GetAttachedShaders = reinterpret_cast(resolveFunc("glGetAttachedShaders")); - GetAttribLocation = reinterpret_cast(resolveFunc("glGetAttribLocation")); - GetBufferParameteriv = reinterpret_cast(resolveFunc("glGetBufferParameteriv")); - GetFramebufferAttachmentParameteriv = reinterpret_cast(resolveFunc("glGetFramebufferAttachmentParameteriv")); - GetProgramiv = reinterpret_cast(resolveFunc("glGetProgramiv")); - GetProgramInfoLog = reinterpret_cast(resolveFunc("glGetProgramInfoLog")); - GetRenderbufferParameteriv = reinterpret_cast(resolveFunc("glGetRenderbufferParameteriv")); - GetShaderiv = reinterpret_cast(resolveFunc("glGetShaderiv")); - GetShaderInfoLog = reinterpret_cast(resolveFunc("glGetShaderInfoLog")); - GetShaderPrecisionFormat = reinterpret_cast(resolveFunc("glGetShaderPrecisionFormat")); - GetShaderSource = reinterpret_cast(resolveFunc("glGetShaderSource")); - GetUniformfv = reinterpret_cast(resolveFunc("glGetUniformfv")); - GetUniformiv = reinterpret_cast(resolveFunc("glGetUniformiv")); - GetUniformLocation = reinterpret_cast(resolveFunc("glGetUniformLocation")); - GetVertexAttribfv = reinterpret_cast(resolveFunc("glGetVertexAttribfv")); - GetVertexAttribiv = reinterpret_cast(resolveFunc("glGetVertexAttribiv")); - GetVertexAttribPointerv = reinterpret_cast(resolveFunc("glGetVertexAttribPointerv")); - IsBuffer = reinterpret_cast(resolveFunc("glIsBuffer")); - IsFramebuffer = reinterpret_cast(resolveFunc("glIsFramebuffer")); - IsProgram = reinterpret_cast(resolveFunc("glIsProgram")); - IsRenderbuffer = reinterpret_cast(resolveFunc("glIsRenderbuffer")); - IsShader = reinterpret_cast(resolveFunc("glIsShader")); - LinkProgram = reinterpret_cast(resolveFunc("glLinkProgram")); - ReleaseShaderCompiler = reinterpret_cast(resolveFunc("glReleaseShaderCompiler")); - RenderbufferStorage = reinterpret_cast(resolveFunc("glRenderbufferStorage")); - SampleCoverage = reinterpret_cast(resolveFunc("glSampleCoverage")); - ShaderBinary = reinterpret_cast(resolveFunc("glShaderBinary")); - ShaderSource = reinterpret_cast(resolveFunc("glShaderSource")); - StencilFuncSeparate = reinterpret_cast(resolveFunc("glStencilFuncSeparate")); - StencilMaskSeparate = reinterpret_cast(resolveFunc("glStencilMaskSeparate")); - StencilOpSeparate = reinterpret_cast(resolveFunc("glStencilOpSeparate")); - Uniform1f = reinterpret_cast(resolveFunc("glUniform1f")); - Uniform1fv = reinterpret_cast(resolveFunc("glUniform1fv")); - Uniform1i = reinterpret_cast(resolveFunc("glUniform1i")); - Uniform1iv = reinterpret_cast(resolveFunc("glUniform1iv")); - Uniform2f = reinterpret_cast(resolveFunc("glUniform2f")); - Uniform2fv = reinterpret_cast(resolveFunc("glUniform2fv")); - Uniform2i = reinterpret_cast(resolveFunc("glUniform2i")); - Uniform2iv = reinterpret_cast(resolveFunc("glUniform2iv")); - Uniform3f = reinterpret_cast(resolveFunc("glUniform3f")); - Uniform3fv = reinterpret_cast(resolveFunc("glUniform3fv")); - Uniform3i = reinterpret_cast(resolveFunc("glUniform3i")); - Uniform3iv = reinterpret_cast(resolveFunc("glUniform3iv")); - Uniform4f = reinterpret_cast(resolveFunc("glUniform4f")); - Uniform4fv = reinterpret_cast(resolveFunc("glUniform4fv")); - Uniform4i = reinterpret_cast(resolveFunc("glUniform4i")); - Uniform4iv = reinterpret_cast(resolveFunc("glUniform4iv")); - UniformMatrix2fv = reinterpret_cast(resolveFunc("glUniformMatrix2fv")); - UniformMatrix3fv = reinterpret_cast(resolveFunc("glUniformMatrix3fv")); - UniformMatrix4fv = reinterpret_cast(resolveFunc("glUniformMatrix4fv")); - UseProgram = reinterpret_cast(resolveFunc("glUseProgram")); - ValidateProgram = reinterpret_cast(resolveFunc("glValidateProgram")); - VertexAttrib1f = reinterpret_cast(resolveFunc("glVertexAttrib1f")); - VertexAttrib1fv = reinterpret_cast(resolveFunc("glVertexAttrib1fv")); - VertexAttrib2f = reinterpret_cast(resolveFunc("glVertexAttrib2f")); - VertexAttrib2fv = reinterpret_cast(resolveFunc("glVertexAttrib2fv")); - VertexAttrib3f = reinterpret_cast(resolveFunc("glVertexAttrib3f")); - VertexAttrib3fv = reinterpret_cast(resolveFunc("glVertexAttrib3fv")); - VertexAttrib4f = reinterpret_cast(resolveFunc("glVertexAttrib4f")); - VertexAttrib4fv = reinterpret_cast(resolveFunc("glVertexAttrib4fv")); - VertexAttribPointer = reinterpret_cast(resolveFunc("glVertexAttribPointer")); -} - -void QWindowsOpenGL::resolve() -{ - switch (libraryType()) { - case DesktopGL: - resolveWGL(); - resolveGLCommon(); - resolveGL11(); - break; - - case GLES2: - resolveEGL(); - resolveGLCommon(); - resolveGLES2(); - break; - - default: - Q_ASSERT_X(0, "QWindowsOpenGL", "Nothing to resolve"); - break; - } -} - -bool QWindowsOpenGL::testDesktopGL() -{ - HMODULE lib = 0; - HWND wnd = 0; - HDC dc = 0; - HGLRC context = 0; - LPCTSTR className = L"qtopenglproxytest"; - - HGLRC (WINAPI * CreateContext)(HDC dc) = 0; - BOOL (WINAPI * DeleteContext)(HGLRC context) = 0; - BOOL (WINAPI * MakeCurrent)(HDC dc, HGLRC context) = 0; - PROC (WINAPI * WGL_GetProcAddress)(LPCSTR name) = 0; - - bool result = false; - - // Test #1: Load opengl32.dll and try to resolve an OpenGL 2 function. - // This will typically fail on systems that do not have a real OpenGL driver. - lib = qgl_loadLib("opengl32.dll", false); - if (lib) { - CreateContext = reinterpret_cast(::GetProcAddress(lib, "wglCreateContext")); - if (!CreateContext) - goto cleanup; - DeleteContext = reinterpret_cast(::GetProcAddress(lib, "wglDeleteContext")); - if (!DeleteContext) - goto cleanup; - MakeCurrent = reinterpret_cast(::GetProcAddress(lib, "wglMakeCurrent")); - if (!MakeCurrent) - goto cleanup; - WGL_GetProcAddress = reinterpret_cast(::GetProcAddress(lib, "wglGetProcAddress")); - if (!WGL_GetProcAddress) - goto cleanup; - - WNDCLASS wclass; - wclass.cbClsExtra = 0; - wclass.cbWndExtra = 0; - wclass.hInstance = (HINSTANCE) GetModuleHandle(0); - wclass.hIcon = 0; - wclass.hCursor = 0; - wclass.hbrBackground = (HBRUSH) (COLOR_BACKGROUND); - wclass.lpszMenuName = 0; - wclass.lpfnWndProc = DefWindowProc; - wclass.lpszClassName = className; - wclass.style = CS_OWNDC; - if (!RegisterClass(&wclass)) - goto cleanup; - wnd = CreateWindow(className, L"qtopenglproxytest", WS_OVERLAPPED, - 0, 0, 640, 480, 0, 0, wclass.hInstance, 0); - if (!wnd) - goto cleanup; - dc = GetDC(wnd); - if (!dc) - goto cleanup; - - PIXELFORMATDESCRIPTOR pfd; - memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); - pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); - pfd.nVersion = 1; - pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_GENERIC_FORMAT; - pfd.iPixelType = PFD_TYPE_RGBA; - // Use the GDI functions. Under the hood this will call the wgl variants in opengl32.dll. - int pixelFormat = ChoosePixelFormat(dc, &pfd); - if (!pixelFormat) - goto cleanup; - if (!SetPixelFormat(dc, pixelFormat, &pfd)) - goto cleanup; - context = CreateContext(dc); - if (!context) - goto cleanup; - if (!MakeCurrent(dc, context)) - goto cleanup; - - // Now that there is finally a context current, try doing something useful. - if (WGL_GetProcAddress("glCreateShader")) { - result = true; - qCDebug(qglLc, "OpenGL 2 entry points available"); - } else { - qCDebug(qglLc, "OpenGL 2 entry points not found"); - } - } else { - qCDebug(qglLc, "Failed to load opengl32.dll"); - } - -cleanup: - if (MakeCurrent) - MakeCurrent(0, 0); - if (context) - DeleteContext(context); - if (dc && wnd) - ReleaseDC(wnd, dc); - if (wnd) - DestroyWindow(wnd); - UnregisterClass(className, GetModuleHandle(0)); - if (lib) - FreeLibrary(lib); - - return result; -} - -class QWindowsOpenGLList -{ -public: - QWindowsOpenGLList(); - ~QWindowsOpenGLList(); - QVector list; -}; - -QWindowsOpenGLList::QWindowsOpenGLList() -{ - // For now there is always one OpenGL ( + winsys interface) loaded. - // This may change in the future. - list.append(new QWindowsOpenGL); -} - -QWindowsOpenGLList::~QWindowsOpenGLList() -{ - qDeleteAll(list); -} - -// Use Q_GLOBAL_STATIC and perform initialization in the constructor to be -// thread safe. -Q_GLOBAL_STATIC(QWindowsOpenGLList, gl) - -static inline QAbstractWindowsOpenGL *qgl_choose() -{ - return gl()->list[0]; -} - -// functionsReady() -> the DLL is there but some functions were not resolved. This is fatal. -// !functionsReady() -> could not load a GL implementation. No error message in this case. -#define GLWARN(g, func, prefix) \ - { \ - if (g->functionsReady()) \ - qFatal("Qt OpenGL: Attempted to call unresolved function %s%s. " \ - "This is likely caused by making OpenGL-only calls with an OpenGL ES implementation (Angle).", \ - prefix, #func); \ - } - -#define GLCALLV(func, ...) \ - { \ - QAbstractWindowsOpenGL *g = qgl_choose(); \ - if (g->func) \ - g->func(__VA_ARGS__); \ - else \ - GLWARN(g, func, "gl") \ - } - -#define GLCALL(func, ...) \ - { \ - QAbstractWindowsOpenGL *g = qgl_choose(); \ - if (g->func) \ - return g->func(__VA_ARGS__); \ - GLWARN(g, func, "gl") \ - return 0; \ - } - -#define WGLCALL(func, ...) \ - { \ - QAbstractWindowsOpenGL *g = qgl_choose(); \ - if (g->func) \ - return g->func(__VA_ARGS__); \ - GLWARN(g, func, "wgl") \ - return 0; \ - } - -#define EGLCALL(func, ...) \ - { \ - QAbstractWindowsOpenGL *g = qgl_choose(); \ - if (g->EGL_##func) \ - return g->EGL_##func(__VA_ARGS__); \ - GLWARN(g, func, "egl") \ - return 0; \ - } - - -extern "C" { - -// WGL - -Q_DECL_EXPORT BOOL WINAPI wglCopyContext(HGLRC src, HGLRC dst, UINT mask) -{ - WGLCALL(CopyContext, src, dst, mask); -} - -Q_DECL_EXPORT HGLRC WINAPI wglCreateContext(HDC dc) -{ - WGLCALL(CreateContext, dc); -} - -Q_DECL_EXPORT HGLRC WINAPI wglCreateLayerContext(HDC dc, int plane) -{ - WGLCALL(CreateLayerContext, dc, plane); -} - -Q_DECL_EXPORT BOOL WINAPI wglDeleteContext(HGLRC context) -{ - WGLCALL(DeleteContext, context); -} - -Q_DECL_EXPORT HGLRC WINAPI wglGetCurrentContext(VOID) -{ - WGLCALL(GetCurrentContext); -} - -Q_DECL_EXPORT HDC WINAPI wglGetCurrentDC(VOID) -{ - WGLCALL(GetCurrentDC); -} - -Q_DECL_EXPORT PROC WINAPI wglGetProcAddress(LPCSTR name) -{ - WGLCALL(GetProcAddress, name); -} - -Q_DECL_EXPORT BOOL WINAPI wglMakeCurrent(HDC dc, HGLRC context) -{ - WGLCALL(MakeCurrent, dc, context); -} - -Q_DECL_EXPORT BOOL WINAPI wglShareLists(HGLRC context1, HGLRC context2) -{ - WGLCALL(ShareLists, context1, context2); -} - -Q_DECL_EXPORT BOOL WINAPI wglUseFontBitmapsW(HDC dc, DWORD first, DWORD count, DWORD base) -{ - WGLCALL(UseFontBitmapsW, dc, first, count, base); -} - -Q_DECL_EXPORT BOOL WINAPI wglUseFontOutlinesW(HDC dc, DWORD first, DWORD count, DWORD base, FLOAT deviation, - FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT gmf) -{ - WGLCALL(UseFontOutlinesW, dc, first, count, base, deviation, extrusion, format, gmf); -} - -Q_DECL_EXPORT BOOL WINAPI wglDescribeLayerPlane(HDC dc, int pixelFormat, int plane, UINT n, - LPLAYERPLANEDESCRIPTOR planeDescriptor) -{ - WGLCALL(DescribeLayerPlane, dc, pixelFormat, plane, n, planeDescriptor); -} - -Q_DECL_EXPORT int WINAPI wglSetLayerPaletteEntries(HDC dc, int plane, int start, int entries, - CONST COLORREF *colors) -{ - WGLCALL(SetLayerPaletteEntries, dc, plane, start, entries, colors); -} - -Q_DECL_EXPORT int WINAPI wglGetLayerPaletteEntries(HDC dc, int plane, int start, int entries, - COLORREF *color) -{ - WGLCALL(GetLayerPaletteEntries, dc, plane, start, entries, color); -} - -Q_DECL_EXPORT BOOL WINAPI wglRealizeLayerPalette(HDC dc, int plane, BOOL realize) -{ - WGLCALL(RealizeLayerPalette, dc, plane, realize); -} - -Q_DECL_EXPORT BOOL WINAPI wglSwapLayerBuffers(HDC dc, UINT planes) -{ - WGLCALL(SwapLayerBuffers, dc, planes); -} - -Q_DECL_EXPORT DWORD WINAPI wglSwapMultipleBuffers(UINT n, CONST WGLSWAP *buffers) -{ - WGLCALL(SwapMultipleBuffers, n, buffers); -} - -// EGL - -Q_DECL_EXPORT EGLint EGLAPIENTRY eglGetError(void) -{ - EGLCALL(GetError); -} - -Q_DECL_EXPORT EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) -{ - EGLCALL(GetDisplay, display_id); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) -{ - EGLCALL(Initialize, dpy, major, minor); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) -{ - EGLCALL(Terminate, dpy); -} - -Q_DECL_EXPORT const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) -{ - EGLCALL(QueryString, dpy, name); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, - EGLint config_size, EGLint *num_config) -{ - EGLCALL(GetConfigs, dpy, configs, config_size, num_config); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, - EGLConfig *configs, EGLint config_size, - EGLint *num_config) -{ - EGLCALL(ChooseConfig, dpy, attrib_list, configs, config_size, num_config); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, - EGLint attribute, EGLint *value) -{ - EGLCALL(GetConfigAttrib, dpy, config, attribute, value); -} - -Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, - EGLNativeWindowType win, - const EGLint *attrib_list) -{ - EGLCALL(CreateWindowSurface, dpy, config, win, attrib_list); -} - -Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list) -{ - EGLCALL(CreatePbufferSurface, dpy, config, attrib_list); -} - -Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, - EGLNativePixmapType pixmap, - const EGLint *attrib_list) -{ - EGLCALL(CreatePixmapSurface, dpy, config, pixmap, attrib_list); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface) -{ - EGLCALL(DestroySurface, dpy, surface); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, - EGLint attribute, EGLint *value) -{ - EGLCALL(QuerySurface, dpy, surface, attribute, value); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api) -{ - EGLCALL(BindAPI, api); -} - -Q_DECL_EXPORT EGLenum EGLAPIENTRY eglQueryAPI(void) -{ - EGLCALL(QueryAPI); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglWaitClient(void) -{ - EGLCALL(WaitClient); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglReleaseThread(void) -{ - EGLCALL(ReleaseThread); -} - -Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer( - EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, - EGLConfig config, const EGLint *attrib_list) -{ - EGLCALL(CreatePbufferFromClientBuffer, dpy, buftype, buffer, config, attrib_list); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, - EGLint attribute, EGLint value) -{ - EGLCALL(SurfaceAttrib, dpy, surface, attribute, value); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - EGLCALL(BindTexImage, dpy, surface, buffer); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) -{ - EGLCALL(ReleaseTexImage, dpy, surface, buffer); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval) -{ - EGLCALL(SwapInterval, dpy, interval); -} - -Q_DECL_EXPORT EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, - EGLContext share_context, - const EGLint *attrib_list) -{ - EGLCALL(CreateContext, dpy, config, share_context, attrib_list); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx) -{ - EGLCALL(DestroyContext, dpy, ctx); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, - EGLSurface read, EGLContext ctx) -{ - EGLCALL(MakeCurrent, dpy, draw, read, ctx); -} - -Q_DECL_EXPORT EGLContext EGLAPIENTRY eglGetCurrentContext(void) -{ - EGLCALL(GetCurrentContext); -} - -Q_DECL_EXPORT EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) -{ - EGLCALL(GetCurrentSurface, readdraw); -} - -Q_DECL_EXPORT EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void) -{ - EGLCALL(GetCurrentDisplay); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, - EGLint attribute, EGLint *value) -{ - EGLCALL(QueryContext, dpy, ctx, attribute, value); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglWaitGL(void) -{ - EGLCALL(WaitGL); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine) -{ - EGLCALL(WaitNative, engine); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) -{ - EGLCALL(SwapBuffers, dpy, surface); -} - -Q_DECL_EXPORT EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, - EGLNativePixmapType target) -{ - EGLCALL(CopyBuffers, dpy, surface, target); -} - -// OpenGL - -Q_DECL_EXPORT void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) -{ - GLCALLV(Viewport, x, y, width, height); -} - -Q_DECL_EXPORT void APIENTRY glDepthRange(GLdouble nearVal, GLdouble farVal) -{ - if (qgl_choose()->libraryType() == QAbstractWindowsOpenGL::DesktopGL) { - GLCALLV(DepthRange, nearVal, farVal); - } else { - GLCALLV(DepthRangef, nearVal, farVal); - } -} - -Q_DECL_EXPORT GLboolean APIENTRY glIsEnabled(GLenum cap) -{ - GLCALL(IsEnabled, cap); -} - -Q_DECL_EXPORT void APIENTRY glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) -{ - GLCALLV(GetTexLevelParameteriv, target, level, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params) -{ - GLCALLV(GetTexLevelParameterfv, target, level, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint *params) -{ - GLCALLV(GetTexParameteriv, target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - GLCALLV(GetTexParameterfv, target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels) -{ - GLCALLV(GetTexImage, target, level, format, type, pixels); -} - -Q_DECL_EXPORT const GLubyte * APIENTRY glGetString(GLenum name) -{ - GLCALL(GetString, name); -} - -Q_DECL_EXPORT void APIENTRY glGetIntegerv(GLenum pname, GLint *params) -{ - GLCALLV(GetIntegerv, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetFloatv(GLenum pname, GLfloat *params) -{ - GLCALLV(GetFloatv, pname, params); -} - -Q_DECL_EXPORT GLenum APIENTRY glGetError() -{ - GLCALL(GetError); -} - -Q_DECL_EXPORT void APIENTRY glGetDoublev(GLenum pname, GLdouble *params) -{ - GLCALLV(GetDoublev, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetBooleanv(GLenum pname, GLboolean *params) -{ - GLCALLV(GetBooleanv, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) -{ - GLCALLV(ReadPixels, x, y, width, height, format, type, pixels); -} - -Q_DECL_EXPORT void APIENTRY glReadBuffer(GLenum mode) -{ - GLCALLV(ReadBuffer, mode); -} - -Q_DECL_EXPORT void APIENTRY glPixelStorei(GLenum pname, GLint param) -{ - GLCALLV(PixelStorei, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glPixelStoref(GLenum pname, GLfloat param) -{ - GLCALLV(PixelStoref, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glDepthFunc(GLenum func) -{ - GLCALLV(DepthFunc, func); -} - -Q_DECL_EXPORT void APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) -{ - GLCALLV(StencilOp, fail, zfail, zpass); -} - -Q_DECL_EXPORT void APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) -{ - GLCALLV(StencilFunc, func, ref, mask); -} - -Q_DECL_EXPORT void APIENTRY glLogicOp(GLenum opcode) -{ - GLCALLV(LogicOp, opcode); -} - -Q_DECL_EXPORT void APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) -{ - GLCALLV(BlendFunc, sfactor, dfactor); -} - -Q_DECL_EXPORT void APIENTRY glFlush() -{ - GLCALLV(Flush); -} - -Q_DECL_EXPORT void APIENTRY glFinish() -{ - GLCALLV(Finish); -} - -Q_DECL_EXPORT void APIENTRY glEnable(GLenum cap) -{ - GLCALLV(Enable, cap); -} - -Q_DECL_EXPORT void APIENTRY glDisable(GLenum cap) -{ - GLCALLV(Disable, cap); -} - -Q_DECL_EXPORT void APIENTRY glDepthMask(GLboolean flag) -{ - GLCALLV(DepthMask, flag); -} - -Q_DECL_EXPORT void APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -{ - GLCALLV(ColorMask, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glStencilMask(GLuint mask) -{ - GLCALLV(StencilMask, mask); -} - -Q_DECL_EXPORT void APIENTRY glClearDepth(GLdouble depth) -{ - if (qgl_choose()->libraryType() == QAbstractWindowsOpenGL::DesktopGL) { - GLCALLV(ClearDepth, depth); - } else { - GLCALLV(ClearDepthf, depth); - } -} - -Q_DECL_EXPORT void APIENTRY glClearStencil(GLint s) -{ - GLCALLV(ClearStencil, s); -} - -Q_DECL_EXPORT void APIENTRY glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - GLCALLV(ClearColor, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glClear(GLbitfield mask) -{ - GLCALLV(Clear, mask); -} - -Q_DECL_EXPORT void APIENTRY glDrawBuffer(GLenum mode) -{ - GLCALLV(DrawBuffer, mode); -} - -Q_DECL_EXPORT void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) -{ - GLCALLV(TexImage2D, target, level, internalformat, width, height, border, format, type, pixels); -} - -Q_DECL_EXPORT void APIENTRY glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels) -{ - GLCALLV(TexImage1D, target, level, internalformat, width, border, format, type, pixels); -} - -Q_DECL_EXPORT void APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint *params) -{ - GLCALLV(TexParameteriv, target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) -{ - GLCALLV(TexParameteri, target, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params) -{ - GLCALLV(TexParameterfv, target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) -{ - GLCALLV(TexParameterf, target, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) -{ - GLCALLV(Scissor, x, y, width, height); -} - -Q_DECL_EXPORT void APIENTRY glPolygonMode(GLenum face, GLenum mode) -{ - GLCALLV(PolygonMode, face, mode); -} - -Q_DECL_EXPORT void APIENTRY glPointSize(GLfloat size) -{ - GLCALLV(PointSize, size); -} - -Q_DECL_EXPORT void APIENTRY glLineWidth(GLfloat width) -{ - GLCALLV(LineWidth, width); -} - -Q_DECL_EXPORT void APIENTRY glHint(GLenum target, GLenum mode) -{ - GLCALLV(Hint, target, mode); -} - -Q_DECL_EXPORT void APIENTRY glFrontFace(GLenum mode) -{ - GLCALLV(FrontFace, mode); -} - -Q_DECL_EXPORT void APIENTRY glCullFace(GLenum mode) -{ - GLCALLV(CullFace, mode); -} - -Q_DECL_EXPORT void APIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z) -{ - GLCALLV(Translatef, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glTranslated(GLdouble x, GLdouble y, GLdouble z) -{ - GLCALLV(Translated, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z) -{ - GLCALLV(Scalef, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glScaled(GLdouble x, GLdouble y, GLdouble z) -{ - GLCALLV(Scaled, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) -{ - GLCALLV(Rotatef, angle, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) -{ - GLCALLV(Rotated, angle, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glPushMatrix() -{ - GLCALLV(PushMatrix); -} - -Q_DECL_EXPORT void APIENTRY glPopMatrix() -{ - GLCALLV(PopMatrix); -} - -Q_DECL_EXPORT void APIENTRY glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) -{ - GLCALLV(Ortho, left, right, bottom, top, zNear, zFar); -} - -Q_DECL_EXPORT void APIENTRY glMultMatrixd(const GLdouble *m) -{ - GLCALLV(MultMatrixd, m); -} - -Q_DECL_EXPORT void APIENTRY glMultMatrixf(const GLfloat *m) -{ - GLCALLV(MultMatrixf, m); -} - -Q_DECL_EXPORT void APIENTRY glMatrixMode(GLenum mode) -{ - GLCALLV(MatrixMode, mode); -} - -Q_DECL_EXPORT void APIENTRY glLoadMatrixd(const GLdouble *m) -{ - GLCALLV(LoadMatrixd, m); -} - -Q_DECL_EXPORT void APIENTRY glLoadMatrixf(const GLfloat *m) -{ - GLCALLV(LoadMatrixf, m); -} - -Q_DECL_EXPORT void APIENTRY glLoadIdentity() -{ - GLCALLV(LoadIdentity); -} - -Q_DECL_EXPORT void APIENTRY glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) -{ - GLCALLV(Frustum, left, right, bottom, top, zNear, zFar); -} - -Q_DECL_EXPORT GLboolean APIENTRY glIsList(GLuint list) -{ - GLCALL(IsList, list); -} - -Q_DECL_EXPORT void APIENTRY glGetTexGeniv(GLenum coord, GLenum pname, GLint *params) -{ - GLCALLV(GetTexGeniv, coord, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) -{ - GLCALLV(GetTexGenfv, coord, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params) -{ - GLCALLV(GetTexGendv, coord, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetTexEnviv(GLenum target, GLenum pname, GLint *params) -{ - GLCALLV(GetTexEnviv, target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params) -{ - GLCALLV(GetTexEnvfv, target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetPolygonStipple(GLubyte *mask) -{ - GLCALLV(GetPolygonStipple, mask); -} - -Q_DECL_EXPORT void APIENTRY glGetPixelMapusv(GLenum map, GLushort *values) -{ - GLCALLV(GetPixelMapusv, map, values); -} - -Q_DECL_EXPORT void APIENTRY glGetPixelMapuiv(GLenum map, GLuint *values) -{ - GLCALLV(GetPixelMapuiv, map, values); -} - -Q_DECL_EXPORT void APIENTRY glGetPixelMapfv(GLenum map, GLfloat *values) -{ - GLCALLV(GetPixelMapfv, map, values); -} - -Q_DECL_EXPORT void APIENTRY glGetMaterialiv(GLenum face, GLenum pname, GLint *params) -{ - GLCALLV(GetMaterialiv, face, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params) -{ - GLCALLV(GetMaterialfv, face, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetMapiv(GLenum target, GLenum query, GLint *v) -{ - GLCALLV(GetMapiv, target, query, v); -} - -Q_DECL_EXPORT void APIENTRY glGetMapfv(GLenum target, GLenum query, GLfloat *v) -{ - GLCALLV(GetMapfv, target, query, v); -} - -Q_DECL_EXPORT void APIENTRY glGetMapdv(GLenum target, GLenum query, GLdouble *v) -{ - GLCALLV(GetMapdv, target, query, v); -} - -Q_DECL_EXPORT void APIENTRY glGetLightiv(GLenum light, GLenum pname, GLint *params) -{ - GLCALLV(GetLightiv, light, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetLightfv(GLenum light, GLenum pname, GLfloat *params) -{ - GLCALLV(GetLightfv, light, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetClipPlane(GLenum plane, GLdouble *equation) -{ - GLCALLV(GetClipPlane, plane, equation); -} - -Q_DECL_EXPORT void APIENTRY glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) -{ - GLCALLV(DrawPixels, width, height, format, type, pixels); -} - -Q_DECL_EXPORT void APIENTRY glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) -{ - GLCALLV(CopyPixels, x, y, width, height, type); -} - -Q_DECL_EXPORT void APIENTRY glPixelMapusv(GLenum map, GLint mapsize, const GLushort *values) -{ - GLCALLV(PixelMapusv, map, mapsize, values); -} - -Q_DECL_EXPORT void APIENTRY glPixelMapuiv(GLenum map, GLint mapsize, const GLuint *values) -{ - GLCALLV(PixelMapuiv, map, mapsize, values); -} - -Q_DECL_EXPORT void APIENTRY glPixelMapfv(GLenum map, GLint mapsize, const GLfloat *values) -{ - GLCALLV(PixelMapfv, map, mapsize, values); -} - -Q_DECL_EXPORT void APIENTRY glPixelTransferi(GLenum pname, GLint param) -{ - GLCALLV(PixelTransferi, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glPixelTransferf(GLenum pname, GLfloat param) -{ - GLCALLV(PixelTransferf, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glPixelZoom(GLfloat xfactor, GLfloat yfactor) -{ - GLCALLV(PixelZoom, xfactor, yfactor); -} - -Q_DECL_EXPORT void APIENTRY glAlphaFunc(GLenum func, GLfloat ref) -{ - GLCALLV(AlphaFunc, func, ref); -} - -Q_DECL_EXPORT void APIENTRY glEvalPoint2(GLint i, GLint j) -{ - GLCALLV(EvalPoint2, i, j); -} - -Q_DECL_EXPORT void APIENTRY glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) -{ - GLCALLV(EvalMesh2, mode, i1, i2, j1, j2); -} - -Q_DECL_EXPORT void APIENTRY glEvalPoint1(GLint i) -{ - GLCALLV(EvalPoint1, i); -} - -Q_DECL_EXPORT void APIENTRY glEvalMesh1(GLenum mode, GLint i1, GLint i2) -{ - GLCALLV(EvalMesh1, mode, i1, i2); -} - -Q_DECL_EXPORT void APIENTRY glEvalCoord2fv(const GLfloat *u) -{ - GLCALLV(EvalCoord2fv, u); -} - -Q_DECL_EXPORT void APIENTRY glEvalCoord2f(GLfloat u, GLfloat v) -{ - GLCALLV(EvalCoord2f, u, v); -} - -Q_DECL_EXPORT void APIENTRY glEvalCoord2dv(const GLdouble *u) -{ - GLCALLV(EvalCoord2dv, u); -} - -Q_DECL_EXPORT void APIENTRY glEvalCoord2d(GLdouble u, GLdouble v) -{ - GLCALLV(EvalCoord2d, u, v); -} - -Q_DECL_EXPORT void APIENTRY glEvalCoord1fv(const GLfloat *u) -{ - GLCALLV(EvalCoord1fv, u); -} - -Q_DECL_EXPORT void APIENTRY glEvalCoord1f(GLfloat u) -{ - GLCALLV(EvalCoord1f, u); -} - -Q_DECL_EXPORT void APIENTRY glEvalCoord1dv(const GLdouble *u) -{ - GLCALLV(EvalCoord1dv, u); -} - -Q_DECL_EXPORT void APIENTRY glEvalCoord1d(GLdouble u) -{ - GLCALLV(EvalCoord1d, u); -} - -Q_DECL_EXPORT void APIENTRY glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) -{ - GLCALLV(MapGrid2f, un, u1, u2, vn, v1, v2); -} - -Q_DECL_EXPORT void APIENTRY glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) -{ - GLCALLV(MapGrid2d, un, u1, u2, vn, v1, v2); -} - -Q_DECL_EXPORT void APIENTRY glMapGrid1f(GLint un, GLfloat u1, GLfloat u2) -{ - GLCALLV(MapGrid1f, un, u1, u2); -} - -Q_DECL_EXPORT void APIENTRY glMapGrid1d(GLint un, GLdouble u1, GLdouble u2) -{ - GLCALLV(MapGrid1d, un, u1, u2); -} - -Q_DECL_EXPORT void APIENTRY glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points) -{ - GLCALLV(Map2f, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -Q_DECL_EXPORT void APIENTRY glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points) -{ - GLCALLV(Map2d, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); -} - -Q_DECL_EXPORT void APIENTRY glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points) -{ - GLCALLV(Map1f, target, u1, u2, stride, order, points); -} - -Q_DECL_EXPORT void APIENTRY glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points) -{ - GLCALLV(Map1d, target, u1, u2, stride, order, points); -} - -Q_DECL_EXPORT void APIENTRY glPushAttrib(GLbitfield mask) -{ - GLCALLV(PushAttrib, mask); -} - -Q_DECL_EXPORT void APIENTRY glPopAttrib() -{ - GLCALLV(PopAttrib); -} - -Q_DECL_EXPORT void APIENTRY glAccum(GLenum op, GLfloat value) -{ - GLCALLV(Accum, op, value); -} - -Q_DECL_EXPORT void APIENTRY glIndexMask(GLuint mask) -{ - GLCALLV(IndexMask, mask); -} - -Q_DECL_EXPORT void APIENTRY glClearIndex(GLfloat c) -{ - GLCALLV(ClearIndex, c); -} - -Q_DECL_EXPORT void APIENTRY glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - GLCALLV(ClearAccum, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glPushName(GLuint name) -{ - GLCALLV(PushName, name); -} - -Q_DECL_EXPORT void APIENTRY glPopName() -{ - GLCALLV(PopName); -} - -Q_DECL_EXPORT void APIENTRY glPassThrough(GLfloat token) -{ - GLCALLV(PassThrough, token); -} - -Q_DECL_EXPORT void APIENTRY glLoadName(GLuint name) -{ - GLCALLV(LoadName, name); -} - -Q_DECL_EXPORT void APIENTRY glInitNames() -{ - GLCALLV(InitNames); -} - -Q_DECL_EXPORT GLint APIENTRY glRenderMode(GLenum mode) -{ - GLCALL(RenderMode, mode); -} - -Q_DECL_EXPORT void APIENTRY glSelectBuffer(GLsizei size, GLuint *buffer) -{ - GLCALLV(SelectBuffer, size, buffer); -} - -Q_DECL_EXPORT void APIENTRY glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer) -{ - GLCALLV(FeedbackBuffer, size, type, buffer); -} - -Q_DECL_EXPORT void APIENTRY glTexGeniv(GLenum coord, GLenum pname, const GLint *params) -{ - GLCALLV(TexGeniv, coord, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glTexGeni(GLenum coord, GLenum pname, GLint param) -{ - GLCALLV(TexGeni, coord, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params) -{ - GLCALLV(TexGenfv, coord, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glTexGenf(GLenum coord, GLenum pname, GLfloat param) -{ - GLCALLV(TexGenf, coord, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glTexGendv(GLenum coord, GLenum pname, const GLdouble *params) -{ - GLCALLV(TexGendv, coord, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glTexGend(GLenum coord, GLenum pname, GLdouble param) -{ - GLCALLV(TexGend, coord, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glTexEnviv(GLenum target, GLenum pname, const GLint *params) -{ - GLCALLV(TexEnviv, target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param) -{ - GLCALLV(TexEnvi, target, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) -{ - GLCALLV(TexEnvfv, target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glTexEnvf(GLenum target, GLenum pname, GLfloat param) -{ - GLCALLV(TexEnvf, target, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glShadeModel(GLenum mode) -{ - GLCALLV(ShadeModel, mode); -} - -Q_DECL_EXPORT void APIENTRY glPolygonStipple(const GLubyte *mask) -{ - GLCALLV(PolygonStipple, mask); -} - -Q_DECL_EXPORT void APIENTRY glMaterialiv(GLenum face, GLenum pname, const GLint *params) -{ - GLCALLV(Materialiv, face, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glMateriali(GLenum face, GLenum pname, GLint param) -{ - GLCALLV(Materiali, face, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) -{ - GLCALLV(Materialfv, face, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glMaterialf(GLenum face, GLenum pname, GLfloat param) -{ - GLCALLV(Materialf, face, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glLineStipple(GLint factor, GLushort pattern) -{ - GLCALLV(LineStipple, factor, pattern); -} - -Q_DECL_EXPORT void APIENTRY glLightModeliv(GLenum pname, const GLint *params) -{ - GLCALLV(LightModeliv, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glLightModeli(GLenum pname, GLint param) -{ - GLCALLV(LightModeli, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glLightModelfv(GLenum pname, const GLfloat *params) -{ - GLCALLV(LightModelfv, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glLightModelf(GLenum pname, GLfloat param) -{ - GLCALLV(LightModelf, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glLightiv(GLenum light, GLenum pname, const GLint *params) -{ - GLCALLV(Lightiv, light, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glLighti(GLenum light, GLenum pname, GLint param) -{ - GLCALLV(Lighti, light, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params) -{ - GLCALLV(Lightfv, light, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glLightf(GLenum light, GLenum pname, GLfloat param) -{ - GLCALLV(Lightf, light, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glFogiv(GLenum pname, const GLint *params) -{ - GLCALLV(Fogiv, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glFogi(GLenum pname, GLint param) -{ - GLCALLV(Fogi, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glFogfv(GLenum pname, const GLfloat *params) -{ - GLCALLV(Fogfv, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glFogf(GLenum pname, GLfloat param) -{ - GLCALLV(Fogf, pname, param); -} - -Q_DECL_EXPORT void APIENTRY glColorMaterial(GLenum face, GLenum mode) -{ - GLCALLV(ColorMaterial, face, mode); -} - -Q_DECL_EXPORT void APIENTRY glClipPlane(GLenum plane, const GLdouble *equation) -{ - GLCALLV(ClipPlane, plane, equation); -} - -Q_DECL_EXPORT void APIENTRY glVertex4sv(const GLshort *v) -{ - GLCALLV(Vertex4sv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w) -{ - GLCALLV(Vertex4s, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glVertex4iv(const GLint *v) -{ - GLCALLV(Vertex4iv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex4i(GLint x, GLint y, GLint z, GLint w) -{ - GLCALLV(Vertex4i, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glVertex4fv(const GLfloat *v) -{ - GLCALLV(Vertex4fv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GLCALLV(Vertex4f, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glVertex4dv(const GLdouble *v) -{ - GLCALLV(Vertex4dv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - GLCALLV(Vertex4d, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glVertex3sv(const GLshort *v) -{ - GLCALLV(Vertex3sv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex3s(GLshort x, GLshort y, GLshort z) -{ - GLCALLV(Vertex3s, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glVertex3iv(const GLint *v) -{ - GLCALLV(Vertex3iv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex3i(GLint x, GLint y, GLint z) -{ - GLCALLV(Vertex3i, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glVertex3fv(const GLfloat *v) -{ - GLCALLV(Vertex3fv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z) -{ - GLCALLV(Vertex3f, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glVertex3dv(const GLdouble *v) -{ - GLCALLV(Vertex3dv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex3d(GLdouble x, GLdouble y, GLdouble z) -{ - GLCALLV(Vertex3d, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glVertex2sv(const GLshort *v) -{ - GLCALLV(Vertex2sv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex2s(GLshort x, GLshort y) -{ - GLCALLV(Vertex2s, x, y); -} - -Q_DECL_EXPORT void APIENTRY glVertex2iv(const GLint *v) -{ - GLCALLV(Vertex2iv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex2i(GLint x, GLint y) -{ - GLCALLV(Vertex2i, x, y); -} - -Q_DECL_EXPORT void APIENTRY glVertex2fv(const GLfloat *v) -{ - GLCALLV(Vertex2fv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex2f(GLfloat x, GLfloat y) -{ - GLCALLV(Vertex2f, x, y); -} - -Q_DECL_EXPORT void APIENTRY glVertex2dv(const GLdouble *v) -{ - GLCALLV(Vertex2dv, v); -} - -Q_DECL_EXPORT void APIENTRY glVertex2d(GLdouble x, GLdouble y) -{ - GLCALLV(Vertex2d, x, y); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord4sv(const GLshort *v) -{ - GLCALLV(TexCoord4sv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q) -{ - GLCALLV(TexCoord4s, s, t, r, q); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord4iv(const GLint *v) -{ - GLCALLV(TexCoord4iv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord4i(GLint s, GLint t, GLint r, GLint q) -{ - GLCALLV(TexCoord4i, s, t, r, q); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord4fv(const GLfloat *v) -{ - GLCALLV(TexCoord4fv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q) -{ - GLCALLV(TexCoord4f, s, t, r, q); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord4dv(const GLdouble *v) -{ - GLCALLV(TexCoord4dv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q) -{ - GLCALLV(TexCoord4d, s, t, r, q); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord3sv(const GLshort *v) -{ - GLCALLV(TexCoord3sv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord3s(GLshort s, GLshort t, GLshort r) -{ - GLCALLV(TexCoord3s, s, t, r); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord3iv(const GLint *v) -{ - GLCALLV(TexCoord3iv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord3i(GLint s, GLint t, GLint r) -{ - GLCALLV(TexCoord3i, s, t, r); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord3fv(const GLfloat *v) -{ - GLCALLV(TexCoord3fv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord3f(GLfloat s, GLfloat t, GLfloat r) -{ - GLCALLV(TexCoord3f, s, t, r); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord3dv(const GLdouble *v) -{ - GLCALLV(TexCoord3dv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord3d(GLdouble s, GLdouble t, GLdouble r) -{ - GLCALLV(TexCoord3d, s, t, r); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord2sv(const GLshort *v) -{ - GLCALLV(TexCoord2sv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord2s(GLshort s, GLshort t) -{ - GLCALLV(TexCoord2s, s, t); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord2iv(const GLint *v) -{ - GLCALLV(TexCoord2iv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord2i(GLint s, GLint t) -{ - GLCALLV(TexCoord2i, s, t); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord2fv(const GLfloat *v) -{ - GLCALLV(TexCoord2fv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord2f(GLfloat s, GLfloat t) -{ - GLCALLV(TexCoord2f, s, t); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord2dv(const GLdouble *v) -{ - GLCALLV(TexCoord2dv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord2d(GLdouble s, GLdouble t) -{ - GLCALLV(TexCoord2d, s, t); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord1sv(const GLshort *v) -{ - GLCALLV(TexCoord1sv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord1s(GLshort s) -{ - GLCALLV(TexCoord1s, s); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord1iv(const GLint *v) -{ - GLCALLV(TexCoord1iv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord1i(GLint s) -{ - GLCALLV(TexCoord1i, s); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord1fv(const GLfloat *v) -{ - GLCALLV(TexCoord1fv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord1f(GLfloat s) -{ - GLCALLV(TexCoord1f, s); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord1dv(const GLdouble *v) -{ - GLCALLV(TexCoord1dv, v); -} - -Q_DECL_EXPORT void APIENTRY glTexCoord1d(GLdouble s) -{ - GLCALLV(TexCoord1d, s); -} - -Q_DECL_EXPORT void APIENTRY glRectsv(const GLshort *v1, const GLshort *v2) -{ - GLCALLV(Rectsv, v1, v2); -} - -Q_DECL_EXPORT void APIENTRY glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) -{ - GLCALLV(Rects, x1, y1, x2, y2); -} - -Q_DECL_EXPORT void APIENTRY glRectiv(const GLint *v1, const GLint *v2) -{ - GLCALLV(Rectiv, v1, v2); -} - -Q_DECL_EXPORT void APIENTRY glRecti(GLint x1, GLint y1, GLint x2, GLint y2) -{ - GLCALLV(Recti, x1, y1, x2, y2); -} - -Q_DECL_EXPORT void APIENTRY glRectfv(const GLfloat *v1, const GLfloat *v2) -{ - GLCALLV(Rectfv, v1, v2); -} - -Q_DECL_EXPORT void APIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) -{ - GLCALLV(Rectf, x1, y1, x2, y2); -} - -Q_DECL_EXPORT void APIENTRY glRectdv(const GLdouble *v1, const GLdouble *v2) -{ - GLCALLV(Rectdv, v1, v2); -} - -Q_DECL_EXPORT void APIENTRY glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) -{ - GLCALLV(Rectd, x1, y1, x2, y2); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos4sv(const GLshort *v) -{ - GLCALLV(RasterPos4sv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) -{ - GLCALLV(RasterPos4s, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos4iv(const GLint *v) -{ - GLCALLV(RasterPos4iv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos4i(GLint x, GLint y, GLint z, GLint w) -{ - GLCALLV(RasterPos4i, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos4fv(const GLfloat *v) -{ - GLCALLV(RasterPos4fv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GLCALLV(RasterPos4f, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos4dv(const GLdouble *v) -{ - GLCALLV(RasterPos4dv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - GLCALLV(RasterPos4d, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos3sv(const GLshort *v) -{ - GLCALLV(RasterPos3sv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos3s(GLshort x, GLshort y, GLshort z) -{ - GLCALLV(RasterPos3s, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos3iv(const GLint *v) -{ - GLCALLV(RasterPos3iv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos3i(GLint x, GLint y, GLint z) -{ - GLCALLV(RasterPos3i, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos3fv(const GLfloat *v) -{ - GLCALLV(RasterPos3fv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos3f(GLfloat x, GLfloat y, GLfloat z) -{ - GLCALLV(RasterPos3f, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos3dv(const GLdouble *v) -{ - GLCALLV(RasterPos3dv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos3d(GLdouble x, GLdouble y, GLdouble z) -{ - GLCALLV(RasterPos3d, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos2sv(const GLshort *v) -{ - GLCALLV(RasterPos2sv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos2s(GLshort x, GLshort y) -{ - GLCALLV(RasterPos2s, x, y); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos2iv(const GLint *v) -{ - GLCALLV(RasterPos2iv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos2i(GLint x, GLint y) -{ - GLCALLV(RasterPos2i, x, y); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos2fv(const GLfloat *v) -{ - GLCALLV(RasterPos2fv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos2f(GLfloat x, GLfloat y) -{ - GLCALLV(RasterPos2f, x, y); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos2dv(const GLdouble *v) -{ - GLCALLV(RasterPos2dv, v); -} - -Q_DECL_EXPORT void APIENTRY glRasterPos2d(GLdouble x, GLdouble y) -{ - GLCALLV(RasterPos2d, x, y); -} - -Q_DECL_EXPORT void APIENTRY glNormal3sv(const GLshort *v) -{ - GLCALLV(Normal3sv, v); -} - -Q_DECL_EXPORT void APIENTRY glNormal3s(GLshort nx, GLshort ny, GLshort nz) -{ - GLCALLV(Normal3s, nx, ny, nz); -} - -Q_DECL_EXPORT void APIENTRY glNormal3iv(const GLint *v) -{ - GLCALLV(Normal3iv, v); -} - -Q_DECL_EXPORT void APIENTRY glNormal3i(GLint nx, GLint ny, GLint nz) -{ - GLCALLV(Normal3i, nx, ny, nz); -} - -Q_DECL_EXPORT void APIENTRY glNormal3fv(const GLfloat *v) -{ - GLCALLV(Normal3fv, v); -} - -Q_DECL_EXPORT void APIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) -{ - GLCALLV(Normal3f, nx, ny, nz); -} - -Q_DECL_EXPORT void APIENTRY glNormal3dv(const GLdouble *v) -{ - GLCALLV(Normal3dv, v); -} - -Q_DECL_EXPORT void APIENTRY glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz) -{ - GLCALLV(Normal3d, nx, ny, nz); -} - -Q_DECL_EXPORT void APIENTRY glNormal3bv(const GLbyte *v) -{ - GLCALLV(Normal3bv, v); -} - -Q_DECL_EXPORT void APIENTRY glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz) -{ - GLCALLV(Normal3b, nx, ny, nz); -} - -Q_DECL_EXPORT void APIENTRY glIndexsv(const GLshort *c) -{ - GLCALLV(Indexsv, c); -} - -Q_DECL_EXPORT void APIENTRY glIndexs(GLshort c) -{ - GLCALLV(Indexs, c); -} - -Q_DECL_EXPORT void APIENTRY glIndexiv(const GLint *c) -{ - GLCALLV(Indexiv, c); -} - -Q_DECL_EXPORT void APIENTRY glIndexi(GLint c) -{ - GLCALLV(Indexi, c); -} - -Q_DECL_EXPORT void APIENTRY glIndexfv(const GLfloat *c) -{ - GLCALLV(Indexfv, c); -} - -Q_DECL_EXPORT void APIENTRY glIndexf(GLfloat c) -{ - GLCALLV(Indexf, c); -} - -Q_DECL_EXPORT void APIENTRY glIndexdv(const GLdouble *c) -{ - GLCALLV(Indexdv, c); -} - -Q_DECL_EXPORT void APIENTRY glIndexd(GLdouble c) -{ - GLCALLV(Indexd, c); -} - -Q_DECL_EXPORT void APIENTRY glEnd() -{ - GLCALLV(End); -} - -Q_DECL_EXPORT void APIENTRY glEdgeFlagv(const GLboolean *flag) -{ - GLCALLV(EdgeFlagv, flag); -} - -Q_DECL_EXPORT void APIENTRY glEdgeFlag(GLboolean flag) -{ - GLCALLV(EdgeFlag, flag); -} - -Q_DECL_EXPORT void APIENTRY glColor4usv(const GLushort *v) -{ - GLCALLV(Color4usv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha) -{ - GLCALLV(Color4us, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glColor4uiv(const GLuint *v) -{ - GLCALLV(Color4uiv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha) -{ - GLCALLV(Color4ui, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glColor4ubv(const GLubyte *v) -{ - GLCALLV(Color4ubv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) -{ - GLCALLV(Color4ub, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glColor4sv(const GLshort *v) -{ - GLCALLV(Color4sv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha) -{ - GLCALLV(Color4s, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glColor4iv(const GLint *v) -{ - GLCALLV(Color4iv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor4i(GLint red, GLint green, GLint blue, GLint alpha) -{ - GLCALLV(Color4i, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glColor4fv(const GLfloat *v) -{ - GLCALLV(Color4fv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - GLCALLV(Color4f, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glColor4dv(const GLdouble *v) -{ - GLCALLV(Color4dv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) -{ - GLCALLV(Color4d, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glColor4bv(const GLbyte *v) -{ - GLCALLV(Color4bv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) -{ - GLCALLV(Color4b, red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glColor3usv(const GLushort *v) -{ - GLCALLV(Color3usv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor3us(GLushort red, GLushort green, GLushort blue) -{ - GLCALLV(Color3us, red, green, blue); -} - -Q_DECL_EXPORT void APIENTRY glColor3uiv(const GLuint *v) -{ - GLCALLV(Color3uiv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor3ui(GLuint red, GLuint green, GLuint blue) -{ - GLCALLV(Color3ui, red, green, blue); -} - -Q_DECL_EXPORT void APIENTRY glColor3ubv(const GLubyte *v) -{ - GLCALLV(Color3ubv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor3ub(GLubyte red, GLubyte green, GLubyte blue) -{ - GLCALLV(Color3ub, red, green, blue); -} - -Q_DECL_EXPORT void APIENTRY glColor3sv(const GLshort *v) -{ - GLCALLV(Color3sv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor3s(GLshort red, GLshort green, GLshort blue) -{ - GLCALLV(Color3s, red, green, blue); -} - -Q_DECL_EXPORT void APIENTRY glColor3iv(const GLint *v) -{ - GLCALLV(Color3iv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor3i(GLint red, GLint green, GLint blue) -{ - GLCALLV(Color3i, red, green, blue); -} - -Q_DECL_EXPORT void APIENTRY glColor3fv(const GLfloat *v) -{ - GLCALLV(Color3fv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor3f(GLfloat red, GLfloat green, GLfloat blue) -{ - GLCALLV(Color3f, red, green, blue); -} - -Q_DECL_EXPORT void APIENTRY glColor3dv(const GLdouble *v) -{ - GLCALLV(Color3dv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor3d(GLdouble red, GLdouble green, GLdouble blue) -{ - GLCALLV(Color3d, red, green, blue); -} - -Q_DECL_EXPORT void APIENTRY glColor3bv(const GLbyte *v) -{ - GLCALLV(Color3bv, v); -} - -Q_DECL_EXPORT void APIENTRY glColor3b(GLbyte red, GLbyte green, GLbyte blue) -{ - GLCALLV(Color3b, red, green, blue); -} - -Q_DECL_EXPORT void APIENTRY glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) -{ - GLCALLV(Bitmap, width, height, xorig, yorig, xmove, ymove, bitmap); -} - -Q_DECL_EXPORT void APIENTRY glBegin(GLenum mode) -{ - GLCALLV(Begin, mode); -} - -Q_DECL_EXPORT void APIENTRY glListBase(GLuint base) -{ - GLCALLV(ListBase, base); -} - -Q_DECL_EXPORT GLuint APIENTRY glGenLists(GLsizei range) -{ - GLCALL(GenLists, range); -} - -Q_DECL_EXPORT void APIENTRY glDeleteLists(GLuint list, GLsizei range) -{ - GLCALLV(DeleteLists, list, range); -} - -Q_DECL_EXPORT void APIENTRY glCallLists(GLsizei n, GLenum type, const GLvoid *lists) -{ - GLCALLV(CallLists, n, type, lists); -} - -Q_DECL_EXPORT void APIENTRY glCallList(GLuint list) -{ - GLCALLV(CallList, list); -} - -Q_DECL_EXPORT void APIENTRY glEndList() -{ - GLCALLV(EndList); -} - -Q_DECL_EXPORT void APIENTRY glNewList(GLuint list, GLenum mode) -{ - GLCALLV(NewList, list, mode); -} - -Q_DECL_EXPORT void APIENTRY glIndexubv(const GLubyte *c) -{ - GLCALLV(Indexubv, c); -} - -Q_DECL_EXPORT void APIENTRY glIndexub(GLubyte c) -{ - GLCALLV(Indexub, c); -} - -Q_DECL_EXPORT GLboolean APIENTRY glIsTexture(GLuint texture) -{ - GLCALL(IsTexture, texture); -} - -Q_DECL_EXPORT void APIENTRY glGenTextures(GLsizei n, GLuint *textures) -{ - GLCALLV(GenTextures, n, textures); -} - -Q_DECL_EXPORT void APIENTRY glDeleteTextures(GLsizei n, const GLuint *textures) -{ - GLCALLV(DeleteTextures, n, textures); -} - -Q_DECL_EXPORT void APIENTRY glBindTexture(GLenum target, GLuint texture) -{ - GLCALLV(BindTexture, target, texture); -} - -Q_DECL_EXPORT void APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) -{ - GLCALLV(TexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, pixels); -} - -Q_DECL_EXPORT void APIENTRY glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) -{ - GLCALLV(TexSubImage1D, target, level, xoffset, width, format, type, pixels); -} - -Q_DECL_EXPORT void APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) -{ - GLCALLV(CopyTexSubImage2D, target, level, xoffset, yoffset, x, y, width, height); -} - -Q_DECL_EXPORT void APIENTRY glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) -{ - GLCALLV(CopyTexSubImage1D, target, level, xoffset, x, y, width); -} - -Q_DECL_EXPORT void APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) -{ - GLCALLV(CopyTexImage2D, target, level, internalformat, x, y, width, height, border); -} - -Q_DECL_EXPORT void APIENTRY glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) -{ - GLCALLV(CopyTexImage1D, target, level, internalformat, x, y, width, border); -} - -Q_DECL_EXPORT void APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) -{ - GLCALLV(PolygonOffset, factor, units); -} - -Q_DECL_EXPORT void APIENTRY glGetPointerv(GLenum pname, GLvoid* *params) -{ - GLCALLV(GetPointerv, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) -{ - GLCALLV(DrawElements, mode, count, type, indices); -} - -Q_DECL_EXPORT void APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) -{ - GLCALLV(DrawArrays, mode, first, count); -} - -Q_DECL_EXPORT void APIENTRY glPushClientAttrib(GLbitfield mask) -{ - GLCALLV(PushClientAttrib, mask); -} - -Q_DECL_EXPORT void APIENTRY glPopClientAttrib() -{ - GLCALLV(PopClientAttrib); -} - -Q_DECL_EXPORT void APIENTRY glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities) -{ - GLCALLV(PrioritizeTextures, n, textures, priorities); -} - -Q_DECL_EXPORT GLboolean APIENTRY glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences) -{ - GLCALL(AreTexturesResident, n, textures, residences); -} - -Q_DECL_EXPORT void APIENTRY glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - GLCALLV(VertexPointer, size, type, stride, pointer); -} - -Q_DECL_EXPORT void APIENTRY glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - GLCALLV(TexCoordPointer, size, type, stride, pointer); -} - -Q_DECL_EXPORT void APIENTRY glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) -{ - GLCALLV(NormalPointer, type, stride, pointer); -} - -Q_DECL_EXPORT void APIENTRY glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) -{ - GLCALLV(InterleavedArrays, format, stride, pointer); -} - -Q_DECL_EXPORT void APIENTRY glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer) -{ - GLCALLV(IndexPointer, type, stride, pointer); -} - -Q_DECL_EXPORT void APIENTRY glEnableClientState(GLenum array) -{ - GLCALLV(EnableClientState, array); -} - -Q_DECL_EXPORT void APIENTRY glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer) -{ - GLCALLV(EdgeFlagPointer, stride, pointer); -} - -Q_DECL_EXPORT void APIENTRY glDisableClientState(GLenum array) -{ - GLCALLV(DisableClientState, array); -} - -Q_DECL_EXPORT void APIENTRY glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - GLCALLV(ColorPointer, size, type, stride, pointer); -} - -Q_DECL_EXPORT void APIENTRY glArrayElement(GLint i) -{ - GLCALLV(ArrayElement, i); -} - -// OpenGL ES 2.0 - -Q_DECL_EXPORT void APIENTRY glActiveTexture(GLenum texture) -{ - GLCALLV(ActiveTexture,texture); -} - -Q_DECL_EXPORT void APIENTRY glAttachShader(GLuint program, GLuint shader) -{ - GLCALLV(AttachShader,program, shader); -} - -Q_DECL_EXPORT void APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) -{ - GLCALLV(BindAttribLocation,program, index, name); -} - -Q_DECL_EXPORT void APIENTRY glBindBuffer(GLenum target, GLuint buffer) -{ - GLCALLV(BindBuffer,target, buffer); -} - -Q_DECL_EXPORT void APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer) -{ - GLCALLV(BindFramebuffer,target, framebuffer); -} - -Q_DECL_EXPORT void APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer) -{ - GLCALLV(BindRenderbuffer,target, renderbuffer); -} - -Q_DECL_EXPORT void APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -{ - GLCALLV(BlendColor,red, green, blue, alpha); -} - -Q_DECL_EXPORT void APIENTRY glBlendEquation(GLenum mode) -{ - GLCALLV(BlendEquation,mode); -} - -Q_DECL_EXPORT void APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) -{ - GLCALLV(BlendEquationSeparate,modeRGB, modeAlpha); -} - -Q_DECL_EXPORT void APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -{ - GLCALLV(BlendFuncSeparate,srcRGB, dstRGB, srcAlpha, dstAlpha); -} - -Q_DECL_EXPORT void APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) -{ - GLCALLV(BufferData,target, size, data, usage); -} - -Q_DECL_EXPORT void APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) -{ - GLCALLV(BufferSubData,target, offset, size, data); -} - -Q_DECL_EXPORT GLenum APIENTRY glCheckFramebufferStatus(GLenum target) -{ - GLCALL(CheckFramebufferStatus,target); -} - -Q_DECL_EXPORT void APIENTRY glClearDepthf(GLclampf depth) -{ - glClearDepth(depth); -} - -Q_DECL_EXPORT void APIENTRY glCompileShader(GLuint shader) -{ - GLCALLV(CompileShader,shader); -} - -Q_DECL_EXPORT void APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) -{ - GLCALLV(CompressedTexImage2D,target, level, internalformat, width, height, border, imageSize, data); -} - -Q_DECL_EXPORT void APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) -{ - GLCALLV(CompressedTexSubImage2D,target, level, xoffset, yoffset, width, height, format, imageSize, data); -} - -Q_DECL_EXPORT GLuint APIENTRY glCreateProgram(void) -{ - GLCALL(CreateProgram); -} - -Q_DECL_EXPORT GLuint glCreateShader(GLenum type) -{ - GLCALL(CreateShader,type); -} - -Q_DECL_EXPORT void APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers) -{ - GLCALLV(DeleteBuffers,n, buffers); -} - -Q_DECL_EXPORT void APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) -{ - GLCALLV(DeleteFramebuffers,n, framebuffers); -} - -Q_DECL_EXPORT void APIENTRY glDeleteProgram(GLuint program) -{ - GLCALLV(DeleteProgram,program); -} - -Q_DECL_EXPORT void APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) -{ - GLCALLV(DeleteRenderbuffers,n, renderbuffers); -} - -Q_DECL_EXPORT void APIENTRY glDeleteShader(GLuint shader) -{ - GLCALLV(DeleteShader,shader); -} - -Q_DECL_EXPORT void APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar) -{ - glDepthRange(zNear, zFar); -} - -Q_DECL_EXPORT void APIENTRY glDetachShader(GLuint program, GLuint shader) -{ - GLCALLV(DetachShader,program, shader); -} - -Q_DECL_EXPORT void APIENTRY glDisableVertexAttribArray(GLuint index) -{ - GLCALLV(DisableVertexAttribArray,index); -} - -Q_DECL_EXPORT void APIENTRY glEnableVertexAttribArray(GLuint index) -{ - GLCALLV(EnableVertexAttribArray,index); -} - -Q_DECL_EXPORT void APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) -{ - GLCALLV(FramebufferRenderbuffer,target, attachment, renderbuffertarget, renderbuffer); -} - -Q_DECL_EXPORT void APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -{ - GLCALLV(FramebufferTexture2D,target, attachment, textarget, texture, level); -} - -Q_DECL_EXPORT void APIENTRY glGenBuffers(GLsizei n, GLuint* buffers) -{ - GLCALLV(GenBuffers,n, buffers); -} - -Q_DECL_EXPORT void APIENTRY glGenerateMipmap(GLenum target) -{ - GLCALLV(GenerateMipmap,target); -} - -Q_DECL_EXPORT void APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) -{ - GLCALLV(GenFramebuffers,n, framebuffers); -} - -Q_DECL_EXPORT void APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) -{ - GLCALLV(GenRenderbuffers,n, renderbuffers); -} - -Q_DECL_EXPORT void APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) -{ - GLCALLV(GetActiveAttrib,program, index, bufsize, length, size, type, name); -} - -Q_DECL_EXPORT void APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) -{ - GLCALLV(GetActiveUniform,program, index, bufsize, length, size, type, name); -} - -Q_DECL_EXPORT void APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) -{ - GLCALLV(GetAttachedShaders,program, maxcount, count, shaders); -} - -Q_DECL_EXPORT int APIENTRY glGetAttribLocation(GLuint program, const GLchar* name) -{ - GLCALL(GetAttribLocation,program, name); -} - -Q_DECL_EXPORT void APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) -{ - GLCALLV(GetBufferParameteriv,target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) -{ - GLCALLV(GetFramebufferAttachmentParameteriv,target, attachment, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) -{ - GLCALLV(GetProgramiv,program, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) -{ - GLCALLV(GetProgramInfoLog,program, bufsize, length, infolog); -} - -Q_DECL_EXPORT void APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) -{ - GLCALLV(GetRenderbufferParameteriv,target, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) -{ - GLCALLV(GetShaderiv,shader, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) -{ - GLCALLV(GetShaderInfoLog,shader, bufsize, length, infolog); -} - -Q_DECL_EXPORT void APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) -{ - GLCALLV(GetShaderPrecisionFormat,shadertype, precisiontype, range, precision); -} - -Q_DECL_EXPORT void APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) -{ - GLCALLV(GetShaderSource,shader, bufsize, length, source); -} - -Q_DECL_EXPORT void APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) -{ - GLCALLV(GetUniformfv, program, location, params); -} - -Q_DECL_EXPORT void APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) -{ - GLCALLV(GetUniformiv, program, location, params); -} - -Q_DECL_EXPORT int APIENTRY glGetUniformLocation(GLuint program, const GLchar* name) -{ - GLCALL(GetUniformLocation,program, name); -} - -Q_DECL_EXPORT void APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) -{ - GLCALLV(GetVertexAttribfv,index, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) -{ - GLCALLV(GetVertexAttribiv,index, pname, params); -} - -Q_DECL_EXPORT void APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) -{ - GLCALLV(GetVertexAttribPointerv,index, pname, pointer); -} - -Q_DECL_EXPORT GLboolean APIENTRY glIsBuffer(GLuint buffer) -{ - GLCALL(IsBuffer,buffer); -} - -Q_DECL_EXPORT GLboolean APIENTRY glIsFramebuffer(GLuint framebuffer) -{ - GLCALL(IsFramebuffer,framebuffer); -} - -Q_DECL_EXPORT GLboolean APIENTRY glIsProgram(GLuint program) -{ - GLCALL(IsProgram,program); -} - -Q_DECL_EXPORT GLboolean APIENTRY glIsRenderbuffer(GLuint renderbuffer) -{ - GLCALL(IsRenderbuffer,renderbuffer); -} - -Q_DECL_EXPORT GLboolean APIENTRY glIsShader(GLuint shader) -{ - GLCALL(IsShader,shader); -} - -Q_DECL_EXPORT void APIENTRY glLinkProgram(GLuint program) -{ - GLCALLV(LinkProgram,program); -} - -Q_DECL_EXPORT void APIENTRY glReleaseShaderCompiler(void) -{ - GLCALLV(ReleaseShaderCompiler,); -} - -Q_DECL_EXPORT void APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) -{ - GLCALLV(RenderbufferStorage,target, internalformat, width, height); -} - -Q_DECL_EXPORT void APIENTRY glSampleCoverage(GLclampf value, GLboolean invert) -{ - GLCALLV(SampleCoverage,value, invert); -} - -Q_DECL_EXPORT void APIENTRY glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) -{ - GLCALLV(ShaderBinary,n, shaders, binaryformat, binary, length); -} - -Q_DECL_EXPORT void APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar* *string, const GLint* length) -{ - GLCALLV(ShaderSource,shader, count, string, length); -} - -Q_DECL_EXPORT void APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) -{ - GLCALLV(StencilFuncSeparate,face, func, ref, mask); -} - -Q_DECL_EXPORT void APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) -{ - GLCALLV(StencilMaskSeparate,face, mask); -} - -Q_DECL_EXPORT void APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) -{ - GLCALLV(StencilOpSeparate,face, fail, zfail, zpass); -} - -Q_DECL_EXPORT void APIENTRY glUniform1f(GLint location, GLfloat x) -{ - GLCALLV(Uniform1f,location, x); -} - -Q_DECL_EXPORT void APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v) -{ - GLCALLV(Uniform1fv,location, count, v); -} - -Q_DECL_EXPORT void APIENTRY glUniform1i(GLint location, GLint x) -{ - GLCALLV(Uniform1i,location, x); -} - -Q_DECL_EXPORT void APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v) -{ - GLCALLV(Uniform1iv,location, count, v); -} - -Q_DECL_EXPORT void APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y) -{ - GLCALLV(Uniform2f,location, x, y); -} - -Q_DECL_EXPORT void APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v) -{ - GLCALLV(Uniform2fv,location, count, v); -} - -Q_DECL_EXPORT void APIENTRY glUniform2i(GLint location, GLint x, GLint y) -{ - GLCALLV(Uniform2i,location, x, y); -} - -Q_DECL_EXPORT void APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v) -{ - GLCALLV(Uniform2iv,location, count, v); -} - -Q_DECL_EXPORT void APIENTRY glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) -{ - GLCALLV(Uniform3f,location, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v) -{ - GLCALLV(Uniform3fv,location, count, v); -} - -Q_DECL_EXPORT void APIENTRY glUniform3i(GLint location, GLint x, GLint y, GLint z) -{ - GLCALLV(Uniform3i,location, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v) -{ - GLCALLV(Uniform3iv,location, count, v); -} - -Q_DECL_EXPORT void APIENTRY glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GLCALLV(Uniform4f,location, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v) -{ - GLCALLV(Uniform4fv,location, count, v); -} - -Q_DECL_EXPORT void APIENTRY glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) -{ - GLCALLV(Uniform4i,location, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v) -{ - GLCALLV(Uniform4iv,location, count, v); -} - -Q_DECL_EXPORT void APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - GLCALLV(UniformMatrix2fv,location, count, transpose, value); -} - -Q_DECL_EXPORT void APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - GLCALLV(UniformMatrix3fv,location, count, transpose, value); -} - -Q_DECL_EXPORT void APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - GLCALLV(UniformMatrix4fv,location, count, transpose, value); -} - -Q_DECL_EXPORT void APIENTRY glUseProgram(GLuint program) -{ - GLCALLV(UseProgram,program); -} - -Q_DECL_EXPORT void APIENTRY glValidateProgram(GLuint program) -{ - GLCALLV(ValidateProgram,program); -} - -Q_DECL_EXPORT void APIENTRY glVertexAttrib1f(GLuint indx, GLfloat x) -{ - GLCALLV(VertexAttrib1f,indx, x); -} - -Q_DECL_EXPORT void APIENTRY glVertexAttrib1fv(GLuint indx, const GLfloat* values) -{ - GLCALLV(VertexAttrib1fv,indx, values); -} - -Q_DECL_EXPORT void APIENTRY glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) -{ - GLCALLV(VertexAttrib2f,indx, x, y); -} - -Q_DECL_EXPORT void APIENTRY glVertexAttrib2fv(GLuint indx, const GLfloat* values) -{ - GLCALLV(VertexAttrib2fv,indx, values); -} - -Q_DECL_EXPORT void APIENTRY glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) -{ - GLCALLV(VertexAttrib3f,indx, x, y, z); -} - -Q_DECL_EXPORT void APIENTRY glVertexAttrib3fv(GLuint indx, const GLfloat* values) -{ - GLCALLV(VertexAttrib3fv,indx, values); -} - -Q_DECL_EXPORT void APIENTRY glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GLCALLV(VertexAttrib4f,indx, x, y, z, w); -} - -Q_DECL_EXPORT void APIENTRY glVertexAttrib4fv(GLuint indx, const GLfloat* values) -{ - GLCALLV(VertexAttrib4fv,indx, values); -} - -Q_DECL_EXPORT void APIENTRY glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) -{ - GLCALLV(VertexAttribPointer,indx, size, type, normalized, stride, ptr); -} - -// EGL - -Q_DECL_EXPORT __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname) -{ - // This is a bit more complicated since the GLES2 functions (that are not in OpenGL 1) - // must be made queriable in order to allow classes like QOpenGLFunctions to operate - // on the same code path for desktop GL and proxied ES. - typedef __eglMustCastToProperFunctionPointerType FuncType; - FuncType f = 0; - f = qgl_choose()->EGL_GetProcAddress(procname); - if (!f) { - static struct Tab { - const char *name; - FuncType func; - } tab[] = { - { "glActiveTexture", (FuncType) glActiveTexture }, - { "glAttachShader", (FuncType) glAttachShader }, - { "glBindAttribLocation", (FuncType) glBindAttribLocation }, - { "glBindBuffer", (FuncType) glBindBuffer }, - { "glBindFramebuffer", (FuncType) glBindFramebuffer }, - { "glBindRenderbuffer", (FuncType) glBindRenderbuffer }, - { "glBlendColor", (FuncType) glBlendColor }, - { "glBlendEquation", (FuncType) glBlendEquation }, - { "glBlendEquationSeparate", (FuncType) glBlendEquationSeparate }, - { "glBlendFuncSeparate", (FuncType) glBlendFuncSeparate }, - { "glBufferData", (FuncType) glBufferData }, - { "glBufferSubData", (FuncType) glBufferSubData }, - { "glCheckFramebufferStatus", (FuncType) glCheckFramebufferStatus }, - { "glCompileShader", (FuncType) glCompileShader }, - { "glCompressedTexImage2D", (FuncType) glCompressedTexImage2D }, - { "glCompressedTexSubImage2D", (FuncType) glCompressedTexSubImage2D }, - { "glCreateProgram", (FuncType) glCreateProgram }, - { "glCreateShader", (FuncType) glCreateShader }, - { "glDeleteBuffers", (FuncType) glDeleteBuffers }, - { "glDeleteFramebuffers", (FuncType) glDeleteFramebuffers }, - { "glDeleteProgram", (FuncType) glDeleteProgram }, - { "glDeleteRenderbuffers", (FuncType) glDeleteRenderbuffers }, - { "glDeleteShader", (FuncType) glDeleteShader }, - { "glDetachShader", (FuncType) glDetachShader }, - { "glDisableVertexAttribArray", (FuncType) glDisableVertexAttribArray }, - { "glEnableVertexAttribArray", (FuncType) glEnableVertexAttribArray }, - { "glFramebufferRenderbuffer", (FuncType) glFramebufferRenderbuffer }, - { "glFramebufferTexture2D", (FuncType) glFramebufferTexture2D }, - { "glGenBuffers", (FuncType) glGenBuffers }, - { "glGenerateMipmap", (FuncType) glGenerateMipmap }, - { "glGenFramebuffers", (FuncType) glGenFramebuffers }, - { "glGenRenderbuffers", (FuncType) glGenRenderbuffers }, - { "glGetActiveAttrib", (FuncType) glGetActiveAttrib }, - { "glGetActiveUniform", (FuncType) glGetActiveUniform }, - { "glGetAttachedShaders", (FuncType) glGetAttachedShaders }, - { "glGetAttribLocation", (FuncType) glGetAttribLocation }, - { "glGetBufferParameteriv", (FuncType) glGetBufferParameteriv }, - { "glGetFramebufferAttachmentParameteriv", (FuncType) glGetFramebufferAttachmentParameteriv }, - { "glGetProgramiv", (FuncType) glGetProgramiv }, - { "glGetProgramInfoLog", (FuncType) glGetProgramInfoLog }, - { "glGetRenderbufferParameteriv", (FuncType) glGetRenderbufferParameteriv }, - { "glGetShaderiv", (FuncType) glGetShaderiv }, - { "glGetShaderInfoLog", (FuncType) glGetShaderInfoLog }, - { "glGetShaderPrecisionFormat", (FuncType) glGetShaderPrecisionFormat }, - { "glGetShaderSource", (FuncType) glGetShaderSource }, - { "glGetUniformfv", (FuncType) glGetUniformfv }, - { "glGetUniformiv", (FuncType) glGetUniformiv }, - { "glGetUniformLocation", (FuncType) glGetUniformLocation }, - { "glGetVertexAttribfv", (FuncType) glGetVertexAttribfv }, - { "glGetVertexAttribiv", (FuncType) glGetVertexAttribiv }, - { "glGetVertexAttribPointerv", (FuncType) glGetVertexAttribPointerv }, - { "glIsBuffer", (FuncType) glIsBuffer }, - { "glIsFramebuffer", (FuncType) glIsFramebuffer }, - { "glIsProgram", (FuncType) glIsProgram }, - { "glIsRenderbuffer", (FuncType) glIsRenderbuffer }, - { "glIsShader", (FuncType) glIsShader }, - { "glLinkProgram", (FuncType) glLinkProgram }, - { "glReleaseShaderCompiler", (FuncType) glReleaseShaderCompiler }, - { "glRenderbufferStorage", (FuncType) glRenderbufferStorage }, - { "glSampleCoverage", (FuncType) glSampleCoverage }, - { "glShaderBinary", (FuncType) glShaderBinary }, - { "glShaderSource", (FuncType) glShaderSource }, - { "glStencilFuncSeparate", (FuncType) glStencilFuncSeparate }, - { "glStencilMaskSeparate", (FuncType) glStencilMaskSeparate }, - { "glStencilOpSeparate", (FuncType) glStencilOpSeparate }, - { "glUniform1f", (FuncType) glUniform1f }, - { "glUniform1fv", (FuncType) glUniform1fv }, - { "glUniform1i", (FuncType) glUniform1i }, - { "glUniform1iv", (FuncType) glUniform1iv }, - { "glUniform2f", (FuncType) glUniform2f }, - { "glUniform2fv", (FuncType) glUniform2fv }, - { "glUniform2i", (FuncType) glUniform2i }, - { "glUniform2iv", (FuncType) glUniform2iv }, - { "glUniform3f", (FuncType) glUniform3f }, - { "glUniform3fv", (FuncType) glUniform3fv }, - { "glUniform3i", (FuncType) glUniform3i }, - { "glUniform3iv", (FuncType) glUniform3iv }, - { "glUniform4f", (FuncType) glUniform4f }, - { "glUniform4fv", (FuncType) glUniform4fv }, - { "glUniform4i", (FuncType) glUniform4i }, - { "glUniform4iv", (FuncType) glUniform4iv }, - { "glUniformMatrix2fv", (FuncType) glUniformMatrix2fv }, - { "glUniformMatrix3fv", (FuncType) glUniformMatrix3fv }, - { "glUniformMatrix4fv", (FuncType) glUniformMatrix4fv }, - { "glUseProgram", (FuncType) glUseProgram }, - { "glValidateProgram", (FuncType) glValidateProgram }, - { "glVertexAttrib1f", (FuncType) glVertexAttrib1f }, - { "glVertexAttrib1fv", (FuncType) glVertexAttrib1fv }, - { "glVertexAttrib2f", (FuncType) glVertexAttrib2f }, - { "glVertexAttrib2fv", (FuncType) glVertexAttrib2fv }, - { "glVertexAttrib3f", (FuncType) glVertexAttrib3f }, - { "glVertexAttrib3fv", (FuncType) glVertexAttrib3fv }, - { "glVertexAttrib4f", (FuncType) glVertexAttrib4f }, - { "glVertexAttrib4fv", (FuncType) glVertexAttrib4fv }, - { "glVertexAttribPointer", (FuncType) glVertexAttribPointer } - }; - for (size_t i = 0; i < sizeof(tab) / sizeof(Tab); ++i) { - uint len = qstrlen(tab[i].name); - if (!qstrncmp(tab[i].name, procname, len) - && procname[len] == '\0') { - f = tab[i].func; - break; - } - } - if (!f) - qCDebug(qglLc, "eglGetProcAddress failed for %s", procname); - } - - return f; -} - -} // extern "C" - -// For QOpenGLFunctions -int qgl_proxyLibraryType(void) -{ - return qgl_choose()->libraryType(); -} - -HMODULE qgl_glHandle(void) -{ - return qgl_choose()->libraryHandle(); -} - -QAbstractWindowsOpenGL::QAbstractWindowsOpenGL() - : - CopyContext(0), - CreateContext(0), - CreateLayerContext(0), - DeleteContext(0), - GetCurrentContext(0), - GetCurrentDC(0), - GetProcAddress(0), - MakeCurrent(0), - ShareLists(0), - UseFontBitmapsW(0), - UseFontOutlinesW(0), - DescribeLayerPlane(0), - SetLayerPaletteEntries(0), - GetLayerPaletteEntries(0), - RealizeLayerPalette(0), - SwapLayerBuffers(0), - SwapMultipleBuffers(0), - - EGL_GetError(0), - EGL_GetDisplay(0), - EGL_Initialize(0), - EGL_Terminate(0), - EGL_QueryString(0), - EGL_GetConfigs(0), - EGL_ChooseConfig(0), - EGL_GetConfigAttrib(0), - EGL_CreateWindowSurface(0), - EGL_CreatePbufferSurface(0), - EGL_CreatePixmapSurface(0), - EGL_DestroySurface(0), - EGL_QuerySurface(0), - EGL_BindAPI(0), - EGL_QueryAPI(0), - EGL_WaitClient(0), - EGL_ReleaseThread(0), - EGL_CreatePbufferFromClientBuffer(0), - EGL_SurfaceAttrib(0), - EGL_BindTexImage(0), - EGL_ReleaseTexImage(0), - EGL_SwapInterval(0), - EGL_CreateContext(0), - EGL_DestroyContext(0), - EGL_MakeCurrent (0), - EGL_GetCurrentContext(0), - EGL_GetCurrentSurface(0), - EGL_GetCurrentDisplay(0), - EGL_QueryContext(0), - EGL_WaitGL(0), - EGL_WaitNative(0), - EGL_SwapBuffers(0), - EGL_CopyBuffers(0), - EGL_GetProcAddress(0), - - Viewport(0), - DepthRange(0), - IsEnabled(0), - GetTexLevelParameteriv(0), - GetTexLevelParameterfv(0), - GetTexParameteriv(0), - GetTexParameterfv(0), - GetTexImage(0), - GetString(0), - GetIntegerv(0), - GetFloatv(0), - GetError(0), - GetDoublev(0), - GetBooleanv(0), - ReadPixels(0), - ReadBuffer(0), - PixelStorei(0), - PixelStoref(0), - DepthFunc(0), - StencilOp(0), - StencilFunc(0), - LogicOp(0), - BlendFunc(0), - Flush(0), - Finish(0), - Enable(0), - Disable(0), - DepthMask(0), - ColorMask(0), - StencilMask(0), - ClearDepth(0), - ClearStencil(0), - ClearColor(0), - Clear(0), - DrawBuffer(0), - TexImage2D(0), - TexImage1D(0), - TexParameteriv(0), - TexParameteri(0), - TexParameterfv(0), - TexParameterf(0), - Scissor(0), - PolygonMode(0), - PointSize(0), - LineWidth(0), - Hint(0), - FrontFace(0), - CullFace(0), - - Translatef(0), - Translated(0), - Scalef(0), - Scaled(0), - Rotatef(0), - Rotated(0), - PushMatrix(0), - PopMatrix(0), - Ortho(0), - MultMatrixd(0), - MultMatrixf(0), - MatrixMode(0), - LoadMatrixd(0), - LoadMatrixf(0), - LoadIdentity(0), - Frustum(0), - IsList(0), - GetTexGeniv(0), - GetTexGenfv(0), - GetTexGendv(0), - GetTexEnviv(0), - GetTexEnvfv(0), - GetPolygonStipple(0), - GetPixelMapusv(0), - GetPixelMapuiv(0), - GetPixelMapfv(0), - GetMaterialiv(0), - GetMaterialfv(0), - GetMapiv(0), - GetMapfv(0), - GetMapdv(0), - GetLightiv(0), - GetLightfv(0), - GetClipPlane(0), - DrawPixels(0), - CopyPixels(0), - PixelMapusv(0), - PixelMapuiv(0), - PixelMapfv(0), - PixelTransferi(0), - PixelTransferf(0), - PixelZoom(0), - AlphaFunc(0), - EvalPoint2(0), - EvalMesh2(0), - EvalPoint1(0), - EvalMesh1(0), - EvalCoord2fv(0), - EvalCoord2f(0), - EvalCoord2dv(0), - EvalCoord2d(0), - EvalCoord1fv(0), - EvalCoord1f(0), - EvalCoord1dv(0), - EvalCoord1d(0), - MapGrid2f(0), - MapGrid2d(0), - MapGrid1f(0), - MapGrid1d(0), - Map2f(0), - Map2d(0), - Map1f(0), - Map1d(0), - PushAttrib(0), - PopAttrib(0), - Accum(0), - IndexMask(0), - ClearIndex(0), - ClearAccum(0), - PushName(0), - PopName(0), - PassThrough(0), - LoadName(0), - InitNames(0), - RenderMode(0), - SelectBuffer(0), - FeedbackBuffer(0), - TexGeniv(0), - TexGeni(0), - TexGenfv(0), - TexGenf(0), - TexGendv(0), - TexGend(0), - TexEnviv(0), - TexEnvi(0), - TexEnvfv(0), - TexEnvf(0), - ShadeModel(0), - PolygonStipple(0), - Materialiv(0), - Materiali(0), - Materialfv(0), - Materialf(0), - LineStipple(0), - LightModeliv(0), - LightModeli(0), - LightModelfv(0), - LightModelf(0), - Lightiv(0), - Lighti(0), - Lightfv(0), - Lightf(0), - Fogiv(0), - Fogi(0), - Fogfv(0), - Fogf(0), - ColorMaterial(0), - ClipPlane(0), - Vertex4sv(0), - Vertex4s(0), - Vertex4iv(0), - Vertex4i(0), - Vertex4fv(0), - Vertex4f(0), - Vertex4dv(0), - Vertex4d(0), - Vertex3sv(0), - Vertex3s(0), - Vertex3iv(0), - Vertex3i(0), - Vertex3fv(0), - Vertex3f(0), - Vertex3dv(0), - Vertex3d(0), - Vertex2sv(0), - Vertex2s(0), - Vertex2iv(0), - Vertex2i(0), - Vertex2fv(0), - Vertex2f(0), - Vertex2dv(0), - Vertex2d(0), - TexCoord4sv(0), - TexCoord4s(0), - TexCoord4iv(0), - TexCoord4i(0), - TexCoord4fv(0), - TexCoord4f(0), - TexCoord4dv(0), - TexCoord4d(0), - TexCoord3sv(0), - TexCoord3s(0), - TexCoord3iv(0), - TexCoord3i(0), - TexCoord3fv(0), - TexCoord3f(0), - TexCoord3dv(0), - TexCoord3d(0), - TexCoord2sv(0), - TexCoord2s(0), - TexCoord2iv(0), - TexCoord2i(0), - TexCoord2fv(0), - TexCoord2f(0), - TexCoord2dv(0), - TexCoord2d(0), - TexCoord1sv(0), - TexCoord1s(0), - TexCoord1iv(0), - TexCoord1i(0), - TexCoord1fv(0), - TexCoord1f(0), - TexCoord1dv(0), - TexCoord1d(0), - Rectsv(0), - Rects(0), - Rectiv(0), - Recti(0), - Rectfv(0), - Rectf(0), - Rectdv(0), - Rectd(0), - RasterPos4sv(0), - RasterPos4s(0), - RasterPos4iv(0), - RasterPos4i(0), - RasterPos4fv(0), - RasterPos4f(0), - RasterPos4dv(0), - RasterPos4d(0), - RasterPos3sv(0), - RasterPos3s(0), - RasterPos3iv(0), - RasterPos3i(0), - RasterPos3fv(0), - RasterPos3f(0), - RasterPos3dv(0), - RasterPos3d(0), - RasterPos2sv(0), - RasterPos2s(0), - RasterPos2iv(0), - RasterPos2i(0), - RasterPos2fv(0), - RasterPos2f(0), - RasterPos2dv(0), - RasterPos2d(0), - Normal3sv(0), - Normal3s(0), - Normal3iv(0), - Normal3i(0), - Normal3fv(0), - Normal3f(0), - Normal3dv(0), - Normal3d(0), - Normal3bv(0), - Normal3b(0), - Indexsv(0), - Indexs(0), - Indexiv(0), - Indexi(0), - Indexfv(0), - Indexf(0), - Indexdv(0), - Indexd(0), - End(0), - EdgeFlagv(0), - EdgeFlag(0), - Color4usv(0), - Color4us(0), - Color4uiv(0), - Color4ui(0), - Color4ubv(0), - Color4ub(0), - Color4sv(0), - Color4s(0), - Color4iv(0), - Color4i(0), - Color4fv(0), - Color4f(0), - Color4dv(0), - Color4d(0), - Color4bv(0), - Color4b(0), - Color3usv(0), - Color3us(0), - Color3uiv(0), - Color3ui(0), - Color3ubv(0), - Color3ub(0), - Color3sv(0), - Color3s(0), - Color3iv(0), - Color3i(0), - Color3fv(0), - Color3f(0), - Color3dv(0), - Color3d(0), - Color3bv(0), - Color3b(0), - Bitmap(0), - Begin(0), - ListBase(0), - GenLists(0), - DeleteLists(0), - CallLists(0), - CallList(0), - EndList(0), - NewList(0), - - Indexubv(0), - Indexub(0), - IsTexture(0), - GenTextures(0), - DeleteTextures(0), - BindTexture(0), - TexSubImage2D(0), - TexSubImage1D(0), - CopyTexSubImage2D(0), - CopyTexSubImage1D(0), - CopyTexImage2D(0), - CopyTexImage1D(0), - PolygonOffset(0), - GetPointerv(0), - DrawElements(0), - DrawArrays(0), - - PushClientAttrib(0), - PopClientAttrib(0), - PrioritizeTextures(0), - AreTexturesResident(0), - VertexPointer(0), - TexCoordPointer(0), - NormalPointer(0), - InterleavedArrays(0), - IndexPointer(0), - EnableClientState(0), - EdgeFlagPointer(0), - DisableClientState(0), - ColorPointer(0), - ArrayElement(0), - - ActiveTexture(0), - AttachShader(0), - BindAttribLocation(0), - BindBuffer(0), - BindFramebuffer(0), - BindRenderbuffer(0), - BlendColor(0), - BlendEquation(0), - BlendEquationSeparate(0), - BlendFuncSeparate(0), - BufferData(0), - BufferSubData(0), - CheckFramebufferStatus(0), - ClearDepthf(0), - CompileShader(0), - CompressedTexImage2D(0), - CompressedTexSubImage2D(0), - CreateProgram(0), - CreateShader(0), - DeleteBuffers(0), - DeleteFramebuffers(0), - DeleteProgram(0), - DeleteRenderbuffers(0), - DeleteShader(0), - DepthRangef(0), - DetachShader(0), - DisableVertexAttribArray(0), - EnableVertexAttribArray(0), - FramebufferRenderbuffer(0), - FramebufferTexture2D(0), - GenBuffers(0), - GenerateMipmap(0), - GenFramebuffers(0), - GenRenderbuffers(0), - GetActiveAttrib(0), - GetActiveUniform(0), - GetAttachedShaders(0), - GetAttribLocation(0), - GetBufferParameteriv(0), - GetFramebufferAttachmentParameteriv(0), - GetProgramiv(0), - GetProgramInfoLog(0), - GetRenderbufferParameteriv(0), - GetShaderiv(0), - GetShaderInfoLog(0), - GetShaderPrecisionFormat(0), - GetShaderSource(0), - GetUniformfv(0), - GetUniformiv(0), - GetUniformLocation(0), - GetVertexAttribfv(0), - GetVertexAttribiv(0), - GetVertexAttribPointerv(0), - IsBuffer(0), - IsFramebuffer(0), - IsProgram(0), - IsRenderbuffer(0), - IsShader(0), - LinkProgram(0), - ReleaseShaderCompiler(0), - RenderbufferStorage(0), - SampleCoverage(0), - ShaderBinary(0), - ShaderSource(0), - StencilFuncSeparate(0), - StencilMaskSeparate(0), - StencilOpSeparate(0), - Uniform1f(0), - Uniform1fv(0), - Uniform1i(0), - Uniform1iv(0), - Uniform2f(0), - Uniform2fv(0), - Uniform2i(0), - Uniform2iv(0), - Uniform3f(0), - Uniform3fv(0), - Uniform3i(0), - Uniform3iv(0), - Uniform4f(0), - Uniform4fv(0), - Uniform4i(0), - Uniform4iv(0), - UniformMatrix2fv(0), - UniformMatrix3fv(0), - UniformMatrix4fv(0), - UseProgram(0), - ValidateProgram(0), - VertexAttrib1f(0), - VertexAttrib1fv(0), - VertexAttrib2f(0), - VertexAttrib2fv(0), - VertexAttrib3f(0), - VertexAttrib3fv(0), - VertexAttrib4f(0), - VertexAttrib4fv(0), - VertexAttribPointer(0), - - m_lib(0), - m_libraryType(DesktopGL), - m_loaded(false) -{ -} diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index 164e5e69256..08930b558eb 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -176,7 +176,7 @@ public: #endif { #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!ctx->isES()) { QSurfaceFormat f = ctx->format(); // Geometry shaders require OpenGL >= 3.2 @@ -445,7 +445,7 @@ bool QOpenGLShader::compileSourceCode(const char *source) #ifdef QOpenGL_REDEFINE_HIGHP if (d->shaderType == Fragment && !ctx_d->workaround_missingPrecisionQualifiers - && QOpenGLFunctions::isES()) { + && QOpenGLContext::currentContext()->isES()) { src.append(redefineHighp); srclen.append(GLint(sizeof(redefineHighp) - 1)); } @@ -674,7 +674,7 @@ bool QOpenGLShaderProgram::init() #ifndef QT_OPENGL_ES_2 // Resolve OpenGL 4 functions for tessellation shader support QSurfaceFormat format = context->format(); - if (!QOpenGLFunctions::isES() + if (!context->isES() && format.version() >= qMakePair(4, 0)) { d->tessellationFuncs = context->versionFunctions(); d->tessellationFuncs->initializeOpenGLFunctions(); @@ -3273,7 +3273,7 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context) #ifndef QT_OPENGL_ES_2 // Geometry shaders require OpenGL 3.2 or newer QSurfaceFormat format = context->format(); - return (!QOpenGLFunctions::isES()) + return (!context->isES()) && (format.version() >= qMakePair(3, 2)); #else // No geometry shader support in OpenGL ES2 @@ -3281,7 +3281,7 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context) #endif } else if (type == TessellationControl || type == TessellationEvaluation) { #if !defined(QT_OPENGL_ES_2) - return (!QOpenGLFunctions::isES()) + return (!context->isES()) && (format.version() >= qMakePair(4, 0)); #else // No tessellation shader support in OpenGL ES2 diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 8bdbdba6f76..901c564a8bf 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -2430,7 +2430,7 @@ bool QOpenGLTexture::hasFeature(Feature feature) bool supported = false; #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!ctx->isES()) { switch (feature) { case ImmutableMultisampleStorage: case TextureBuffer: @@ -2487,7 +2487,7 @@ bool QOpenGLTexture::hasFeature(Feature feature) } } - if (QOpenGLFunctions::isES()) + if (ctx->isES()) #endif { switch (feature) { @@ -2522,7 +2522,7 @@ bool QOpenGLTexture::hasFeature(Feature feature) void QOpenGLTexture::setMipBaseLevel(int baseLevel) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->textureId); @@ -2559,7 +2559,7 @@ int QOpenGLTexture::mipBaseLevel() const void QOpenGLTexture::setMipMaxLevel(int maxLevel) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->textureId); @@ -2596,7 +2596,7 @@ int QOpenGLTexture::mipMaxLevel() const void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->textureId); @@ -2706,7 +2706,7 @@ void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel) void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value) { #if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2733,7 +2733,7 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g, SwizzleValue b, SwizzleValue a) { #if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2782,7 +2782,7 @@ QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent compon void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode) { #if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2972,7 +2972,7 @@ QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDire void QOpenGLTexture::setBorderColor(QColor color) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -3000,7 +3000,7 @@ void QOpenGLTexture::setBorderColor(QColor color) void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -3031,7 +3031,7 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -3064,7 +3064,7 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -3170,7 +3170,7 @@ void QOpenGLTexture::borderColor(unsigned int *border) const void QOpenGLTexture::setMinimumLevelOfDetail(float value) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -3207,7 +3207,7 @@ float QOpenGLTexture::minimumLevelOfDetail() const void QOpenGLTexture::setMaximumLevelOfDetail(float value) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -3243,7 +3243,7 @@ float QOpenGLTexture::maximumLevelOfDetail() const void QOpenGLTexture::setLevelOfDetailRange(float min, float max) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -3282,7 +3282,7 @@ QPair QOpenGLTexture::levelOfDetailRange() const void QOpenGLTexture::setLevelofDetailBias(float bias) { #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 356f68b49b7..92eb9be80c0 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -378,7 +378,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed || mask.format() == QImage::Format_ARGB32_Premultiplied #else || (mask.format() == QImage::Format_ARGB32_Premultiplied - && QOpenGLFunctions::isES()) + && ctx->isES()) #endif ) { for (int y = 0; y < maskHeight; ++y) { @@ -396,7 +396,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed src[x] = qRgba(r, g, b, avg); // swizzle the bits to accommodate for the GL_RGBA upload. #if Q_BYTE_ORDER != Q_BIG_ENDIAN - if (QOpenGLFunctions::isES()) + if (ctx->isES()) #endif src[x] = ARGB2RGBA(src[x]); } @@ -409,7 +409,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed #ifdef QT_OPENGL_ES_2 GLenum fmt = GL_RGBA; #else - GLenum fmt = QOpenGLFunctions::isES() ? GL_RGBA : GL_BGRA; + GLenum fmt = ctx->isES() ? GL_RGBA : GL_BGRA; #endif // QT_OPENGL_ES_2 #if Q_BYTE_ORDER == Q_BIG_ENDIAN diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index 1f44a812764..1d31fb56053 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -42,14 +42,13 @@ #include "qopengltexturehelper_p.h" #include -#include QT_BEGIN_NAMESPACE QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) { // Resolve EXT_direct_state_access entry points if present - if (!QOpenGLFunctions::isES() + if (!context->isES() && context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) { TextureParameteriEXT = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT"))); TextureParameterivEXT = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT"))); @@ -122,7 +121,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) } // Some DSA functions are part of NV_texture_multisample instead - if (!QOpenGLFunctions::isES() + if (!context->isES() && context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) { TextureImage3DMultisampleNV = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV"))); TextureImage2DMultisampleNV = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV"))); @@ -138,7 +137,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) // Hence, we resolve them "the hard way" #if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2) - HMODULE handle = static_cast(QOpenGLFunctions::platformGLHandle()); + HMODULE handle = static_cast(QOpenGLContext::openGLModuleHandle()); if (!handle) handle = GetModuleHandleA("opengl32.dll"); @@ -191,7 +190,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) TexSubImage1D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexSubImage1D"))); #endif - if (QOpenGLFunctions::isES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) { + if (context->isES() && context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) { TexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES"))); TexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES"))); CompressedTexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES"))); diff --git a/src/gui/opengl/qopengltimerquery.cpp b/src/gui/opengl/qopengltimerquery.cpp index c756e3f5270..908a9cee079 100644 --- a/src/gui/opengl/qopengltimerquery.cpp +++ b/src/gui/opengl/qopengltimerquery.cpp @@ -124,11 +124,6 @@ public: bool QOpenGLTimerQueryPrivate::create() { - if (QOpenGLFunctions::isES()) { - qWarning("QOpenGLTimerQuery: Not supported on dynamic GL ES"); - return false; - } - QOpenGLContext *ctx = QOpenGLContext::currentContext(); if (timer && context == ctx) @@ -140,6 +135,11 @@ bool QOpenGLTimerQueryPrivate::create() return false; } + if (context->isES()) { + qWarning("QOpenGLTimerQuery: Not supported on OpenGL ES"); + return false; + } + // Resolve the functions provided by OpenGL 1.5 and OpenGL 3.3 or ARB_timer_query core = new QOpenGLQueryHelper(context); diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index 52fd482b531..b1fd4ffdfe5 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -59,7 +59,7 @@ public: QVertexArrayObjectHelper(QOpenGLContext *context) { Q_ASSERT(context); - if (QOpenGLFunctions::isES()) { + if (context->isES()) { GenVertexArrays = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES"))); DeleteVertexArrays = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES"))); BindVertexArray = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES"))); @@ -160,7 +160,7 @@ bool QOpenGLVertexArrayObjectPrivate::create() context = ctx; QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed())); - if (QOpenGLFunctions::isES()) { + if (ctx->isES()) { if (ctx->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) { vaoFuncs.helper = new QVertexArrayObjectHelper(ctx); vaoFuncsType = OES; diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 15459dd748c..b4ea8e48424 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -286,7 +286,7 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion) const glGenTextures(1, &d_ptr->textureId); glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); } diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 394eb993078..56f3f5ad0ab 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -163,7 +163,7 @@ QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) code[NonPremultipliedImageSrcFragmentShader] = qglslNonPremultipliedImageSrcFragmentShader; code[CustomImageSrcFragmentShader] = qglslCustomSrcFragmentShader; // Calls "customShader", which must be appended code[SolidBrushSrcFragmentShader] = qglslSolidBrushSrcFragmentShader; - if (!QOpenGLFunctions::isES()) + if (!context->contextHandle()->isES()) code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader_desktop; else code[TextureBrushSrcFragmentShader] = qglslTextureBrushSrcFragmentShader_ES; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index b8c039d0e2d..fd64a4a71ff 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -539,7 +539,7 @@ void QGL2PaintEngineEx::beginNativePainting() d->funcs.glDisableVertexAttribArray(i); #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!d->ctx->contextHandle()->isES()) { const QGLContext *ctx = d->ctx; const QGLFormat &fmt = d->device->format(); if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1) @@ -597,7 +597,7 @@ void QGL2PaintEngineExPrivate::resetGLState() ctx->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false); ctx->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!ctx->contextHandle()->isES()) { // gl_Color, corresponding to vertex attribute 3, may have been changed float color[] = { 1.0f, 1.0f, 1.0f, 1.0f }; funcs.glVertexAttrib4fv(3, color); @@ -1353,10 +1353,11 @@ void QGL2PaintEngineEx::compositionModeChanged() void QGL2PaintEngineEx::renderHintsChanged() { + Q_D(QGL2PaintEngineEx); state()->renderHintsChanged = true; #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!d->ctx->contextHandle()->isES()) { if ((state()->renderHints & QPainter::Antialiasing) || (state()->renderHints & QPainter::HighQualityAntialiasing)) glEnable(GL_MULTISAMPLE); @@ -1365,7 +1366,6 @@ void QGL2PaintEngineEx::renderHintsChanged() } #endif - Q_D(QGL2PaintEngineEx); d->lastTextureUsed = GLuint(-1); d->brushTextureDirty = true; // qDebug("QGL2PaintEngineEx::renderHintsChanged() not implemented!"); @@ -2032,14 +2032,14 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) glDisable(GL_SCISSOR_TEST); #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) + if (!d->ctx->contextHandle()->isES()) glDisable(GL_MULTISAMPLE); #endif d->glyphCacheFormat = QFontEngine::Format_A8; #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (!d->ctx->contextHandle()->isES()) { d->glyphCacheFormat = QFontEngine::Format_A32; d->multisamplingAlwaysEnabled = false; } else { diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index f9f2670375f..b1e289254f4 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -319,7 +319,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub uchar g = src[x] >> 8; uchar b = src[x]; quint32 avg = (quint32(r) + quint32(g) + quint32(b) + 1) / 3; // "+1" for rounding. - if (QOpenGLFunctions::isES()) { + if (ctx->contextHandle()->isES()) { // swizzle the bits to accommodate for the GL_RGBA upload. src[x] = (avg << 24) | (quint32(r) << 0) | (quint32(g) << 8) | (quint32(b) << 16); } else { @@ -333,7 +333,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub if (mask.format() == QImage::Format_RGB32) { GLenum format = GL_RGBA; #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) + if (!ctx->contextHandle()->isES()) format = GL_BGRA; #endif glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits()); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e027de02e0f..1bdc9b84e0b 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1700,7 +1700,7 @@ QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alp int w = size.width(); int h = size.height(); #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { //### glGetTexImage not in GL ES 2.0, need to do something else here! glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.bits()); } @@ -2284,7 +2284,8 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G glBindTexture(target, tx_id); glTexParameteri(target, GL_TEXTURE_MAG_FILTER, filtering); - bool genMipmap = !QOpenGLFunctions::isES(); + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + bool genMipmap = !ctx->isES(); if (glFormat.directRendering() && (qgl_extensions()->hasOpenGLExtension(QOpenGLExtensions::GenerateMipmap)) && target == GL_TEXTURE_2D @@ -2426,7 +2427,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G printf(" - did byte swapping (%d ms)\n", time.elapsed()); #endif } - if (QOpenGLFunctions::isES()) { + if (ctx->isES()) { // OpenGL/ES requires that the internal and external formats be // identical. internalFormat = externalFormat; @@ -2439,7 +2440,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G const QImage &constRef = img; // to avoid detach in bits()... glTexImage2D(target, 0, internalFormat, img.width(), img.height(), 0, externalFormat, pixel_type, constRef.bits()); - if (genMipmap && QOpenGLFunctions::isES()) + if (genMipmap && ctx->isES()) functions->glGenerateMipmap(target); #ifndef QT_NO_DEBUG GLenum error = glGetError(); @@ -2516,13 +2517,15 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, /*! \internal */ int QGLContextPrivate::maxTextureSize() { + Q_Q(QGLContext); + if (max_texture_size != -1) return max_texture_size; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + if (!q->contextHandle()->isES()) { GLenum proxy = GL_PROXY_TEXTURE_2D; GLint size; @@ -2700,7 +2703,7 @@ static void qDrawTextureRect(const QRectF &target, GLint textureWidth, GLint tex Q_UNUSED(textureHeight); Q_UNUSED(textureTarget); #else - if (textureTarget != GL_TEXTURE_2D && !QOpenGLFunctions::isES()) { + if (textureTarget != GL_TEXTURE_2D && !QOpenGLContext::currentContext()->isES()) { if (textureWidth == -1 || textureHeight == -1) { glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_WIDTH, &textureWidth); glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_HEIGHT, &textureHeight); @@ -2767,7 +2770,7 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text #endif #ifndef QT_OPENGL_ES_2 - if (!QOpenGLFunctions::isES()) { + if (!contextHandle()->isES()) { #ifdef QT_OPENGL_ES if (textureTarget != GL_TEXTURE_2D) { qWarning("QGLContext::drawTexture(): texture target must be GL_TEXTURE_2D on OpenGL ES"); @@ -2829,7 +2832,7 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text Q_UNUSED(textureId); Q_UNUSED(textureTarget); #else - if (!QOpenGLFunctions::isES()) { + if (!contextHandle()->isES()) { const bool wasEnabled = glIsEnabled(GL_TEXTURE_2D); GLint oldTexture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTexture); @@ -4172,7 +4175,7 @@ void QGLWidget::glDraw() return; makeCurrent(); #ifndef QT_OPENGL_ES - if (d->glcx->deviceIsPixmap() && !QOpenGLFunctions::isES()) + if (d->glcx->deviceIsPixmap() && !d->glcx->contextHandle()->isES()) glDrawBuffer(GL_FRONT); #endif QSize readback_target_size = d->glcx->d_ptr->readback_target_size; @@ -4215,20 +4218,18 @@ void QGLWidget::qglColor(const QColor& c) const #ifdef QT_OPENGL_ES glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF()); #else - if (!QOpenGLFunctions::isES()) { - Q_D(const QGLWidget); - const QGLContext *ctx = QGLContext::currentContext(); - if (ctx) { - if (ctx->format().rgba()) - glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF()); - else if (!d->cmap.isEmpty()) { // QGLColormap in use? - int i = d->cmap.find(c.rgb()); - if (i < 0) - i = d->cmap.findNearest(c.rgb()); - glIndexi(i); - } else - glIndexi(ctx->colorIndex(c)); - } + Q_D(const QGLWidget); + const QGLContext *ctx = QGLContext::currentContext(); + if (ctx && !ctx->contextHandle()->isES()) { + if (ctx->format().rgba()) + glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF()); + else if (!d->cmap.isEmpty()) { // QGLColormap in use? + int i = d->cmap.find(c.rgb()); + if (i < 0) + i = d->cmap.findNearest(c.rgb()); + glIndexi(i); + } else + glIndexi(ctx->colorIndex(c)); } #endif //QT_OPENGL_ES #else @@ -4249,20 +4250,18 @@ void QGLWidget::qglClearColor(const QColor& c) const #ifdef QT_OPENGL_ES glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); #else - if (!QOpenGLFunctions::isES()) { - Q_D(const QGLWidget); - const QGLContext *ctx = QGLContext::currentContext(); - if (ctx) { - if (ctx->format().rgba()) - glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); - else if (!d->cmap.isEmpty()) { // QGLColormap in use? - int i = d->cmap.find(c.rgb()); - if (i < 0) - i = d->cmap.findNearest(c.rgb()); - glClearIndex(i); - } else { - glClearIndex(ctx->colorIndex(c)); - } + Q_D(const QGLWidget); + const QGLContext *ctx = QGLContext::currentContext(); + if (ctx && !ctx->contextHandle()->isES()) { + if (ctx->format().rgba()) + glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); + else if (!d->cmap.isEmpty()) { // QGLColormap in use? + int i = d->cmap.find(c.rgb()); + if (i < 0) + i = d->cmap.findNearest(c.rgb()); + glClearIndex(i); + } else { + glClearIndex(ctx->colorIndex(c)); } } else { glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); @@ -4427,7 +4426,8 @@ static void qt_gl_draw_text(QPainter *p, int x, int y, const QString &str, void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font) { #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + Q_D(QGLWidget); + if (!d->glcx->contextHandle()->isES()) { Q_D(QGLWidget); if (str.isEmpty() || !isValid()) return; @@ -4522,7 +4522,8 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font) void QGLWidget::renderText(double x, double y, double z, const QString &str, const QFont &font) { #ifndef QT_OPENGL_ES - if (!QOpenGLFunctions::isES()) { + Q_D(QGLWidget); + if (!d->glcx->contextHandle()->isES()) { Q_D(QGLWidget); if (str.isEmpty() || !isValid()) return; diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 4f4df8d2e4a..fe4d1c363c7 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -321,7 +321,7 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) d->context = new QOpenGLContext; #if !defined(QT_OPENGL_ES) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { // On desktop, request latest released version QSurfaceFormat format; #if defined(Q_OS_MAC) diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp index 5491bad6289..0bcb9d4f1f0 100644 --- a/src/opengl/qglbuffer.cpp +++ b/src/opengl/qglbuffer.cpp @@ -344,7 +344,7 @@ void QGLBuffer::destroy() bool QGLBuffer::read(int offset, void *data, int count) { #if !defined(QT_OPENGL_ES) - if (QOpenGLFunctions::platformGLType() != QOpenGLFunctions::GLES1) { + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) { Q_D(QGLBuffer); if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) return false; diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index b4821ccf610..d636da91b57 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -595,7 +595,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, GL_DEPTH_COMPONENT16, size.width(), size.height()); } #else - if (QOpenGLFunctions::isES()) { + if (ctx->contextHandle()->isES()) { if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_DEPTH_COMPONENT24, size.width(), size.height()); @@ -617,7 +617,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, size.width(), size.height()); } #else - if (QOpenGLFunctions::isES()) { + if (ctx->contextHandle()->isES()) { if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) { funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size.width(), size.height()); @@ -647,7 +647,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, #ifdef QT_OPENGL_ES GLenum storage = GL_STENCIL_INDEX8; #else - GLenum storage = QOpenGLFunctions::isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX; + GLenum storage = ctx->contextHandle()->isES() ? GL_STENCIL_INDEX8 : GL_STENCIL_INDEX; #endif if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) @@ -849,7 +849,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, GLenum target) Q_D(QGLFramebufferObject); d->init(this, size, NoAttachment, target, #ifndef QT_OPENGL_ES_2 - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 + QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8 #else GL_RGBA #endif @@ -869,7 +869,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, GLenum target) Q_D(QGLFramebufferObject); d->init(this, QSize(width, height), NoAttachment, target, #ifndef QT_OPENGL_ES_2 - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 + QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8 #else GL_RGBA #endif @@ -926,7 +926,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, Attachment att #ifdef QT_OPENGL_ES_2 internal_format = GL_RGBA; #else - internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8; #endif d->init(this, QSize(width, height), attachment, target, internal_format); } @@ -953,7 +953,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, Attachment attachm #ifdef QT_OPENGL_ES_2 internal_format = GL_RGBA; #else - internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + internal_format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8; #endif d->init(this, size, attachment, target, internal_format); } diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index 3b36c5c2b6e..0edce5da2f1 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -71,7 +71,9 @@ public: mipmap(false) { #ifndef QT_OPENGL_ES_2 - internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + const bool isES = ctx ? ctx->isES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL; + internal_format = isES ? GL_RGBA : GL_RGBA8; #else internal_format = GL_RGBA; #endif diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp index e75f9cf9150..7dc30d53195 100644 --- a/src/opengl/qglfunctions.cpp +++ b/src/opengl/qglfunctions.cpp @@ -213,7 +213,9 @@ QGLFunctions::QGLFunctions(const QGLContext *context) static int qt_gl_resolve_features() { - if (QOpenGLFunctions::platformGLType() == QOpenGLFunctions::GLES2) { + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx->isES() && QOpenGLContext::openGLModuleType() != QOpenGLContext::GLES1) { + // OpenGL ES 2 int features = QGLFunctions::Multitexture | QGLFunctions::Shaders | QGLFunctions::Buffers | @@ -232,7 +234,8 @@ static int qt_gl_resolve_features() if (extensions.match("GL_IMG_texture_npot")) features |= QGLFunctions::NPOTTextures; return features; - } if (QOpenGLFunctions::platformGLType() == QOpenGLFunctions::GLES1) { + } else if (ctx->isES()) { + // OpenGL ES 1 int features = QGLFunctions::Multitexture | QGLFunctions::Buffers | QGLFunctions::CompressedTextures | @@ -252,6 +255,7 @@ static int qt_gl_resolve_features() features |= QGLFunctions::NPOTTextures; return features; } else { + // OpenGL int features = 0; QGLFormat::OpenGLVersionFlags versions = QGLFormat::openGLVersionFlags(); QOpenGLExtensionMatcher extensions; diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index 51e7648d728..32b18bfda4d 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -361,7 +361,7 @@ void QGLPixelBuffer::updateDynamicTexture(GLuint texture_id) const glBindTexture(GL_TEXTURE_2D, texture_id); #ifndef QT_OPENGL_ES - GLenum format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + GLenum format = ctx->isES() ? GL_RGBA : GL_RGBA8; glCopyTexImage2D(GL_TEXTURE_2D, 0, format, 0, 0, d->req_size.width(), d->req_size.height(), 0); #else glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, d->req_size.width(), d->req_size.height(), 0); @@ -488,7 +488,7 @@ GLuint QGLPixelBuffer::bindTexture(const QImage &image, GLenum target) { Q_D(QGLPixelBuffer); #ifndef QT_OPENGL_ES - GLenum format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + GLenum format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8; return d->qctx->bindTexture(image, target, GLint(format)); #else return d->qctx->bindTexture(image, target, GL_RGBA); @@ -507,7 +507,7 @@ GLuint QGLPixelBuffer::bindTexture(const QPixmap &pixmap, GLenum target) { Q_D(QGLPixelBuffer); #ifndef QT_OPENGL_ES - GLenum format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + GLenum format = QOpenGLContext::currentContext()->isES() ? GL_RGBA : GL_RGBA8; return d->qctx->bindTexture(pixmap, target, GLint(format)); #else return d->qctx->bindTexture(pixmap, target, GL_RGBA); diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 6b8d38ef423..7261b68a883 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -248,7 +248,7 @@ bool QGLShaderPrivate::create() shader = glfuncs->glCreateShader(GL_VERTEX_SHADER); #if !defined(QT_OPENGL_ES_2) else if (shaderType == QGLShader::Geometry - && !QOpenGLFunctions::isES()) + && !context->contextHandle()->isES()) shader = glfuncs->glCreateShader(GL_GEOMETRY_SHADER_EXT); #endif else @@ -430,14 +430,14 @@ bool QGLShader::compileSourceCode(const char *source) srclen.append(GLint(headerLen)); } #ifdef QGL_DEFINE_QUALIFIERS - if (!QOpenGLFunctions::isES()) { + if (!QOpenGLContext::currentContext()->isES()) { src.append(qualifierDefines); srclen.append(GLint(sizeof(qualifierDefines) - 1)); } #endif #ifdef QGL_REDEFINE_HIGHP if (d->shaderType == Fragment - && QOpenGLFunctions::isES()) { + && QOpenGLContext::currentContext()->isES()) { src.append(redefineHighp); srclen.append(GLint(sizeof(redefineHighp) - 1)); } @@ -567,8 +567,8 @@ public: void initializeGeometryShaderFunctions() { - if (!QOpenGLFunctions::isES()) { - QOpenGLContext *context = QOpenGLContext::currentContext(); + QOpenGLContext *context = QOpenGLContext::currentContext(); + if (!context->isES()) { glProgramParameteri = (type_glProgramParameteri) context->getProcAddress("glProgramParameteri"); @@ -936,7 +936,7 @@ bool QGLShaderProgram::link() #if !defined(QT_OPENGL_ES_2) // Set up the geometry shader parameters - if (!QOpenGLFunctions::isES() + if (!QOpenGLContext::currentContext()->isES() && d->glfuncs->glProgramParameteri) { foreach (QGLShader *shader, d->shaders) { if (shader->shaderType() & QGLShader::Geometry) { @@ -3068,7 +3068,7 @@ int QGLShaderProgram::maxGeometryOutputVertices() const { GLint n = 0; #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) + if (!QOpenGLContext::currentContext()->isES()) glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT, &n); #endif return n; diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index a36d0b83d44..790467150fa 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include #ifdef Q_OS_LINUX #include @@ -245,9 +245,11 @@ EGLConfig QEglConfigChooser::chooseConfig() break; #ifdef EGL_VERSION_1_4 case QSurfaceFormat::DefaultRenderableType: - if (!QOpenGLFunctions::isES()) +#ifndef QT_NO_OPENGL + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) configureAttributes.append(EGL_OPENGL_BIT); else +#endif // QT_NO_OPENGL configureAttributes.append(EGL_OPENGL_ES2_BIT); break; case QSurfaceFormat::OpenGL: @@ -361,7 +363,9 @@ QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, && (renderableType & EGL_OPENGL_BIT)) format.setRenderableType(QSurfaceFormat::OpenGL); else if (referenceFormat.renderableType() == QSurfaceFormat::DefaultRenderableType - && !QOpenGLFunctions::isES() +#ifndef QT_NO_OPENGL + && QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL +#endif && (renderableType & EGL_OPENGL_BIT)) format.setRenderableType(QSurfaceFormat::OpenGL); #endif diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 3a34748fc73..630c77fba0b 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -42,7 +42,7 @@ #include "qeglplatformcontext_p.h" #include "qeglconvenience_p.h" #include -#include +#include QT_BEGIN_NAMESPACE @@ -71,9 +71,11 @@ static inline void bindApi(const QSurfaceFormat &format) break; #ifdef EGL_VERSION_1_4 case QSurfaceFormat::DefaultRenderableType: - if (!QOpenGLFunctions::isES()) +#ifndef QT_NO_OPENGL + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) eglBindAPI(EGL_OPENGL_API); else +#endif // QT_NO_OPENGL eglBindAPI(EGL_OPENGL_ES_API); break; case QSurfaceFormat::OpenGL: diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 2a7a275060f..64a842d492a 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -234,7 +234,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case ThreadedOpenGL: #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - return QOpenGLFunctions::isES() ? QWindowsEGLContext::hasThreadedOpenGLCapability() : true; + return QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL + ? QWindowsEGLContext::hasThreadedOpenGLCapability() : true; # else return true; # endif // QT_OPENGL_ES_2 @@ -298,7 +299,7 @@ QPlatformOpenGLContext { qCDebug(lcQpaGl) << __FUNCTION__ << context->format(); #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()){ + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) { if (d->m_staticEGLContext.isNull()) { QWindowsEGLStaticContext *staticContext = QWindowsEGLStaticContext::create(); if (!staticContext) @@ -309,7 +310,7 @@ QPlatformOpenGLContext } #endif #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { if (d->m_staticOpenGLContext.isNull()) d->m_staticOpenGLContext = QSharedPointer(QOpenGLStaticContext::create()); diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index f6d01d7ef7a..7e15be1d196 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -125,7 +125,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour return 0; } #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) { QWindowsEGLContext *windowsEglContext = static_cast(context->handle()); if (resource == QByteArrayLiteral("eglDisplay")) return windowsEglContext->eglDisplay(); @@ -136,7 +136,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour } #endif // QT_OPENGL_ES_2 || QT_OPENGL_DYNAMIC #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { QWindowsGLContext *windowsContext = static_cast(context->handle()); if (resource == QByteArrayLiteral("renderingContext")) return windowsContext->renderingContext(); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d77f587b924..3cf9481c17f 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -880,7 +880,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) if (aWindow->surfaceType() == QWindow::OpenGLSurface) { setFlag(OpenGLSurface); #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()) + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) setFlag(OpenGL_ES2); #endif } diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 57128e4a825..718b5263bfb 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -752,7 +752,7 @@ void tst_QGL::openGLVersionCheck() #elif defined(QT_OPENGL_ES_2) QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0); #else - if (QOpenGLFunctions::isES()) + if (QOpenGLContext::currentContext()->isES()) QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0); else QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_1); @@ -1534,7 +1534,7 @@ void tst_QGL::fboFormat() #ifdef QT_OPENGL_ES_2 GL_RGBA; #else - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8; + QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8; #endif QCOMPARE(int(format1.internalTextureFormat()), expectedFormat); @@ -1611,7 +1611,7 @@ void tst_QGL::fboFormat() #ifdef QT_OPENGL_ES_2 GL_RGBA #else - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 + QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8 #endif ); QVERIFY(!(format1c == format3c)); @@ -1624,7 +1624,7 @@ void tst_QGL::fboFormat() #ifdef QT_OPENGL_ES_2 GL_RGBA #else - QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8 + QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8 #endif ); QVERIFY(!(format1c == format4c)); diff --git a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp index fea3c7b643f..cdd820cf5b8 100644 --- a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp +++ b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp @@ -96,7 +96,7 @@ void tst_QGLFunctions::features() funcs.initializeGLFunctions(); // Validate the features against what we expect for this platform. - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::currentContext()->isES()) { #if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) QGLFunctions::OpenGLFeatures allFeatures = (QGLFunctions::Multitexture | diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 765dc221dc7..63c6cb658be 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -333,7 +333,7 @@ static inline float qrandom() { return (rand() % 100) / 100.f; } void renderAScene(int w, int h) { - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::currentContext()->isES()) { QGLFunctions funcs(QGLContext::currentContext()); Q_UNUSED(w); Q_UNUSED(h); diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 5f4284e79a7..ba9652a1700 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -59,6 +59,7 @@ #include #ifndef QT_NO_OPENGL #include +#include #endif #include @@ -2596,8 +2597,8 @@ void tst_QMdiArea::nativeSubWindows() const QString platformName = QGuiApplication::platformName(); if (platformName != QLatin1String("xcb") && platformName != QLatin1String("windows")) QSKIP(qPrintable(QString::fromLatin1("nativeSubWindows() does not work on this platform (%1).").arg(platformName))); -#ifdef Q_OS_WIN - if (QOpenGLFunctions::isES()) +#if defined(Q_OS_WIN) && !defined(QT_NO_OPENGL) + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) QSKIP("nativeSubWindows() does not work with ANGLE on Windows, QTBUG-28545."); #endif { // Add native widgets after show. From f07841bc7c621d3bca01c4f2dc11cf62c11b30d5 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 21 Feb 2014 15:21:24 +0100 Subject: [PATCH 055/172] Revert path() behavior to not expand a current path on a drive In the original change - cfb44c6528b2518274bf157388832d1d610ce0e4 - when querying for the path of a file that did not contain a slash after the drive indicator it would get the current path and return that as the path that the file resided on. However this meant that it would take the current path at that time which may not be the actual path that was expected. So it was decided that it should revert back to the original behavior which was to just return the drive letter followed by the colon which would thus indicate still that it represented whatever the current path was on that drive. Change-Id: Ic57ae9227882a66e9a4c4d6537d7f2cae829165a Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qfilesystementry.cpp | 2 +- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp index 42a724670e7..5365ca9bcc7 100644 --- a/src/corelib/io/qfilesystementry.cpp +++ b/src/corelib/io/qfilesystementry.cpp @@ -195,7 +195,7 @@ QString QFileSystemEntry::path() const if (m_lastSeparator == -1) { #if defined(Q_OS_WIN) if (m_filePath.length() >= 2 && m_filePath.at(1) == QLatin1Char(':')) - return QFSFileEngine::currentPath(m_filePath.left(2)); + return m_filePath.left(2); #endif return QString(QLatin1Char('.')); } diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 74667a951f5..b31b6631f40 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -713,7 +713,7 @@ void tst_QFileInfo::dir_data() QTest::newRow("resource1") << ":/tst_qfileinfo/resources/file1.ext1" << true << ":/tst_qfileinfo/resources"; #ifdef Q_OS_WIN QTest::newRow("driveWithSlash") << "C:/file1.ext1.ext2" << true << "C:/"; - QTest::newRow("driveWithoutSlash") << QDir::currentPath().left(2) + "file1.ext1.ext2" << false << QDir::currentPath(); + QTest::newRow("driveWithoutSlash") << QDir::currentPath().left(2) + "file1.ext1.ext2" << false << QDir::currentPath().left(2); #endif } From 565f39aad1c02fda14f52fdd002eaba52abf8d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 28 Feb 2014 16:31:32 +0100 Subject: [PATCH 056/172] Don't assume a QBasicDrag will start and end over a QWindow A QBasicDrag is started from QBasicDrag::drag() through the drag manager, which may happen from e.g a widget. The event filter needs to look at events to more than just QWindows, otherwise the filter will miss eg. mouse release events that are sent to QWidget and not to the QWindow handle, and the drag goes on forever, causing invalid internal state when a new drag is then started. Change-Id: I5cee250e2c7552817bda0895d4c5794e12d26592 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qsimpledrag.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index dcf476e4fe0..d53239e74f2 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -116,6 +116,8 @@ void QBasicDrag::disableEventFilter() bool QBasicDrag::eventFilter(QObject *o, QEvent *e) { + Q_UNUSED(o); + if (!m_drag) { if (e->type() == QEvent::KeyRelease && static_cast(e)->key() == Qt::Key_Escape) { disableEventFilter(); @@ -125,9 +127,6 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) return false; } - if (!qobject_cast(o)) - return false; - switch (e->type()) { case QEvent::ShortcutOverride: // prevent accelerators from firing while dragging From 1e18df9c73e5431083ac2983c8899823d5ce259d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 3 Mar 2014 14:47:27 +0100 Subject: [PATCH 057/172] Extend QOpenGLFunctions with GL1 functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This introduces the ability to indirectly invoke all common GL1-GLES2 functions via QOpenGLFunctions. The GL1 functions are not yet resolved, since this would not work anyway when linking to an OpenGL implementation directly. However this may change later but that will be a completely internal change without affecting any public APIs. Also migrate some of the opengl examples to use QOpenGLFunctions for everything. Once dynamic GL loading becomes available on some platforms, these examples should continue to function without any changes since they do not anymore invoke any OpenGL functions directly. Task-number: QTBUG-36483 Change-Id: Ie630029651e5a4863a480aac5306edd67ee36813 Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- examples/opengl/contextinfo/renderwindow.cpp | 12 +- examples/opengl/contextinfo/widget.cpp | 9 +- examples/opengl/hellowindow/hellowindow.cpp | 22 +- examples/opengl/textures/glwidget.cpp | 2 + examples/opengl/textures/glwidget.h | 3 +- src/gui/opengl/qopenglfunctions.cpp | 552 +++++++++++- src/gui/opengl/qopenglfunctions.h | 832 ++++++++++++++++--- 7 files changed, 1313 insertions(+), 119 deletions(-) diff --git a/examples/opengl/contextinfo/renderwindow.cpp b/examples/opengl/contextinfo/renderwindow.cpp index ab8e89fab83..85fb19bd1a6 100644 --- a/examples/opengl/contextinfo/renderwindow.cpp +++ b/examples/opengl/contextinfo/renderwindow.cpp @@ -43,6 +43,7 @@ #include #include #include +#include RenderWindow::RenderWindow(const QSurfaceFormat &format) : m_context(0), @@ -177,10 +178,11 @@ void RenderWindow::render() return; } + QOpenGLFunctions *f = m_context->functions(); if (!m_initialized) { m_initialized = true; - glEnable(GL_DEPTH_TEST); - glClearColor(0, 0, 0, 1); + f->glEnable(GL_DEPTH_TEST); + f->glClearColor(0, 0, 0, 1); init(); emit ready(); } @@ -189,8 +191,8 @@ void RenderWindow::render() return; const qreal retinaScale = devicePixelRatio(); - glViewport(0, 0, width() * retinaScale, height() * retinaScale); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + f->glViewport(0, 0, width() * retinaScale, height() * retinaScale); + f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); m_program->bind(); QMatrix4x4 matrix; @@ -204,7 +206,7 @@ void RenderWindow::render() else // no VAO support, set the vertex attribute arrays now setupVertexAttribs(); - glDrawArrays(GL_TRIANGLES, 0, 3); + f->glDrawArrays(GL_TRIANGLES, 0, 3); m_vao.release(); m_program->release(); diff --git a/examples/opengl/contextinfo/widget.cpp b/examples/opengl/contextinfo/widget.cpp index 6d4b97ca8f0..ff78639e240 100644 --- a/examples/opengl/contextinfo/widget.cpp +++ b/examples/opengl/contextinfo/widget.cpp @@ -312,13 +312,14 @@ void Widget::renderWindowReady() QString vendor, renderer, version, glslVersion; const GLubyte *p; - if ((p = glGetString(GL_VENDOR))) + QOpenGLFunctions *f = context->functions(); + if ((p = f->glGetString(GL_VENDOR))) vendor = QString::fromLatin1(reinterpret_cast(p)); - if ((p = glGetString(GL_RENDERER))) + if ((p = f->glGetString(GL_RENDERER))) renderer = QString::fromLatin1(reinterpret_cast(p)); - if ((p = glGetString(GL_VERSION))) + if ((p = f->glGetString(GL_VERSION))) version = QString::fromLatin1(reinterpret_cast(p)); - if ((p = glGetString(GL_SHADING_LANGUAGE_VERSION))) + if ((p = f->glGetString(GL_SHADING_LANGUAGE_VERSION))) glslVersion = QString::fromLatin1(reinterpret_cast(p)); m_output->append(tr("\nVendor: %1").arg(vendor)); diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index 2864883f5eb..3b5971c0d37 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -41,6 +41,7 @@ #include "hellowindow.h" #include +#include #include Renderer::Renderer(const QSurfaceFormat &format, Renderer *share, QScreen *screen) @@ -142,15 +143,16 @@ void Renderer::render() m_initialized = true; } - glViewport(0, 0, viewSize.width() * surface->devicePixelRatio(), viewSize.height() * surface->devicePixelRatio()); + QOpenGLFunctions *f = m_context->functions(); + f->glViewport(0, 0, viewSize.width() * surface->devicePixelRatio(), viewSize.height() * surface->devicePixelRatio()); - glClearColor(0.1f, 0.1f, 0.2f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + f->glClearColor(0.1f, 0.1f, 0.2f, 1.0f); + f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glFrontFace(GL_CW); - glCullFace(GL_FRONT); - glEnable(GL_CULL_FACE); - glEnable(GL_DEPTH_TEST); + f->glFrontFace(GL_CW); + f->glCullFace(GL_FRONT); + f->glEnable(GL_CULL_FACE); + f->glEnable(GL_DEPTH_TEST); QMatrix4x4 modelview; modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f); @@ -164,8 +166,8 @@ void Renderer::render() paintQtLogo(); m_program->release(); - glDisable(GL_DEPTH_TEST); - glDisable(GL_CULL_FACE); + f->glDisable(GL_DEPTH_TEST); + f->glDisable(GL_CULL_FACE); m_context->swapBuffers(surface); @@ -187,8 +189,6 @@ void Renderer::paintQtLogo() void Renderer::initialize() { - glClearColor(0.1f, 0.1f, 0.2f, 1.0f); - QOpenGLShader *vshader = new QOpenGLShader(QOpenGLShader::Vertex, this); vshader->compileSourceCode( "attribute highp vec4 vertex;" diff --git a/examples/opengl/textures/glwidget.cpp b/examples/opengl/textures/glwidget.cpp index ac1e7965af0..305ca1aa4c2 100644 --- a/examples/opengl/textures/glwidget.cpp +++ b/examples/opengl/textures/glwidget.cpp @@ -83,6 +83,8 @@ void GLWidget::setClearColor(const QColor &color) void GLWidget::initializeGL() { + initializeOpenGLFunctions(); + makeObject(); glEnable(GL_DEPTH_TEST); diff --git a/examples/opengl/textures/glwidget.h b/examples/opengl/textures/glwidget.h index fee47b9b48c..b210b0fd8fe 100644 --- a/examples/opengl/textures/glwidget.h +++ b/examples/opengl/textures/glwidget.h @@ -43,10 +43,11 @@ #include #include +#include QT_FORWARD_DECLARE_CLASS(QGLShaderProgram); -class GLWidget : public QGLWidget +class GLWidget : public QGLWidget, protected QOpenGLFunctions { Q_OBJECT diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 9a52ae2a9f7..504e62adf44 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -124,9 +124,13 @@ QT_BEGIN_NAMESPACE glFuncs.glActiveTexture(GL_TEXTURE1); \endcode - QOpenGLFunctions provides wrappers for all OpenGL/ES 2.0 functions, - except those like \c{glDrawArrays()}, \c{glViewport()}, and - \c{glBindTexture()} that don't have portability issues. + QOpenGLFunctions provides wrappers for all OpenGL/ES 2.0 + functions, including the common subset of OpenGL 1.x and ES + 2.0. While such functions, for example glClear() or + glDrawArrays(), can be called also directly, as long as the + application links to the platform-specific OpenGL library, calling + them via QOpenGLFunctions enables the possibility of dynamically + loading the OpenGL implementation. The hasOpenGLFeature() and openGLFeatures() functions can be used to determine if the OpenGL implementation has a major OpenGL/ES 2.0 @@ -487,6 +491,501 @@ void QOpenGLFunctions::initializeOpenGLFunctions() d_ptr = qt_gl_functions(); } +/*! + \fn void QOpenGLFunctions::glBindTexture(GLenum target, GLuint texture) + + Convenience function that calls glBindTexture(\a target, \a texture). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBindTexture.xml}{glBindTexture()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glBlendFunc(GLenum sfactor, GLenum dfactor) + + Convenience function that calls glBlendFunc(\a sfactor, \a dfactor). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendFunc.xml}{glBlendFunc()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glClear(GLbitfield mask) + + Convenience function that calls glClear(\a mask). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glClear.xml}{glClear()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) + + Convenience function that calls glClearColor(\a red, \a green, \a blue, \a alpha). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glClearColor.xml}{glClearColor()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glClearStencil(GLint s) + + Convenience function that calls glClearStencil(\a s). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glClearStencil.xml}{glClearStencil()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) + + Convenience function that calls glColorMask(\a red, \a green, \a blue, \a alpha). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glColorMask.xml}{glColorMask()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) + + Convenience function that calls glCopyTexImage2D(\a target, \a level, \a internalformat, \a x, \a y, \a width, \a height, \a border). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glCopyTexImage2D.xml}{glCopyTexImage2D()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) + + Convenience function that calls glCopyTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a x, \a y, \a width, \a height). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glCopyTexSubImage2D.xml}{glCopyTexSubImage2D()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glCullFace(GLenum mode) + + Convenience function that calls glCullFace(\a mode). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glCullFace.xml}{glCullFace()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glDeleteTextures(GLsizei n, const GLuint* textures) + + Convenience function that calls glDeleteTextures(\a n, \a textures). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteTextures.xml}{glDeleteTextures()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glDepthFunc(GLenum func) + + Convenience function that calls glDepthFunc(\a func). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDepthFunc.xml}{glDepthFunc()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glDepthMask(GLboolean flag) + + Convenience function that calls glDepthMask(\a flag). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDepthMask.xml}{glDepthMask()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glDisable(GLenum cap) + + Convenience function that calls glDisable(\a cap). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDisable.xml}{glDisable()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei count) + + Convenience function that calls glDrawArrays(\a mode, \a first, \a count). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDrawArrays.xml}{glDrawArrays()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) + + Convenience function that calls glDrawElements(\a mode, \a count, \a type, \a indices). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDrawElements.xml}{glDrawElements()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glEnable(GLenum cap) + + Convenience function that calls glEnable(\a cap). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glEnable.xml}{glEnable()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glFinish() + + Convenience function that calls glFinish(). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glFinish.xml}{glFinish()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glFlush() + + Convenience function that calls glFlush(). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glFlush.xml}{glFlush()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glFrontFace(GLenum mode) + + Convenience function that calls glFrontFace(\a mode). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glFrontFace.xml}{glFrontFace()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glGenTextures(GLsizei n, GLuint* textures) + + Convenience function that calls glGenTextures(\a n, \a textures). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGenTextures.xml}{glGenTextures()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glGetBooleanv(GLenum pname, GLboolean* params) + + Convenience function that calls glGetBooleanv(\a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetBooleanv.xml}{glGetBooleanv()}. + + \since 5.3 +*/ + +/*! + \fn GLenum QOpenGLFunctions::glGetError() + + Convenience function that calls glGetError(). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetError.xml}{glGetError()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glGetFloatv(GLenum pname, GLfloat* params) + + Convenience function that calls glGetFloatv(\a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetFloatv.xml}{glGetFloatv()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glGetIntegerv(GLenum pname, GLint* params) + + Convenience function that calls glGetIntegerv(\a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetIntegerv.xml}{glGetIntegerv()}. + + \since 5.3 +*/ + +/*! + \fn const GLubyte *QOpenGLFunctions::glGetString(GLenum name) + + Convenience function that calls glGetString(\a name). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetString.xml}{glGetString()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) + + Convenience function that calls glGetTexParameterfv(\a target, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetTexParameterfv.xml}{glGetTexParameterfv()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) + + Convenience function that calls glGetTexParameteriv(\a target, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetTexParameteriv.xml}{glGetTexParameteriv()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glHint(GLenum target, GLenum mode) + + Convenience function that calls glHint(\a target, \a mode). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glHint.xml}{glHint()}. + + \since 5.3 +*/ + +/*! + \fn GLboolean QOpenGLFunctions::glIsEnabled(GLenum cap) + + Convenience function that calls glIsEnabled(\a cap). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glIsEnabled.xml}{glIsEnabled()}. + + \since 5.3 +*/ + +/*! + \fn GLboolean QOpenGLFunctions::glIsTexture(GLuint texture) + + Convenience function that calls glIsTexture(\a texture). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glIsTexture.xml}{glIsTexture()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glLineWidth(GLfloat width) + + Convenience function that calls glLineWidth(\a width). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glLineWidth.xml}{glLineWidth()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glPixelStorei(GLenum pname, GLint param) + + Convenience function that calls glPixelStorei(\a pname, \a param). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glPixelStorei.xml}{glPixelStorei()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glPolygonOffset(GLfloat factor, GLfloat units) + + Convenience function that calls glPolygonOffset(\a factor, \a units). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glPolygonOffset.xml}{glPolygonOffset()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) + + Convenience function that calls glReadPixels(\a x, \a y, \a width, \a height, \a format, \a type, \a pixels). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glReadPixels.xml}{glReadPixels()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glScissor(GLint x, GLint y, GLsizei width, GLsizei height) + + Convenience function that calls glScissor(\a x, \a y, \a width, \a height). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glScissor.xml}{glScissor()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glStencilFunc(GLenum func, GLint ref, GLuint mask) + + Convenience function that calls glStencilFunc(\a func, \a ref, \a mask). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilFunc.xml}{glStencilFunc()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glStencilMask(GLuint mask) + + Convenience function that calls glStencilMask(\a mask). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilMask.xml}{glStencilMask()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) + + Convenience function that calls glStencilOp(\a fail, \a zfail, \a zpass). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilOp.xml}{glStencilOp()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) + + Convenience function that calls glTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a format, \a type, \a pixels). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glTexImage2D.xml}{glTexImage2D()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glTexParameterf(GLenum target, GLenum pname, GLfloat param) + + Convenience function that calls glTexParameterf(\a target, \a pname, \a param). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameterf.xml}{glTexParameterf()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) + + Convenience function that calls glTexParameterfv(\a target, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameterfv.xml}{glTexParameterfv()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glTexParameteri(GLenum target, GLenum pname, GLint param) + + Convenience function that calls glTexParameteri(\a target, \a pname, \a param). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameteri.xml}{glTexParameteri()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glTexParameteriv(GLenum target, GLenum pname, const GLint* params) + + Convenience function that calls glTexParameteriv(\a target, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameteriv.xml}{glTexParameteriv()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) + + Convenience function that calls glTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a type, \a pixels). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glTexSubImage2D.xml}{glTexSubImage2D()}. + + \since 5.3 +*/ + +/*! + \fn void QOpenGLFunctions::glViewport(GLint x, GLint y, GLsizei width, GLsizei height) + + Convenience function that calls glViewport(\a x, \a y, \a width, \a height). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glViewport.xml}{glViewport()}. + + \since 5.3 +*/ + /*! \fn void QOpenGLFunctions::glActiveTexture(GLenum texture) @@ -2407,6 +2906,53 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) * context, assigns it to the member variable and executes it * (see Resolver template) */ #ifndef QT_OPENGL_ES_2 + // OpenGL1 functions do not need resolving for now since QtGui links to libGL, libGLESv2 or opengl32. + BindTexture = ::glBindTexture; + BlendFunc = ::glBlendFunc; + Clear = ::glClear; + ClearColor = ::glClearColor; + ClearStencil = ::glClearStencil; + ColorMask = ::glColorMask; + CopyTexImage2D = ::glCopyTexImage2D; + CopyTexSubImage2D = ::glCopyTexSubImage2D; + CullFace = ::glCullFace; + DeleteTextures = ::glDeleteTextures; + DepthFunc = ::glDepthFunc; + DepthMask = ::glDepthMask; + Disable = ::glDisable; + DrawArrays = ::glDrawArrays; + DrawElements = ::glDrawElements; + Enable = ::glEnable; + Finish = ::glFinish; + Flush = ::glFlush; + FrontFace = ::glFrontFace; + GenTextures = ::glGenTextures; + GetBooleanv = ::glGetBooleanv; + GetError = ::glGetError; + GetFloatv = ::glGetFloatv; + GetIntegerv = ::glGetIntegerv; + GetString = ::glGetString; + GetTexParameterfv = ::glGetTexParameterfv; + GetTexParameteriv = ::glGetTexParameteriv; + Hint = ::glHint; + IsEnabled = ::glIsEnabled; + IsTexture = ::glIsTexture; + LineWidth = ::glLineWidth; + PixelStorei = ::glPixelStorei; + PolygonOffset = ::glPolygonOffset; + ReadPixels = ::glReadPixels; + Scissor = ::glScissor; + StencilFunc = ::glStencilFunc; + StencilMask = ::glStencilMask; + StencilOp = ::glStencilOp; + TexImage2D = ::glTexImage2D; + TexParameterf = ::glTexParameterf; + TexParameterfv = ::glTexParameterfv; + TexParameteri = ::glTexParameteri; + TexParameteriv = ::glTexParameteriv; + TexSubImage2D = ::glTexSubImage2D; + Viewport = ::glViewport; + ActiveTexture = qopenglfResolveActiveTexture; AttachShader = qopenglfResolveAttachShader; BindAttribLocation = qopenglfResolveBindAttribLocation; diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index 8b84a460a33..ac490372603 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -79,6 +79,52 @@ struct QOpenGLFunctionsPrivate; // Undefine any macros from GLEW, qopenglextensions_p.h, etc that // may interfere with the definition of QOpenGLFunctions. +#undef glBindTexture +#undef glBlendFunc +#undef glClear +#undef glClearColor +#undef glClearStencil +#undef glColorMask +#undef glCopyTexImage2D +#undef glCopyTexSubImage2D +#undef glCullFace +#undef glDeleteTextures +#undef glDepthFunc +#undef glDepthMask +#undef glDisable +#undef glDrawArrays +#undef glDrawElements +#undef glEnable +#undef glFinish +#undef glFlush +#undef glFrontFace +#undef glGenTextures +#undef glGetBooleanv +#undef glGetError +#undef glGetFloatv +#undef glGetIntegerv +#undef glGetString +#undef glGetTexParameterfv +#undef glGetTexParameteriv +#undef glHint +#undef glIsEnabled +#undef glIsTexture +#undef glLineWidth +#undef glPixelStorei +#undef glPolygonOffset +#undef glReadPixels +#undef glScissor +#undef glStencilFunc +#undef glStencilMask +#undef glStencilOp +#undef glTexImage2D +#undef glTexParameterf +#undef glTexParameterfv +#undef glTexParameteri +#undef glTexParameteriv +#undef glTexSubImage2D +#undef glViewport + #undef glActiveTexture #undef glAttachShader #undef glBindAttribLocation @@ -213,6 +259,54 @@ public: QT_DEPRECATED void initializeGLFunctions() { initializeOpenGLFunctions(); } #endif + // GLES2 + OpenGL1 common subset + void glBindTexture(GLenum target, GLuint texture); + void glBlendFunc(GLenum sfactor, GLenum dfactor); + void glClear(GLbitfield mask); + void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void glClearStencil(GLint s); + void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); + void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void glCullFace(GLenum mode); + void glDeleteTextures(GLsizei n, const GLuint* textures); + void glDepthFunc(GLenum func); + void glDepthMask(GLboolean flag); + void glDisable(GLenum cap); + void glDrawArrays(GLenum mode, GLint first, GLsizei count); + void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); + void glEnable(GLenum cap); + void glFinish(); + void glFlush(); + void glFrontFace(GLenum mode); + void glGenTextures(GLsizei n, GLuint* textures); + void glGetBooleanv(GLenum pname, GLboolean* params); + GLenum glGetError(); + void glGetFloatv(GLenum pname, GLfloat* params); + void glGetIntegerv(GLenum pname, GLint* params); + const GLubyte *glGetString(GLenum name); + void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params); + void glGetTexParameteriv(GLenum target, GLenum pname, GLint* params); + void glHint(GLenum target, GLenum mode); + GLboolean glIsEnabled(GLenum cap); + GLboolean glIsTexture(GLuint texture); + void glLineWidth(GLfloat width); + void glPixelStorei(GLenum pname, GLint param); + void glPolygonOffset(GLfloat factor, GLfloat units); + void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); + void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); + void glStencilFunc(GLenum func, GLint ref, GLuint mask); + void glStencilMask(GLuint mask); + void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); + void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); + void glTexParameterf(GLenum target, GLenum pname, GLfloat param); + void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params); + void glTexParameteri(GLenum target, GLenum pname, GLint param); + void glTexParameteriv(GLenum target, GLenum pname, const GLint* params); + void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); + void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); + + // GL(ES)2 void glActiveTexture(GLenum texture); void glAttachShader(GLuint program, GLuint shader); void glBindAttribLocation(GLuint program, GLuint index, const char* name); @@ -322,6 +416,52 @@ struct QOpenGLFunctionsPrivate { QOpenGLFunctionsPrivate(QOpenGLContext *ctx); + void (QOPENGLF_APIENTRYP BindTexture)(GLenum target, GLuint texture); + void (QOPENGLF_APIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor); + void (QOPENGLF_APIENTRYP Clear)(GLbitfield mask); + void (QOPENGLF_APIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void (QOPENGLF_APIENTRYP ClearStencil)(GLint s); + void (QOPENGLF_APIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void (QOPENGLF_APIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); + void (QOPENGLF_APIENTRYP CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void (QOPENGLF_APIENTRYP CullFace)(GLenum mode); + void (QOPENGLF_APIENTRYP DeleteTextures)(GLsizei n, const GLuint* textures); + void (QOPENGLF_APIENTRYP DepthFunc)(GLenum func); + void (QOPENGLF_APIENTRYP DepthMask)(GLboolean flag); + void (QOPENGLF_APIENTRYP Disable)(GLenum cap); + void (QOPENGLF_APIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count); + void (QOPENGLF_APIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); + void (QOPENGLF_APIENTRYP Enable)(GLenum cap); + void (QOPENGLF_APIENTRYP Finish)(); + void (QOPENGLF_APIENTRYP Flush)(); + void (QOPENGLF_APIENTRYP FrontFace)(GLenum mode); + void (QOPENGLF_APIENTRYP GenTextures)(GLsizei n, GLuint* textures); + void (QOPENGLF_APIENTRYP GetBooleanv)(GLenum pname, GLboolean* params); + GLenum (QOPENGLF_APIENTRYP GetError)(); + void (QOPENGLF_APIENTRYP GetFloatv)(GLenum pname, GLfloat* params); + void (QOPENGLF_APIENTRYP GetIntegerv)(GLenum pname, GLint* params); + const GLubyte * (QOPENGLF_APIENTRYP GetString)(GLenum name); + void (QOPENGLF_APIENTRYP GetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params); + void (QOPENGLF_APIENTRYP GetTexParameteriv)(GLenum target, GLenum pname, GLint* params); + void (QOPENGLF_APIENTRYP Hint)(GLenum target, GLenum mode); + GLboolean (QOPENGLF_APIENTRYP IsEnabled)(GLenum cap); + GLboolean (QOPENGLF_APIENTRYP IsTexture)(GLuint texture); + void (QOPENGLF_APIENTRYP LineWidth)(GLfloat width); + void (QOPENGLF_APIENTRYP PixelStorei)(GLenum pname, GLint param); + void (QOPENGLF_APIENTRYP PolygonOffset)(GLfloat factor, GLfloat units); + void (QOPENGLF_APIENTRYP ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); + void (QOPENGLF_APIENTRYP Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); + void (QOPENGLF_APIENTRYP StencilFunc)(GLenum func, GLint ref, GLuint mask); + void (QOPENGLF_APIENTRYP StencilMask)(GLuint mask); + void (QOPENGLF_APIENTRYP StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); + void (QOPENGLF_APIENTRYP TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); + void (QOPENGLF_APIENTRYP TexParameterf)(GLenum target, GLenum pname, GLfloat param); + void (QOPENGLF_APIENTRYP TexParameterfv)(GLenum target, GLenum pname, const GLfloat* params); + void (QOPENGLF_APIENTRYP TexParameteri)(GLenum target, GLenum pname, GLint param); + void (QOPENGLF_APIENTRYP TexParameteriv)(GLenum target, GLenum pname, const GLint* params); + void (QOPENGLF_APIENTRYP TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); + void (QOPENGLF_APIENTRYP Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); + void (QOPENGLF_APIENTRYP ActiveTexture)(GLenum texture); void (QOPENGLF_APIENTRYP AttachShader)(GLuint program, GLuint shader); void (QOPENGLF_APIENTRYP BindAttribLocation)(GLuint program, GLuint index, const char* name); @@ -419,9 +559,511 @@ struct QOpenGLFunctionsPrivate void (QOPENGLF_APIENTRYP VertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); }; +// GLES2 + OpenGL1 common subset + +inline void QOpenGLFunctions::glBindTexture(GLenum target, GLuint texture) +{ +#ifdef QT_OPENGL_ES_2 + ::glBindTexture(target, texture); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BindTexture(target, texture); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBlendFunc(GLenum sfactor, GLenum dfactor) +{ +#ifdef QT_OPENGL_ES_2 + ::glBlendFunc(sfactor, dfactor); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BlendFunc(sfactor, dfactor); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glClear(GLbitfield mask) +{ +#ifdef QT_OPENGL_ES_2 + ::glClear(mask); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Clear(mask); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ +#ifdef QT_OPENGL_ES_2 + ::glClearColor(red, green, blue, alpha); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ClearColor(red, green, blue, alpha); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glClearStencil(GLint s) +{ +#ifdef QT_OPENGL_ES_2 + ::glClearStencil(s); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ClearStencil(s); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ +#ifdef QT_OPENGL_ES_2 + ::glColorMask(red, green, blue, alpha); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ColorMask(red, green, blue, alpha); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ +#ifdef QT_OPENGL_ES_2 + ::glCopyTexImage2D(target, level, internalformat, x, y, width,height, border); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->CopyTexImage2D(target, level, internalformat, x, y, width,height, border); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ +#ifdef QT_OPENGL_ES_2 + ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glCullFace(GLenum mode) +{ +#ifdef QT_OPENGL_ES_2 + ::glCullFace(mode); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->CullFace(mode); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDeleteTextures(GLsizei n, const GLuint* textures) +{ +#ifdef QT_OPENGL_ES_2 + ::glDeleteTextures(n, textures); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DeleteTextures(n, textures); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDepthFunc(GLenum func) +{ +#ifdef QT_OPENGL_ES_2 + ::glDepthFunc(func); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DepthFunc(func); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDepthMask(GLboolean flag) +{ +#ifdef QT_OPENGL_ES_2 + ::glDepthMask(flag); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DepthMask(flag); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDisable(GLenum cap) +{ +#ifdef QT_OPENGL_ES_2 + ::glDisable(cap); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Disable(cap); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDrawArrays(GLenum mode, GLint first, GLsizei count) +{ +#ifdef QT_OPENGL_ES_2 + ::glDrawArrays(mode, first, count); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DrawArrays(mode, first, count); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) +{ +#ifdef QT_OPENGL_ES_2 + ::glDrawElements(mode, count, type, indices); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DrawElements(mode, count, type, indices); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glEnable(GLenum cap) +{ +#ifdef QT_OPENGL_ES_2 + ::glEnable(cap); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Enable(cap); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glFinish() +{ +#ifdef QT_OPENGL_ES_2 + ::glFinish(); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Finish(); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glFlush() +{ +#ifdef QT_OPENGL_ES_2 + ::glFlush(); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Flush(); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glFrontFace(GLenum mode) +{ +#ifdef QT_OPENGL_ES_2 + ::glFrontFace(mode); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->FrontFace(mode); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGenTextures(GLsizei n, GLuint* textures) +{ +#ifdef QT_OPENGL_ES_2 + ::glGenTextures(n, textures); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GenTextures(n, textures); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetBooleanv(GLenum pname, GLboolean* params) +{ +#ifdef QT_OPENGL_ES_2 + ::glGetBooleanv(pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetBooleanv(pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline GLenum QOpenGLFunctions::glGetError() +{ +#ifdef QT_OPENGL_ES_2 + GLenum result = ::glGetError(); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLenum result = d_ptr->GetError(); +#endif + return result; +} + +inline void QOpenGLFunctions::glGetFloatv(GLenum pname, GLfloat* params) +{ +#ifdef QT_OPENGL_ES_2 + ::glGetFloatv(pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetFloatv(pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetIntegerv(GLenum pname, GLint* params) +{ +#ifdef QT_OPENGL_ES_2 + ::glGetIntegerv(pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetIntegerv(pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline const GLubyte *QOpenGLFunctions::glGetString(GLenum name) +{ +#ifdef QT_OPENGL_ES_2 + const GLubyte *result = ::glGetString(name); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + const GLubyte *result = d_ptr->GetString(name); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline void QOpenGLFunctions::glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) +{ +#ifdef QT_OPENGL_ES_2 + ::glGetTexParameterfv(target, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetTexParameterfv(target, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) +{ +#ifdef QT_OPENGL_ES_2 + ::glGetTexParameteriv(target, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetTexParameteriv(target, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glHint(GLenum target, GLenum mode) +{ +#ifdef QT_OPENGL_ES_2 + ::glHint(target, mode); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Hint(target, mode); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline GLboolean QOpenGLFunctions::glIsEnabled(GLenum cap) +{ +#ifdef QT_OPENGL_ES_2 + GLboolean result = ::glIsEnabled(cap); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLboolean result = d_ptr->IsEnabled(cap); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline GLboolean QOpenGLFunctions::glIsTexture(GLuint texture) +{ +#ifdef QT_OPENGL_ES_2 + GLboolean result = ::glIsTexture(texture); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLboolean result = d_ptr->IsTexture(texture); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline void QOpenGLFunctions::glLineWidth(GLfloat width) +{ +#ifdef QT_OPENGL_ES_2 + ::glLineWidth(width); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->LineWidth(width); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glPixelStorei(GLenum pname, GLint param) +{ +#ifdef QT_OPENGL_ES_2 + ::glPixelStorei(pname, param); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->PixelStorei(pname, param); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glPolygonOffset(GLfloat factor, GLfloat units) +{ +#ifdef QT_OPENGL_ES_2 + ::glPolygonOffset(factor, units); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->PolygonOffset(factor, units); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) +{ +#ifdef QT_OPENGL_ES_2 + ::glReadPixels(x, y, width, height, format, type, pixels); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ReadPixels(x, y, width, height, format, type, pixels); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glScissor(GLint x, GLint y, GLsizei width, GLsizei height) +{ +#ifdef QT_OPENGL_ES_2 + ::glScissor(x, y, width, height); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Scissor(x, y, width, height); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glStencilFunc(GLenum func, GLint ref, GLuint mask) +{ +#ifdef QT_OPENGL_ES_2 + ::glStencilFunc(func, ref, mask); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->StencilFunc(func, ref, mask); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glStencilMask(GLuint mask) +{ +#ifdef QT_OPENGL_ES_2 + ::glStencilMask(mask); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->StencilMask(mask); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) +{ +#ifdef QT_OPENGL_ES_2 + ::glStencilOp(fail, zfail, zpass); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->StencilOp(fail, zfail, zpass); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) +{ +#ifdef QT_OPENGL_ES_2 + ::glTexImage2D(target, level, internalformat, width,height, border, format, type, pixels); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->TexImage2D(target, level, internalformat, width,height, border, format, type, pixels); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glTexParameterf(GLenum target, GLenum pname, GLfloat param) +{ +#ifdef QT_OPENGL_ES_2 + ::glTexParameterf(target, pname, param); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->TexParameterf(target, pname, param); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) +{ +#ifdef QT_OPENGL_ES_2 + ::glTexParameterfv(target, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->TexParameterfv(target, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glTexParameteri(GLenum target, GLenum pname, GLint param) +{ +#ifdef QT_OPENGL_ES_2 + ::glTexParameteri(target, pname, param); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->TexParameteri(target, pname, param); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glTexParameteriv(GLenum target, GLenum pname, const GLint* params) +{ +#ifdef QT_OPENGL_ES_2 + ::glTexParameteriv(target, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->TexParameteriv(target, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) +{ +#ifdef QT_OPENGL_ES_2 + ::glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glViewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ +#ifdef QT_OPENGL_ES_2 + ::glViewport(x, y, width, height); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Viewport(x, y, width, height); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +// GL(ES)2 + inline void QOpenGLFunctions::glActiveTexture(GLenum texture) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glActiveTexture(texture); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -432,7 +1074,7 @@ inline void QOpenGLFunctions::glActiveTexture(GLenum texture) inline void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glAttachShader(program, shader); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -443,7 +1085,7 @@ inline void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader) inline void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBindAttribLocation(program, index, name); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -454,7 +1096,7 @@ inline void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index, inline void QOpenGLFunctions::glBindBuffer(GLenum target, GLuint buffer) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBindBuffer(target, buffer); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -467,7 +1109,7 @@ inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffe { if (framebuffer == 0) framebuffer = QOpenGLContext::currentContext()->defaultFramebufferObject(); -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBindFramebuffer(target, framebuffer); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -478,7 +1120,7 @@ inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffe inline void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBindRenderbuffer(target, renderbuffer); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -489,7 +1131,7 @@ inline void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuf inline void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBlendColor(red, green, blue, alpha); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -500,7 +1142,7 @@ inline void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclamp inline void QOpenGLFunctions::glBlendEquation(GLenum mode) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBlendEquation(mode); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -511,7 +1153,7 @@ inline void QOpenGLFunctions::glBlendEquation(GLenum mode) inline void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBlendEquationSeparate(modeRGB, modeAlpha); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -522,7 +1164,7 @@ inline void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum mod inline void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -533,7 +1175,7 @@ inline void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, inline void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBufferData(target, size, data, usage); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -544,7 +1186,7 @@ inline void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr siz inline void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glBufferSubData(target, offset, size, data); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -555,7 +1197,7 @@ inline void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr of inline GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLenum result = ::glCheckFramebufferStatus(target); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -577,7 +1219,7 @@ inline void QOpenGLFunctions::glClearDepthf(GLclampf depth) inline void QOpenGLFunctions::glCompileShader(GLuint shader) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glCompileShader(shader); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -588,7 +1230,7 @@ inline void QOpenGLFunctions::glCompileShader(GLuint shader) inline void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -599,7 +1241,7 @@ inline void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, inline void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -610,7 +1252,7 @@ inline void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint lev inline GLuint QOpenGLFunctions::glCreateProgram() { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLuint result = ::glCreateProgram(); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -622,7 +1264,7 @@ inline GLuint QOpenGLFunctions::glCreateProgram() inline GLuint QOpenGLFunctions::glCreateShader(GLenum type) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLuint result = ::glCreateShader(type); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -634,7 +1276,7 @@ inline GLuint QOpenGLFunctions::glCreateShader(GLenum type) inline void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glDeleteBuffers(n, buffers); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -645,7 +1287,7 @@ inline void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers) inline void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glDeleteFramebuffers(n, framebuffers); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -656,7 +1298,7 @@ inline void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* fram inline void QOpenGLFunctions::glDeleteProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glDeleteProgram(program); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -667,7 +1309,7 @@ inline void QOpenGLFunctions::glDeleteProgram(GLuint program) inline void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glDeleteRenderbuffers(n, renderbuffers); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -678,7 +1320,7 @@ inline void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* ren inline void QOpenGLFunctions::glDeleteShader(GLuint shader) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glDeleteShader(shader); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -699,7 +1341,7 @@ inline void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar) inline void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glDetachShader(program, shader); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -710,7 +1352,7 @@ inline void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader) inline void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glDisableVertexAttribArray(index); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -721,7 +1363,7 @@ inline void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index) inline void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glEnableVertexAttribArray(index); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -732,7 +1374,7 @@ inline void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index) inline void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -743,7 +1385,7 @@ inline void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum at inline void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glFramebufferTexture2D(target, attachment, textarget, texture, level); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -754,7 +1396,7 @@ inline void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attac inline void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGenBuffers(n, buffers); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -765,7 +1407,7 @@ inline void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers) inline void QOpenGLFunctions::glGenerateMipmap(GLenum target) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGenerateMipmap(target); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -776,7 +1418,7 @@ inline void QOpenGLFunctions::glGenerateMipmap(GLenum target) inline void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGenFramebuffers(n, framebuffers); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -787,7 +1429,7 @@ inline void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers) inline void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGenRenderbuffers(n, renderbuffers); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -798,7 +1440,7 @@ inline void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffer inline void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetActiveAttrib(program, index, bufsize, length, size, type, name); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -809,7 +1451,7 @@ inline void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GL inline void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetActiveUniform(program, index, bufsize, length, size, type, name); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -820,7 +1462,7 @@ inline void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, G inline void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetAttachedShaders(program, maxcount, count, shaders); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -831,7 +1473,7 @@ inline void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxco inline GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* name) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLint result = ::glGetAttribLocation(program, name); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -843,7 +1485,7 @@ inline GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* n inline void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetBufferParameteriv(target, pname, params); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -854,7 +1496,7 @@ inline void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname inline void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -865,7 +1507,7 @@ inline void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum targe inline void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetProgramiv(program, pname, params); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -876,7 +1518,7 @@ inline void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint inline void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetProgramInfoLog(program, bufsize, length, infolog); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -887,7 +1529,7 @@ inline void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsiz inline void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetRenderbufferParameteriv(target, pname, params); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -898,7 +1540,7 @@ inline void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum inline void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetShaderiv(shader, pname, params); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -909,7 +1551,7 @@ inline void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* inline void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetShaderInfoLog(shader, bufsize, length, infolog); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -920,7 +1562,7 @@ inline void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, inline void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -931,7 +1573,7 @@ inline void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLen inline void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetShaderSource(shader, bufsize, length, source); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -942,7 +1584,7 @@ inline void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, inline void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetUniformfv(program, location, params); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -953,7 +1595,7 @@ inline void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLf inline void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetUniformiv(program, location, params); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -964,7 +1606,7 @@ inline void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLi inline GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char* name) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLint result = ::glGetUniformLocation(program, name); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -976,7 +1618,7 @@ inline GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char* inline void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetVertexAttribfv(index, pname, params); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -987,7 +1629,7 @@ inline void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GL inline void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetVertexAttribiv(index, pname, params); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -998,7 +1640,7 @@ inline void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GL inline void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glGetVertexAttribPointerv(index, pname, pointer); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1009,7 +1651,7 @@ inline void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pna inline GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLboolean result = ::glIsBuffer(buffer); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1021,7 +1663,7 @@ inline GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer) inline GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLboolean result = ::glIsFramebuffer(framebuffer); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1033,7 +1675,7 @@ inline GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer) inline GLboolean QOpenGLFunctions::glIsProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLboolean result = ::glIsProgram(program); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1045,7 +1687,7 @@ inline GLboolean QOpenGLFunctions::glIsProgram(GLuint program) inline GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLboolean result = ::glIsRenderbuffer(renderbuffer); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1057,7 +1699,7 @@ inline GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer) inline GLboolean QOpenGLFunctions::glIsShader(GLuint shader) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 GLboolean result = ::glIsShader(shader); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1069,7 +1711,7 @@ inline GLboolean QOpenGLFunctions::glIsShader(GLuint shader) inline void QOpenGLFunctions::glLinkProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glLinkProgram(program); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1080,7 +1722,7 @@ inline void QOpenGLFunctions::glLinkProgram(GLuint program) inline void QOpenGLFunctions::glReleaseShaderCompiler() { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glReleaseShaderCompiler(); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1091,7 +1733,7 @@ inline void QOpenGLFunctions::glReleaseShaderCompiler() inline void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glRenderbufferStorage(target, internalformat, width, height); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1102,7 +1744,7 @@ inline void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum intern inline void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glSampleCoverage(value, invert); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1113,7 +1755,7 @@ inline void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert) inline void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glShaderBinary(n, shaders, binaryformat, binary, length); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1124,7 +1766,7 @@ inline void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLe inline void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glShaderSource(shader, count, string, length); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1135,7 +1777,7 @@ inline void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const inline void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glStencilFuncSeparate(face, func, ref, mask); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1146,7 +1788,7 @@ inline void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GL inline void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glStencilMaskSeparate(face, mask); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1157,7 +1799,7 @@ inline void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask) inline void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glStencilOpSeparate(face, fail, zfail, zpass); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1168,7 +1810,7 @@ inline void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLen inline void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform1f(location, x); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1179,7 +1821,7 @@ inline void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x) inline void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform1fv(location, count, v); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1190,7 +1832,7 @@ inline void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const inline void QOpenGLFunctions::glUniform1i(GLint location, GLint x) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform1i(location, x); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1201,7 +1843,7 @@ inline void QOpenGLFunctions::glUniform1i(GLint location, GLint x) inline void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform1iv(location, count, v); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1212,7 +1854,7 @@ inline void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const inline void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform2f(location, x, y); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1223,7 +1865,7 @@ inline void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y) inline void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform2fv(location, count, v); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1234,7 +1876,7 @@ inline void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const inline void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform2i(location, x, y); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1245,7 +1887,7 @@ inline void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y) inline void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform2iv(location, count, v); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1256,7 +1898,7 @@ inline void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const inline void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform3f(location, x, y, z); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1267,7 +1909,7 @@ inline void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, inline void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform3fv(location, count, v); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1278,7 +1920,7 @@ inline void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const inline void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform3i(location, x, y, z); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1289,7 +1931,7 @@ inline void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLin inline void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform3iv(location, count, v); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1300,7 +1942,7 @@ inline void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const inline void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform4f(location, x, y, z, w); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1311,7 +1953,7 @@ inline void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, inline void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform4fv(location, count, v); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1322,7 +1964,7 @@ inline void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const inline void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform4i(location, x, y, z, w); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1333,7 +1975,7 @@ inline void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLin inline void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniform4iv(location, count, v); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1344,7 +1986,7 @@ inline void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const inline void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniformMatrix2fv(location, count, transpose, value); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1355,7 +1997,7 @@ inline void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, inline void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniformMatrix3fv(location, count, transpose, value); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1366,7 +2008,7 @@ inline void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, inline void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUniformMatrix4fv(location, count, transpose, value); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1377,7 +2019,7 @@ inline void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, inline void QOpenGLFunctions::glUseProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glUseProgram(program); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1388,7 +2030,7 @@ inline void QOpenGLFunctions::glUseProgram(GLuint program) inline void QOpenGLFunctions::glValidateProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glValidateProgram(program); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1399,7 +2041,7 @@ inline void QOpenGLFunctions::glValidateProgram(GLuint program) inline void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glVertexAttrib1f(indx, x); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1410,7 +2052,7 @@ inline void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x) inline void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glVertexAttrib1fv(indx, values); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1421,7 +2063,7 @@ inline void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* valu inline void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glVertexAttrib2f(indx, x, y); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1432,7 +2074,7 @@ inline void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y inline void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glVertexAttrib2fv(indx, values); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1443,7 +2085,7 @@ inline void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* valu inline void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glVertexAttrib3f(indx, x, y, z); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1454,7 +2096,7 @@ inline void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y inline void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glVertexAttrib3fv(indx, values); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1465,7 +2107,7 @@ inline void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* valu inline void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glVertexAttrib4f(indx, x, y, z, w); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1476,7 +2118,7 @@ inline void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y inline void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glVertexAttrib4fv(indx, values); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); @@ -1487,7 +2129,7 @@ inline void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* valu inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 ::glVertexAttribPointer(indx, size, type, normalized, stride, ptr); #else Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); From 9d79c3458c7d27441d20935b25584f7b9382d77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 4 Mar 2014 15:25:29 +0100 Subject: [PATCH 058/172] Disable the qmetatype test on Clang + ARM, it's causing OOM during build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And takes a very long time to build if it doesn't run out of memory. Task-number: QTBUG-37237 Change-Id: I8c7fae4d2d99ad59c6d6306da2df554a05955446 Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/kernel/kernel.pro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro index 4b3b2e824ee..3ec783ab2cf 100644 --- a/tests/auto/corelib/kernel/kernel.pro +++ b/tests/auto/corelib/kernel/kernel.pro @@ -8,7 +8,6 @@ SUBDIRS=\ qmetaobjectbuilder \ qmetamethod \ qmetaproperty \ - qmetatype \ qmimedata \ qobject \ qpointer \ @@ -22,6 +21,10 @@ SUBDIRS=\ qvariant \ qwineventnotifier +# Building the qmetatype test with Clang on ARM takes forever (QTBUG-37237) +!clang|!contains(QT_ARCH, arm): \ + SUBDIRS += qmetatype + !qtHaveModule(gui): SUBDIRS -= \ qmimedata From f99fd06d7d72627dcb92f6093537d64429d0563a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 4 Mar 2014 14:39:36 +0100 Subject: [PATCH 059/172] Merge qfontdatabase_qpa.cpp with qfontdatabase.cpp There's no point in separating them anymore, and it just makes editing and reasoning about the QFontDatabase code harder. Change-Id: I6bc8cb5e5daac26293e75553639e4a4d34eba3bd Reviewed-by: Simon Hausmann Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontdatabase.cpp | 419 ++++++++++++++++++++++++- src/gui/text/qfontdatabase_qpa.cpp | 472 ----------------------------- 2 files changed, 416 insertions(+), 475 deletions(-) delete mode 100644 src/gui/text/qfontdatabase_qpa.cpp diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 61c93dc2ac0..b8ac7efb6c9 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -55,6 +55,8 @@ #include #include +#include + #include #include #include @@ -654,9 +656,200 @@ QMutex *qt_fontdatabase_mutex() return fontDatabaseMutex(); } -QT_BEGIN_INCLUDE_NAMESPACE -# include "qfontdatabase_qpa.cpp" -QT_END_INCLUDE_NAMESPACE + +void qt_registerFont(const QString &familyName, const QString &stylename, + const QString &foundryname, int weight, + QFont::Style style, int stretch, bool antialiased, + bool scalable, int pixelSize, bool fixedPitch, + const QSupportedWritingSystems &writingSystems, void *handle) +{ + QFontDatabasePrivate *d = privateDb(); +// qDebug() << "Adding font" << familyName << weight << style << pixelSize << antialiased; + QtFontStyle::Key styleKey; + styleKey.style = style; + styleKey.weight = weight; + styleKey.stretch = stretch; + QtFontFamily *f = d->family(familyName, true); + f->fixedPitch = fixedPitch; + + for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) { + if (writingSystems.supported(QFontDatabase::WritingSystem(i))) + f->writingSystems[i] = QtFontFamily::Supported; + } + + QtFontFoundry *foundry = f->foundry(foundryname, true); + QtFontStyle *fontStyle = foundry->style(styleKey, stylename, true); + fontStyle->smoothScalable = scalable; + fontStyle->antialiased = antialiased; + QtFontSize *size = fontStyle->pixelSize(pixelSize ? pixelSize : SMOOTH_SCALABLE, true); + if (size->handle) { + QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration(); + if (integration) + integration->fontDatabase()->releaseHandle(size->handle); + } + size->handle = handle; +} + +void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias) +{ + if (alias.isEmpty()) + return; + + QFontDatabasePrivate *d = privateDb(); + QtFontFamily *f = d->family(familyName, false); + if (!f) + return; + + if (f->aliases.contains(alias, Qt::CaseInsensitive)) + return; + + f->aliases.push_back(alias); +} + +QString qt_resolveFontFamilyAlias(const QString &alias) +{ + if (!alias.isEmpty()) { + const QFontDatabasePrivate *d = privateDb(); + for (int i = 0; i < d->count; ++i) + if (d->families[i]->matchesFamilyName(alias)) + return d->families[i]->name; + } + return alias; +} + +static QStringList fallbackFamilies(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) +{ + QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script); + QFontDatabasePrivate *db = privateDb(); + + QStringList::iterator i; + for (i = retList.begin(); i != retList.end(); ++i) { + bool contains = false; + for (int j = 0; j < db->count; j++) { + if (db->families[j]->matchesFamilyName(*i)) { + contains = true; + break; + } + } + if (!contains) { + i = retList.erase(i); + i--; + } + } + return retList; +} + +static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt); + +static void initializeDb() +{ + QFontDatabasePrivate *db = privateDb(); + + // init by asking for the platformfontdb for the first time or after invalidation + if (!db->count) + QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase(); + + if (db->reregisterAppFonts) { + for (int i = 0; i < db->applicationFonts.count(); i++) { + if (!db->applicationFonts.at(i).families.isEmpty()) + registerFont(&db->applicationFonts[i]); + } + db->reregisterAppFonts = false; + } +} + +static inline void load(const QString & = QString(), int = -1) +{ + // Only initialize the database if it has been cleared or not initialized yet + if (!privateDb()->count) + initializeDb(); +} + +static +QFontEngine *loadSingleEngine(int script, + const QFontDef &request, + QtFontFoundry *foundry, + QtFontStyle *style, QtFontSize *size) +{ + Q_UNUSED(foundry); + + Q_ASSERT(size); + QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); + int pixelSize = size->pixelSize; + if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE) + || pfdb->fontsAlwaysScalable()) { + pixelSize = request.pixelSize; + } + + QFontDef def = request; + def.pixelSize = pixelSize; + + QFontCache::Key key(def,script); + QFontEngine *engine = QFontCache::instance()->findEngine(key); + if (!engine) { + engine = pfdb->fontEngine(def, size->handle); + if (engine) { + // Also check for OpenType tables when using complex scripts + if (!engine->supportsScript(QChar::Script(script))) { + qWarning(" OpenType support missing for script %d", script); + if (engine->ref.load() == 0) + delete engine; + return 0; + } + + QFontCache::instance()->insertEngine(key, engine); + } + } + return engine; +} + +static +QFontEngine *loadEngine(int script, const QFontDef &request, + QtFontFamily *family, QtFontFoundry *foundry, + QtFontStyle *style, QtFontSize *size) +{ + + QFontEngine *engine = loadSingleEngine(script, request, foundry, style, size); + //make sure that the db has all fallback families + if (engine && engine->type() != QFontEngine::Multi + && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol ) { + + if (family && !family->askedForFallback) { + QFont::Style fontStyle = QFont::Style(style->key.style); + QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint); + if (styleHint == QFont::AnyStyle && request.fixedPitch) + styleHint = QFont::TypeWriter; + family->fallbackFamilies = fallbackFamilies(family->name, fontStyle, styleHint, QChar::Script(script)); + + family->askedForFallback = true; + } + + QStringList fallbacks = privateDb()->fallbackFamilies; + if (family && !family->fallbackFamilies.isEmpty()) + fallbacks = family->fallbackFamilies; + + QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); + QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script)); + pfMultiEngine->setFallbackFamiliesList(fallbacks); + engine = pfMultiEngine; + + // Cache Multi font engine as well in case we got the single + // font engine when we are actually looking for a Multi one + QFontCache::Key key(request, script, 1); + QFontCache::instance()->insertEngine(key, engine); + } + + return engine; +} + +static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) +{ + QFontDatabasePrivate *db = privateDb(); + + fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName); + + db->reregisterAppFonts = true; +} static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey, const QString &styleName = QString()) @@ -2146,6 +2339,20 @@ QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type) \sa removeAllApplicationFonts(), addApplicationFont(), addApplicationFontFromData() */ +bool QFontDatabase::removeApplicationFont(int handle) +{ + QMutexLocker locker(fontDatabaseMutex()); + + QFontDatabasePrivate *db = privateDb(); + if (handle < 0 || handle >= db->applicationFonts.count()) + return false; + + db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont(); + + db->reregisterAppFonts = true; + db->invalidate(); + return true; +} /*! \fn bool QFontDatabase::removeAllApplicationFonts() @@ -2159,6 +2366,18 @@ QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type) \sa removeApplicationFont(), addApplicationFont(), addApplicationFontFromData() */ +bool QFontDatabase::removeAllApplicationFonts() +{ + QMutexLocker locker(fontDatabaseMutex()); + + QFontDatabasePrivate *db = privateDb(); + if (db->applicationFonts.isEmpty()) + return false; + + db->applicationFonts.clear(); + db->invalidate(); + return true; +} /*! \fn bool QFontDatabase::supportsThreadedFontRendering() @@ -2174,6 +2393,200 @@ QFont QFontDatabase::systemFont(QFontDatabase::SystemFont type) \sa {Thread-Support in Qt Modules#Painting In Threads}{Painting In Threads} */ +// QT_DEPRECATED_SINCE(5, 2) +bool QFontDatabase::supportsThreadedFontRendering() +{ + return true; +} + +/*! + \internal +*/ +QFontEngine * +QFontDatabase::findFont(int script, const QFontPrivate *fp, + const QFontDef &request, bool multi) +{ + QMutexLocker locker(fontDatabaseMutex()); + + const int force_encoding_id = -1; + + if (!privateDb()->count) + initializeDb(); + + QFontEngine *engine; + QFontCache::Key key(request, script, multi ? 1 : 0); + engine = QFontCache::instance()->findEngine(key); + if (engine) { + FM_DEBUG("Cache hit level 1"); + return engine; + } + + QString family_name, foundry_name; + + parseFontName(request.family, foundry_name, family_name); + + if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) { + engine =new QTestFontEngine(request.pixelSize); + engine->fontDef = request; + } + + QtFontDesc desc; + QList blackListed; + int index = match(script, request, family_name, foundry_name, force_encoding_id, &desc, blackListed); + if (index >= 0) { + engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size); + if (!engine) + blackListed.append(index); + } else { + FM_DEBUG(" NO MATCH FOUND\n"); + } + + if (engine && engine->type() != QFontEngine::TestFontEngine) { + initFontDef(desc, request, &engine->fontDef, engine->type() == QFontEngine::Multi); + + if (fp) { + QFontDef def = request; + if (def.family.isEmpty()) { + def.family = fp->request.family; + def.family = def.family.left(def.family.indexOf(QLatin1Char(','))); + } + } + } + + if (!engine) { + if (!request.family.isEmpty()) { + QStringList fallbacks = request.fallBackFamilies + + fallbackFamilies(request.family, + QFont::Style(request.style), + QFont::StyleHint(request.styleHint), + QChar::Script(script)); + if (script > QChar::Script_Common) + fallbacks += QString(); // Find the first font matching the specified script. + + for (int i = 0; !engine && i < fallbacks.size(); i++) { + QFontDef def = request; + def.family = fallbacks.at(i); + QFontCache::Key key(def, script, multi ? 1 : 0); + engine = QFontCache::instance()->findEngine(key); + if (!engine) { + QtFontDesc desc; + do { + index = match(script, def, def.family, QLatin1String(""), 0, &desc, blackListed); + if (index >= 0) { + QFontDef loadDef = def; + if (loadDef.family.isEmpty()) + loadDef.family = desc.family->name; + engine = loadEngine(script, loadDef, desc.family, desc.foundry, desc.style, desc.size); + if (engine) + initFontDef(desc, loadDef, &engine->fontDef, engine->type() == QFontEngine::Multi); + else + blackListed.append(index); + } + } while (index >= 0 && !engine); + } + } + } + + if (!engine) + engine = new QFontEngineBox(request.pixelSize); + + FM_DEBUG("returning box engine"); + } + + if (fp && fp->dpi > 0) { + engine->fontDef.pointSize = qreal(double((engine->fontDef.pixelSize * 72) / fp->dpi)); + } else { + engine->fontDef.pointSize = request.pointSize; + } + + return engine; +} + +void QFontDatabase::load(const QFontPrivate *d, int script) +{ + QFontDef req = d->request; + + if (req.pixelSize == -1) { + req.pixelSize = floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100; + req.pixelSize = qRound(req.pixelSize); + } + if (req.pointSize < 0) + req.pointSize = req.pixelSize*72.0/d->dpi; + if (req.weight == 0) + req.weight = QFont::Normal; + if (req.stretch == 0) + req.stretch = 100; + + // Until we specifically asked not to, try looking for Multi font engine + // first, the last '1' indicates that we want Multi font engine instead + // of single ones + bool multi = !(req.styleStrategy & QFont::NoFontMerging); + QFontCache::Key key(req, script, multi ? 1 : 0); + + if (!d->engineData) + getEngineData(d, req); + + // the cached engineData could have already loaded the engine we want + if (d->engineData->engines[script]) + return; + + QFontEngine *fe = QFontCache::instance()->findEngine(key); + + // list of families to try + QStringList family_list; + + if (!req.family.isEmpty()) { + QStringList familiesForRequest = familyList(req); + + // Add primary selection + family_list << familiesForRequest.takeFirst(); + + // Fallbacks requested in font request + req.fallBackFamilies = familiesForRequest; + + // add the default family + QString defaultFamily = QGuiApplication::font().family(); + if (! family_list.contains(defaultFamily)) + family_list << defaultFamily; + + } + + // null family means find the first font matching the specified script + family_list << QString(); + + QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd(); + for (; !fe && it != end; ++it) { + req.family = *it; + + fe = QFontDatabase::findFont(script, d, req, multi); + if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) { + if (fe->ref.load() == 0) + delete fe; + + fe = 0; + } + + // No need to check requested fallback families again + req.fallBackFamilies.clear(); + } + + if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) { + for (int i = 0; i < QChar::ScriptCount; ++i) { + if (!d->engineData->engines[i]) { + d->engineData->engines[i] = fe; + fe->ref.ref(); + } + } + } else { + d->engineData->engines[script] = fe; + fe->ref.ref(); + } +} + +QString QFontDatabase::resolveFontFamilyAlias(const QString &family) +{ + return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family); +} QT_END_NAMESPACE diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp deleted file mode 100644 index 1972f5d58c2..00000000000 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qlibraryinfo.h" -#include - -#include "qfontengine_qpa_p.h" -#include "qplatformdefs.h" - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -void qt_registerFont(const QString &familyName, const QString &stylename, - const QString &foundryname, int weight, - QFont::Style style, int stretch, bool antialiased, - bool scalable, int pixelSize, bool fixedPitch, - const QSupportedWritingSystems &writingSystems, void *handle) -{ - QFontDatabasePrivate *d = privateDb(); -// qDebug() << "Adding font" << familyName << weight << style << pixelSize << antialiased; - QtFontStyle::Key styleKey; - styleKey.style = style; - styleKey.weight = weight; - styleKey.stretch = stretch; - QtFontFamily *f = d->family(familyName, true); - f->fixedPitch = fixedPitch; - - for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) { - if (writingSystems.supported(QFontDatabase::WritingSystem(i))) - f->writingSystems[i] = QtFontFamily::Supported; - } - - QtFontFoundry *foundry = f->foundry(foundryname, true); - QtFontStyle *fontStyle = foundry->style(styleKey, stylename, true); - fontStyle->smoothScalable = scalable; - fontStyle->antialiased = antialiased; - QtFontSize *size = fontStyle->pixelSize(pixelSize ? pixelSize : SMOOTH_SCALABLE, true); - if (size->handle) { - QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration(); - if (integration) - integration->fontDatabase()->releaseHandle(size->handle); - } - size->handle = handle; -} - -void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias) -{ - if (alias.isEmpty()) - return; - - QFontDatabasePrivate *d = privateDb(); - QtFontFamily *f = d->family(familyName, false); - if (!f) - return; - - if (f->aliases.contains(alias, Qt::CaseInsensitive)) - return; - - f->aliases.push_back(alias); -} - -QString qt_resolveFontFamilyAlias(const QString &alias) -{ - if (!alias.isEmpty()) { - const QFontDatabasePrivate *d = privateDb(); - for (int i = 0; i < d->count; ++i) - if (d->families[i]->matchesFamilyName(alias)) - return d->families[i]->name; - } - return alias; -} - -static QStringList fallbackFamilies(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) -{ - QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script); - QFontDatabasePrivate *db = privateDb(); - - QStringList::iterator i; - for (i = retList.begin(); i != retList.end(); ++i) { - bool contains = false; - for (int j = 0; j < db->count; j++) { - if (db->families[j]->matchesFamilyName(*i)) { - contains = true; - break; - } - } - if (!contains) { - i = retList.erase(i); - i--; - } - } - return retList; -} - -static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt); - -static void initializeDb() -{ - QFontDatabasePrivate *db = privateDb(); - - // init by asking for the platformfontdb for the first time or after invalidation - if (!db->count) - QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase(); - - if (db->reregisterAppFonts) { - for (int i = 0; i < db->applicationFonts.count(); i++) { - if (!db->applicationFonts.at(i).families.isEmpty()) - registerFont(&db->applicationFonts[i]); - } - db->reregisterAppFonts = false; - } -} - -static inline void load(const QString & = QString(), int = -1) -{ - // Only initialize the database if it has been cleared or not initialized yet - if (!privateDb()->count) - initializeDb(); -} - -static -QFontEngine *loadSingleEngine(int script, - const QFontDef &request, - QtFontFoundry *foundry, - QtFontStyle *style, QtFontSize *size) -{ - Q_UNUSED(foundry); - - Q_ASSERT(size); - QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); - int pixelSize = size->pixelSize; - if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE) - || pfdb->fontsAlwaysScalable()) { - pixelSize = request.pixelSize; - } - - QFontDef def = request; - def.pixelSize = pixelSize; - - QFontCache::Key key(def,script); - QFontEngine *engine = QFontCache::instance()->findEngine(key); - if (!engine) { - engine = pfdb->fontEngine(def, size->handle); - if (engine) { - // Also check for OpenType tables when using complex scripts - if (!engine->supportsScript(QChar::Script(script))) { - qWarning(" OpenType support missing for script %d", script); - if (engine->ref.load() == 0) - delete engine; - return 0; - } - - QFontCache::instance()->insertEngine(key, engine); - } - } - return engine; -} - -static -QFontEngine *loadEngine(int script, const QFontDef &request, - QtFontFamily *family, QtFontFoundry *foundry, - QtFontStyle *style, QtFontSize *size) -{ - - QFontEngine *engine = loadSingleEngine(script, request, foundry, style, size); - //make sure that the db has all fallback families - if (engine && engine->type() != QFontEngine::Multi - && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol ) { - - if (family && !family->askedForFallback) { - QFont::Style fontStyle = QFont::Style(style->key.style); - QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint); - if (styleHint == QFont::AnyStyle && request.fixedPitch) - styleHint = QFont::TypeWriter; - family->fallbackFamilies = fallbackFamilies(family->name, fontStyle, styleHint, QChar::Script(script)); - - family->askedForFallback = true; - } - - QStringList fallbacks = privateDb()->fallbackFamilies; - if (family && !family->fallbackFamilies.isEmpty()) - fallbacks = family->fallbackFamilies; - - QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); - QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script)); - pfMultiEngine->setFallbackFamiliesList(fallbacks); - engine = pfMultiEngine; - - // Cache Multi font engine as well in case we got the single - // font engine when we are actually looking for a Multi one - QFontCache::Key key(request, script, 1); - QFontCache::instance()->insertEngine(key, engine); - } - - return engine; -} - -static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) -{ - QFontDatabasePrivate *db = privateDb(); - - fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName); - - db->reregisterAppFonts = true; -} - -bool QFontDatabase::removeApplicationFont(int handle) -{ - QMutexLocker locker(fontDatabaseMutex()); - - QFontDatabasePrivate *db = privateDb(); - if (handle < 0 || handle >= db->applicationFonts.count()) - return false; - - db->applicationFonts[handle] = QFontDatabasePrivate::ApplicationFont(); - - db->reregisterAppFonts = true; - db->invalidate(); - return true; -} - -bool QFontDatabase::removeAllApplicationFonts() -{ - QMutexLocker locker(fontDatabaseMutex()); - - QFontDatabasePrivate *db = privateDb(); - if (db->applicationFonts.isEmpty()) - return false; - - db->applicationFonts.clear(); - db->invalidate(); - return true; -} - -// QT_DEPRECATED_SINCE(5, 2) -bool QFontDatabase::supportsThreadedFontRendering() -{ - return true; -} - -/*! - \internal -*/ -QFontEngine * -QFontDatabase::findFont(int script, const QFontPrivate *fp, - const QFontDef &request, bool multi) -{ - QMutexLocker locker(fontDatabaseMutex()); - - const int force_encoding_id = -1; - - if (!privateDb()->count) - initializeDb(); - - QFontEngine *engine; - QFontCache::Key key(request, script, multi ? 1 : 0); - engine = QFontCache::instance()->findEngine(key); - if (engine) { - FM_DEBUG("Cache hit level 1"); - return engine; - } - - QString family_name, foundry_name; - - parseFontName(request.family, foundry_name, family_name); - - if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) { - engine =new QTestFontEngine(request.pixelSize); - engine->fontDef = request; - } - - QtFontDesc desc; - QList blackListed; - int index = match(script, request, family_name, foundry_name, force_encoding_id, &desc, blackListed); - if (index >= 0) { - engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size); - if (!engine) - blackListed.append(index); - } else { - FM_DEBUG(" NO MATCH FOUND\n"); - } - - if (engine && engine->type() != QFontEngine::TestFontEngine) { - initFontDef(desc, request, &engine->fontDef, engine->type() == QFontEngine::Multi); - - if (fp) { - QFontDef def = request; - if (def.family.isEmpty()) { - def.family = fp->request.family; - def.family = def.family.left(def.family.indexOf(QLatin1Char(','))); - } - } - } - - if (!engine) { - if (!request.family.isEmpty()) { - QStringList fallbacks = request.fallBackFamilies - + fallbackFamilies(request.family, - QFont::Style(request.style), - QFont::StyleHint(request.styleHint), - QChar::Script(script)); - if (script > QChar::Script_Common) - fallbacks += QString(); // Find the first font matching the specified script. - - for (int i = 0; !engine && i < fallbacks.size(); i++) { - QFontDef def = request; - def.family = fallbacks.at(i); - QFontCache::Key key(def, script, multi ? 1 : 0); - engine = QFontCache::instance()->findEngine(key); - if (!engine) { - QtFontDesc desc; - do { - index = match(script, def, def.family, QLatin1String(""), 0, &desc, blackListed); - if (index >= 0) { - QFontDef loadDef = def; - if (loadDef.family.isEmpty()) - loadDef.family = desc.family->name; - engine = loadEngine(script, loadDef, desc.family, desc.foundry, desc.style, desc.size); - if (engine) - initFontDef(desc, loadDef, &engine->fontDef, engine->type() == QFontEngine::Multi); - else - blackListed.append(index); - } - } while (index >= 0 && !engine); - } - } - } - - if (!engine) - engine = new QFontEngineBox(request.pixelSize); - - FM_DEBUG("returning box engine"); - } - - if (fp && fp->dpi > 0) { - engine->fontDef.pointSize = qreal(double((engine->fontDef.pixelSize * 72) / fp->dpi)); - } else { - engine->fontDef.pointSize = request.pointSize; - } - - return engine; -} - -void QFontDatabase::load(const QFontPrivate *d, int script) -{ - QFontDef req = d->request; - - if (req.pixelSize == -1) { - req.pixelSize = floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100; - req.pixelSize = qRound(req.pixelSize); - } - if (req.pointSize < 0) - req.pointSize = req.pixelSize*72.0/d->dpi; - if (req.weight == 0) - req.weight = QFont::Normal; - if (req.stretch == 0) - req.stretch = 100; - - // Until we specifically asked not to, try looking for Multi font engine - // first, the last '1' indicates that we want Multi font engine instead - // of single ones - bool multi = !(req.styleStrategy & QFont::NoFontMerging); - QFontCache::Key key(req, script, multi ? 1 : 0); - - if (!d->engineData) - getEngineData(d, req); - - // the cached engineData could have already loaded the engine we want - if (d->engineData->engines[script]) - return; - - QFontEngine *fe = QFontCache::instance()->findEngine(key); - - // list of families to try - QStringList family_list; - - if (!req.family.isEmpty()) { - QStringList familiesForRequest = familyList(req); - - // Add primary selection - family_list << familiesForRequest.takeFirst(); - - // Fallbacks requested in font request - req.fallBackFamilies = familiesForRequest; - - // add the default family - QString defaultFamily = QGuiApplication::font().family(); - if (! family_list.contains(defaultFamily)) - family_list << defaultFamily; - - } - - // null family means find the first font matching the specified script - family_list << QString(); - - QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd(); - for (; !fe && it != end; ++it) { - req.family = *it; - - fe = QFontDatabase::findFont(script, d, req, multi); - if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) { - if (fe->ref.load() == 0) - delete fe; - - fe = 0; - } - - // No need to check requested fallback families again - req.fallBackFamilies.clear(); - } - - if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) { - for (int i = 0; i < QChar::ScriptCount; ++i) { - if (!d->engineData->engines[i]) { - d->engineData->engines[i] = fe; - fe->ref.ref(); - } - } - } else { - d->engineData->engines[script] = fe; - fe->ref.ref(); - } -} - -QString QFontDatabase::resolveFontFamilyAlias(const QString &family) -{ - return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family); -} - -QT_END_NAMESPACE From f697f3ceb6751cfa04338ac8a62ad54dfadad73d Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 5 Mar 2014 07:02:12 +0200 Subject: [PATCH 060/172] Optimize glyph lookups with QFontEngine::glyphIndex(uint) Change-Id: I56c7e727f3d9b08195f38939106620c744c6eaf0 Reviewed-by: Lars Knoll Reviewed-by: BogDan Vatra --- src/gui/text/qdistancefield.cpp | 17 ++---- src/gui/text/qfontengine.cpp | 72 ++++------------------ src/gui/text/qfontengine_ft.cpp | 20 ++---- src/gui/text/qfontmetrics.cpp | 104 +++++--------------------------- src/gui/text/qfontsubset.cpp | 16 +---- src/gui/text/qharfbuzzng.cpp | 28 +-------- src/gui/text/qrawfont.cpp | 2 +- src/gui/text/qtextengine.cpp | 65 ++++++++------------ 8 files changed, 61 insertions(+), 263 deletions(-) diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index f2b88c46921..17116ee2d06 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -739,20 +739,11 @@ bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine) if (!fe) return false; - const QChar uc(QLatin1Char('O')); + QImage im; - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - int numGlyphs = 1; - - if (!fe->stringToCMap(&uc, 1, &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(numGlyphs == 1); - - QImage im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform()); + const glyph_t glyph = fe->glyphIndex('O'); + if (glyph != 0) + im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform()); Q_ASSERT(fe->ref.load() == 0); delete fe; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 316b491e185..87d3090a398 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -101,35 +101,13 @@ static HB_Bool hb_stringToGlyphs(HB_Font font, const HB_UChar16 *string, hb_uint *numGlyphs = nGlyphs; if (rightToLeft && result && !fe->symbol) { - uint glyph_pos = 0; - for (uint i = 0; i < length; ++i, ++glyph_pos) { - uint ucs4 = str[i].unicode(); - if (Q_UNLIKELY(QChar::isHighSurrogate(ucs4) && i + 1 < length)) { - uint low = str[i + 1].unicode(); - if (Q_LIKELY(QChar::isLowSurrogate(low))) { - ucs4 = QChar::surrogateToUcs4(ucs4, low); - ++i; - } - } - - uint mirrored = QChar::mirroredChar(ucs4); - if (Q_UNLIKELY(mirrored != ucs4)) { - QChar chars[2]; - uint numChars = 0; - if (Q_UNLIKELY(QChar::requiresSurrogates(mirrored))) { - chars[numChars++] = QChar(QChar::highSurrogate(mirrored)); - chars[numChars++] = QChar(QChar::lowSurrogate(mirrored)); - } else { - chars[numChars++] = QChar(mirrored); - } - - qglyphs.numGlyphs = numChars; - qglyphs.glyphs = glyphs + glyph_pos; - nGlyphs = numChars; - if (!fe->stringToCMap(chars, numChars, &qglyphs, &nGlyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nGlyphs == 1); - } + QStringIterator it(str, str + length); + while (it.hasNext()) { + const uint ucs4 = it.next(); + const uint mirrored = QChar::mirroredChar(ucs4); + if (Q_UNLIKELY(mirrored != ucs4)) + *glyphs = fe->glyphIndex(mirrored); + ++glyphs; } } @@ -417,38 +395,14 @@ glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix QFixed QFontEngine::xHeight() const { - QChar x((ushort)'x'); - - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - - int nglyphs = 1; - if (!stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); - + const glyph_t glyph = glyphIndex('x'); glyph_metrics_t bb = const_cast(this)->boundingBox(glyph); return bb.height; } QFixed QFontEngine::averageCharWidth() const { - QChar x((ushort)'x'); - - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - - int nglyphs = 1; - if (!stringToCMap(&x, 1, &glyphs, &nglyphs, GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); - + const glyph_t glyph = glyphIndex('x'); glyph_metrics_t bb = const_cast(this)->boundingBox(glyph); return bb.xoff; } @@ -509,18 +463,14 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform if (glyphs.justifications[i].nKashidas) { QChar ch(0x640); // Kashida character - glyph_t kashidaGlyph; + glyph_t kashidaGlyph = glyphIndex(ch.unicode()); QFixed kashidaWidth; QGlyphLayout g; g.numGlyphs = 1; g.glyphs = &kashidaGlyph; g.advances = &kashidaWidth; - - int nglyphs = 1; - if (!stringToCMap(&ch, 1, &g, &nglyphs, 0)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + recalcAdvances(&g, 0); for (uint k = 0; k < glyphs.justifications[i].nKashidas; ++k) { xpos -= kashidaWidth; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 04cf6bfdcb5..892fc225869 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1282,22 +1282,10 @@ qreal QFontEngineFT::minRightBearing() const { if (rbearing == SHRT_MIN) { lbearing = rbearing = 0; - - const QChar *ch = reinterpret_cast(char_table); - - glyph_t glyphs[char_table_entries]; - - QGlyphLayout g; - g.glyphs = glyphs; - g.numGlyphs = char_table_entries; - int ng = char_table_entries; - if (!stringToCMap(ch, char_table_entries, &g, &ng, GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(ng == char_table_entries); - - while (--ng) { - if (glyphs[ng]) { - glyph_metrics_t gi = const_cast(this)->boundingBox(glyphs[ng]); + for (int i = 0; i < char_table_entries; ++i) { + const glyph_t glyph = glyphIndex(char_table[i]); + if (glyph != 0) { + glyph_metrics_t gi = const_cast(this)->boundingBox(glyph); lbearing = qMin(lbearing, gi.x); rbearing = qMin(rbearing, (gi.xoff - gi.x - gi.width)); } diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 2f4709afe4f..7868fd23d15 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -410,12 +410,7 @@ int QFontMetrics::averageCharWidth() const */ bool QFontMetrics::inFont(QChar ch) const { - const int script = ch.script(); - QFontEngine *engine = d->engineForScript(script); - Q_ASSERT(engine != 0); - if (engine->type() == QFontEngine::Box) - return false; - return engine->canRender(&ch, 1); + return inFontUcs4(ch.unicode()); } /*! @@ -458,16 +453,7 @@ int QFontMetrics::leftBearing(QChar ch) const d->alterCharForCapitalization(ch); - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - - int nglyphs = 1; - if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + glyph_t glyph = engine->glyphIndex(ch.unicode()); qreal lb; engine->getGlyphBearings(glyph, &lb); @@ -500,16 +486,7 @@ int QFontMetrics::rightBearing(QChar ch) const d->alterCharForCapitalization(ch); - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - - int nglyphs = 1; - if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + glyph_t glyph = engine->glyphIndex(ch.unicode()); qreal rb; engine->getGlyphBearings(glyph, 0, &rb); @@ -605,18 +582,14 @@ int QFontMetrics::width(QChar ch) const d->alterCharForCapitalization(ch); + glyph_t glyph = engine->glyphIndex(ch.unicode()); QFixed advance; QGlyphLayout glyphs; glyphs.numGlyphs = 1; - glyph_t glyph; glyphs.glyphs = &glyph; glyphs.advances = &advance; - - int nglyphs = 1; - if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + engine->recalcAdvances(&glyphs, 0); return qRound(advance); } @@ -660,18 +633,14 @@ int QFontMetrics::charWidth(const QString &text, int pos) const d->alterCharForCapitalization(ch); + glyph_t glyph = engine->glyphIndex(ch.unicode()); QFixed advance; QGlyphLayout glyphs; glyphs.numGlyphs = 1; - glyph_t glyph; glyphs.glyphs = &glyph; glyphs.advances = &advance; - - int nglyphs = 1; - if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + engine->recalcAdvances(&glyphs, 0); width = qRound(advance); } @@ -739,16 +708,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const d->alterCharForCapitalization(ch); - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - - int nglyphs = 1; - if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + glyph_t glyph = engine->glyphIndex(ch.unicode()); glyph_metrics_t gm = engine->boundingBox(glyph); return QRect(qRound(gm.x), qRound(gm.y), qRound(gm.width), qRound(gm.height)); @@ -1315,12 +1275,7 @@ qreal QFontMetricsF::averageCharWidth() const */ bool QFontMetricsF::inFont(QChar ch) const { - const int script = ch.script(); - QFontEngine *engine = d->engineForScript(script); - Q_ASSERT(engine != 0); - if (engine->type() == QFontEngine::Box) - return false; - return engine->canRender(&ch, 1); + return inFontUcs4(ch.unicode()); } /*! @@ -1365,16 +1320,7 @@ qreal QFontMetricsF::leftBearing(QChar ch) const d->alterCharForCapitalization(ch); - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - - int nglyphs = 1; - if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + glyph_t glyph = engine->glyphIndex(ch.unicode()); qreal lb; engine->getGlyphBearings(glyph, &lb); @@ -1407,16 +1353,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const d->alterCharForCapitalization(ch); - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - - int nglyphs = 1; - if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + glyph_t glyph = engine->glyphIndex(ch.unicode()); qreal rb; engine->getGlyphBearings(glyph, 0, &rb); @@ -1484,18 +1421,14 @@ qreal QFontMetricsF::width(QChar ch) const d->alterCharForCapitalization(ch); + glyph_t glyph = engine->glyphIndex(ch.unicode()); QFixed advance; QGlyphLayout glyphs; glyphs.numGlyphs = 1; - glyph_t glyph; glyphs.glyphs = &glyph; glyphs.advances = &advance; - - int nglyphs = 1; - if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + engine->recalcAdvances(&glyphs, 0); return advance.toReal(); } @@ -1559,16 +1492,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const d->alterCharForCapitalization(ch); - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - - int nglyphs = 1; - if (!engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); + glyph_t glyph = engine->glyphIndex(ch.unicode()); glyph_metrics_t gm = engine->boundingBox(glyph); return QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal()); diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index 2109b16bb59..4bb29da2af4 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -201,22 +201,8 @@ static void checkRanges(QPdf::ByteStream &ts, QByteArray &ranges, int &nranges) QVector QFontSubset::getReverseMap() const { QVector reverseMap(0x10000, 0); - - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.glyphs = &glyph; - glyphs.numGlyphs = 1; - for (uint uc = 0; uc < 0x10000; ++uc) { - QChar ch(uc); - - int nglyphs = 1; - if (!fontEngine->stringToCMap(&ch, 1, &glyphs, &nglyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); - - int idx = glyph_indices.indexOf(glyph); + int idx = glyph_indices.indexOf(fontEngine->glyphIndex(uc)); if (idx >= 0 && !reverseMap.at(idx)) reverseMap[idx] = uc; } diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp index 31bb6f38f20..f7a1d30e6f7 100644 --- a/src/gui/text/qharfbuzzng.cpp +++ b/src/gui/text/qharfbuzzng.cpp @@ -397,33 +397,7 @@ _hb_qt_font_get_glyph(hb_font_t * /*font*/, void *font_data, QFontEngine *fe = (QFontEngine *)font_data; Q_ASSERT(fe); - QChar chars[2]; - int numChars = 0; - if (Q_UNLIKELY(QChar::requiresSurrogates(unicode))) { - chars[numChars++] = QChar(QChar::highSurrogate(unicode)); - chars[numChars++] = QChar(QChar::lowSurrogate(unicode)); - } else { - chars[numChars++] = QChar(unicode); - } -#if 0 - if (Q_UNLIKELY(variation_selector != 0)) { - if (Q_UNLIKELY(QChar::requiresSurrogates(variation_selector))) { - chars[numChars++] = QChar(QChar::highSurrogate(variation_selector)); - chars[numChars++] = QChar(QChar::lowSurrogate(variation_selector)); - } else { - chars[numChars++] = QChar(variation_selector); - } - } -#endif - - QGlyphLayout g; - g.numGlyphs = numChars; - g.glyphs = glyph; - - int numGlyphs = numChars; - if (!fe->stringToCMap(chars, numChars, &g, &numGlyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(numGlyphs == 1); + *glyph = fe->glyphIndex(unicode); return true; } diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 449278df06b..2ba350fb678 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -665,7 +665,7 @@ QList QRawFont::supportedWritingSystems() const */ bool QRawFont::supportsCharacter(QChar character) const { - return d->isValid() && d->fontEngine->canRender(&character, 1); + return supportsCharacter(character.unicode()); } /*! diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 45894d27b69..2d7611774ba 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2011,21 +2011,16 @@ static void set(QJustificationPoint *point, int type, const QGlyphLayout &glyph, if (type >= Justification_Arabic_Normal) { QChar ch(0x640); // Kashida character - glyph_t kashidaGlyph; - QFixed kashidaWidth; + glyph_t kashidaGlyph = fe->glyphIndex(ch.unicode()); + if (kashidaGlyph != 0) { + QGlyphLayout g; + g.numGlyphs = 1; + g.glyphs = &kashidaGlyph; + g.advances = &point->kashidaWidth; + fe->recalcAdvances(&g, 0); - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &kashidaGlyph; - glyphs.advances = &kashidaWidth; - - int nglyphs = 1; - if (!fe->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0)) - Q_UNREACHABLE(); - Q_ASSERT(nglyphs == 1); - - if (kashidaGlyph != 0 && kashidaWidth != 0) { - point->kashidaWidth = kashidaWidth; + if (point->kashidaWidth == 0) + point->type = Justification_Prohibited; } else { point->type = Justification_Prohibited; point->kashidaWidth = 0; @@ -2644,40 +2639,30 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int QFixed ellipsisWidth; QString ellipsisText; { + QFontEngine *fe = fnt.d->engineForScript(QChar::Script_Common); + QFontEngine *engine = fe->type() == QFontEngine::Multi ? static_cast(fe)->engine(0) : fe; + QChar ellipsisChar(0x2026); - QFontEngine *fe = fnt.d->engineForScript(QChar::Script_Common); + glyph_t glyph = engine->glyphIndex(ellipsisChar.unicode()); - QGlyphLayoutArray<1> ellipsisGlyph; - { - QFontEngine *feForEllipsis = (fe->type() == QFontEngine::Multi) - ? static_cast(fe)->engine(0) - : fe; + QGlyphLayout glyphs; + glyphs.numGlyphs = 1; + glyphs.glyphs = &glyph; + glyphs.advances = &ellipsisWidth; - if (feForEllipsis->type() == QFontEngine::Mac) - feForEllipsis = fe; + if (glyph != 0) { + engine->recalcAdvances(&glyphs, 0); - int nGlyphs = 1; - if (!feForEllipsis->stringToCMap(&ellipsisChar, 1, &ellipsisGlyph, &nGlyphs, 0)) - Q_UNREACHABLE(); - Q_ASSERT(nGlyphs == 1); - } - - if (ellipsisGlyph.glyphs[0]) { - ellipsisWidth = ellipsisGlyph.advances[0]; ellipsisText = ellipsisChar; } else { - QString dotDotDot(QLatin1String("...")); + glyph = engine->glyphIndex('.'); + if (glyph != 0) { + engine->recalcAdvances(&glyphs, 0); - QGlyphLayoutArray<3> glyphs; - int nGlyphs = 3; - if (!fe->stringToCMap(dotDotDot.constData(), 3, &glyphs, &nGlyphs, 0)) - Q_UNREACHABLE(); - Q_ASSERT(nGlyphs == 3); - - for (int i = 0; i < nGlyphs; ++i) - ellipsisWidth += glyphs.advances[i]; - ellipsisText = dotDotDot; + ellipsisWidth *= 3; + ellipsisText = QStringLiteral("..."); + } } } From 34e560fc928d2b0fb78cff60f690f3094ec36ac0 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 5 Mar 2014 11:13:02 +0200 Subject: [PATCH 061/172] Optimize QFontEngineMulti::stringToCMap() in case of missing glyphs Use recently introduced glyphIndex() method and only recalc advances if the glyph is present in the font. This allows to avoid restoring the old advance when the glyph was not found in the fallback fonts. Change-Id: I3e0aa549961767e5448816327328101cf6a78873 Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 87d3090a398..a5f213113dd 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1600,9 +1600,6 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()); uint ucs4 = surrogate ? QChar::surrogateToUcs4(str[i], str[i+1]) : str[i].unicode(); if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) { - QFixed tmpAdvance; - if (!(flags & GlyphIndicesOnly)) - tmpAdvance = glyphs->advances[glyph_pos]; for (int x = 1, n = qMin(engines.size(), 256); x < n; ++x) { if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4)) continue; @@ -1616,23 +1613,18 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, if (engine->type() == Box) continue; - if (!(flags & GlyphIndicesOnly)) - glyphs->advances[glyph_pos] = QFixed(); - int num = 2; - QGlyphLayout g = glyphs->mid(glyph_pos, num); - if (!engine->stringToCMap(str + i, surrogate ? 2 : 1, &g, &num, flags)) - Q_UNREACHABLE(); - Q_ASSERT(num == 1); - if (glyphs->glyphs[glyph_pos]) { + glyph_t glyph = engine->glyphIndex(ucs4); + if (glyph != 0) { + glyphs->glyphs[glyph_pos] = glyph; + if (!(flags & GlyphIndicesOnly)) { + QGlyphLayout g = glyphs->mid(glyph_pos, 1); + engine->recalcAdvances(&g, flags); + } // set the high byte to indicate which engine the glyph came from glyphs->glyphs[glyph_pos] |= (x << 24); break; } } - - // ensure we use metrics from the 1st font when we use the fallback image. - if (!(flags & GlyphIndicesOnly) && glyphs->glyphs[glyph_pos] == 0) - glyphs->advances[glyph_pos] = tmpAdvance; } if (surrogate) From e69284db08966cbe907df4b3cdc58fb9f9ee5dc4 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 5 Mar 2014 08:34:46 +0200 Subject: [PATCH 062/172] Get rid of QFontEngine::name() It was only used in QFontCache debug output, and some engines weren't even report a name. Change-Id: I6cec4b75f105f5a4e1405f50188bebb3a3f04e33 Reviewed-by: Lars Knoll --- src/gui/text/qfont.cpp | 8 ++++---- src/gui/text/qfontengine.cpp | 6 ------ src/gui/text/qfontengine_ft_p.h | 2 -- src/gui/text/qfontengine_p.h | 6 ------ src/gui/text/qfontengine_qpa_p.h | 2 -- .../fontdatabases/mac/qfontengine_coretext_p.h | 2 -- src/plugins/platforms/windows/qwindowsfontengine.cpp | 6 ------ src/plugins/platforms/windows/qwindowsfontengine.h | 2 -- .../platforms/windows/qwindowsfontenginedirectwrite.cpp | 5 ----- .../platforms/windows/qwindowsfontenginedirectwrite.h | 2 -- 10 files changed, 4 insertions(+), 37 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 83f2d7190b3..2e21a81187c 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2770,10 +2770,10 @@ void QFontCache::updateHitCountAndTimeStamp(Engine &value) value.timestamp = ++current_timestamp; FC_DEBUG("QFontCache: found font engine\n" - " %p: timestamp %4u hits %3u ref %2d/%2d, type '%s'", + " %p: timestamp %4u hits %3u ref %2d/%2d, type %d", value.data, value.timestamp, value.hits, value.data->ref.load(), engineCacheCount.value(value.data), - value.data->name()); + value.data->type()); } void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMulti) @@ -2969,10 +2969,10 @@ void QFontCache::timerEvent(QTimerEvent *) it = jt; if (it != end) { - FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'", + FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type %d", it.value().data, it.value().timestamp, it.value().hits, it.value().data->ref.load(), engineCacheCount.value(it.value().data), - it.value().data->name()); + it.value().data->type()); QFontEngine *fontEngine = it.value().data; // get rid of all occurrences diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index a5f213113dd..75e55a5d23b 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1497,12 +1497,6 @@ qreal QFontEngineBox::maxCharWidth() const return _size; } - -const char *QFontEngineBox::name() const -{ - return "null"; -} - bool QFontEngineBox::canRender(const QChar *, int) const { return true; diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index fa6ef6f4220..a322ab7ea49 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -230,8 +230,6 @@ private: inline virtual Type type() const { return QFontEngine::Freetype; } - inline virtual const char *name() const - { return "freetype"; } virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics); diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index f5e4ae98faf..f5a894506f8 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -225,8 +225,6 @@ public: virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0); - virtual const char *name() const = 0; - inline bool canRender(uint ucs4) const { return glyphIndex(ucs4) != 0; } virtual bool canRender(const QChar *str, int len) const; @@ -361,8 +359,6 @@ public: virtual qreal minRightBearing() const { return 0; } virtual QImage alphaMapForGlyph(glyph_t); - virtual const char *name() const; - virtual bool canRender(const QChar *string, int len) const; virtual Type type() const; @@ -411,8 +407,6 @@ public: { return QFontEngine::Multi; } virtual bool canRender(const QChar *string, int len) const; - inline virtual const char *name() const - { return "Multi"; } QFontEngine *engine(int at) const {Q_ASSERT(at < engines.size()); return engines.at(at); } diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h index 9d9140b8423..326c905caa4 100644 --- a/src/gui/text/qfontengine_qpa_p.h +++ b/src/gui/text/qfontengine_qpa_p.h @@ -184,8 +184,6 @@ public: Type type() const; - inline const char *name() const { return "QPF2"; } - virtual int glyphCount() const { return glyphMapEntries; } bool isValid() const; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index aefe495c37b..f6247ca5e63 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -79,8 +79,6 @@ public: virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int numGlyphs, QPainterPath *path, QTextItem::RenderFlags); - virtual const char *name() const { return "QCoreTextFontEngine"; } - virtual bool canRender(const QChar *string, int len) const; virtual int synthesized() const { return synthesisFlags; } diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 264c22f47e6..cc2f152bf9a 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -771,12 +771,6 @@ qreal QWindowsFontEngine::minRightBearing() const #endif // Q_OS_WINCE } - -const char *QWindowsFontEngine::name() const -{ - return 0; -} - QFontEngine::Type QWindowsFontEngine::type() const { return QFontEngine::Win; diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index 89ad08f6895..b5347989581 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -110,8 +110,6 @@ public: virtual qreal minLeftBearing() const; virtual qreal minRightBearing() const; - virtual const char *name() const; - Type type() const; virtual QImage alphaMapForGlyph(glyph_t t) { return alphaMapForGlyph(t, QTransform()); } diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 744058279e6..665e767786b 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -642,11 +642,6 @@ QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t, : mask.convertToFormat(QImage::Format_RGB32); } -const char *QWindowsFontEngineDirectWrite::name() const -{ - return 0; -} - QFontEngine::Type QWindowsFontEngineDirectWrite::type() const { return QFontEngine::DirectWrite; diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index 070adfcbdec..c61f1a06353 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -90,8 +90,6 @@ public: QFixed xHeight() const; qreal maxCharWidth() const; - const char *name() const; - bool supportsSubPixelPositions() const; QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition); From 9f1089531d75b0a831e03c3a31ef8b4e5c0b54f4 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 5 Mar 2014 09:00:31 +0200 Subject: [PATCH 063/172] Make QFontEngine::type() non-virtual Change-Id: I24ece90d6d8f96dad0c41a474a491b4ea96d97c3 Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 29 ++++++++----------- src/gui/text/qfontengine_ft.cpp | 1 + src/gui/text/qfontengine_ft_p.h | 3 -- src/gui/text/qfontengine_p.h | 21 ++++++++------ src/gui/text/qfontengine_qpa.cpp | 8 ++--- src/gui/text/qfontengine_qpa_p.h | 2 -- .../fontdatabases/mac/qfontengine_coretext.mm | 2 ++ .../mac/qfontengine_coretext_p.h | 2 -- .../platforms/windows/qwindowsfontengine.cpp | 8 ++--- .../platforms/windows/qwindowsfontengine.h | 2 -- .../windows/qwindowsfontenginedirectwrite.cpp | 9 ++---- .../windows/qwindowsfontenginedirectwrite.h | 2 -- 12 files changed, 33 insertions(+), 56 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 75e55a5d23b..c6674a1b125 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -220,8 +220,8 @@ Q_AUTOTEST_EXPORT QList QFontEngine_stopCollectingEngines() // QFontEngine -QFontEngine::QFontEngine() - : ref(0), +QFontEngine::QFontEngine(Type type) + : m_type(type), ref(0), font_(0), font_destroy_func(0), face_(0), face_destroy_func(0) { @@ -1369,7 +1369,15 @@ QFontEngine::GlyphCacheEntry &QFontEngine::GlyphCacheEntry::operator=(const Glyp // ------------------------------------------------------------------ QFontEngineBox::QFontEngineBox(int size) - : _size(size) + : QFontEngine(Box), + _size(size) +{ + cache_cost = sizeof(QFontEngineBox); +} + +QFontEngineBox::QFontEngineBox(Type type, int size) + : QFontEngine(type), + _size(size) { cache_cost = sizeof(QFontEngineBox); } @@ -1502,11 +1510,6 @@ bool QFontEngineBox::canRender(const QChar *, int) const return true; } -QFontEngine::Type QFontEngineBox::type() const -{ - return Box; -} - QImage QFontEngineBox::alphaMapForGlyph(glyph_t) { QImage image(_size, _size, QImage::Format_Indexed8); @@ -1538,6 +1541,7 @@ static inline glyph_t stripped(glyph_t glyph) { return glyph & 0x00ffffff; } QFontEngineMulti::QFontEngineMulti(int engineCount) + : QFontEngine(Multi) { engines.fill(0, engineCount); cache_cost = 0; @@ -1968,13 +1972,4 @@ QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosit return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, t); } -QTestFontEngine::QTestFontEngine(int size) - : QFontEngineBox(size) -{} - -QFontEngine::Type QTestFontEngine::type() const -{ - return TestFontEngine; -} - QT_END_NAMESPACE diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 892fc225869..f8b7fc3d5c7 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -635,6 +635,7 @@ static void convoluteBitmap(const uchar *src, uchar *dst, int width, int height, } QFontEngineFT::QFontEngineFT(const QFontDef &fd) + : QFontEngine(Freetype) { fontDef = fd; matrix.xx = 0x10000; diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index a322ab7ea49..8bdf991174a 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -228,9 +228,6 @@ private: virtual glyph_t glyphIndex(uint ucs4) const; void doKerning(QGlyphLayout *, ShaperFlags) const; - inline virtual Type type() const - { return QFontEngine::Freetype; } - virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics); virtual bool supportsTransformation(const QTransform &transform) const; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index f5a894506f8..5e40abbda6d 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -125,9 +125,10 @@ public: }; Q_DECLARE_FLAGS(ShaperFlags, ShaperFlag) - QFontEngine(); virtual ~QFontEngine(); + inline Type type() const { return m_type; } + // all of these are in unscaled metrics if the engine supports uncsaled metrics, // otherwise in design metrics struct Properties { @@ -230,8 +231,6 @@ public: virtual bool supportsTransformation(const QTransform &transform) const; - virtual Type type() const = 0; - virtual int glyphCount() const; virtual int glyphMargin(GlyphFormat format) { return format == Format_A32 ? 2 : 0; } @@ -260,6 +259,10 @@ public: }; virtual void setDefaultHintStyle(HintStyle) { } +private: + const Type m_type; + +public: QAtomicInt ref; QFontDef fontDef; @@ -294,6 +297,8 @@ public: inline QVariant userData() const { return m_userData; } protected: + explicit QFontEngine(Type type); + QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false); inline void setUserData(const QVariant &userData) { m_userData = userData; } @@ -361,9 +366,11 @@ public: virtual bool canRender(const QChar *string, int len) const; - virtual Type type() const; inline int size() const { return _size; } +protected: + explicit QFontEngineBox(Type type, int size); + private: friend class QFontPrivate; int _size; @@ -403,9 +410,6 @@ public: virtual qreal minLeftBearing() const; virtual qreal minRightBearing() const; - virtual inline Type type() const - { return QFontEngine::Multi; } - virtual bool canRender(const QChar *string, int len) const; QFontEngine *engine(int at) const @@ -430,8 +434,7 @@ protected: class QTestFontEngine : public QFontEngineBox { public: - QTestFontEngine(int size); - virtual Type type() const; + inline QTestFontEngine(int size) : QFontEngineBox(TestFontEngine, size) {} }; QT_END_NAMESPACE diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index b0bfd024480..e9252b328e0 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -237,7 +237,8 @@ static inline unsigned int getChar(const QChar *str, int &i, const int len) } QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data) - : fontData(reinterpret_cast(data.constData())), dataSize(data.size()) + : QFontEngine(QPF2), + fontData(reinterpret_cast(data.constData())), dataSize(data.size()) { fontDef = def; cache_cost = 100; @@ -510,11 +511,6 @@ QFixed QFontEngineQPA::lineThickness() const return QFixed::fromReal(extractHeaderField(fontData, Tag_LineThickness).value()); } -QFontEngine::Type QFontEngineQPA::type() const -{ - return QFontEngine::QPF2; -} - bool QFontEngineQPA::isValid() const { return fontData && dataSize && (cmapOffset || externalCMap) diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h index 326c905caa4..35bf9ad74cd 100644 --- a/src/gui/text/qfontengine_qpa_p.h +++ b/src/gui/text/qfontengine_qpa_p.h @@ -182,8 +182,6 @@ public: QFixed underlinePosition() const; QFixed lineThickness() const; - Type type() const; - virtual int glyphCount() const { return glyphMapEntries; } bool isValid() const; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 53c4c01a73e..3c30df6efbf 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -85,6 +85,7 @@ CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef) } QCoreTextFontEngine::QCoreTextFontEngine(CTFontRef font, const QFontDef &def) + : QFontEngine(Mac) { fontDef = def; transform = qt_transform_from_fontdef(fontDef); @@ -95,6 +96,7 @@ QCoreTextFontEngine::QCoreTextFontEngine(CTFontRef font, const QFontDef &def) } QCoreTextFontEngine::QCoreTextFontEngine(CGFontRef font, const QFontDef &def) + : QFontEngine(Mac) { fontDef = def; transform = qt_transform_from_fontdef(fontDef); diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index f6247ca5e63..b9593b983eb 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -84,8 +84,6 @@ public: virtual int synthesized() const { return synthesisFlags; } virtual bool supportsSubPixelPositions() const { return true; } - virtual Type type() const { return QFontEngine::Mac; } - void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight); virtual FaceId faceId() const; diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index cc2f152bf9a..e8e2978ee32 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -272,7 +272,8 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa QWindowsFontEngine::QWindowsFontEngine(const QString &name, HFONT _hfont, bool stockFontIn, LOGFONT lf, - const QSharedPointer &fontEngineData) : + const QSharedPointer &fontEngineData) + : QFontEngine(Win), m_fontEngineData(fontEngineData), _name(name), hfont(_hfont), @@ -771,11 +772,6 @@ qreal QWindowsFontEngine::minRightBearing() const #endif // Q_OS_WINCE } -QFontEngine::Type QWindowsFontEngine::type() const -{ - return QFontEngine::Win; -} - static inline double qt_fixed_to_double(const FIXED &p) { return ((p.value << 16) + p.fract) / 65536.0; } diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index b5347989581..0a40082ad26 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -110,8 +110,6 @@ public: virtual qreal minLeftBearing() const; virtual qreal minRightBearing() const; - Type type() const; - virtual QImage alphaMapForGlyph(glyph_t t) { return alphaMapForGlyph(t, QTransform()); } virtual QImage alphaMapForGlyph(glyph_t, const QTransform &xform); virtual QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform); diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 665e767786b..b6b554d4b0e 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -201,8 +201,8 @@ namespace { QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace, qreal pixelSize, const QSharedPointer &d) - - : m_fontEngineData(d) + : QFontEngine(DirectWrite) + , m_fontEngineData(d) , m_directWriteFontFace(directWriteFontFace) , m_directWriteBitmapRenderTarget(0) , m_lineThickness(-1) @@ -642,11 +642,6 @@ QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t, : mask.convertToFormat(QImage::Format_RGB32); } -QFontEngine::Type QWindowsFontEngineDirectWrite::type() const -{ - return QFontEngine::DirectWrite; -} - QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const { QFontEngine *fontEngine = new QWindowsFontEngineDirectWrite(m_directWriteFontFace, diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index c61f1a06353..2da014ddc35 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -97,8 +97,6 @@ public: QFontEngine *cloneWithSize(qreal pixelSize) const; - Type type() const; - const QSharedPointer &fontEngineData() const { return m_fontEngineData; } static QString fontNameSubstitute(const QString &familyName); From 3fec94fd07f23dabfa23524d55028dc09cd1ddbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 4 Mar 2014 16:27:38 +0100 Subject: [PATCH 064/172] Prevent repeated and unnecessary font population QCoreTextFontDatabase The platform font database is populated from QFontDatabase, through the static initializeDb() function, whenever the font database determines that the platform database has not been initialized (by checking if the font database is empty). There are other clients of QPlatformFontDatabase though, such as QFont, which uses the platform font database to check for the default family. The CoreText implementation of determining the default family relies on data that is computed during font population, and hence does an internal (self-triggered) populate. To prevent repeated populates as a result of calling QFont::defaultFamily() we guard the populate by a similar isEmpty() check as QFontDatabase does, but to ensure that this check works in the case of an invalidated font database, we need to propagate the font database invalidation down to the platform font database. Change-Id: I8d06c6f6fc5da6353c087335859eaca008c2f6a6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qfontdatabase.cpp | 1 + src/gui/text/qplatformfontdatabase.cpp | 10 +++++ src/gui/text/qplatformfontdatabase.h | 2 + .../mac/qcoretextfontdatabase.mm | 45 +++++++++++-------- .../mac/qcoretextfontdatabase_p.h | 2 + 5 files changed, 42 insertions(+), 18 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index b8ac7efb6c9..fbb7fe02d6c 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -420,6 +420,7 @@ void QFontDatabasePrivate::invalidate() { QFontCache::instance()->clear(); free(); + QGuiApplicationPrivate::platformIntegration()->fontDatabase()->invalidate(); emit static_cast(QCoreApplication::instance())->fontDatabaseChanged(); } diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 3049e0ab5ee..5f277c878a1 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -275,6 +275,16 @@ void QPlatformFontDatabase::populateFontDatabase() } } +/*! + This function is called whenever the font database is invalidated. + + Reimplement this function to clear any internal data structures that + will need to be rebuilt at the next call to populateFontDatabase(). +*/ +void QPlatformFontDatabase::invalidate() +{ +} + /*! Returns a multi font engine in the specified \a script to encapsulate \a fontEngine with the option to fall back to the fonts given by \a fallbacks if \a fontEngine does not support diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h index 5f2c9a74bac..870480809ba 100644 --- a/src/gui/text/qplatformfontdatabase.h +++ b/src/gui/text/qplatformfontdatabase.h @@ -96,6 +96,8 @@ class Q_GUI_EXPORT QPlatformFontDatabase public: virtual ~QPlatformFontDatabase(); virtual void populateFontDatabase(); + virtual void invalidate(); + virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script); virtual QFontEngine *fontEngine(const QFontDef &fontDef, void *handle); virtual QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 76506d12e91..f37e7a1db2b 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -199,6 +199,12 @@ void QCoreTextFontDatabase::populateFontDatabase() [pool release]; } +void QCoreTextFontDatabase::invalidate() +{ + psNameToFamily.clear(); + familyNameToPsName.clear(); +} + void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) { QString foundryName = QStringLiteral("CoreText"); @@ -389,29 +395,31 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo if (fallbackLists.contains(family)) return fallbackLists.value(family); - if (!familyNameToPsName.contains(family)) + if (familyNameToPsName.isEmpty()) const_cast(this)->populateFontDatabase(); - QCFType font = CTFontCreateWithName(QCFString(familyNameToPsName[family]), 12.0, NULL); - if (font) { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"]; + if (familyNameToPsName.contains(family)) { + QCFType font = CTFontCreateWithName(QCFString(familyNameToPsName[family]), 12.0, NULL); + if (font) { + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"]; - QCFType cascadeList = (CFArrayRef) CTFontCopyDefaultCascadeListForLanguages(font, (CFArrayRef) languages); - if (cascadeList) { - QStringList fallbackList; - const int numCascades = CFArrayGetCount(cascadeList); - for (int i = 0; i < numCascades; ++i) { - CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i); - QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyLocalizedAttribute(fontFallback, kCTFontFamilyNameAttribute, NULL); - fallbackList.append(QCFString::toQString(fallbackFamilyName)); + QCFType cascadeList = (CFArrayRef) CTFontCopyDefaultCascadeListForLanguages(font, (CFArrayRef) languages); + if (cascadeList) { + QStringList fallbackList; + const int numCascades = CFArrayGetCount(cascadeList); + for (int i = 0; i < numCascades; ++i) { + CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i); + QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyLocalizedAttribute(fontFallback, kCTFontFamilyNameAttribute, NULL); + fallbackList.append(QCFString::toQString(fallbackFamilyName)); + } + fallbackLists[family] = fallbackList; } - fallbackLists[family] = fallbackList; } - } - if (fallbackLists.contains(family)) - return fallbackLists.value(family); + if (fallbackLists.contains(family)) + return fallbackLists.value(family); + } } #endif } @@ -425,7 +433,8 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo if (!didPopulateStyleFallbacks) { #if defined(Q_OS_MACX) // Ensure we have the psNameToFamily mapping set up - const_cast(this)->populateFontDatabase(); + if (psNameToFamily.isEmpty()) + const_cast(this)->populateFontDatabase(); NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"]; diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 1560d366440..5b2fc2ed7ed 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -72,6 +72,8 @@ public: QCoreTextFontDatabase(); ~QCoreTextFontDatabase(); void populateFontDatabase(); + void invalidate() Q_DECL_OVERRIDE; + QFontEngine *fontEngine(const QFontDef &fontDef, void *handle); QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; From 134527162ac6d36023fb9cd4265c2b98bf321805 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 4 Mar 2014 16:25:07 +0100 Subject: [PATCH 065/172] Update QStyle::sizeFromContents() docs Task-number: QTBUG-37125 Change-Id: Id220312dab6b7e3e7de4932fd377f8850fe86e84 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qstyle.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index da9b5da2a59..7568ba4e6e7 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1585,14 +1585,28 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \table \header \li Contents Type \li QStyleOption Subclass - \row \li \l CT_PushButton \li \l QStyleOptionButton - \row \li \l CT_CheckBox \li \l QStyleOptionButton - \row \li \l CT_RadioButton \li \l QStyleOptionButton - \row \li \l CT_ToolButton \li \l QStyleOptionToolButton - \row \li \l CT_ComboBox \li \l QStyleOptionComboBox - \row \li \l CT_Splitter \li \l QStyleOption - \row \li \l CT_ProgressBar \li \l QStyleOptionProgressBar - \row \li \l CT_MenuItem \li \l QStyleOptionMenuItem + \row \li \l CT_CheckBox \li \l QStyleOptionButton + \row \li \l CT_ComboBox \li \l QStyleOptionComboBox + \row \li \l CT_GroupBox \li \l QStyleOptionGroupBox + \row \li \l CT_HeaderSection \li \l QStyleOptionHeader + \row \li \l CT_ItemViewItem \li \l QStyleOptionViewItem + \row \li \l CT_LineEdit \li \l QStyleOptionFrame + \row \li \l CT_MdiControls \li \l QStyleOptionComplex + \row \li \l CT_Menu \li \l QStyleOption + \row \li \l CT_MenuItem \li \l QStyleOptionMenuItem + \row \li \l CT_MenuBar \li \l QStyleOptionMenuItem + \row \li \l CT_MenuBarItem \li \l QStyleOptionMenuItem + \row \li \l CT_ProgressBar \li \l QStyleOptionProgressBar + \row \li \l CT_PushButton \li \l QStyleOptionButton + \row \li \l CT_RadioButton \li \l QStyleOptionButton + \row \li \l CT_ScrollBar \li \l QStyleOptionSlider + \row \li \l CT_SizeGrip \li \l QStyleOption + \row \li \l CT_Slider \li \l QStyleOptionSlider + \row \li \l CT_SpinBox \li \l QStyleOptionSpinBox + \row \li \l CT_Splitter \li \l QStyleOption + \row \li \l CT_TabBarTab \li \l QStyleOptionTab + \row \li \l CT_TabWidget \li \l QStyleOptionTabWidgetFrame + \row \li \l CT_ToolButton \li \l QStyleOptionToolButton \endtable \sa ContentsType, QStyleOption From 5ab630f8be137157c5f0809d8325f9b163036b01 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 4 Mar 2014 11:03:26 +0200 Subject: [PATCH 066/172] Android: Display HTML text correctly on Android native dialog. Task-number: QTBUG-35687 Change-Id: I3a298b7f4c5f9608537b1afdb994d76ef3abb706 Reviewed-by: Shawn Rutledge --- .../qt5/android/QtMessageDialogHelper.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java index 6ee1304c120..b8dbaa48297 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java @@ -51,6 +51,8 @@ import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Build; import android.text.ClipboardManager; +import android.text.Html; +import android.text.Spanned; import android.util.TypedValue; import android.view.View; import android.widget.Button; @@ -74,11 +76,11 @@ class ButtonStruct implements View.OnClickListener { m_dialog = dialog; m_id = id; - m_text = text; + m_text = Html.fromHtml(text); } QtMessageDialogHelper m_dialog; private int m_id; - String m_text; + Spanned m_text; @Override public void onClick(View view) { @@ -153,22 +155,22 @@ public class QtMessageDialogHelper public void setTile(String title) { - m_title = title; + m_title = Html.fromHtml(title); } public void setText(String text) { - m_text = text; + m_text = Html.fromHtml(text); } public void setInformativeText(String informativeText) { - m_informativeText = informativeText; + m_informativeText = Html.fromHtml(informativeText); } public void setDetailedText(String text) { - m_detailedText = text; + m_detailedText = Html.fromHtml(text); } public void addButton(int id, String text) @@ -417,7 +419,7 @@ public class QtMessageDialogHelper private Activity m_activity; private int m_icon = 0; - private String m_title, m_text, m_informativeText, m_detailedText; + private Spanned m_title, m_text, m_informativeText, m_detailedText; private ArrayList m_buttonsList; private AlertDialog m_dialog; private long m_handler = 0; From 1f695a31e2e3df1782e2ee5565ff9e7bfd8dd9ae Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 4 Mar 2014 12:19:17 +0200 Subject: [PATCH 067/172] Pass the APPLICATION_PARAMETERS variable if defined. Change-Id: I2a3c049db43bbd0a2c373dae9e9ac1395c099b74 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../qtproject/qt5/android/bindings/QtActivity.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index edfd2d606d9..f99bb840774 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -634,11 +634,15 @@ public class QtActivity extends Activity + "\tQML_IMPORT_PATH=" + pluginsPrefix + "/imports" + "\tQT_PLUGIN_PATH=" + pluginsPrefix + "/plugins"); - Intent intent = getIntent(); - if (intent != null) { - String parameters = intent.getStringExtra("applicationArguments"); - if (parameters != null) - loaderParams.putString(APPLICATION_PARAMETERS_KEY, parameters.replace(' ', '\t')); + if (APPLICATION_PARAMETERS != null) { + loaderParams.putString(APPLICATION_PARAMETERS_KEY, APPLICATION_PARAMETERS); + } else { + Intent intent = getIntent(); + if (intent != null) { + String parameters = intent.getStringExtra("applicationArguments"); + if (parameters != null) + loaderParams.putString(APPLICATION_PARAMETERS_KEY, parameters.replace(' ', '\t')); + } } loadApplication(loaderParams); From c5b2425e8ea1aa25d7ce4253f0205c989bf7a345 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 5 Mar 2014 10:12:39 +0200 Subject: [PATCH 068/172] Fix compile Move Q_Q(QGLContext); inside #ifndef block, otherwise q varialble remains unused and it breaks the compilation. Change-Id: Iebef9a45930fd4f7783eb983b55bf6b5e0b94cf4 Reviewed-by: Laszlo Agocs --- src/opengl/qgl.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 1bdc9b84e0b..1fbff0f0fe3 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2517,14 +2517,13 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, /*! \internal */ int QGLContextPrivate::maxTextureSize() { - Q_Q(QGLContext); - if (max_texture_size != -1) return max_texture_size; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); #ifndef QT_OPENGL_ES + Q_Q(QGLContext); if (!q->contextHandle()->isES()) { GLenum proxy = GL_PROXY_TEXTURE_2D; From 736d7a26cd511ccff010c3ec1b582cd8a027d616 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Thu, 20 Feb 2014 23:26:59 +0100 Subject: [PATCH 069/172] Avoid creating a new QMimeData each time the Android clipboard is used This patch aims to fix a memory leak that occurs when the platform clipboard is used on Android. The QMimeData from the clipboard is recreated each time mimeData is called [ChangeLog][QtCore][QPA/Android] Fixed a memory leak in the clipboard Task-number: QTBUG-36025 Change-Id: I241f586589ff256885caee5e5f737313d24d942d Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/qandroidplatformclipboard.cpp | 6 ++---- src/plugins/platforms/android/qandroidplatformclipboard.h | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/android/qandroidplatformclipboard.cpp b/src/plugins/platforms/android/qandroidplatformclipboard.cpp index bc48b4935b3..0b5e96fa360 100644 --- a/src/plugins/platforms/android/qandroidplatformclipboard.cpp +++ b/src/plugins/platforms/android/qandroidplatformclipboard.cpp @@ -42,7 +42,6 @@ #include "qandroidplatformclipboard.h" #include "androidjniclipboard.h" #ifndef QT_NO_CLIPBOARD -#include QT_BEGIN_NAMESPACE @@ -56,9 +55,8 @@ QMimeData *QAndroidPlatformClipboard::mimeData(QClipboard::Mode mode) if (QClipboard::Clipboard != mode || !QtAndroidClipboard::hasClipboardText()) return 0; - QMimeData *mimeData = new QMimeData(); - mimeData->setText(QtAndroidClipboard::clipboardText()); - return mimeData; + m_mimeData.setText(QtAndroidClipboard::clipboardText()); + return &m_mimeData; } void QAndroidPlatformClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) diff --git a/src/plugins/platforms/android/qandroidplatformclipboard.h b/src/plugins/platforms/android/qandroidplatformclipboard.h index 644f3269349..f67355c3582 100644 --- a/src/plugins/platforms/android/qandroidplatformclipboard.h +++ b/src/plugins/platforms/android/qandroidplatformclipboard.h @@ -43,6 +43,7 @@ #define QANDROIDPLATFORMCLIPBOARD_H #include +#include #ifndef QT_NO_CLIPBOARD QT_BEGIN_NAMESPACE @@ -55,6 +56,9 @@ public: virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); virtual bool supportsMode(QClipboard::Mode mode) const; + +private: + QMimeData m_mimeData; }; QT_END_NAMESPACE From 02c8306da6c9c738c8191b23e216602a741d73e4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 4 Mar 2014 08:44:51 -0800 Subject: [PATCH 070/172] Fix the name of the GPLv3 license file Qt 4 used to have it called LICENSE.GPL3 since we used to have GPLv2 as an option before Qt 4.5 (which is when we added the LGPL v2.1). Looks like no one realized that the configure script looks for that file when LICENSE.GPL was added to the modularized repositories... Task-number: QTBUG-37175 Change-Id: Iffb35adf128c3e49a7a0c12dbccd5ebe9bccf3f2 Reviewed-by: Oswald Buddenhagen --- configure | 8 ++++---- tools/configure/configureapp.cpp | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 5b57f8fa55f..383918df8a6 100755 --- a/configure +++ b/configure @@ -2962,7 +2962,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then ;; esac if [ '!' -f "$outpath/LICENSE" ]; then - echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with" + echo "The LICENSE, LICENSE.GPL LICENSE.LGPL file shipped with" echo "this software has disappeared." echo echo "Sorry, you are not licensed to use this software." @@ -2999,7 +2999,7 @@ if [ "$Edition" = "OpenSource" ]; then while true; do echo "You are licensed to use this software under the terms of" echo "the Lesser GNU General Public License (LGPL) versions 2.1." - if [ -f "$relpath/LICENSE.GPL3" ]; then + if [ -f "$relpath/LICENSE.GPL" ]; then echo "You are also licensed to use this software under the terms of" echo "the GNU General Public License (GPL) versions 3." affix="either" @@ -3011,7 +3011,7 @@ if [ "$Edition" = "OpenSource" ]; then echo "You have already accepted the terms of the $LicenseType license." acceptance=yes else - if [ -f "$relpath/LICENSE.GPL3" ]; then + if [ -f "$relpath/LICENSE.GPL" ]; then echo "Type '3' to view the GNU General Public License version 3." fi echo "Type 'L' to view the Lesser GNU General Public License version 2.1." @@ -3029,7 +3029,7 @@ if [ "$Edition" = "OpenSource" ]; then echo exit 1 elif [ "$acceptance" = "3" ]; then - more "$relpath/LICENSE.GPL3" + more "$relpath/LICENSE.GPL" elif [ "$acceptance" = "L" ]; then more "$relpath/LICENSE.LGPL" fi diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 9995fb179e0..f71d0cf9a89 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -4215,7 +4215,7 @@ bool Configure::showLicense(QString orgLicenseFile) QString licenseFile = orgLicenseFile; QString theLicense; if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") { - haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL3"); + haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL"); theLicense = "GNU Lesser General Public License (LGPL) version 2.1"; if (haveGpl3) theLicense += "\nor the GNU General Public License (GPL) version 3"; @@ -4255,7 +4255,7 @@ bool Configure::showLicense(QString orgLicenseFile) } else { if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") { if (accept == '3') - licenseFile = orgLicenseFile + "/LICENSE.GPL3"; + licenseFile = orgLicenseFile + "/LICENSE.GPL"; else licenseFile = orgLicenseFile + "/LICENSE.LGPL"; } @@ -4292,7 +4292,7 @@ void Configure::readLicense() dictionary["LICENSE FILE"] = sourcePath; bool openSource = false; - bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL"); + bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL"); if (dictionary["BUILDTYPE"] == "commercial") { openSource = false; } else if (dictionary["BUILDTYPE"] == "opensource") { From 0aba7fbb5837c81351e7e4ba43044a8dbb37098c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 1 Mar 2014 10:39:30 -0800 Subject: [PATCH 071/172] Always initialize integer types in D-Bus demarshalling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If you tried to demarshall in a write-only QDBusArgument, the class would print a warning, but will continue running nonetheless. So instead just initialize everything, despite the warning. qdbusargument.cpp:1138:30: error: ‘d’ may be used uninitialized in this function [-Werror=maybe-uninitialized] qdbusargument.cpp:1165:33: error: ‘s’ may be used uninitialized in this function [-Werror=maybe-uninitialized] qdbusargument.cpp:1301:15: error: ‘y’ may be used uninitialized in this function [-Werror=maybe-uninitialized] etc. Change-Id: I6d713b4a7b7639e31f3b39bb488ad3ed3ab3fa4a Reviewed-by: Frederik Gladhorn Reviewed-by: Jędrzej Nowacki --- src/dbus/qdbusargument.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp index 83a544c4e36..6157694d12e 100644 --- a/src/dbus/qdbusargument.cpp +++ b/src/dbus/qdbusargument.cpp @@ -605,6 +605,8 @@ const QDBusArgument &QDBusArgument::operator>>(uchar &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toByte(); + else + arg = 0; return *this; } @@ -617,6 +619,8 @@ const QDBusArgument &QDBusArgument::operator>>(bool &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toBool(); + else + arg = false; return *this; } @@ -629,6 +633,8 @@ const QDBusArgument &QDBusArgument::operator>>(ushort &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toUShort(); + else + arg = 0; return *this; } @@ -641,6 +647,8 @@ const QDBusArgument &QDBusArgument::operator>>(short &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toShort(); + else + arg = 0; return *this; } @@ -653,6 +661,8 @@ const QDBusArgument &QDBusArgument::operator>>(int &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toInt(); + else + arg = 0; return *this; } @@ -665,6 +675,8 @@ const QDBusArgument &QDBusArgument::operator>>(uint &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toUInt(); + else + arg = 0; return *this; } @@ -677,6 +689,8 @@ const QDBusArgument &QDBusArgument::operator>>(qlonglong &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toLongLong(); + else + arg = 0; return *this; } @@ -689,6 +703,8 @@ const QDBusArgument &QDBusArgument::operator>>(qulonglong &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toULongLong(); + else + arg = 0; return *this; } @@ -701,6 +717,8 @@ const QDBusArgument &QDBusArgument::operator>>(double &arg) const { if (QDBusArgumentPrivate::checkReadAndDetach(d)) arg = d->demarshaller()->toDouble(); + else + arg = 0; return *this; } From b83dc929ec851b81c1236ea4fbeb7f9ad6239565 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Tue, 4 Mar 2014 20:48:31 +0800 Subject: [PATCH 072/172] Complete QJsonValue::fromVariant() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - QVariant can store (U)Int, (U)LongLong, Float and Double numbers. Previously, QJsonValue::fromVariant() converted Floats into Strings while converting the others to Doubles. - Add unit tests for QJsonValue::fromVariant() [ChangeLog][QtCore][JSON] QJsonValue::fromVariant() will now convert single-precision Floats into Doubles instead of Strings Change-Id: I457adbe29c37ada611d1c6d711c42866d63d4024 Reviewed-by: Lars Knoll Reviewed-by: Jędrzej Nowacki --- src/corelib/json/qjsonvalue.cpp | 4 +- tests/auto/corelib/json/tst_qtjson.cpp | 57 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp index e5194f73367..4c4838d314c 100644 --- a/src/corelib/json/qjsonvalue.cpp +++ b/src/corelib/json/qjsonvalue.cpp @@ -360,6 +360,7 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other) \li QMetaType::UInt \li QMetaType::LongLong \li QMetaType::ULongLong + \li QMetaType::Float \li QMetaType::Double \endlist \li QJsonValue::Double @@ -391,10 +392,11 @@ QJsonValue &QJsonValue::operator =(const QJsonValue &other) */ QJsonValue QJsonValue::fromVariant(const QVariant &variant) { - switch (variant.type()) { + switch (variant.userType()) { case QVariant::Bool: return QJsonValue(variant.toBool()); case QVariant::Int: + case QMetaType::Float: case QVariant::Double: case QVariant::LongLong: case QVariant::ULongLong: diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 589978e1a4a..2f75ad631f4 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -95,6 +95,7 @@ private Q_SLOTS: void undefinedValues(); + void fromVariant(); void fromVariantMap(); void toVariantMap(); void toVariantList(); @@ -1040,6 +1041,62 @@ void tst_QtJson::undefinedValues() QCOMPARE(array.at(-1).type(), QJsonValue::Undefined); } +void tst_QtJson::fromVariant() +{ + bool boolValue = true; + int intValue = -1; + uint uintValue = 1; + long long longlongValue = -2; + unsigned long long ulonglongValue = 2; + float floatValue = 3.3f; + double doubleValue = 4.4; + QString stringValue("str"); + + QStringList stringList; + stringList.append(stringValue); + stringList.append("str2"); + QJsonArray jsonArray_string; + jsonArray_string.append(stringValue); + jsonArray_string.append("str2"); + + QVariantList variantList; + variantList.append(boolValue); + variantList.append(floatValue); + variantList.append(doubleValue); + variantList.append(stringValue); + variantList.append(stringList); + variantList.append(QVariant()); + QJsonArray jsonArray_variant; + jsonArray_variant.append(boolValue); + jsonArray_variant.append(floatValue); + jsonArray_variant.append(doubleValue); + jsonArray_variant.append(stringValue); + jsonArray_variant.append(jsonArray_string); + jsonArray_variant.append(QJsonValue()); + + QVariantMap variantMap; + variantMap["bool"] = boolValue; + variantMap["float"] = floatValue; + variantMap["string"] = stringValue; + variantMap["array"] = variantList; + QJsonObject jsonObject; + jsonObject["bool"] = boolValue; + jsonObject["float"] = floatValue; + jsonObject["string"] = stringValue; + jsonObject["array"] = jsonArray_variant; + + QCOMPARE(QJsonValue::fromVariant(QVariant(boolValue)), QJsonValue(boolValue)); + QCOMPARE(QJsonValue::fromVariant(QVariant(intValue)), QJsonValue(intValue)); + QCOMPARE(QJsonValue::fromVariant(QVariant(uintValue)), QJsonValue(static_cast(uintValue))); + QCOMPARE(QJsonValue::fromVariant(QVariant(longlongValue)), QJsonValue(longlongValue)); + QCOMPARE(QJsonValue::fromVariant(QVariant(ulonglongValue)), QJsonValue(static_cast(ulonglongValue))); + QCOMPARE(QJsonValue::fromVariant(QVariant(floatValue)), QJsonValue(static_cast(floatValue))); + QCOMPARE(QJsonValue::fromVariant(QVariant(doubleValue)), QJsonValue(doubleValue)); + QCOMPARE(QJsonValue::fromVariant(QVariant(stringValue)), QJsonValue(stringValue)); + QCOMPARE(QJsonValue::fromVariant(QVariant(stringList)), QJsonValue(jsonArray_string)); + QCOMPARE(QJsonValue::fromVariant(QVariant(variantList)), QJsonValue(jsonArray_variant)); + QCOMPARE(QJsonValue::fromVariant(QVariant(variantMap)), QJsonValue(jsonObject)); +} void tst_QtJson::fromVariantMap() { From 04ef22b9ee71c42d8ff67d23ebeab704c38bec1e Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Fri, 28 Feb 2014 23:45:46 +0200 Subject: [PATCH 073/172] CustomSortFilterModel example: fix build with QT_NO_CURSOR Change-Id: Icb40e49365114fedd5f1ef118dbd61ff2c413863 Reviewed-by: Friedemann Kleint --- .../widgets/itemviews/customsortfiltermodel/filterwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/widgets/itemviews/customsortfiltermodel/filterwidget.cpp b/examples/widgets/itemviews/customsortfiltermodel/filterwidget.cpp index 053c56d4c4b..571052e506f 100644 --- a/examples/widgets/itemviews/customsortfiltermodel/filterwidget.cpp +++ b/examples/widgets/itemviews/customsortfiltermodel/filterwidget.cpp @@ -81,7 +81,9 @@ FilterWidget::FilterWidget(QWidget *parent) const QIcon icon = QIcon(QPixmap(":/images/find.png")); QToolButton *optionsButton = new QToolButton; +#ifndef QT_NO_CURSOR optionsButton->setCursor(Qt::ArrowCursor); +#endif optionsButton->setFocusPolicy(Qt::NoFocus); optionsButton->setStyleSheet("* { border: none; }"); optionsButton->setIcon(icon); From 2bac49265efcf8faabc3756d1a3e405a3d336f68 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 5 Mar 2014 10:32:59 +0100 Subject: [PATCH 074/172] Tablet target widget isn't always the same as its widget window In this scenario there is a widget with a QPushButton inside, and you click the pushbutton with the tablet. The target of the event is the pushbutton, but when you click it, the window is destroyed. The widgetwindow destructor cannot check the pushbutton's window() because it has already been destroyed. So it seems we have to store both widgets: the actual target and the parent widget which has the window. Task-number: QTBUG-36848 Change-Id: I37d8fb03743f3e501d695342edc42de104777b18 Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidgetwindow.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 3cc48b442d4..e50736d6b88 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -59,6 +59,7 @@ Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets(); QWidget *qt_button_down = 0; // widget got last button-down static QWidget *qt_tablet_target = 0; +static QWidget *qt_tablet_target_window = 0; // popup control QWidget *qt_popup_down = 0; // popup that contains the pressed widget @@ -103,8 +104,10 @@ QWidgetWindow::QWidgetWindow(QWidget *widget) QWidgetWindow::~QWidgetWindow() { - if (m_widget == qt_tablet_target) + if (m_widget == qt_tablet_target_window) { qt_tablet_target = 0; + qt_tablet_target_window = 0; + } } #ifndef QT_NO_ACCESSIBILITY @@ -774,6 +777,7 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) widget = m_widget; qt_tablet_target = widget; + qt_tablet_target_window = m_widget; } if (qt_tablet_target) { @@ -786,8 +790,10 @@ void QWidgetWindow::handleTabletEvent(QTabletEvent *event) QGuiApplication::sendSpontaneousEvent(qt_tablet_target, &ev); } - if (event->type() == QEvent::TabletRelease) + if (event->type() == QEvent::TabletRelease) { qt_tablet_target = 0; + qt_tablet_target_window = 0; + } } #endif // QT_NO_TABLETEVENT From e9ebb4341944390d375b9516eed51a12a95f7952 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 3 Mar 2014 18:20:51 +0100 Subject: [PATCH 075/172] Dynamic GL: Query gl handle and type via the native interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7ca5beaeb57ee2e4e9c175f53ac32371d1f6b5ed Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- src/gui/kernel/qopenglcontext.cpp | 16 ++++++++++++++- src/gui/kernel/qplatformintegration.cpp | 26 ++++++++++++++++++++++++- src/gui/kernel/qplatformintegration.h | 6 ++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 357beb4e245..005f716788f 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -969,13 +970,21 @@ void QOpenGLContext::deleteQGLContext() The library might be GL-only, meaning that windowing system interface functions (for example EGL) may live in another, separate library. + \note This function requires that the QGuiApplication instance is already created. + \sa openGLModuleType() \since 5.3 */ void *QOpenGLContext::openGLModuleHandle() { +#ifdef QT_OPENGL_DYNAMIC + QGuiApplication *app = qGuiApp; + Q_ASSERT(app); + return app->platformNativeInterface()->nativeResourceForIntegration(QByteArrayLiteral("glhandle")); +#else return 0; +#endif } /*! @@ -1001,11 +1010,16 @@ void *QOpenGLContext::openGLModuleHandle() appropriate to check QSurfaceFormat::renderableType() or using the the convenience function isES(). + \note This function requires that the QGuiApplication instance is already created. + \since 5.3 */ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType() { -#if defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_DYNAMIC) + Q_ASSERT(qGuiApp); + return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType(); +#elif defined(QT_OPENGL_ES_2) return GLES2; #elif defined(QT_OPENGL_ES) return GLES1; diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index bec201f3f70..6c0130f4e4e 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -465,7 +465,31 @@ QPlatformSessionManager *QPlatformIntegration::createPlatformSessionManager(cons */ void QPlatformIntegration::sync() { - } +#ifndef QT_NO_OPENGL +/*! + Platform integration function for querying the OpenGL implementation type. + + Used only when dynamic OpenGL implementation loading is enabled. + + Subclasses should reimplement this function and return a value based on + the OpenGL implementation they have chosen to load. + + \note The return value does not indicate or limit the types of + contexts that can be created by a given implementation. For example + a desktop OpenGL implementation may be capable of creating OpenGL + ES-compatible contexts too. + + \sa QOpenGLContext::openGLModuleType(), QOpenGLContext::isES() + + \since 5.3 + */ +QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType() +{ + qWarning("This plugin does not support dynamic OpenGL loading!"); + return QOpenGLContext::DesktopGL; +} +#endif + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 35ef88949f9..c8948132353 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -54,6 +54,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -169,6 +170,11 @@ public: #endif virtual void sync(); + +#ifndef QT_NO_OPENGL + virtual QOpenGLContext::OpenGLModuleType openGLModuleType(); +#endif + protected: void screenAdded(QPlatformScreen *screen); }; From efbea5866538dcbf8d5f23f9d37ca9a0731839b0 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 3 Mar 2014 16:27:36 +0100 Subject: [PATCH 076/172] Make QOpenGLFunctions able to resolve everything MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At least if the platform plugin's QPlatformOpenGLContext implementation supports it. This completes the QOpenGLFunction changes necessary for dynamic loading of the OpenGL implementation. Everything else is up to the platform plugin. Change-Id: I710e6fbee3005360ecf02bc6ef976e1beb513819 Reviewed-by: Friedemann Kleint Reviewed-by: Sean Harmer Reviewed-by: Jørgen Lind --- src/gui/kernel/qplatformintegration.cpp | 10 + src/gui/kernel/qplatformintegration.h | 3 +- src/gui/opengl/qopenglfunctions.cpp | 383 +++++++++++++++++++++--- tests/manual/qpainfo/main.cpp | 1 + 4 files changed, 348 insertions(+), 49 deletions(-) diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 6c0130f4e4e..a6e0d4705b3 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -229,6 +229,16 @@ QPlatformServices *QPlatformIntegration::services() const management. This includes the typical desktop platforms. Can be set to false on platforms where no window management is available, meaning for example that windows are never repositioned by the window manager. The default implementation returns \c true. + + \value AllGLFunctionsQueryable The QOpenGLContext backend provided by the platform is + able to return function pointers from getProcAddress() even for standard OpenGL + functions, for example OpenGL 1 functions like glClear() or glDrawArrays(). This is + important because the OpenGL specifications do not require this ability from the + getProcAddress implementations of the windowing system interfaces (EGL, WGL, GLX). The + platform plugins may however choose to enhance the behavior in the backend + implementation for QOpenGLContext::getProcAddress() and support returning a function + pointer also for the standard, non-extension functions. This capability is a + prerequisite for dynamic OpenGL loading. */ /*! diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index c8948132353..4804048fdef 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -97,7 +97,8 @@ public: NativeWidgets, WindowManagement, SyncState, - RasterGLSurface + RasterGLSurface, + AllGLFunctionsQueryable }; virtual ~QPlatformIntegration() { } diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 504e62adf44..5d30020f499 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -42,8 +42,10 @@ #include "qopenglfunctions.h" #include "qopenglextensions_p.h" #include "qdebug.h" -#include "QtGui/private/qopenglcontext_p.h" -#include "QtGui/private/qopengl_p.h" +#include +#include +#include +#include QT_BEGIN_NAMESPACE @@ -2369,6 +2371,236 @@ Resolver functionResolver(FuncType Base::*fu #ifndef QT_OPENGL_ES_2 +// GLES2 + OpenGL1 common subset. These are normally not resolvable, +// but the underlying platform code may hide this limitation. + +static void QOPENGLF_APIENTRY qopenglfResolveBindTexture(GLenum target, GLuint texture) +{ + RESOLVE_FUNC_VOID(0, BindTexture)(target, texture); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBlendFunc(GLenum sfactor, GLenum dfactor) +{ + RESOLVE_FUNC_VOID(0, BlendFunc)(sfactor, dfactor); +} + +static void QOPENGLF_APIENTRY qopenglfResolveClear(GLbitfield mask) +{ + RESOLVE_FUNC_VOID(0, Clear)(mask); +} + +static void QOPENGLF_APIENTRY qopenglfResolveClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + RESOLVE_FUNC_VOID(0, ClearColor)(red, green, blue, alpha); +} + +static void QOPENGLF_APIENTRY qopenglfResolveClearStencil(GLint s) +{ + RESOLVE_FUNC_VOID(0, ClearStencil)(s); +} + +static void QOPENGLF_APIENTRY qopenglfResolveColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + RESOLVE_FUNC_VOID(0, ColorMask)(red, green, blue, alpha); +} + +static void QOPENGLF_APIENTRY qopenglfResolveCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ + RESOLVE_FUNC_VOID(0, CopyTexImage2D)(target, level, internalformat, x, y, width, height, border); +} + +static void QOPENGLF_APIENTRY qopenglfResolveCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + RESOLVE_FUNC_VOID(0, CopyTexSubImage2D)(target, level, xoffset, yoffset, x, y, width, height); +} + +static void QOPENGLF_APIENTRY qopenglfResolveCullFace(GLenum mode) +{ + RESOLVE_FUNC_VOID(0, CullFace)(mode); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDeleteTextures(GLsizei n, const GLuint* textures) +{ + RESOLVE_FUNC_VOID(0, DeleteTextures)(n, textures); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDepthFunc(GLenum func) +{ + RESOLVE_FUNC_VOID(0, DepthFunc)(func); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDepthMask(GLboolean flag) +{ + RESOLVE_FUNC_VOID(0, DepthMask)(flag); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDisable(GLenum cap) +{ + RESOLVE_FUNC_VOID(0, Disable)(cap); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDrawArrays(GLenum mode, GLint first, GLsizei count) +{ + RESOLVE_FUNC_VOID(0, DrawArrays)(mode, first, count); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) +{ + RESOLVE_FUNC_VOID(0, DrawElements)(mode, count, type, indices); +} + +static void QOPENGLF_APIENTRY qopenglfResolveEnable(GLenum cap) +{ + RESOLVE_FUNC_VOID(0, Enable)(cap); +} + +static void QOPENGLF_APIENTRY qopenglfResolveFinish() +{ + RESOLVE_FUNC_VOID(0, Finish)(); +} + +static void QOPENGLF_APIENTRY qopenglfResolveFlush() +{ + RESOLVE_FUNC_VOID(0, Flush)(); +} + +static void QOPENGLF_APIENTRY qopenglfResolveFrontFace(GLenum mode) +{ + RESOLVE_FUNC_VOID(0, FrontFace)(mode); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGenTextures(GLsizei n, GLuint* textures) +{ + RESOLVE_FUNC_VOID(0, GenTextures)(n, textures); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetBooleanv(GLenum pname, GLboolean* params) +{ + RESOLVE_FUNC_VOID(0, GetBooleanv)(pname, params); +} + +static GLenum QOPENGLF_APIENTRY qopenglfResolveGetError() +{ + RESOLVE_FUNC(GLenum, 0, GetError)(); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetFloatv(GLenum pname, GLfloat* params) +{ + RESOLVE_FUNC_VOID(0, GetFloatv)(pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetIntegerv(GLenum pname, GLint* params) +{ + RESOLVE_FUNC_VOID(0, GetIntegerv)(pname, params); +} + +static const GLubyte * QOPENGLF_APIENTRY qopenglfResolveGetString(GLenum name) +{ + RESOLVE_FUNC(const GLubyte *, 0, GetString)(name); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) +{ + RESOLVE_FUNC_VOID(0, GetTexParameterfv)(target, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetTexParameteriv(GLenum target, GLenum pname, GLint* params) +{ + RESOLVE_FUNC_VOID(0, GetTexParameteriv)(target, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveHint(GLenum target, GLenum mode) +{ + RESOLVE_FUNC_VOID(0, Hint)(target, mode); +} + +static GLboolean QOPENGLF_APIENTRY qopenglfResolveIsEnabled(GLenum cap) +{ + RESOLVE_FUNC(GLboolean, 0, IsEnabled)(cap); +} + +static GLboolean QOPENGLF_APIENTRY qopenglfResolveIsTexture(GLuint texture) +{ + RESOLVE_FUNC(GLboolean, 0, IsTexture)(texture); +} + +static void QOPENGLF_APIENTRY qopenglfResolveLineWidth(GLfloat width) +{ + RESOLVE_FUNC_VOID(0, LineWidth)(width); +} + +static void QOPENGLF_APIENTRY qopenglfResolvePixelStorei(GLenum pname, GLint param) +{ + RESOLVE_FUNC_VOID(0, PixelStorei)(pname, param); +} + +static void QOPENGLF_APIENTRY qopenglfResolvePolygonOffset(GLfloat factor, GLfloat units) +{ + RESOLVE_FUNC_VOID(0, PolygonOffset)(factor, units); +} + +static void QOPENGLF_APIENTRY qopenglfResolveReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) +{ + RESOLVE_FUNC_VOID(0, ReadPixels)(x, y, width, height, format, type, pixels); +} + +static void QOPENGLF_APIENTRY qopenglfResolveScissor(GLint x, GLint y, GLsizei width, GLsizei height) +{ + RESOLVE_FUNC_VOID(0, Scissor)(x, y, width, height); +} + +static void QOPENGLF_APIENTRY qopenglfResolveStencilFunc(GLenum func, GLint ref, GLuint mask) +{ + RESOLVE_FUNC_VOID(0, StencilFunc)(func, ref, mask); +} + +static void QOPENGLF_APIENTRY qopenglfResolveStencilMask(GLuint mask) +{ + RESOLVE_FUNC_VOID(0, StencilMask)(mask); +} + +static void QOPENGLF_APIENTRY qopenglfResolveStencilOp(GLenum fail, GLenum zfail, GLenum zpass) +{ + RESOLVE_FUNC_VOID(0, StencilOp)(fail, zfail, zpass); +} + +static void QOPENGLF_APIENTRY qopenglfResolveTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) +{ + RESOLVE_FUNC_VOID(0, TexImage2D)(target, level, internalformat, width, height, border, format, type, pixels); +} + +static void QOPENGLF_APIENTRY qopenglfResolveTexParameterf(GLenum target, GLenum pname, GLfloat param) +{ + RESOLVE_FUNC_VOID(0, TexParameterf)(target, pname, param); +} + +static void QOPENGLF_APIENTRY qopenglfResolveTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) +{ + RESOLVE_FUNC_VOID(0, TexParameterfv)(target, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveTexParameteri(GLenum target, GLenum pname, GLint param) +{ + RESOLVE_FUNC_VOID(0, TexParameteri)(target, pname, param); +} + +static void QOPENGLF_APIENTRY qopenglfResolveTexParameteriv(GLenum target, GLenum pname, const GLint* params) +{ + RESOLVE_FUNC_VOID(0, TexParameteriv)(target, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) +{ + RESOLVE_FUNC_VOID(0, TexSubImage2D)(target, level, xoffset, yoffset, width, height, format, type, pixels); +} + +static void QOPENGLF_APIENTRY qopenglfResolveViewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ + RESOLVE_FUNC_VOID(0, Viewport)(x, y, width, height); +} + +// GL(ES)2 + static void QOPENGLF_APIENTRY qopenglfResolveActiveTexture(GLenum texture) { RESOLVE_FUNC_VOID(0, ActiveTexture)(texture); @@ -2906,52 +3138,107 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) * context, assigns it to the member variable and executes it * (see Resolver template) */ #ifndef QT_OPENGL_ES_2 - // OpenGL1 functions do not need resolving for now since QtGui links to libGL, libGLESv2 or opengl32. - BindTexture = ::glBindTexture; - BlendFunc = ::glBlendFunc; - Clear = ::glClear; - ClearColor = ::glClearColor; - ClearStencil = ::glClearStencil; - ColorMask = ::glColorMask; - CopyTexImage2D = ::glCopyTexImage2D; - CopyTexSubImage2D = ::glCopyTexSubImage2D; - CullFace = ::glCullFace; - DeleteTextures = ::glDeleteTextures; - DepthFunc = ::glDepthFunc; - DepthMask = ::glDepthMask; - Disable = ::glDisable; - DrawArrays = ::glDrawArrays; - DrawElements = ::glDrawElements; - Enable = ::glEnable; - Finish = ::glFinish; - Flush = ::glFlush; - FrontFace = ::glFrontFace; - GenTextures = ::glGenTextures; - GetBooleanv = ::glGetBooleanv; - GetError = ::glGetError; - GetFloatv = ::glGetFloatv; - GetIntegerv = ::glGetIntegerv; - GetString = ::glGetString; - GetTexParameterfv = ::glGetTexParameterfv; - GetTexParameteriv = ::glGetTexParameteriv; - Hint = ::glHint; - IsEnabled = ::glIsEnabled; - IsTexture = ::glIsTexture; - LineWidth = ::glLineWidth; - PixelStorei = ::glPixelStorei; - PolygonOffset = ::glPolygonOffset; - ReadPixels = ::glReadPixels; - Scissor = ::glScissor; - StencilFunc = ::glStencilFunc; - StencilMask = ::glStencilMask; - StencilOp = ::glStencilOp; - TexImage2D = ::glTexImage2D; - TexParameterf = ::glTexParameterf; - TexParameterfv = ::glTexParameterfv; - TexParameteri = ::glTexParameteri; - TexParameteriv = ::glTexParameteriv; - TexSubImage2D = ::glTexSubImage2D; - Viewport = ::glViewport; + // The GL1 functions may not be queriable via getProcAddress(). + if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::AllGLFunctionsQueryable)) { + // The platform plugin supports resolving these. + BindTexture = qopenglfResolveBindTexture; + BlendFunc = qopenglfResolveBlendFunc; + Clear = qopenglfResolveClear; + ClearColor = qopenglfResolveClearColor; + ClearStencil = qopenglfResolveClearStencil; + ColorMask = qopenglfResolveColorMask; + CopyTexImage2D = qopenglfResolveCopyTexImage2D; + CopyTexSubImage2D = qopenglfResolveCopyTexSubImage2D; + CullFace = qopenglfResolveCullFace; + DeleteTextures = qopenglfResolveDeleteTextures; + DepthFunc = qopenglfResolveDepthFunc; + DepthMask = qopenglfResolveDepthMask; + Disable = qopenglfResolveDisable; + DrawArrays = qopenglfResolveDrawArrays; + DrawElements = qopenglfResolveDrawElements; + Enable = qopenglfResolveEnable; + Finish = qopenglfResolveFinish; + Flush = qopenglfResolveFlush; + FrontFace = qopenglfResolveFrontFace; + GenTextures = qopenglfResolveGenTextures; + GetBooleanv = qopenglfResolveGetBooleanv; + GetError = qopenglfResolveGetError; + GetFloatv = qopenglfResolveGetFloatv; + GetIntegerv = qopenglfResolveGetIntegerv; + GetString = qopenglfResolveGetString; + GetTexParameterfv = qopenglfResolveGetTexParameterfv; + GetTexParameteriv = qopenglfResolveGetTexParameteriv; + Hint = qopenglfResolveHint; + IsEnabled = qopenglfResolveIsEnabled; + IsTexture = qopenglfResolveIsTexture; + LineWidth = qopenglfResolveLineWidth; + PixelStorei = qopenglfResolvePixelStorei; + PolygonOffset = qopenglfResolvePolygonOffset; + ReadPixels = qopenglfResolveReadPixels; + Scissor = qopenglfResolveScissor; + StencilFunc = qopenglfResolveStencilFunc; + StencilMask = qopenglfResolveStencilMask; + StencilOp = qopenglfResolveStencilOp; + TexImage2D = qopenglfResolveTexImage2D; + TexParameterf = qopenglfResolveTexParameterf; + TexParameterfv = qopenglfResolveTexParameterfv; + TexParameteri = qopenglfResolveTexParameteri; + TexParameteriv = qopenglfResolveTexParameteriv; + TexSubImage2D = qopenglfResolveTexSubImage2D; + Viewport = qopenglfResolveViewport; + } else { +#ifndef QT_OPENGL_DYNAMIC + // Use the functions directly. This requires linking QtGui to an OpenGL implementation. + BindTexture = ::glBindTexture; + BlendFunc = ::glBlendFunc; + Clear = ::glClear; + ClearColor = ::glClearColor; + ClearStencil = ::glClearStencil; + ColorMask = ::glColorMask; + CopyTexImage2D = ::glCopyTexImage2D; + CopyTexSubImage2D = ::glCopyTexSubImage2D; + CullFace = ::glCullFace; + DeleteTextures = ::glDeleteTextures; + DepthFunc = ::glDepthFunc; + DepthMask = ::glDepthMask; + Disable = ::glDisable; + DrawArrays = ::glDrawArrays; + DrawElements = ::glDrawElements; + Enable = ::glEnable; + Finish = ::glFinish; + Flush = ::glFlush; + FrontFace = ::glFrontFace; + GenTextures = ::glGenTextures; + GetBooleanv = ::glGetBooleanv; + GetError = ::glGetError; + GetFloatv = ::glGetFloatv; + GetIntegerv = ::glGetIntegerv; + GetString = ::glGetString; + GetTexParameterfv = ::glGetTexParameterfv; + GetTexParameteriv = ::glGetTexParameteriv; + Hint = ::glHint; + IsEnabled = ::glIsEnabled; + IsTexture = ::glIsTexture; + LineWidth = ::glLineWidth; + PixelStorei = ::glPixelStorei; + PolygonOffset = ::glPolygonOffset; + ReadPixels = ::glReadPixels; + Scissor = ::glScissor; + StencilFunc = ::glStencilFunc; + StencilMask = ::glStencilMask; + StencilOp = ::glStencilOp; + TexImage2D = ::glTexImage2D; + TexParameterf = ::glTexParameterf; + TexParameterfv = ::glTexParameterfv; + TexParameteri = ::glTexParameteri; + TexParameteriv = ::glTexParameteriv; + TexSubImage2D = ::glTexSubImage2D; + Viewport = ::glViewport; +#else // QT_OPENGL_DYNAMIC + // This should not happen. + qFatal("QOpenGLFunctions: Dynamic OpenGL builds do not support platforms with insufficient function resolving capabilities"); +#endif + } ActiveTexture = qopenglfResolveActiveTexture; AttachShader = qopenglfResolveAttachShader; diff --git a/tests/manual/qpainfo/main.cpp b/tests/manual/qpainfo/main.cpp index c51ca6323b5..02ac88dd06d 100644 --- a/tests/manual/qpainfo/main.cpp +++ b/tests/manual/qpainfo/main.cpp @@ -170,6 +170,7 @@ int main(int argc, char **argv) DUMP_CAPABILITY(platformIntegration, MultipleWindows) DUMP_CAPABILITY(platformIntegration, ApplicationState) DUMP_CAPABILITY(platformIntegration, ForeignWindows) + DUMP_CAPABILITY(platformIntegration, AllGLFunctionsQueryable) std::cout << '\n'; const QStyleHints *styleHints = QGuiApplication::styleHints(); From 62742d037f20455e8acbe3bcd6542a484da3776f Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 5 Mar 2014 14:24:25 +0100 Subject: [PATCH 077/172] spdy autotest: Fix build with QT_NO_OPENSSL Task-number: QTBUG-37171 Change-Id: I76df40d53e1310c16f559f91c244c6162e35475e Reviewed-by: Andrew Knight --- tests/auto/network/access/spdy/tst_spdy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/network/access/spdy/tst_spdy.cpp b/tests/auto/network/access/spdy/tst_spdy.cpp index 15c08315900..50c4347a9d8 100644 --- a/tests/auto/network/access/spdy/tst_spdy.cpp +++ b/tests/auto/network/access/spdy/tst_spdy.cpp @@ -47,9 +47,9 @@ #include #include #include -#ifdef QT_BUILD_INTERNAL +#if defined(QT_BUILD_INTERNAL) && !defined(QT_NO_OPENSSL) #include -#endif // QT_BUILD_INTERNAL +#endif // QT_BUILD_INTERNAL && !QT_NO_OPENSSL #include "../../../network-settings.h" From 7aa1a7f1c1fc4feaeb27c08ef7080064fef8dfb3 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 5 Mar 2014 14:25:44 +0100 Subject: [PATCH 078/172] spdy autotest: Fixed build with QT_NO_NETWORKPROXY Task-number: QTBUG-37171 Change-Id: I835764978cf75592d46a20fa5f644f6accec43f5 Reviewed-by: Andrew Knight --- tests/auto/network/access/spdy/tst_spdy.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/auto/network/access/spdy/tst_spdy.cpp b/tests/auto/network/access/spdy/tst_spdy.cpp index 50c4347a9d8..3f69549bbd0 100644 --- a/tests/auto/network/access/spdy/tst_spdy.cpp +++ b/tests/auto/network/access/spdy/tst_spdy.cpp @@ -67,13 +67,17 @@ private Q_SLOTS: void initTestCase(); void settingsAndNegotiation_data(); void settingsAndNegotiation(); +#ifndef QT_NO_NETWORKPROXY void download_data(); void download(); +#endif // !QT_NO_NETWORKPROXY void headerFields(); +#ifndef QT_NO_NETWORKPROXY void upload_data(); void upload(); void errors_data(); void errors(); +#endif // !QT_NO_NETWORKPROXY void multipleRequests_data(); void multipleRequests(); @@ -202,6 +206,7 @@ void tst_Spdy::proxyAuthenticationRequired(const QNetworkProxy &/*proxy*/, authenticator->setPassword("password"); } +#ifndef QT_NO_NETWORKPROXY void tst_Spdy::download_data() { QTest::addColumn("url"); @@ -299,6 +304,7 @@ void tst_Spdy::download() reply->deleteLater(); m_manager.setProxy(QNetworkProxy()); // reset } +#endif // !QT_NO_NETWORKPROXY void tst_Spdy::headerFields() { @@ -329,6 +335,7 @@ static inline QByteArray md5sum(const QByteArray &data) return QCryptographicHash::hash(data, QCryptographicHash::Md5).toHex().append('\n'); } +#ifndef QT_NO_NETWORKPROXY void tst_Spdy::upload_data() { QTest::addColumn("url"); @@ -602,6 +609,7 @@ void tst_Spdy::errors() this, SLOT(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)), Qt::UniqueConnection); // reset } +#endif // !QT_NO_NETWORKPROXY void tst_Spdy::multipleRequests_data() { From 742e0fb560df3d5aa0f2576bde458513eaa39dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Mon, 3 Mar 2014 14:20:44 +0100 Subject: [PATCH 079/172] QDoc: Do not warn about a file overwritting while writing to /dev/null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7d23edf5a73d521bad361f1007be0750acd4c1e9 Reviewed-by: Topi Reiniö Reviewed-by: Frederik Gladhorn --- src/tools/qdoc/generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 71c550d4ab7..9b82e80927f 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -270,7 +270,7 @@ void Generator::beginSubPage(const InnerNode* node, const QString& fileName) path += fileName; QFile* outFile = new QFile(redirectDocumentationToDevNull_ ? QStringLiteral("/dev/null") : path); - if (outFile->exists()) + if (!redirectDocumentationToDevNull_ && outFile->exists()) node->location().error(tr("HTML file already exists; overwriting %1").arg(outFile->fileName())); if (!outFile->open(QFile::WriteOnly)) node->location().fatal(tr("Cannot open output file '%1'").arg(outFile->fileName())); From bc361899f214a6ecb2603ed92bb8dd6ac4c0f086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Tue, 4 Mar 2014 15:43:02 +0100 Subject: [PATCH 080/172] Remove unused and unlinked qdocconf file from src/plugins. Change-Id: Ie6fd3f9fe7d5bbbe948dd3d38d2be835fd92834d Reviewed-by: Frederik Gladhorn --- .../platforms/windows/qwindows.qdocconf | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 src/plugins/platforms/windows/qwindows.qdocconf diff --git a/src/plugins/platforms/windows/qwindows.qdocconf b/src/plugins/platforms/windows/qwindows.qdocconf deleted file mode 100644 index 1684773b876..00000000000 --- a/src/plugins/platforms/windows/qwindows.qdocconf +++ /dev/null @@ -1,25 +0,0 @@ -project = "Qt Windows Lighthouse Plugin" -description = "Documentation of the Qt Windows Lighthouse Plugin" - -language = Cpp - -headerdirs = . - -sourcedirs = . - -showinternal = true - -headers.fileextensions = "*.h" -sources.fileextensions = "*.cpp *.qdoc" - -qhp.projects = QtLighthouseWindows -qhp.QtLighthouseWindowsDev.file = qtlighthousewindows-dev.qhp -qhp.QtLighthouseWindowsDev.namespace = com.nokia.qt.developer.lighthouse -qhp.QtLighthouseWindowsDev.virtualFolder = doc -qhp.QtLighthouseWindowsDev.indexTitle = Qt Windows Lighthouse Plugin -qhp.QtLighthouseWindowsDev.indexRoot = - -# Doxygen compatibility commands - -macro.see = "\\sa" -macro.function = "\\fn" From af113cfc0f0de5bfcb4739c4cc1d88e76a514a19 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 5 Mar 2014 13:57:36 +0100 Subject: [PATCH 081/172] Use None instead of GLX_NONE GLX_NONE is not 0, so it doesn't work as end-of-list marker The documentation explicitly mentions to use None or NULL Fixes valgrind warning ==22686== Conditional jump or move depends on uninitialised value(s) ==22686== at 0x78949AF: glXCreatePbuffer (glx_pbuffer.c:709) ==22686== by 0xDD7F0E1: QGLXPbuffer::QGLXPbuffer(QOffscreenSurface*) (qglxintegration.cpp:515) ==22686== by 0xDD624B0: QXcbIntegration::createPlatformOffscreenSurface(QOffscreenSurface*) const (qxcbintegration.cpp:259) ==22686== by 0x4F1D6A2: QOffscreenSurface::create() (in /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5.2.1) ==22686== by 0xDD80248: QGLXContext::queryDummyContext() (qglxintegration.cpp:454) ==22686== by 0xDD803F0: QGLXContext::supportsThreading() (qglxintegration.cpp:488) ==22686== by 0x5BD9927: QSGRenderLoop::instance() (in /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5.2.1) ==22686== by 0x5BF969E: QQuickWindowPrivate::init(QQuickWindow*) (in /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5.2.1) ==22686== by 0x5C97BFC: QQuickView::QQuickView(QWindow*) (in /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5.2.1) ==22686== by 0x40636F: startShell(int, char const**, void*) (main.cpp:91) ==22686== by 0x407125: main (main.cpp:193) Change-Id: Ib4f5ae50f7e31d3fbeb5acf67753e1d8b9e434b0 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qglxintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index ed2f6857703..eaa4d053118 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -537,7 +537,7 @@ QGLXPbuffer::QGLXPbuffer(QOffscreenSurface *offscreenSurface) GLX_PBUFFER_HEIGHT, offscreenSurface->size().height(), GLX_LARGEST_PBUFFER, False, GLX_PRESERVED_CONTENTS, False, - GLX_NONE + None }; m_pbuffer = glXCreatePbuffer(DISPLAY_FROM_XCB(m_screen), config, attributes); From 19501b073142a3b3ac1d228e87e63cc6bc078619 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 3 Mar 2014 20:41:52 +0100 Subject: [PATCH 082/172] Fix win32 mkspecs Instead of checking for dynamicgl in QT_CONFIG, which is apparently not possible, revert them and do it in opengl.prf instead. Dynamic GL is Windows-only for the time being so this should be sufficient. Change-Id: If293ea4c9b024df52257086c8b6250602a44724d Reviewed-by: Oswald Buddenhagen Reviewed-by: Laszlo Agocs --- mkspecs/features/win32/opengl.prf | 6 ++++-- mkspecs/win32-g++/qmake.conf | 4 ++-- mkspecs/win32-icc/qmake.conf | 5 ++--- mkspecs/win32-msvc2005/qmake.conf | 5 ++--- mkspecs/win32-msvc2008/qmake.conf | 5 ++--- mkspecs/win32-msvc2010/qmake.conf | 5 ++--- mkspecs/win32-msvc2012/qmake.conf | 5 ++--- mkspecs/win32-msvc2013/qmake.conf | 5 ++--- src/gui/gui.pro | 2 +- 9 files changed, 19 insertions(+), 23 deletions(-) diff --git a/mkspecs/features/win32/opengl.prf b/mkspecs/features/win32/opengl.prf index 0f33f31e596..46101d6b762 100644 --- a/mkspecs/features/win32/opengl.prf +++ b/mkspecs/features/win32/opengl.prf @@ -24,7 +24,9 @@ wince* { contains(QT_CONFIG, static): DEFINES += QT_OPENGL_ES_2_ANGLE_STATIC QT_CONFIG -= opengl } else { - QMAKE_LIBS += $$QMAKE_LIBS_OPENGL - QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL + !contains(QT_CONFIG, dynamicgl) { + QMAKE_LIBS += $$QMAKE_LIBS_OPENGL + QMAKE_LFLAGS += $$QMAKE_LFLAGS_OPENGL + } } } diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index d739fd04a12..1ac35611f54 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -8,7 +8,6 @@ # load(device_config) -load(qt_config) MAKEFILE_GENERATOR = MINGW QMAKE_PLATFORM = win32 mingw @@ -85,7 +84,7 @@ QMAKE_LIBS = QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32 QMAKE_LIBS_NETWORK = -lws2_32 -!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32 +QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32 QMAKE_LIBS_OPENGL_ES2 = -llibEGL -llibGLESv2 -lgdi32 -luser32 QMAKE_LIBS_OPENGL_ES2_DEBUG = -llibEGLd -llibGLESv2d -lgdi32 -luser32 QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32 @@ -111,3 +110,4 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_STRIPFLAGS_LIB += --strip-unneeded QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P +load(qt_config) diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf index 0c6290335ee..1ee07c64b67 100644 --- a/mkspecs/win32-icc/qmake.conf +++ b/mkspecs/win32-icc/qmake.conf @@ -4,8 +4,6 @@ # Written for Intel C++ # -load(qt_config) - MAKEFILE_GENERATOR = MSVC.NET QMAKE_PLATFORM = win32 CONFIG += incremental flat debug_and_release debug_and_release_target @@ -63,7 +61,7 @@ QMAKE_LIBS = QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_NETWORK = ws2_32.lib -!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib delayimp.lib +QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib delayimp.lib QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib QMAKE_LIBS_QT_ENTRY = -lqtmain @@ -74,3 +72,4 @@ QMAKE_RC = rc include(../common/shell-win32.conf) DSP_EXTENSION = .dsp +load(qt_config) diff --git a/mkspecs/win32-msvc2005/qmake.conf b/mkspecs/win32-msvc2005/qmake.conf index 5c8247605d4..4a0fab761eb 100644 --- a/mkspecs/win32-msvc2005/qmake.conf +++ b/mkspecs/win32-msvc2005/qmake.conf @@ -4,8 +4,6 @@ # Written for Microsoft Visual C++ 2005 # -load(qt_config) - MAKEFILE_GENERATOR = MSVC.NET QMAKE_PLATFORM = win32 CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe @@ -77,7 +75,7 @@ QMAKE_EXTENSION_STATICLIB = lib QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_NETWORK = ws2_32.lib -!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib +QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib @@ -93,3 +91,4 @@ include(../common/shell-win32.conf) VCPROJ_EXTENSION = .vcproj VCSOLUTION_EXTENSION = .sln VCPROJ_KEYWORD = Qt4VSv1.0 +load(qt_config) diff --git a/mkspecs/win32-msvc2008/qmake.conf b/mkspecs/win32-msvc2008/qmake.conf index 142eda5e678..8fd6eb0c7d0 100644 --- a/mkspecs/win32-msvc2008/qmake.conf +++ b/mkspecs/win32-msvc2008/qmake.conf @@ -4,8 +4,6 @@ # Written for Microsoft Visual C++ 2008 # -load(qt_config) - MAKEFILE_GENERATOR = MSVC.NET QMAKE_PLATFORM = win32 CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe @@ -79,7 +77,7 @@ QMAKE_EXTENSION_STATICLIB = lib QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_NETWORK = ws2_32.lib -!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib +QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib @@ -95,3 +93,4 @@ include(../common/shell-win32.conf) VCPROJ_EXTENSION = .vcproj VCSOLUTION_EXTENSION = .sln VCPROJ_KEYWORD = Qt4VSv1.0 +load(qt_config) diff --git a/mkspecs/win32-msvc2010/qmake.conf b/mkspecs/win32-msvc2010/qmake.conf index ff4de22a95e..07422abb0af 100644 --- a/mkspecs/win32-msvc2010/qmake.conf +++ b/mkspecs/win32-msvc2010/qmake.conf @@ -4,8 +4,6 @@ # Written for Microsoft Visual C++ 2010 # -load(qt_config) - MAKEFILE_GENERATOR = MSBUILD QMAKE_PLATFORM = win32 CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe @@ -81,7 +79,7 @@ QMAKE_EXTENSION_STATICLIB = lib QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_NETWORK = ws2_32.lib -!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib +QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib @@ -97,3 +95,4 @@ include(../common/shell-win32.conf) VCPROJ_EXTENSION = .vcxproj VCSOLUTION_EXTENSION = .sln VCPROJ_KEYWORD = Qt4VSv1.0 +load(qt_config) diff --git a/mkspecs/win32-msvc2012/qmake.conf b/mkspecs/win32-msvc2012/qmake.conf index 7585c3300b3..45054862ba6 100644 --- a/mkspecs/win32-msvc2012/qmake.conf +++ b/mkspecs/win32-msvc2012/qmake.conf @@ -4,8 +4,6 @@ # Written for Microsoft Visual C++ 2012 # -load(qt_config) - MAKEFILE_GENERATOR = MSBUILD QMAKE_PLATFORM = win32 CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe @@ -81,7 +79,7 @@ QMAKE_EXTENSION_STATICLIB = lib QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_NETWORK = ws2_32.lib -!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib +QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib @@ -97,3 +95,4 @@ include(../common/shell-win32.conf) VCPROJ_EXTENSION = .vcxproj VCSOLUTION_EXTENSION = .sln VCPROJ_KEYWORD = Qt4VSv1.0 +load(qt_config) diff --git a/mkspecs/win32-msvc2013/qmake.conf b/mkspecs/win32-msvc2013/qmake.conf index 5ce41b730b2..9fc69e4d1a3 100644 --- a/mkspecs/win32-msvc2013/qmake.conf +++ b/mkspecs/win32-msvc2013/qmake.conf @@ -4,8 +4,6 @@ # Written for Microsoft Visual C++ 2013 # -load(qt_config) - MAKEFILE_GENERATOR = MSBUILD QMAKE_PLATFORM = win32 CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe @@ -81,7 +79,7 @@ QMAKE_EXTENSION_STATICLIB = lib QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_NETWORK = ws2_32.lib -!contains(QT_CONFIG, dynamicgl): QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib +QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL_ES2_DEBUG = libEGLd.lib libGLESv2d.lib gdi32.lib user32.lib QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib @@ -97,3 +95,4 @@ include(../common/shell-win32.conf) VCPROJ_EXTENSION = .vcxproj VCSOLUTION_EXTENSION = .sln VCPROJ_KEYWORD = Qt4VSv1.0 +load(qt_config) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 9bd33d1f57f..962d6fd5e7f 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -86,7 +86,7 @@ contains(QT_CONFIG, angle) { } else:contains(QT_CONFIG, opengl) { !isEmpty(QMAKE_INCDIR_OPENGL): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL) CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL) - CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL) + !contains(QT_CONFIG, dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL) !isEmpty(QMAKE_LIBDIR_OPENGL): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL) CMAKE_GL_HEADER_NAME = GL/gl.h mac: CMAKE_GL_HEADER_NAME = gl.h From 1f802afc49e10647e89e00da68feff73ea66a90f Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 3 Mar 2014 17:56:33 +0100 Subject: [PATCH 083/172] Clean up proxy leftovers in gui/opengl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I24d10dab121c23b0683fa99bd309cf557c3ddffb Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- src/gui/gui.pro | 2 -- src/gui/opengl/opengl.pri | 4 ---- src/gui/opengl/qopengl.h | 10 ---------- 3 files changed, 16 deletions(-) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 962d6fd5e7f..8d37af6321a 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -18,8 +18,6 @@ win32:contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) { \$\$QT_MODULE_INCLUDE_BASE/QtANGLE } -contains(QT_CONFIG, dynamicgl): DEFINES += QT_OPENGL_DYNAMIC_IN_GUI - load(qt_module) # Code coverage with TestCocoon diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri index 56aecd49e24..cadba267979 100644 --- a/src/gui/opengl/opengl.pri +++ b/src/gui/opengl/opengl.pri @@ -122,8 +122,4 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { SOURCES += opengl/qopenglfunctions_es2.cpp } - - contains(QT_CONFIG, dynamicgl) { - win32: SOURCES += opengl/qopenglproxy_win.cpp - } } diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index 025f8b823cf..6eb656cd09b 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -107,17 +107,7 @@ typedef GLfloat GLdouble; # include # else # define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system glext.h - // In dynamic GL builds qopenglproxy will export the GL functions that are - // called also in QtGui itself. To prevent linker warnings (msvc) or errors (mingw) - // we need to make sure the prototypes do not have dllimport. -# ifdef QT_OPENGL_DYNAMIC_IN_GUI -# undef WINGDIAPI -# define WINGDIAPI -# endif // QT_OPENGL_DYNAMIC_IN_GUI # include -# ifdef QT_OPENGL_DYNAMIC_IN_GUI -# undef WINGDIAPI -# endif // QT_OPENGL_DYNAMIC_IN_GUI # include # endif // Q_OS_MAC #endif From 9580f3484d35a9b2c805aa302b990f1b69671f7e Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 4 Mar 2014 16:27:23 +0100 Subject: [PATCH 084/172] Append additional compose file search paths On FreeBSD Compose files are stored in different place than on Linux distributions, this patch adds new search paths. Change-Id: Ic1e745801a2f9a53d1af058be8a1dfaced5032a7 Reviewed-by: Gabriel de Dietrich --- .../platforminputcontexts/compose/compose.pro | 2 +- .../compose/generator/qtablegenerator.cpp | 20 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro index c206e99e578..546a0a2af71 100644 --- a/src/plugins/platforminputcontexts/compose/compose.pro +++ b/src/plugins/platforminputcontexts/compose/compose.pro @@ -8,7 +8,7 @@ QT += gui-private LIBS += $$QMAKE_LIBS_XKBCOMMON QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON -DEFINES += COMPOSE_X11_PREFIX='\\"$$QMAKE_X11_PREFIX\\"' +DEFINES += X11_PREFIX='\\"$$QMAKE_X11_PREFIX\\"' SOURCES += $$PWD/main.cpp \ $$PWD/qcomposeplatforminputcontext.cpp \ diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index e2810c84480..ca61b0e4954 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -73,13 +73,19 @@ TableGenerator::TableGenerator() : m_state(NoErrors), void TableGenerator::initPossibleLocations() { - // To add an extra system path use the QTCOMPOSE environment variable - if (qEnvironmentVariableIsSet("QTCOMPOSE")) { - m_possibleLocations.append(QString(qgetenv("QTCOMPOSE"))); - } - - m_possibleLocations.append(QStringLiteral(COMPOSE_X11_PREFIX "/share/X11/locale")); - m_possibleLocations.append(QStringLiteral(COMPOSE_X11_PREFIX "/lib/X11/locale")); + // Compose files come as a part of Xlib library. Xlib doesn't provide + // a mechanism how to retrieve the location of these files reliably, since it was + // never meant for external software to parse compose tables directly. Best we + // can do is to hardcode search paths. To add an extra system path use + // the QTCOMPOSE environment variable + if (qEnvironmentVariableIsSet("QTCOMPOSE")) + m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE"))); + m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale")); + m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale")); + m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale")); + m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale")); + m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale")); + m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale")); } void TableGenerator::findComposeFile() From 1664458f6327e9f1b612cd8058f840f90f822b61 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 4 Mar 2014 16:26:07 +0100 Subject: [PATCH 085/172] Improve xkb config root detection Relevant part from libxkbcommon's configure.ac file: xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config` if test "x$xkb_base" = x; then xkb_base=$datadir/X11/xkb fi AC_ARG_WITH([xkb_config_root], [AS_HELP_STRING([--with-xkb-config-root=], [Set default XKB config root (default: xkeyboard-config install path)])], [XKBCONFIGROOT="$withval"], [XKBCONFIGROOT="$xkb_base"]) AC_SUBST([XKBCONFIGROOT]) This patch implements an equivalent logic in Qt's configure script (with some additions). Change-Id: I25968f76021e120e2439d2756121bbe3c5e18c98 Reviewed-by: Gabriel de Dietrich Reviewed-by: Oswald Buddenhagen --- configure | 31 ++++++++++++++++++++++++++++++- src/3rdparty/xkbcommon.pri | 2 +- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 383918df8a6..64edc1571f5 100755 --- a/configure +++ b/configure @@ -649,6 +649,7 @@ CFG_XINPUT2=auto CFG_XINPUT=runtime CFG_XKB=auto CFG_XKBCOMMON=auto +CFG_XKB_CONFIG_ROOT=auto CFG_XCB=auto CFG_XCB_XLIB=auto CFG_XCB_GLX=no @@ -898,6 +899,7 @@ while [ "$#" -gt 0 ]; do -qpa| \ -qconfig| \ -qreal| \ + -xkb-config-root| \ -android-sdk| \ -android-ndk| \ -android-ndk-platform| \ @@ -2109,6 +2111,9 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + xkb-config-root) + CFG_XKB_CONFIG_ROOT="$VAL" + ;; android-sdk) CFG_DEFAULT_ANDROID_SDK_ROOT="$VAL" ;; @@ -2358,6 +2363,7 @@ Third Party Libraries: (libxcb.so will still be used from operating system). + -system-xcb ........ Use xcb- libraries from the operating system. + -xkb-config-root ... Set default XKB config root. This option is used only together with -qt-xkbcommon. -qt-xkbcommon ...... Use the xkbcommon library bundled with Qt. + -system-xkbcommon .. Use the xkbcommon library from the operating system. @@ -5360,6 +5366,25 @@ fi if [ "$CFG_XKBCOMMON" = "qt" ]; then QT_CONFIG="$QT_CONFIG xkbcommon-qt" + # detect XKB config root + if [ "$CFG_XKB_CONFIG_ROOT" = "auto" ]; then + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xkeyboard-config" 2> /dev/null; then + CFG_XKB_CONFIG_ROOT="`$PKG_CONFIG --variable=xkb_base xkeyboard-config`" + else + # search for xkb configs in most probable locations + if [ -d "/usr/share/X11/xkb" ]; then + # Linux + CFG_XKB_CONFIG_ROOT="/usr/share/X11/xkb" + elif [ -d "/usr/local/share/X11/xkb" ]; then + # BSD UNIX + CFG_XKB_CONFIG_ROOT="/usr/local/share/X11/xkb" + fi + fi + fi + QMakeVar set QMAKE_XKB_CONFIG_ROOT "$CFG_XKB_CONFIG_ROOT" + if [ "$CFG_XKB_CONFIG_ROOT" = "auto" ]; then + CFG_XKB_CONFIG_ROOT="not found" + fi elif [ "$CFG_XKBCOMMON" = "no" ]; then QMakeVar add DEFINES QT_NO_XKBCOMMON fi @@ -6827,7 +6852,7 @@ report_support " SQLite 2 ............." "$CFG_SQL_sqlite2" plugin "plugin" y report_support_plugin " SQLite ..............." "$CFG_SQL_sqlite" "$CFG_SQLITE" QtSql report_support " TDS .................." "$CFG_SQL_tds" plugin "plugin" yes "built into QtSql" report_support " udev ..................." "$CFG_LIBUDEV" -report_support " xkbcommon .............." "$CFG_XKBCOMMON" system "system library" qt "bundled copy" +report_support " xkbcommon .............." "$CFG_XKBCOMMON" system "system library" qt "bundled copy, XKB config root: $CFG_XKB_CONFIG_ROOT" report_support " zlib ..................." "$CFG_ZLIB" system "system library" yes "bundled copy" echo @@ -6852,6 +6877,10 @@ if [ "$ORIG_CFG_XKBCOMMON" != qt ] && [ "$CFG_XKBCOMMON" = qt ]; then echo "NOTE: libxkbcommon 0.2.0 (or higher) not found on the system, will use " echo "the bundled version from 3rd party directory." fi +if [ "$CFG_XKBCOMMON" = "qt" ] && [ "$CFG_XKB_CONFIG_ROOT" = "not found" ]; then + echo "WARNING: Could not find XKB config root, use -xkb-config-root to set a path to " + echo "XKB configuration data. This is required for keyboard input support." +fi if [ "$CFG_QREAL" = double ] && [ "$CFG_ARCH" = arm ]; then echo "NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1." echo "Configure with '-qreal float' to create a build that is binary compatible with 5.1." diff --git a/src/3rdparty/xkbcommon.pri b/src/3rdparty/xkbcommon.pri index 21a3e78e1cc..57470c04999 100644 --- a/src/3rdparty/xkbcommon.pri +++ b/src/3rdparty/xkbcommon.pri @@ -1,7 +1,7 @@ QMAKE_CFLAGS += -std=gnu99 -w INCLUDEPATH += $$PWD/xkbcommon $$PWD/xkbcommon/src $$PWD/xkbcommon/src/xkbcomp -DEFINES += DFLT_XKB_CONFIG_ROOT='\\"$$QMAKE_X11_PREFIX/share/X11/xkb\\"' +DEFINES += DFLT_XKB_CONFIG_ROOT='\\"$$QMAKE_XKB_CONFIG_ROOT\\"' ### RMLVO names can be overwritten with environmental variables (See libxkbcommon documentation) DEFINES += DEFAULT_XKB_RULES='\\"evdev\\"' From 27015857223fe59ed7a164c1837fcd57e1b625ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Thu, 6 Mar 2014 10:25:52 +0100 Subject: [PATCH 086/172] Fix warning about unused member sub-attaq/boat_p.h:134:9: warning: private field 'key' is not used [-Wunused-private-field] Change-Id: I3f4cb1325aaac71d2bf0e7807381742937d173f7 Reviewed-by: Friedemann Kleint --- examples/widgets/animation/sub-attaq/boat_p.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/widgets/animation/sub-attaq/boat_p.h b/examples/widgets/animation/sub-attaq/boat_p.h index e12cbc74bde..fc3ba81d630 100644 --- a/examples/widgets/animation/sub-attaq/boat_p.h +++ b/examples/widgets/animation/sub-attaq/boat_p.h @@ -118,7 +118,7 @@ private: { public: KeyLaunchTransition(Boat *boat, QEvent::Type type, int key) - : QKeyEventTransition(boat, type, key), boat(boat), key(key) + : QKeyEventTransition(boat, type, key), boat(boat) { } protected: @@ -131,7 +131,6 @@ protected: } private: Boat * boat; - int key; }; //This state is describing when the boat is moving right From 2df1a6c4c9c7bed8dceb23a6b53014fb42014ded Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 27 Feb 2014 16:21:43 +0100 Subject: [PATCH 087/172] Cleanup SPDY stream closing We should not accept or process messages on closed streams, and unless we are in a half-closed state (having initiated close ourselves), we should respond to FIN with a FIN of our own. This patch means we no longer trigger all the corner case teardown on common sites that were fixed in earlier patches. Change-Id: I0d2bab62700a0022a959e66c7053afbad07a9f7e Reviewed-by: Peter Hartmann --- src/network/access/qspdyprotocolhandler.cpp | 49 +++++++-------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp index 6d5885eb680..6d22ebeb35d 100644 --- a/src/network/access/qspdyprotocolhandler.cpp +++ b/src/network/access/qspdyprotocolhandler.cpp @@ -911,6 +911,11 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD QHttpNetworkReply *httpReply = pair.second; Q_ASSERT(httpReply != 0); + if (httpReply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed) { + sendRST_STREAM(streamID, RST_STREAM_STREAM_ALREADY_CLOSED); + return; + } + QByteArray uncompressedHeader; if (!uncompressHeader(headerValuePairs, &uncompressedHeader)) { qWarning() << Q_FUNC_INFO << "error reading header from SYN_REPLY message"; @@ -973,22 +978,9 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD emit httpReply->headerChanged(); if (flag_fin) { - switch (httpReply->d_func()->state) { - case QHttpNetworkReplyPrivate::SPDYSYNSent: - httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYHalfClosed; - break; - case QHttpNetworkReplyPrivate::SPDYHalfClosed: - replyFinished(httpReply, streamID); - break; - case QHttpNetworkReplyPrivate::SPDYClosed: { - sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR); - replyFinishedWithError(httpReply, streamID, QNetworkReply::ProtocolFailure, - "server sent SYN_REPLY on an already closed stream"); - break; - } - default: - qWarning() << Q_FUNC_INFO << "got data frame in unknown state"; - } + if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed) + sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0); + replyFinished(httpReply, streamID); } } @@ -1238,6 +1230,11 @@ void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders) QHttpNetworkReplyPrivate *replyPrivate = httpReply->d_func(); + if (replyPrivate->state == QHttpNetworkReplyPrivate::SPDYClosed) { + sendRST_STREAM(streamID, RST_STREAM_STREAM_ALREADY_CLOSED); + return; + } + // check whether we need to send WINDOW_UPDATE (i.e. tell the sender it can send more) replyPrivate->currentlyReceivedDataInWindow += length; qint32 dataLeftInWindow = replyPrivate->windowSizeDownload - replyPrivate->currentlyReceivedDataInWindow; @@ -1290,23 +1287,9 @@ void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders) } if (flag_fin) { - switch (httpReply->d_func()->state) { - case QHttpNetworkReplyPrivate::SPDYSYNSent: - httpReply->d_func()->state = QHttpNetworkReplyPrivate::SPDYHalfClosed; - // ### send FIN ourselves? - break; - case QHttpNetworkReplyPrivate::SPDYHalfClosed: - replyFinished(httpReply, streamID); - break; - case QHttpNetworkReplyPrivate::SPDYClosed: { - sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR); - replyFinishedWithError(httpReply, streamID, QNetworkReply::ProtocolFailure, - "server sent data on an already closed stream"); - break; - } - default: - qWarning() << Q_FUNC_INFO << "got data frame in unknown state"; - } + if (httpReply->d_func()->state != QHttpNetworkReplyPrivate::SPDYHalfClosed) + sendDataFrame(streamID, DataFrame_FLAG_FIN, 0, 0); + replyFinished(httpReply, streamID); } } From cd652500af18671e0d64b30d51c79a0c45b973a3 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 14 Feb 2014 13:57:35 +0100 Subject: [PATCH 088/172] Add optimize_full qmake config option This patch adds a new config option to qmake to enable full optimization where it makes sense. This currently is supported on all gcc like compilers by exchanging -O2 for -O3. In qtbase it is used to enable full optimizations on qtcore and qtgui and in a later patch can be used to replace similar existing logic in QtWebKit's WTF and JavaScriptCore modules. This fixes a performance regression from gcc 4.7 to 4.8 in the software renderer. An aliasing error in qregion.cpp which was exposed by more aggresive optimization has been solved as well. Change-Id: Ic2c6c41b79cb3846212b40e7bcc11ff492beb27f Reviewed-by: Oswald Buddenhagen --- mkspecs/common/g++-base.conf | 2 +- mkspecs/common/gcc-base.conf | 5 ++++- mkspecs/features/default_post.prf | 9 +++++++++ src/corelib/corelib.pro | 2 ++ src/gui/gui.pro | 2 +- src/gui/painting/qdrawhelper.cpp | 14 -------------- src/gui/painting/qregion.cpp | 27 +++++++++++++++------------ 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/mkspecs/common/g++-base.conf b/mkspecs/common/g++-base.conf index 4d388137104..99c0d8078f8 100644 --- a/mkspecs/common/g++-base.conf +++ b/mkspecs/common/g++-base.conf @@ -15,7 +15,7 @@ QMAKE_CC = gcc QMAKE_LINK_C = $$QMAKE_CC QMAKE_LINK_C_SHLIB = $$QMAKE_CC -QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -g QMAKE_CXX = g++ diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf index e3e72741ab7..4326f919253 100644 --- a/mkspecs/common/gcc-base.conf +++ b/mkspecs/common/gcc-base.conf @@ -31,11 +31,14 @@ # you can use the manual test in tests/manual/mkspecs. # +QMAKE_CFLAGS_OPTIMIZE = -O2 +QMAKE_CFLAGS_OPTIMIZE_FULL = -O3 + QMAKE_CFLAGS += -pipe QMAKE_CFLAGS_DEPS += -M QMAKE_CFLAGS_WARN_ON += -Wall -W QMAKE_CFLAGS_WARN_OFF += -w -QMAKE_CFLAGS_RELEASE += -O2 +QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE QMAKE_CFLAGS_DEBUG += -g QMAKE_CFLAGS_SHLIB += -fPIC QMAKE_CFLAGS_STATIC_LIB += -fPIC diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index dd2923f9bef..938670b2a8b 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -38,6 +38,15 @@ force_debug_info { QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO } +optimize_full { + !isEmpty(QMAKE_CFLAGS_OPTIMIZE):!isEmpty(QMAKE_CFLAGS_OPTIMIZE_FULL) { + QMAKE_CFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE + QMAKE_CXXFLAGS_RELEASE -= $$QMAKE_CFLAGS_OPTIMIZE + QMAKE_CFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL + QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_OPTIMIZE_FULL + } +} + debug { QMAKE_CFLAGS += $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 79c90e0664e..812aee3252b 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -11,6 +11,8 @@ DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused +CONFIG += optimize_full + # otherwise mingw headers do not declare common functions like putenv mingw:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 8d37af6321a..f0832458099 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -30,7 +30,7 @@ testcocoon { mac:!ios: LIBS_PRIVATE += -framework Cocoa -CONFIG += simd +CONFIG += simd optimize_full include(accessible/accessible.pri) include(kernel/kernel.pri) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 66481d4287b..3f598cd3a73 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -39,20 +39,6 @@ ** ****************************************************************************/ -#if defined(__OPTIMIZE__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) \ - && (__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__ >= 440) -// GCC 4.4 supports #pragma GCC optimize and #pragma GCC target - -# if (__GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__ < 473) -// From GCC 4.7.3 onwards, GCC optimize can result in gcc bailing out with OOM -# pragma GCC optimize "O3" -# endif - -# if defined(__i386__) && defined(__SSE2__) && !defined(__SSE2_MATH__) -# pragma GCC target "fpmath=sse" -# endif -#endif - #include #ifdef Q_OS_IOS // We don't build the NEON drawhelpers as they are implemented partly diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index f58cd1c428d..beeac6bd436 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3528,7 +3528,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) QPoint *pts; /* output buffer */ EdgeTableEntry *pPrevAET; /* ptr to previous AET */ EdgeTable ET; /* header node for ET */ - EdgeTableEntry AET; /* header node for AET */ + EdgeTableEntry *AET; /* header node for AET */ EdgeTableEntry *pETEs; /* EdgeTableEntries pool */ ScanLineListBlock SLLBlock; /* header for scanlinelist */ int fixWAET = false; @@ -3567,8 +3567,9 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) region->vectorize(); + AET = new EdgeTableEntry; pts = FirstPtBlock.pts; - CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock); + CreateETandAET(Count, Pts, &ET, AET, pETEs, &SLLBlock); pSLL = ET.scanlines.next; curPtBlock = &FirstPtBlock; @@ -3579,6 +3580,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) #ifndef QT_NO_DEBUG qWarning("QRegion: creating region from big polygon failed...!"); #endif + delete AET; delete region; return 0; } @@ -3596,11 +3598,11 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) * get to the next edge. */ if (pSLL && y == pSLL->scanline) { - loadAET(&AET, pSLL->edgelist); + loadAET(AET, pSLL->edgelist); pSLL = pSLL->next; } - pPrevAET = &AET; - pAET = AET.next; + pPrevAET = AET; + pAET = AET->next; /* * for each active edge @@ -3626,7 +3628,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) } EVALUATEEDGEEVENODD(pAET, pPrevAET, y) } - InsertionSort(&AET); + InsertionSort(AET); } } else { /* @@ -3638,12 +3640,12 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) * get to the next edge. */ if (pSLL && y == pSLL->scanline) { - loadAET(&AET, pSLL->edgelist); - computeWAET(&AET); + loadAET(AET, pSLL->edgelist); + computeWAET(AET); pSLL = pSLL->next; } - pPrevAET = &AET; - pAET = AET.next; + pPrevAET = AET; + pAET = AET->next; pWETE = pAET; /* @@ -3681,8 +3683,8 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) * recompute the winding active edge table if * we just resorted or have exited an edge. */ - if (InsertionSort(&AET) || fixWAET) { - computeWAET(&AET); + if (InsertionSort(AET) || fixWAET) { + computeWAET(AET); fixWAET = false; } } @@ -3706,6 +3708,7 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) free(curPtBlock); curPtBlock = tmpPtBlock; } + delete AET; free(pETEs); return region; } From 7b1058ac92276b81b1d5164fb4ba651421df7990 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 6 Mar 2014 12:01:54 +0100 Subject: [PATCH 089/172] Do not attempt to open multiple windows in hellowindow on embedded Platforms like eglfs will not allow opening more than one OpenGL-based window. To prevent aborting the hellowindow example when invoked without --single, enhance the capability check to include also WindowManagement in addition to ThreadedOpenGL. Change-Id: I147d90b31d9fd94912c36339d36af3f311aaa874 Reviewed-by: Andy Nichols --- examples/opengl/hellowindow/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/opengl/hellowindow/main.cpp b/examples/opengl/hellowindow/main.cpp index d6802a8e208..5b2552ee3ee 100644 --- a/examples/opengl/hellowindow/main.cpp +++ b/examples/opengl/hellowindow/main.cpp @@ -51,8 +51,9 @@ int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - const bool multipleWindows = - QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL) + QPlatformIntegration *integ = QGuiApplicationPrivate::platformIntegration(); + const bool multipleWindows = integ->hasCapability(QPlatformIntegration::ThreadedOpenGL) + && integ->hasCapability(QPlatformIntegration::WindowManagement) && !QGuiApplication::arguments().contains(QStringLiteral("--single")); QScreen *screen = QGuiApplication::primaryScreen(); From aff7e6c02e35641f7d7a2e7543d0f905d96e1667 Mon Sep 17 00:00:00 2001 From: Thomas Senyk Date: Mon, 3 Mar 2014 18:15:37 +0100 Subject: [PATCH 090/172] simd.prf: replace CONFIG based neon check with a QT_CPU_FEATURES check If one doesn't set CONFIG+=neon in it's mkspec but the compiler enables it, Qt fails during linking of libQtGui, because simd.prf isn't executed as needed (doesn't run into neon{..}). Although a mkspec which enabled neon (-mfpu=neon) without CONFIG+=neon could be considered broken, it's still simpler to just 'fix' Qt to not fail unexpected. Follow-up to e5066a3a2eb965e64f6bf6e112739222574d66d7 Task-number: QTBUG-37264 Change-Id: I3aa0afbe430547971e76c2c988697c133d69796b Reviewed-by: Oswald Buddenhagen --- mkspecs/features/simd.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/simd.prf b/mkspecs/features/simd.prf index 84a5d16d77b..4f86f607002 100644 --- a/mkspecs/features/simd.prf +++ b/mkspecs/features/simd.prf @@ -117,7 +117,7 @@ QT_CPU_FEATURES = $$eval(QT_CPU_FEATURES.$$QT_ARCH) silent:avx2_compiler.commands = @echo compiling[avx2] ${QMAKE_FILE_IN} && $$avx2_compiler.commands QMAKE_EXTRA_COMPILERS += avx2_compiler } - neon { + contains(QT_CPU_FEATURES.$$QT_ARCH, neon) { HEADERS += $$NEON_HEADERS neon_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) From 77024a62fefd641ad45371823c77530dcced2750 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 6 Mar 2014 10:56:32 +0100 Subject: [PATCH 091/172] Unify default dpi between eglfs and linuxfb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-37251 Change-Id: I4ab8e645441f6ad3a122304e1ead050b48fafbac Reviewed-by: Jørgen Lind --- src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp index 5af84918d9a..aca8d76041a 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp @@ -148,7 +148,7 @@ static QSizeF determinePhysicalSize(const fb_var_screeninfo &vinfo, const QSize mmWidth = vinfo.width; mmHeight = vinfo.height; } else { - const int dpi = 72; + const int dpi = 100; mmWidth = qRound(res.width() * 25.4 / dpi); mmHeight = qRound(res.height() * 25.4 / dpi); } From b0d7e7b2826e7cbc6c93c17366ee59424240bf98 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 6 Mar 2014 12:13:14 +0100 Subject: [PATCH 092/172] Avoid polluting debug output in eglfs and linuxfb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Size hints will not be implemented. Grabs maybe some day but the warnings should be silenced for now. Change-Id: I1f4861454d45e668c4d758c7f82940cd1136d0c8 Reviewed-by: Jørgen Lind --- .../fbconvenience/qfbwindow_p.h | 20 +++++++++++-------- src/plugins/platforms/eglfs/qeglfswindow.h | 4 ++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/platformsupport/fbconvenience/qfbwindow_p.h b/src/platformsupport/fbconvenience/qfbwindow_p.h index 5ad921b0d79..a2e0785c960 100644 --- a/src/platformsupport/fbconvenience/qfbwindow_p.h +++ b/src/platformsupport/fbconvenience/qfbwindow_p.h @@ -55,17 +55,17 @@ public: QFbWindow(QWindow *window); ~QFbWindow(); - virtual void raise(); - virtual void lower(); + void raise() Q_DECL_OVERRIDE; + void lower() Q_DECL_OVERRIDE; - virtual void setGeometry(const QRect &rect); - virtual void setVisible(bool visible); + void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; + void setVisible(bool visible) Q_DECL_OVERRIDE; - virtual void setWindowState(Qt::WindowState state); - virtual void setWindowFlags(Qt::WindowFlags type); - virtual Qt::WindowFlags windowFlags() const; + void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; + void setWindowFlags(Qt::WindowFlags type) Q_DECL_OVERRIDE; + Qt::WindowFlags windowFlags() const; - WId winId() const { return mWindowId; } + WId winId() const Q_DECL_OVERRIDE { return mWindowId; } void setBackingStore(QFbBackingStore *store) { mBackingStore = store; } QFbBackingStore *backingStore() const { return mBackingStore; } @@ -74,6 +74,10 @@ public: virtual void repaint(const QRegion&); + void propagateSizeHints() Q_DECL_OVERRIDE { } + bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } + bool setMouseGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } + protected: friend class QFbScreen; diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h index f93a9d54bc2..c8c31816a0c 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.h +++ b/src/plugins/platforms/eglfs/qeglfswindow.h @@ -65,6 +65,10 @@ public: void raise() Q_DECL_OVERRIDE; void lower() Q_DECL_OVERRIDE; + void propagateSizeHints() Q_DECL_OVERRIDE { } + bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } + bool setMouseGrabEnabled(bool) Q_DECL_OVERRIDE { return false; } + QSurfaceFormat format() const Q_DECL_OVERRIDE; EGLNativeWindowType eglWindow() const Q_DECL_OVERRIDE; EGLSurface surface() const; From 3d73e11ccc721130af520539fd72d5326626e2c6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 6 Mar 2014 12:01:52 +0100 Subject: [PATCH 093/172] Increase CI timeout for cmake tests. Change-Id: I1711f99f9e46f1d195684e3c3a714b00618dca2e Reviewed-by: Sergio Ahumada Reviewed-by: Stephen Kelly --- tests/auto/cmake/cmake.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro index 715e710490f..9c715974f83 100644 --- a/tests/auto/cmake/cmake.pro +++ b/tests/auto/cmake/cmake.pro @@ -13,3 +13,4 @@ qtHaveModule(opengl): CMAKE_QT_MODULES_UNDER_TEST += opengl qtHaveModule(concurrent): CMAKE_QT_MODULES_UNDER_TEST += concurrent CONFIG += ctest_testcase +win32:testcase.timeout = 1000 # this test is slow on Windows From 37f5935a8985c38e4f7e227214cc3b0bffec32b0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 6 Mar 2014 11:02:48 +0100 Subject: [PATCH 094/172] tst_QGLThreads: Fix errors about makeCurrent() in different thread. QFATAL : tst_QGLThreads::textureUploadInThread() Cannot make QOpenGLContext current in a different thread QFATAL : tst_QGLThreads::painterOnPboInThread() Cannot make QOpenGLContext current in a different thread Task-number: QTBUG-28264 Change-Id: I281cf0593e01b43456410a9a53746bbb15f34f24 Reviewed-by: Laszlo Agocs --- tests/auto/opengl/qglthreads/tst_qglthreads.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 63c6cb658be..999761e3f02 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -216,6 +216,11 @@ public: { m_gl = new QGLWidget(0, shareWidget); moveToThread(this); + + } + + void moveContextToThread() + { m_gl->context()->moveToThread(this); } @@ -307,6 +312,7 @@ void tst_QGLThreads::textureUploadInThread() display.show(); QVERIFY(QTest::qWaitForWindowActive(&display)); + thread.moveContextToThread(); thread.start(); while (thread.isRunning()) { @@ -630,6 +636,12 @@ class PaintThreadManager public: PaintThreadManager(int count) : numThreads(count) { + for (int i=0; i Date: Wed, 26 Feb 2014 16:55:34 +0100 Subject: [PATCH 095/172] Update bundled libxcb-xkb version to 1.10 To utilize the new xkb_x11_* API from libxkbcommon 0.4.0, we need to update the bundled libxcb-xkb version to 1.10, which is the minimal required version. Change-Id: I0b72a2684bd11cbe5ae65d6dab7292be3a76464c Reviewed-by: Lars Knoll --- src/3rdparty/xcb/README | 3 +- src/3rdparty/xcb/include/xcb/xkb.h | 4226 ++------- ...rsions_where_xcb_sumof_not_available.patch | 273 + src/3rdparty/xcb/libxcb/xkb.c | 8129 +++-------------- src/3rdparty/xcb/libxcb/xkb.patch | 172 - .../platforms/xcb/xcb-static/xcb-static.pro | 3 +- 6 files changed, 2035 insertions(+), 10771 deletions(-) create mode 100644 src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch delete mode 100644 src/3rdparty/xcb/libxcb/xkb.patch diff --git a/src/3rdparty/xcb/README b/src/3rdparty/xcb/README index 4d275ef5a85..4de7a17409d 100644 --- a/src/3rdparty/xcb/README +++ b/src/3rdparty/xcb/README @@ -1,7 +1,8 @@ Contains the header and sources files from selected xcb libraries: libxcb-1.5 together with xcb-proto-1.6 (sync, xfixes, randr sources) - libxcb-1.8.1 together with xcb-proto-1.8 (xkb sources) + # libxkbcommon-x11 requires libxcb-xkb >= 1.10 + libxcb-1.10 together with xcb-proto-1.10 (xkb sources) libxcb-util-image-0.3.9 libxcb-util-keysyms-0.3.9 libxcb-util-renderutil-0.3.8 diff --git a/src/3rdparty/xcb/include/xcb/xkb.h b/src/3rdparty/xcb/include/xcb/xkb.h index 0180ec8b587..66b47121940 100644 --- a/src/3rdparty/xcb/include/xcb/xkb.h +++ b/src/3rdparty/xcb/include/xcb/xkb.h @@ -118,41 +118,21 @@ typedef enum xcb_xkb_control_t { XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648u } xcb_xkb_control_t; -typedef enum xcb_xkb_axfb_opt_t { - XCB_XKB_AXFB_OPT_SK_PRESS_FB = 1, - XCB_XKB_AXFB_OPT_SK_ACCEPT_FB = 2, - XCB_XKB_AXFB_OPT_FEATURE_FB = 4, - XCB_XKB_AXFB_OPT_SLOW_WARN_FB = 8, - XCB_XKB_AXFB_OPT_INDICATOR_FB = 16, - XCB_XKB_AXFB_OPT_STICKY_KEYS_FB = 32, - XCB_XKB_AXFB_OPT_SK_RELEASE_FB = 64, - XCB_XKB_AXFB_OPT_SK_REJECT_FB = 128, - XCB_XKB_AXFB_OPT_BK_REJECT_FB = 256, - XCB_XKB_AXFB_OPT_DUMB_BELL = 512 -} xcb_xkb_axfb_opt_t; - -typedef enum xcb_xkb_axsk_opt_t { - XCB_XKB_AXSK_OPT_TWO_KEYS = 64, - XCB_XKB_AXSK_OPT_LATCH_TO_LOCK = 128 -} xcb_xkb_axsk_opt_t; - -/** - * @brief xcb_xkb_ax_option_t - **/ -typedef union xcb_xkb_ax_option_t { - uint16_t fbopt; /**< */ - uint16_t skopt; /**< */ +typedef enum xcb_xkb_ax_option_t { + XCB_XKB_AX_OPTION_SK_PRESS_FB = 1, + XCB_XKB_AX_OPTION_SK_ACCEPT_FB = 2, + XCB_XKB_AX_OPTION_FEATURE_FB = 4, + XCB_XKB_AX_OPTION_SLOW_WARN_FB = 8, + XCB_XKB_AX_OPTION_INDICATOR_FB = 16, + XCB_XKB_AX_OPTION_STICKY_KEYS_FB = 32, + XCB_XKB_AX_OPTION_TWO_KEYS = 64, + XCB_XKB_AX_OPTION_LATCH_TO_LOCK = 128, + XCB_XKB_AX_OPTION_SK_RELEASE_FB = 256, + XCB_XKB_AX_OPTION_SK_REJECT_FB = 512, + XCB_XKB_AX_OPTION_BK_REJECT_FB = 1024, + XCB_XKB_AX_OPTION_DUMB_BELL = 2048 } xcb_xkb_ax_option_t; -/** - * @brief xcb_xkb_ax_option_iterator_t - **/ -typedef struct xcb_xkb_ax_option_iterator_t { - xcb_xkb_ax_option_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_ax_option_iterator_t; - typedef uint16_t xcb_xkb_device_spec_t; /** @@ -170,6 +150,8 @@ typedef enum xcb_xkb_led_class_result_t { } xcb_xkb_led_class_result_t; typedef enum xcb_xkb_led_class_t { + XCB_XKB_LED_CLASS_KBD_FEEDBACK_CLASS = 0, + XCB_XKB_LED_CLASS_LED_FEEDBACK_CLASS = 4, XCB_XKB_LED_CLASS_DFLT_XI_CLASS = 768, XCB_XKB_LED_CLASS_ALL_XI_CLASSES = 1280 } xcb_xkb_led_class_t; @@ -191,6 +173,8 @@ typedef enum xcb_xkb_bell_class_result_t { } xcb_xkb_bell_class_result_t; typedef enum xcb_xkb_bell_class_t { + XCB_XKB_BELL_CLASS_KBD_FEEDBACK_CLASS = 0, + XCB_XKB_BELL_CLASS_BELL_FEEDBACK_CLASS = 5, XCB_XKB_BELL_CLASS_DFLT_XI_CLASS = 768 } xcb_xkb_bell_class_t; @@ -307,13 +291,13 @@ typedef enum xcb_xkb_explicit_t { XCB_XKB_EXPLICIT_KEY_TYPE_1 = 1 } xcb_xkb_explicit_t; -typedef enum xcb_xkb_sym_interpret_t { - XCB_XKB_SYM_INTERPRET_NONE_OF = 0, - XCB_XKB_SYM_INTERPRET_ANY_OF_OR_NONE = 1, - XCB_XKB_SYM_INTERPRET_ANY_OF = 2, - XCB_XKB_SYM_INTERPRET_ALL_OF = 3, - XCB_XKB_SYM_INTERPRET_EXACTLY = 4 -} xcb_xkb_sym_interpret_t; +typedef enum xcb_xkb_sym_interpret_match_t { + XCB_XKB_SYM_INTERPRET_MATCH_NONE_OF = 0, + XCB_XKB_SYM_INTERPRET_MATCH_ANY_OF_OR_NONE = 1, + XCB_XKB_SYM_INTERPRET_MATCH_ANY_OF = 2, + XCB_XKB_SYM_INTERPRET_MATCH_ALL_OF = 3, + XCB_XKB_SYM_INTERPRET_MATCH_EXACTLY = 4 +} xcb_xkb_sym_interpret_match_t; typedef enum xcb_xkb_sym_interp_match_t { XCB_XKB_SYM_INTERP_MATCH_LEVEL_ONE_ONLY = 128, @@ -436,7 +420,7 @@ typedef struct xcb_xkb_mod_def_iterator_t { * @brief xcb_xkb_key_name_t **/ typedef struct xcb_xkb_key_name_t { - uint8_t name[4]; /**< */ + char name[4]; /**< */ } xcb_xkb_key_name_t; /** @@ -452,8 +436,8 @@ typedef struct xcb_xkb_key_name_iterator_t { * @brief xcb_xkb_key_alias_t **/ typedef struct xcb_xkb_key_alias_t { - uint8_t real[4]; /**< */ - uint8_t alias[4]; /**< */ + char real[4]; /**< */ + char alias[4]; /**< */ } xcb_xkb_key_alias_t; /** @@ -465,28 +449,11 @@ typedef struct xcb_xkb_key_alias_iterator_t { int index; /**< */ } xcb_xkb_key_alias_iterator_t; -/** - * @brief xcb_xkb_counted_string_8_t - **/ -typedef struct xcb_xkb_counted_string_8_t { - uint8_t length; /**< */ -} xcb_xkb_counted_string_8_t; - -/** - * @brief xcb_xkb_counted_string_8_iterator_t - **/ -typedef struct xcb_xkb_counted_string_8_iterator_t { - xcb_xkb_counted_string_8_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_counted_string_8_iterator_t; - /** * @brief xcb_xkb_counted_string_16_t **/ typedef struct xcb_xkb_counted_string_16_t { uint16_t length; /**< */ - uint8_t pad0; /**< */ } xcb_xkb_counted_string_16_t; /** @@ -503,8 +470,8 @@ typedef struct xcb_xkb_counted_string_16_iterator_t { **/ typedef struct xcb_xkb_kt_map_entry_t { uint8_t active; /**< */ - uint8_t level; /**< */ uint8_t mods_mask; /**< */ + uint8_t level; /**< */ uint8_t mods_mods; /**< */ uint16_t mods_vmods; /**< */ uint8_t pad0[2]; /**< */ @@ -629,38 +596,21 @@ typedef struct xcb_xkb_radio_group_behavior_iterator_t { } xcb_xkb_radio_group_behavior_iterator_t; /** - * @brief xcb_xkb_overlay_1_behavior_t + * @brief xcb_xkb_overlay_behavior_t **/ -typedef struct xcb_xkb_overlay_1_behavior_t { +typedef struct xcb_xkb_overlay_behavior_t { uint8_t type; /**< */ xcb_keycode_t key; /**< */ -} xcb_xkb_overlay_1_behavior_t; +} xcb_xkb_overlay_behavior_t; /** - * @brief xcb_xkb_overlay_1_behavior_iterator_t + * @brief xcb_xkb_overlay_behavior_iterator_t **/ -typedef struct xcb_xkb_overlay_1_behavior_iterator_t { - xcb_xkb_overlay_1_behavior_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_overlay_1_behavior_iterator_t; - -/** - * @brief xcb_xkb_overlay_2_behavior_t - **/ -typedef struct xcb_xkb_overlay_2_behavior_t { - uint8_t type; /**< */ - uint8_t key; /**< */ -} xcb_xkb_overlay_2_behavior_t; - -/** - * @brief xcb_xkb_overlay_2_behavior_iterator_t - **/ -typedef struct xcb_xkb_overlay_2_behavior_iterator_t { - xcb_xkb_overlay_2_behavior_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_overlay_2_behavior_iterator_t; +typedef struct xcb_xkb_overlay_behavior_iterator_t { + xcb_xkb_overlay_behavior_t *data; /**< */ + int rem; /**< */ + int index; /**< */ +} xcb_xkb_overlay_behavior_iterator_t; /** * @brief xcb_xkb_permament_lock_behavior_t @@ -697,38 +647,21 @@ typedef struct xcb_xkb_permament_radio_group_behavior_iterator_t { } xcb_xkb_permament_radio_group_behavior_iterator_t; /** - * @brief xcb_xkb_permament_overlay_1_behavior_t + * @brief xcb_xkb_permament_overlay_behavior_t **/ -typedef struct xcb_xkb_permament_overlay_1_behavior_t { +typedef struct xcb_xkb_permament_overlay_behavior_t { uint8_t type; /**< */ xcb_keycode_t key; /**< */ -} xcb_xkb_permament_overlay_1_behavior_t; +} xcb_xkb_permament_overlay_behavior_t; /** - * @brief xcb_xkb_permament_overlay_1_behavior_iterator_t + * @brief xcb_xkb_permament_overlay_behavior_iterator_t **/ -typedef struct xcb_xkb_permament_overlay_1_behavior_iterator_t { - xcb_xkb_permament_overlay_1_behavior_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_permament_overlay_1_behavior_iterator_t; - -/** - * @brief xcb_xkb_permament_overlay_2_behavior_t - **/ -typedef struct xcb_xkb_permament_overlay_2_behavior_t { - uint8_t type; /**< */ - uint8_t key; /**< */ -} xcb_xkb_permament_overlay_2_behavior_t; - -/** - * @brief xcb_xkb_permament_overlay_2_behavior_iterator_t - **/ -typedef struct xcb_xkb_permament_overlay_2_behavior_iterator_t { - xcb_xkb_permament_overlay_2_behavior_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_permament_overlay_2_behavior_iterator_t; +typedef struct xcb_xkb_permament_overlay_behavior_iterator_t { + xcb_xkb_permament_overlay_behavior_t *data; /**< */ + int rem; /**< */ + int index; /**< */ +} xcb_xkb_permament_overlay_behavior_iterator_t; /** * @brief xcb_xkb_behavior_t @@ -738,12 +671,12 @@ typedef union xcb_xkb_behavior_t { xcb_xkb_default_behavior_t _default; /**< */ xcb_xkb_lock_behavior_t lock; /**< */ xcb_xkb_radio_group_behavior_t radioGroup; /**< */ - xcb_xkb_overlay_1_behavior_t overlay1; /**< */ - xcb_xkb_overlay_2_behavior_t overlay2; /**< */ + xcb_xkb_overlay_behavior_t overlay1; /**< */ + xcb_xkb_overlay_behavior_t overlay2; /**< */ xcb_xkb_permament_lock_behavior_t permamentLock; /**< */ xcb_xkb_permament_radio_group_behavior_t permamentRadioGroup; /**< */ - xcb_xkb_permament_overlay_1_behavior_t permamentOverlay1; /**< */ - xcb_xkb_permament_overlay_2_behavior_t permamentOverlay2; /**< */ + xcb_xkb_permament_overlay_behavior_t permamentOverlay1; /**< */ + xcb_xkb_permament_overlay_behavior_t permamentOverlay2; /**< */ uint8_t type; /**< */ } xcb_xkb_behavior_t; @@ -889,23 +822,6 @@ typedef struct xcb_xkb_string8_iterator_t { int index; /**< */ } xcb_xkb_string8_iterator_t; -/** - * @brief xcb_xkb_property_t - **/ -typedef struct xcb_xkb_property_t { - uint16_t nameLength; /**< */ - uint16_t valueLength; /**< */ -} xcb_xkb_property_t; - -/** - * @brief xcb_xkb_property_iterator_t - **/ -typedef struct xcb_xkb_property_iterator_t { - xcb_xkb_property_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_property_iterator_t; - /** * @brief xcb_xkb_outline_t **/ @@ -1044,210 +960,6 @@ typedef enum xcb_xkb_doodad_type_t { XCB_XKB_DOODAD_TYPE_LOGO = 5 } xcb_xkb_doodad_type_t; -/** - * @brief xcb_xkb_common_doodad_t - **/ -typedef struct xcb_xkb_common_doodad_t { - xcb_atom_t name; /**< */ - uint8_t type; /**< */ - uint8_t priority; /**< */ - int16_t top; /**< */ - int16_t left; /**< */ - int16_t angle; /**< */ -} xcb_xkb_common_doodad_t; - -/** - * @brief xcb_xkb_common_doodad_iterator_t - **/ -typedef struct xcb_xkb_common_doodad_iterator_t { - xcb_xkb_common_doodad_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_common_doodad_iterator_t; - -/** - * @brief xcb_xkb_shape_doodad_t - **/ -typedef struct xcb_xkb_shape_doodad_t { - xcb_atom_t name; /**< */ - uint8_t type; /**< */ - uint8_t priority; /**< */ - int16_t top; /**< */ - int16_t left; /**< */ - int16_t angle; /**< */ - uint8_t colorNdx; /**< */ - uint8_t shapeNdx; /**< */ - uint8_t pad0[6]; /**< */ -} xcb_xkb_shape_doodad_t; - -/** - * @brief xcb_xkb_shape_doodad_iterator_t - **/ -typedef struct xcb_xkb_shape_doodad_iterator_t { - xcb_xkb_shape_doodad_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_shape_doodad_iterator_t; - -/** - * @brief xcb_xkb_text_doodad_t - **/ -typedef struct xcb_xkb_text_doodad_t { - xcb_atom_t name; /**< */ - uint8_t type; /**< */ - uint8_t priority; /**< */ - int16_t top; /**< */ - int16_t left; /**< */ - int16_t angle; /**< */ - uint16_t width; /**< */ - uint16_t height; /**< */ - uint8_t colorNdx; /**< */ - uint8_t pad0[3]; /**< */ -} xcb_xkb_text_doodad_t; - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_t * xcb_xkb_text_doodad_text - ** - ** @param const xcb_xkb_text_doodad_t *R - ** @returns xcb_xkb_counted_string_16_t * - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_t * -xcb_xkb_text_doodad_text (const xcb_xkb_text_doodad_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_t * xcb_xkb_text_doodad_font - ** - ** @param const xcb_xkb_text_doodad_t *R - ** @returns xcb_xkb_counted_string_16_t * - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_t * -xcb_xkb_text_doodad_font (const xcb_xkb_text_doodad_t *R /**< */); - -/** - * @brief xcb_xkb_text_doodad_iterator_t - **/ -typedef struct xcb_xkb_text_doodad_iterator_t { - xcb_xkb_text_doodad_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_text_doodad_iterator_t; - -/** - * @brief xcb_xkb_indicator_doodad_t - **/ -typedef struct xcb_xkb_indicator_doodad_t { - xcb_atom_t name; /**< */ - uint8_t type; /**< */ - uint8_t priority; /**< */ - int16_t top; /**< */ - int16_t left; /**< */ - int16_t angle; /**< */ - uint8_t shapeNdx; /**< */ - uint8_t onColorNdx; /**< */ - uint8_t offColorNdx; /**< */ - uint8_t pad0[5]; /**< */ -} xcb_xkb_indicator_doodad_t; - -/** - * @brief xcb_xkb_indicator_doodad_iterator_t - **/ -typedef struct xcb_xkb_indicator_doodad_iterator_t { - xcb_xkb_indicator_doodad_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_indicator_doodad_iterator_t; - -/** - * @brief xcb_xkb_logo_doodad_t - **/ -typedef struct xcb_xkb_logo_doodad_t { - xcb_atom_t name; /**< */ - uint8_t type; /**< */ - uint8_t priority; /**< */ - int16_t top; /**< */ - int16_t left; /**< */ - int16_t angle; /**< */ - uint8_t colorNdx; /**< */ - uint8_t shapeNdx; /**< */ - uint8_t pad0[6]; /**< */ -} xcb_xkb_logo_doodad_t; - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_t * xcb_xkb_logo_doodad_logo_name - ** - ** @param const xcb_xkb_logo_doodad_t *R - ** @returns xcb_xkb_counted_string_16_t * - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_t * -xcb_xkb_logo_doodad_logo_name (const xcb_xkb_logo_doodad_t *R /**< */); - -/** - * @brief xcb_xkb_logo_doodad_iterator_t - **/ -typedef struct xcb_xkb_logo_doodad_iterator_t { - xcb_xkb_logo_doodad_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_logo_doodad_iterator_t; - -/** - * @brief xcb_xkb_doodad_t - **/ -typedef union xcb_xkb_doodad_t { - xcb_xkb_common_doodad_t common; /**< */ - xcb_xkb_shape_doodad_t shape; /**< */ - xcb_xkb_text_doodad_t *text; /**< */ - xcb_xkb_indicator_doodad_t indicator; /**< */ - xcb_xkb_logo_doodad_t *logo; /**< */ -} xcb_xkb_doodad_t; - -/** - * @brief xcb_xkb_doodad_iterator_t - **/ -typedef struct xcb_xkb_doodad_iterator_t { - xcb_xkb_doodad_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_doodad_iterator_t; - -/** - * @brief xcb_xkb_section_t - **/ -typedef struct xcb_xkb_section_t { - xcb_atom_t name; /**< */ - int16_t top; /**< */ - int16_t left; /**< */ - uint16_t width; /**< */ - uint16_t height; /**< */ - int16_t angle; /**< */ - uint8_t priority; /**< */ - uint8_t nRows; /**< */ - uint8_t nDoodads; /**< */ - uint8_t nOverlays; /**< */ - uint8_t pad0[2]; /**< */ -} xcb_xkb_section_t; - -/** - * @brief xcb_xkb_section_iterator_t - **/ -typedef struct xcb_xkb_section_iterator_t { - xcb_xkb_section_t *data; /**< */ - int rem; /**< */ - int index; /**< */ -} xcb_xkb_section_iterator_t; - /** * @brief xcb_xkb_listing_t **/ @@ -1548,7 +1260,7 @@ typedef struct xcb_xkb_sa_lock_ptr_btn_iterator_t { } xcb_xkb_sa_lock_ptr_btn_iterator_t; typedef enum xcb_xkb_sa_set_ptr_dflt_flag_t { - XCB_XKB_SA_SET_PTR_DFLT_FLAG_DFLT_BTN_ABSOLUTE = 2, + XCB_XKB_SA_SET_PTR_DFLT_FLAG_DFLT_BTN_ABSOLUTE = 4, XCB_XKB_SA_SET_PTR_DFLT_FLAG_AFFECT_DFLT_BUTTON = 1 } xcb_xkb_sa_set_ptr_dflt_flag_t; @@ -1792,6 +1504,7 @@ typedef struct xcb_xkb_sa_lock_device_btn_t { uint8_t pad0; /**< */ uint8_t button; /**< */ uint8_t device; /**< */ + uint8_t pad1[3]; /**< */ } xcb_xkb_sa_lock_device_btn_t; /** @@ -1835,6 +1548,44 @@ typedef struct xcb_xkb_sa_device_valuator_iterator_t { int index; /**< */ } xcb_xkb_sa_device_valuator_iterator_t; +/** + * @brief xcb_xkb_si_action_t + **/ +typedef struct xcb_xkb_si_action_t { + uint8_t type; /**< */ + uint8_t data[7]; /**< */ +} xcb_xkb_si_action_t; + +/** + * @brief xcb_xkb_si_action_iterator_t + **/ +typedef struct xcb_xkb_si_action_iterator_t { + xcb_xkb_si_action_t *data; /**< */ + int rem; /**< */ + int index; /**< */ +} xcb_xkb_si_action_iterator_t; + +/** + * @brief xcb_xkb_sym_interpret_t + **/ +typedef struct xcb_xkb_sym_interpret_t { + xcb_keysym_t sym; /**< */ + uint8_t mods; /**< */ + uint8_t match; /**< */ + uint8_t virtualMod; /**< */ + uint8_t flags; /**< */ + xcb_xkb_si_action_t action; /**< */ +} xcb_xkb_sym_interpret_t; + +/** + * @brief xcb_xkb_sym_interpret_iterator_t + **/ +typedef struct xcb_xkb_sym_interpret_iterator_t { + xcb_xkb_sym_interpret_t *data; /**< */ + int rem; /**< */ + int index; /**< */ +} xcb_xkb_sym_interpret_iterator_t; + /** * @brief xcb_xkb_action_t **/ @@ -2069,38 +1820,38 @@ typedef struct xcb_xkb_get_controls_request_t { * @brief xcb_xkb_get_controls_reply_t **/ typedef struct xcb_xkb_get_controls_reply_t { - uint8_t response_type; /**< */ - uint8_t deviceID; /**< */ - uint16_t sequence; /**< */ - uint32_t length; /**< */ - uint8_t mouseKeysDfltBtn; /**< */ - uint8_t numGroups; /**< */ - uint8_t groupsWrap; /**< */ - uint8_t internalModsMask; /**< */ - uint8_t ignoreLockModsMask; /**< */ - uint8_t internalModsRealMods; /**< */ - uint8_t ignoreLockModsRealMods; /**< */ - uint8_t pad0; /**< */ - uint16_t internalModsVmods; /**< */ - uint16_t ignoreLockModsVmods; /**< */ - uint16_t repeatDelay; /**< */ - uint16_t repeatInterval; /**< */ - uint16_t slowKeysDelay; /**< */ - uint16_t debounceDelay; /**< */ - uint16_t mouseKeysDelay; /**< */ - uint16_t mouseKeysInterval; /**< */ - uint16_t mouseKeysTimeToMax; /**< */ - uint16_t mouseKeysMaxSpeed; /**< */ - int16_t mouseKeysCurve; /**< */ - xcb_xkb_ax_option_t accessXOption; /**< */ - uint16_t accessXTimeout; /**< */ - xcb_xkb_ax_option_t accessXTimeoutOptionsMask; /**< */ - xcb_xkb_ax_option_t accessXTimeoutOptionsValues; /**< */ - uint8_t pad1[2]; /**< */ - uint32_t accessXTimeoutMask; /**< */ - uint32_t accessXTimeoutValues; /**< */ - uint32_t enabledControls; /**< */ - uint8_t perKeyRepeat[32]; /**< */ + uint8_t response_type; /**< */ + uint8_t deviceID; /**< */ + uint16_t sequence; /**< */ + uint32_t length; /**< */ + uint8_t mouseKeysDfltBtn; /**< */ + uint8_t numGroups; /**< */ + uint8_t groupsWrap; /**< */ + uint8_t internalModsMask; /**< */ + uint8_t ignoreLockModsMask; /**< */ + uint8_t internalModsRealMods; /**< */ + uint8_t ignoreLockModsRealMods; /**< */ + uint8_t pad0; /**< */ + uint16_t internalModsVmods; /**< */ + uint16_t ignoreLockModsVmods; /**< */ + uint16_t repeatDelay; /**< */ + uint16_t repeatInterval; /**< */ + uint16_t slowKeysDelay; /**< */ + uint16_t debounceDelay; /**< */ + uint16_t mouseKeysDelay; /**< */ + uint16_t mouseKeysInterval; /**< */ + uint16_t mouseKeysTimeToMax; /**< */ + uint16_t mouseKeysMaxSpeed; /**< */ + int16_t mouseKeysCurve; /**< */ + uint16_t accessXOption; /**< */ + uint16_t accessXTimeout; /**< */ + uint16_t accessXTimeoutOptionsMask; /**< */ + uint16_t accessXTimeoutOptionsValues; /**< */ + uint8_t pad1[2]; /**< */ + uint32_t accessXTimeoutMask; /**< */ + uint32_t accessXTimeoutValues; /**< */ + uint32_t enabledControls; /**< */ + uint8_t perKeyRepeat[32]; /**< */ } xcb_xkb_get_controls_reply_t; /** Opcode for xcb_xkb_set_controls. */ @@ -2124,7 +1875,7 @@ typedef struct xcb_xkb_set_controls_request_t { uint16_t ignoreLockVirtualMods; /**< */ uint8_t mouseKeysDfltBtn; /**< */ uint8_t groupsWrap; /**< */ - xcb_xkb_ax_option_t accessXOptions; /**< */ + uint16_t accessXOptions; /**< */ uint8_t pad0[2]; /**< */ uint32_t affectEnabledControls; /**< */ uint32_t enabledControls; /**< */ @@ -2141,8 +1892,8 @@ typedef struct xcb_xkb_set_controls_request_t { uint16_t accessXTimeout; /**< */ uint32_t accessXTimeoutMask; /**< */ uint32_t accessXTimeoutValues; /**< */ - xcb_xkb_ax_option_t accessXTimeoutOptionsMask; /**< */ - xcb_xkb_ax_option_t accessXTimeoutOptionsValues; /**< */ + uint16_t accessXTimeoutOptionsMask; /**< */ + uint16_t accessXTimeoutOptionsValues; /**< */ uint8_t perKeyRepeat[32]; /**< */ } xcb_xkb_set_controls_request_t; @@ -2191,11 +1942,15 @@ typedef struct xcb_xkb_get_map_map_t { xcb_xkb_key_type_t *types_rtrn; /**< */ xcb_xkb_key_sym_map_t *syms_rtrn; /**< */ uint8_t *acts_rtrn_count; /**< */ + uint8_t *alignment_pad; /**< */ xcb_xkb_action_t *acts_rtrn_acts; /**< */ xcb_xkb_set_behavior_t *behaviors_rtrn; /**< */ uint8_t *vmods_rtrn; /**< */ + uint8_t *alignment_pad2; /**< */ xcb_xkb_set_explicit_t *explicit_rtrn; /**< */ + uint16_t *alignment_pad3; /**< */ xcb_xkb_key_mod_map_t *modmap_rtrn; /**< */ + uint16_t *alignment_pad4; /**< */ xcb_xkb_key_v_mod_map_t *vmodmap_rtrn; /**< */ } xcb_xkb_get_map_map_t; @@ -2478,6 +2233,7 @@ typedef struct xcb_xkb_get_named_indicator_reply_t { uint8_t map_realMods; /**< */ uint16_t map_vmod; /**< */ uint32_t map_ctrls; /**< */ + uint8_t supported; /**< */ uint8_t pad0[3]; /**< */ } xcb_xkb_get_named_indicator_reply_t; @@ -2544,6 +2300,7 @@ typedef struct xcb_xkb_get_names_value_list_t { xcb_atom_t compatName; /**< */ xcb_atom_t *typeNames; /**< */ uint8_t *nLevelsPerType; /**< */ + uint8_t *alignment_pad; /**< */ xcb_atom_t *ktLevelNames; /**< */ xcb_atom_t *indicatorNames; /**< */ xcb_atom_t *virtualModNames; /**< */ @@ -2624,76 +2381,6 @@ typedef struct xcb_xkb_set_names_request_t { uint16_t totalKTLevelNames; /**< */ } xcb_xkb_set_names_request_t; -/** - * @brief xcb_xkb_get_geometry_cookie_t - **/ -typedef struct xcb_xkb_get_geometry_cookie_t { - unsigned int sequence; /**< */ -} xcb_xkb_get_geometry_cookie_t; - -/** Opcode for xcb_xkb_get_geometry. */ -#define XCB_XKB_GET_GEOMETRY 19 - -/** - * @brief xcb_xkb_get_geometry_request_t - **/ -typedef struct xcb_xkb_get_geometry_request_t { - uint8_t major_opcode; /**< */ - uint8_t minor_opcode; /**< */ - uint16_t length; /**< */ - xcb_xkb_device_spec_t deviceSpec; /**< */ - uint8_t pad0[2]; /**< */ - xcb_atom_t name; /**< */ -} xcb_xkb_get_geometry_request_t; - -/** - * @brief xcb_xkb_get_geometry_reply_t - **/ -typedef struct xcb_xkb_get_geometry_reply_t { - uint8_t response_type; /**< */ - uint8_t deviceID; /**< */ - uint16_t sequence; /**< */ - uint32_t length; /**< */ - xcb_atom_t name; /**< */ - uint8_t found; /**< */ - uint8_t pad0; /**< */ - uint16_t widthMM; /**< */ - uint16_t heightMM; /**< */ - uint16_t nProperties; /**< */ - uint16_t nColors; /**< */ - uint16_t nShapes; /**< */ - uint16_t nSections; /**< */ - uint16_t nDoodads; /**< */ - uint16_t nKeyAliases; /**< */ - uint8_t baseColorNdx; /**< */ - uint8_t labelColorNdx; /**< */ -} xcb_xkb_get_geometry_reply_t; - -/** Opcode for xcb_xkb_set_geometry. */ -#define XCB_XKB_SET_GEOMETRY 20 - -/** - * @brief xcb_xkb_set_geometry_request_t - **/ -typedef struct xcb_xkb_set_geometry_request_t { - uint8_t major_opcode; /**< */ - uint8_t minor_opcode; /**< */ - uint16_t length; /**< */ - xcb_xkb_device_spec_t deviceSpec; /**< */ - uint8_t nShapes; /**< */ - uint8_t nSections; /**< */ - xcb_atom_t name; /**< */ - uint16_t widthMM; /**< */ - uint16_t heightMM; /**< */ - uint16_t nProperties; /**< */ - uint16_t nColors; /**< */ - uint16_t nDoodads; /**< */ - uint16_t nKeyAliases; /**< */ - uint8_t baseColorNdx; /**< */ - uint8_t labelColorNdx; /**< */ - uint8_t pad0[2]; /**< */ -} xcb_xkb_set_geometry_request_t; - /** * @brief xcb_xkb_per_client_flags_cookie_t **/ @@ -2754,12 +2441,6 @@ typedef struct xcb_xkb_list_components_request_t { uint16_t length; /**< */ xcb_xkb_device_spec_t deviceSpec; /**< */ uint16_t maxNames; /**< */ - uint8_t keymapsSpecLen; /**< */ - uint8_t keycodesSpecLen; /**< */ - uint8_t typesSpecLen; /**< */ - uint8_t compatMapSpecLen; /**< */ - uint8_t symbolsSpecLen; /**< */ - uint8_t geometrySpecLen; /**< */ } xcb_xkb_list_components_request_t; /** @@ -2802,12 +2483,6 @@ typedef struct xcb_xkb_get_kbd_by_name_request_t { uint16_t want; /**< */ uint8_t load; /**< */ uint8_t pad0; /**< */ - uint8_t keymapsSpecLen; /**< */ - uint8_t keycodesSpecLen; /**< */ - uint8_t typesSpecLen; /**< */ - uint8_t compatMapSpecLen; /**< */ - uint8_t symbolsSpecLen; /**< */ - uint8_t geometrySpecLen; /**< */ } xcb_xkb_get_kbd_by_name_request_t; /** @@ -2825,36 +2500,6 @@ typedef struct xcb_xkb_get_kbd_by_name_replies_types_map_t { xcb_xkb_key_v_mod_map_t *vmodmap_rtrn; /**< */ } xcb_xkb_get_kbd_by_name_replies_types_map_t; -/** - * @brief xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t - **/ -typedef struct xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t { - xcb_xkb_key_type_t *types_rtrn; /**< */ - xcb_xkb_key_sym_map_t *syms_rtrn; /**< */ - uint8_t *acts_rtrn_count; /**< */ - xcb_xkb_action_t *acts_rtrn_acts; /**< */ - xcb_xkb_set_behavior_t *behaviors_rtrn; /**< */ - uint8_t *vmods_rtrn; /**< */ - xcb_xkb_set_explicit_t *explicit_rtrn; /**< */ - xcb_xkb_key_mod_map_t *modmap_rtrn; /**< */ - xcb_xkb_key_v_mod_map_t *vmodmap_rtrn; /**< */ -} xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t; - -/** - * @brief xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t - **/ -typedef struct xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t { - xcb_xkb_key_type_t *types_rtrn; /**< */ - xcb_xkb_key_sym_map_t *syms_rtrn; /**< */ - uint8_t *acts_rtrn_count; /**< */ - xcb_xkb_action_t *acts_rtrn_acts; /**< */ - xcb_xkb_set_behavior_t *behaviors_rtrn; /**< */ - uint8_t *vmods_rtrn; /**< */ - xcb_xkb_set_explicit_t *explicit_rtrn; /**< */ - xcb_xkb_key_mod_map_t *modmap_rtrn; /**< */ - xcb_xkb_key_v_mod_map_t *vmodmap_rtrn; /**< */ -} xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t; - /** * @brief xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t **/ @@ -2876,202 +2521,108 @@ typedef struct xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t { xcb_atom_t *radioGroupNames; /**< */ } xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t; -/** - * @brief xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t - **/ -typedef struct xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t { - xcb_atom_t keycodesName; /**< */ - xcb_atom_t geometryName; /**< */ - xcb_atom_t symbolsName; /**< */ - xcb_atom_t physSymbolsName; /**< */ - xcb_atom_t typesName; /**< */ - xcb_atom_t compatName; /**< */ - xcb_atom_t *typeNames; /**< */ - uint8_t *nLevelsPerType; /**< */ - xcb_atom_t *ktLevelNames; /**< */ - xcb_atom_t *indicatorNames; /**< */ - xcb_atom_t *virtualModNames; /**< */ - xcb_atom_t *groups; /**< */ - xcb_xkb_key_name_t *keyNames; /**< */ - xcb_xkb_key_alias_t *keyAliases; /**< */ - xcb_atom_t *radioGroupNames; /**< */ -} xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t; - /** * @brief xcb_xkb_get_kbd_by_name_replies_t **/ typedef struct xcb_xkb_get_kbd_by_name_replies_t { struct _types { - uint8_t getmap_type; /**< */ - uint8_t typeDeviceID; /**< */ - uint16_t getmap_sequence; /**< */ - uint32_t getmap_length; /**< */ - uint8_t pad0[2]; /**< */ - xcb_keycode_t typeMinKeyCode; /**< */ - xcb_keycode_t typeMaxKeyCode; /**< */ - uint16_t present; /**< */ - uint8_t firstType; /**< */ - uint8_t nTypes; /**< */ - uint8_t totalTypes; /**< */ - xcb_keycode_t firstKeySym; /**< */ - uint16_t totalSyms; /**< */ - uint8_t nKeySyms; /**< */ - xcb_keycode_t firstKeyAction; /**< */ - uint16_t totalActions; /**< */ - uint8_t nKeyActions; /**< */ - xcb_keycode_t firstKeyBehavior; /**< */ - uint8_t nKeyBehaviors; /**< */ - uint8_t totalKeyBehaviors; /**< */ - xcb_keycode_t firstKeyExplicit; /**< */ - uint8_t nKeyExplicit; /**< */ - uint8_t totalKeyExplicit; /**< */ - xcb_keycode_t firstModMapKey; /**< */ - uint8_t nModMapKeys; /**< */ - uint8_t totalModMapKeys; /**< */ - xcb_keycode_t firstVModMapKey; /**< */ - uint8_t nVModMapKeys; /**< */ - uint8_t totalVModMapKeys; /**< */ - uint8_t pad1; /**< */ - uint16_t virtualMods; /**< */ - xcb_xkb_get_kbd_by_name_replies_types_map_t map; /**< */ + uint8_t getmap_type; /**< */ + uint8_t typeDeviceID; /**< */ + uint16_t getmap_sequence; /**< */ + uint32_t getmap_length; /**< */ + uint8_t pad0[2]; /**< */ + xcb_keycode_t typeMinKeyCode; /**< */ + xcb_keycode_t typeMaxKeyCode; /**< */ + uint16_t present; /**< */ + uint8_t firstType; /**< */ + uint8_t nTypes; /**< */ + uint8_t totalTypes; /**< */ + xcb_keycode_t firstKeySym; /**< */ + uint16_t totalSyms; /**< */ + uint8_t nKeySyms; /**< */ + xcb_keycode_t firstKeyAction; /**< */ + uint16_t totalActions; /**< */ + uint8_t nKeyActions; /**< */ + xcb_keycode_t firstKeyBehavior; /**< */ + uint8_t nKeyBehaviors; /**< */ + uint8_t totalKeyBehaviors; /**< */ + xcb_keycode_t firstKeyExplicit; /**< */ + uint8_t nKeyExplicit; /**< */ + uint8_t totalKeyExplicit; /**< */ + xcb_keycode_t firstModMapKey; /**< */ + uint8_t nModMapKeys; /**< */ + uint8_t totalModMapKeys; /**< */ + xcb_keycode_t firstVModMapKey; /**< */ + uint8_t nVModMapKeys; /**< */ + uint8_t totalVModMapKeys; /**< */ + uint8_t pad1; /**< */ + uint16_t virtualMods; /**< */ + xcb_xkb_get_kbd_by_name_replies_types_map_t map; /**< */ } types; struct _compat_map { - uint8_t compatDeviceID; /**< */ - uint8_t groupsRtrn; /**< */ - uint8_t pad0; /**< */ - uint16_t firstSIRtrn; /**< */ - uint16_t nSIRtrn; /**< */ - uint16_t nTotalSI; /**< */ - uint8_t pad1[16]; /**< */ - uint8_t *si_rtrn; /**< */ - xcb_xkb_mod_def_t *group_rtrn; /**< */ + uint8_t compatmap_type; /**< */ + uint8_t compatDeviceID; /**< */ + uint16_t compatmap_sequence; /**< */ + uint32_t compatmap_length; /**< */ + uint8_t groupsRtrn; /**< */ + uint8_t pad0; /**< */ + uint16_t firstSIRtrn; /**< */ + uint16_t nSIRtrn; /**< */ + uint16_t nTotalSI; /**< */ + uint8_t pad1[16]; /**< */ + xcb_xkb_sym_interpret_t *si_rtrn; /**< */ + xcb_xkb_mod_def_t *group_rtrn; /**< */ } compat_map; - struct _client_symbols { - uint8_t clientDeviceID; /**< */ - uint8_t pad0[2]; /**< */ - xcb_keycode_t clientMinKeyCode; /**< */ - xcb_keycode_t clientMaxKeyCode; /**< */ - uint16_t present; /**< */ - uint8_t firstType; /**< */ - uint8_t nTypes; /**< */ - uint8_t totalTypes; /**< */ - xcb_keycode_t firstKeySym; /**< */ - uint16_t totalSyms; /**< */ - uint8_t nKeySyms; /**< */ - xcb_keycode_t firstKeyAction; /**< */ - uint16_t totalActions; /**< */ - uint8_t nKeyActions; /**< */ - xcb_keycode_t firstKeyBehavior; /**< */ - uint8_t nKeyBehaviors; /**< */ - uint8_t totalKeyBehaviors; /**< */ - xcb_keycode_t firstKeyExplicit; /**< */ - uint8_t nKeyExplicit; /**< */ - uint8_t totalKeyExplicit; /**< */ - xcb_keycode_t firstModMapKey; /**< */ - uint8_t nModMapKeys; /**< */ - uint8_t totalModMapKeys; /**< */ - xcb_keycode_t firstVModMapKey; /**< */ - uint8_t nVModMapKeys; /**< */ - uint8_t totalVModMapKeys; /**< */ - uint8_t pad1; /**< */ - uint16_t virtualMods; /**< */ - xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t map; /**< */ - } client_symbols; - struct _server_symbols { - uint8_t serverDeviceID; /**< */ - uint8_t pad0[2]; /**< */ - xcb_keycode_t serverMinKeyCode; /**< */ - xcb_keycode_t serverMaxKeyCode; /**< */ - uint16_t present; /**< */ - uint8_t firstType; /**< */ - uint8_t nTypes; /**< */ - uint8_t totalTypes; /**< */ - xcb_keycode_t firstKeySym; /**< */ - uint16_t totalSyms; /**< */ - uint8_t nKeySyms; /**< */ - xcb_keycode_t firstKeyAction; /**< */ - uint16_t totalActions; /**< */ - uint8_t nKeyActions; /**< */ - xcb_keycode_t firstKeyBehavior; /**< */ - uint8_t nKeyBehaviors; /**< */ - uint8_t totalKeyBehaviors; /**< */ - xcb_keycode_t firstKeyExplicit; /**< */ - uint8_t nKeyExplicit; /**< */ - uint8_t totalKeyExplicit; /**< */ - xcb_keycode_t firstModMapKey; /**< */ - uint8_t nModMapKeys; /**< */ - uint8_t totalModMapKeys; /**< */ - xcb_keycode_t firstVModMapKey; /**< */ - uint8_t nVModMapKeys; /**< */ - uint8_t totalVModMapKeys; /**< */ - uint8_t pad1; /**< */ - uint16_t virtualMods; /**< */ - xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t map; /**< */ - } server_symbols; struct _indicator_maps { - uint8_t indicatorDeviceID; /**< */ - uint32_t which; /**< */ - uint32_t realIndicators; /**< */ - uint8_t nIndicators; /**< */ - uint8_t pad0[15]; /**< */ - xcb_xkb_indicator_map_t *maps; /**< */ + uint8_t indicatormap_type; /**< */ + uint8_t indicatorDeviceID; /**< */ + uint16_t indicatormap_sequence; /**< */ + uint32_t indicatormap_length; /**< */ + uint32_t which; /**< */ + uint32_t realIndicators; /**< */ + uint8_t nIndicators; /**< */ + uint8_t pad0[15]; /**< */ + xcb_xkb_indicator_map_t *maps; /**< */ } indicator_maps; struct _key_names { - uint8_t keyDeviceID; /**< */ - uint32_t which; /**< */ - xcb_keycode_t keyMinKeyCode; /**< */ - xcb_keycode_t keyMaxKeyCode; /**< */ - uint8_t nTypes; /**< */ - uint8_t groupNames; /**< */ - uint16_t virtualMods; /**< */ - xcb_keycode_t firstKey; /**< */ - uint8_t nKeys; /**< */ - uint32_t indicators; /**< */ - uint8_t nRadioGroups; /**< */ - uint8_t nKeyAliases; /**< */ - uint16_t nKTLevels; /**< */ - uint8_t pad0[4]; /**< */ - xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t valueList; /**< */ + uint8_t keyname_type; /**< */ + uint8_t keyDeviceID; /**< */ + uint16_t keyname_sequence; /**< */ + uint32_t keyname_length; /**< */ + uint32_t which; /**< */ + xcb_keycode_t keyMinKeyCode; /**< */ + xcb_keycode_t keyMaxKeyCode; /**< */ + uint8_t nTypes; /**< */ + uint8_t groupNames; /**< */ + uint16_t virtualMods; /**< */ + xcb_keycode_t firstKey; /**< */ + uint8_t nKeys; /**< */ + uint32_t indicators; /**< */ + uint8_t nRadioGroups; /**< */ + uint8_t nKeyAliases; /**< */ + uint16_t nKTLevels; /**< */ + uint8_t pad0[4]; /**< */ + xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t valueList; /**< */ } key_names; - struct _other_names { - uint8_t otherDeviceID; /**< */ - uint32_t which; /**< */ - xcb_keycode_t otherMinKeyCode; /**< */ - xcb_keycode_t otherMaxKeyCode; /**< */ - uint8_t nTypes; /**< */ - uint8_t groupNames; /**< */ - uint16_t virtualMods; /**< */ - xcb_keycode_t firstKey; /**< */ - uint8_t nKeys; /**< */ - uint32_t indicators; /**< */ - uint8_t nRadioGroups; /**< */ - uint8_t nKeyAliases; /**< */ - uint16_t nKTLevels; /**< */ - uint8_t pad0[4]; /**< */ - xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t valueList; /**< */ - } other_names; struct _geometry { - uint8_t geometryDeviceID; /**< */ - xcb_atom_t name; /**< */ - uint8_t geometryFound; /**< */ - uint8_t pad0; /**< */ - uint16_t widthMM; /**< */ - uint16_t heightMM; /**< */ - uint16_t nProperties; /**< */ - uint16_t nColors; /**< */ - uint16_t nShapes; /**< */ - uint16_t nSections; /**< */ - uint16_t nDoodads; /**< */ - uint16_t nKeyAliases; /**< */ - uint8_t baseColorNdx; /**< */ - uint8_t labelColorNdx; /**< */ - xcb_xkb_counted_string_16_t *labelFont; /**< */ - xcb_xkb_property_t *properties; /**< */ - xcb_xkb_counted_string_16_t *colors; /**< */ - xcb_xkb_shape_t *shapes; /**< */ - xcb_xkb_section_t *sections; /**< */ - xcb_xkb_doodad_t *doodads; /**< */ - xcb_xkb_key_alias_t *keyAliases; /**< */ + uint8_t geometry_type; /**< */ + uint8_t geometryDeviceID; /**< */ + uint16_t geometry_sequence; /**< */ + uint32_t geometry_length; /**< */ + xcb_atom_t name; /**< */ + uint8_t geometryFound; /**< */ + uint8_t pad0; /**< */ + uint16_t widthMM; /**< */ + uint16_t heightMM; /**< */ + uint16_t nProperties; /**< */ + uint16_t nColors; /**< */ + uint16_t nShapes; /**< */ + uint16_t nSections; /**< */ + uint16_t nDoodads; /**< */ + uint16_t nKeyAliases; /**< */ + uint8_t baseColorNdx; /**< */ + uint8_t labelColorNdx; /**< */ + xcb_xkb_counted_string_16_t *labelFont; /**< */ } geometry; } xcb_xkb_get_kbd_by_name_replies_t; @@ -3490,7 +3041,7 @@ typedef struct xcb_xkb_extension_device_notify_event_t { uint8_t pad0; /**< */ uint16_t reason; /**< */ uint16_t ledClass; /**< */ - uint8_t ledID; /**< */ + uint16_t ledID; /**< */ uint32_t ledsDefined; /**< */ uint32_t ledState; /**< */ uint8_t firstButton; /**< */ @@ -3500,49 +3051,6 @@ typedef struct xcb_xkb_extension_device_notify_event_t { uint8_t pad1[2]; /**< */ } xcb_xkb_extension_device_notify_event_t; -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_ax_option_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_ax_option_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_ax_option_next - ** - ** @param xcb_xkb_ax_option_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_ax_option_next (xcb_xkb_ax_option_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_ax_option_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_ax_option_end - ** - ** @param xcb_xkb_ax_option_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_ax_option_end (xcb_xkb_ax_option_iterator_t i /**< */); - /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_device_spec_iterator_t @@ -3887,105 +3395,20 @@ xcb_xkb_key_alias_next (xcb_xkb_key_alias_iterator_t *i /**< */); xcb_generic_iterator_t xcb_xkb_key_alias_end (xcb_xkb_key_alias_iterator_t i /**< */); -int -xcb_xkb_counted_string_8_sizeof (const void *_buffer /**< */); - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_counted_string_8_string - ** - ** @param const xcb_xkb_counted_string_8_t *R - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_counted_string_8_string (const xcb_xkb_counted_string_8_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_counted_string_8_string_length - ** - ** @param const xcb_xkb_counted_string_8_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_counted_string_8_string_length (const xcb_xkb_counted_string_8_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_counted_string_8_string_end - ** - ** @param const xcb_xkb_counted_string_8_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_counted_string_8_string_end (const xcb_xkb_counted_string_8_t *R /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_counted_string_8_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_counted_string_8_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_counted_string_8_next - ** - ** @param xcb_xkb_counted_string_8_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_counted_string_8_next (xcb_xkb_counted_string_8_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_counted_string_8_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_counted_string_8_end - ** - ** @param xcb_xkb_counted_string_8_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_counted_string_8_end (xcb_xkb_counted_string_8_iterator_t i /**< */); - int xcb_xkb_counted_string_16_sizeof (const void *_buffer /**< */); /***************************************************************************** ** - ** uint8_t * xcb_xkb_counted_string_16_string + ** char * xcb_xkb_counted_string_16_string ** ** @param const xcb_xkb_counted_string_16_t *R - ** @returns uint8_t * + ** @returns char * ** *****************************************************************************/ -uint8_t * +char * xcb_xkb_counted_string_16_string (const xcb_xkb_counted_string_16_t *R /**< */); @@ -4017,15 +3440,41 @@ xcb_xkb_counted_string_16_string_end (const xcb_xkb_counted_string_16_t *R /**< /***************************************************************************** ** - ** uint8_t * xcb_xkb_counted_string_16_pad_0 + ** void * xcb_xkb_counted_string_16_alignment_pad ** ** @param const xcb_xkb_counted_string_16_t *R - ** @returns uint8_t * + ** @returns void * ** *****************************************************************************/ -uint8_t * -xcb_xkb_counted_string_16_pad_0 (const xcb_xkb_counted_string_16_t *R /**< */); +void * +xcb_xkb_counted_string_16_alignment_pad (const xcb_xkb_counted_string_16_t *R /**< */); + + +/***************************************************************************** + ** + ** int xcb_xkb_counted_string_16_alignment_pad_length + ** + ** @param const xcb_xkb_counted_string_16_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_counted_string_16_alignment_pad_length (const xcb_xkb_counted_string_16_t *R /**< */); + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_counted_string_16_alignment_pad_end + ** + ** @param const xcb_xkb_counted_string_16_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_counted_string_16_alignment_pad_end (const xcb_xkb_counted_string_16_t *R /**< */); /** * Get the next element of the iterator @@ -4496,28 +3945,28 @@ xcb_xkb_radio_group_behavior_end (xcb_xkb_radio_group_behavior_iterator_t i /** /** * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_overlay_1_behavior_iterator_t + * @param i Pointer to a xcb_xkb_overlay_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_overlay_1_behavior_t) + * element. The member index is increased by sizeof(xcb_xkb_overlay_behavior_t) */ /***************************************************************************** ** - ** void xcb_xkb_overlay_1_behavior_next + ** void xcb_xkb_overlay_behavior_next ** - ** @param xcb_xkb_overlay_1_behavior_iterator_t *i + ** @param xcb_xkb_overlay_behavior_iterator_t *i ** @returns void ** *****************************************************************************/ void -xcb_xkb_overlay_1_behavior_next (xcb_xkb_overlay_1_behavior_iterator_t *i /**< */); +xcb_xkb_overlay_behavior_next (xcb_xkb_overlay_behavior_iterator_t *i /**< */); /** * Return the iterator pointing to the last element - * @param i An xcb_xkb_overlay_1_behavior_iterator_t + * @param i An xcb_xkb_overlay_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. @@ -4527,58 +3976,15 @@ xcb_xkb_overlay_1_behavior_next (xcb_xkb_overlay_1_behavior_iterator_t *i /**< /***************************************************************************** ** - ** xcb_generic_iterator_t xcb_xkb_overlay_1_behavior_end + ** xcb_generic_iterator_t xcb_xkb_overlay_behavior_end ** - ** @param xcb_xkb_overlay_1_behavior_iterator_t i + ** @param xcb_xkb_overlay_behavior_iterator_t i ** @returns xcb_generic_iterator_t ** *****************************************************************************/ xcb_generic_iterator_t -xcb_xkb_overlay_1_behavior_end (xcb_xkb_overlay_1_behavior_iterator_t i /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_overlay_2_behavior_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_overlay_2_behavior_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_overlay_2_behavior_next - ** - ** @param xcb_xkb_overlay_2_behavior_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_overlay_2_behavior_next (xcb_xkb_overlay_2_behavior_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_overlay_2_behavior_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_overlay_2_behavior_end - ** - ** @param xcb_xkb_overlay_2_behavior_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_overlay_2_behavior_end (xcb_xkb_overlay_2_behavior_iterator_t i /**< */); +xcb_xkb_overlay_behavior_end (xcb_xkb_overlay_behavior_iterator_t i /**< */); /** * Get the next element of the iterator @@ -4668,28 +4074,28 @@ xcb_xkb_permament_radio_group_behavior_end (xcb_xkb_permament_radio_group_behavi /** * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_permament_overlay_1_behavior_iterator_t + * @param i Pointer to a xcb_xkb_permament_overlay_behavior_iterator_t * * Get the next element in the iterator. The member rem is * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_permament_overlay_1_behavior_t) + * element. The member index is increased by sizeof(xcb_xkb_permament_overlay_behavior_t) */ /***************************************************************************** ** - ** void xcb_xkb_permament_overlay_1_behavior_next + ** void xcb_xkb_permament_overlay_behavior_next ** - ** @param xcb_xkb_permament_overlay_1_behavior_iterator_t *i + ** @param xcb_xkb_permament_overlay_behavior_iterator_t *i ** @returns void ** *****************************************************************************/ void -xcb_xkb_permament_overlay_1_behavior_next (xcb_xkb_permament_overlay_1_behavior_iterator_t *i /**< */); +xcb_xkb_permament_overlay_behavior_next (xcb_xkb_permament_overlay_behavior_iterator_t *i /**< */); /** * Return the iterator pointing to the last element - * @param i An xcb_xkb_permament_overlay_1_behavior_iterator_t + * @param i An xcb_xkb_permament_overlay_behavior_iterator_t * @return The iterator pointing to the last element * * Set the current element in the iterator to the last element. @@ -4699,58 +4105,15 @@ xcb_xkb_permament_overlay_1_behavior_next (xcb_xkb_permament_overlay_1_behavior_ /***************************************************************************** ** - ** xcb_generic_iterator_t xcb_xkb_permament_overlay_1_behavior_end + ** xcb_generic_iterator_t xcb_xkb_permament_overlay_behavior_end ** - ** @param xcb_xkb_permament_overlay_1_behavior_iterator_t i + ** @param xcb_xkb_permament_overlay_behavior_iterator_t i ** @returns xcb_generic_iterator_t ** *****************************************************************************/ xcb_generic_iterator_t -xcb_xkb_permament_overlay_1_behavior_end (xcb_xkb_permament_overlay_1_behavior_iterator_t i /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_permament_overlay_2_behavior_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_permament_overlay_2_behavior_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_permament_overlay_2_behavior_next - ** - ** @param xcb_xkb_permament_overlay_2_behavior_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_permament_overlay_2_behavior_next (xcb_xkb_permament_overlay_2_behavior_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_permament_overlay_2_behavior_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_permament_overlay_2_behavior_end - ** - ** @param xcb_xkb_permament_overlay_2_behavior_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_permament_overlay_2_behavior_end (xcb_xkb_permament_overlay_2_behavior_iterator_t i /**< */); +xcb_xkb_permament_overlay_behavior_end (xcb_xkb_permament_overlay_behavior_iterator_t i /**< */); /** * Get the next element of the iterator @@ -5177,140 +4540,6 @@ xcb_xkb_string8_next (xcb_xkb_string8_iterator_t *i /**< */); xcb_generic_iterator_t xcb_xkb_string8_end (xcb_xkb_string8_iterator_t i /**< */); -int -xcb_xkb_property_serialize (void **_buffer /**< */, - const xcb_xkb_property_t *_aux /**< */, - const xcb_xkb_string8_t *name /**< */, - const xcb_xkb_string8_t *value /**< */); - -int -xcb_xkb_property_unserialize (const void *_buffer /**< */, - xcb_xkb_property_t **_aux /**< */); - -int -xcb_xkb_property_sizeof (const void *_buffer /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_string8_t * xcb_xkb_property_name - ** - ** @param const xcb_xkb_property_t *R - ** @returns xcb_xkb_string8_t * - ** - *****************************************************************************/ - -xcb_xkb_string8_t * -xcb_xkb_property_name (const xcb_xkb_property_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_property_name_length - ** - ** @param const xcb_xkb_property_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_property_name_length (const xcb_xkb_property_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_property_name_end - ** - ** @param const xcb_xkb_property_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_property_name_end (const xcb_xkb_property_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_string8_t * xcb_xkb_property_value - ** - ** @param const xcb_xkb_property_t *R - ** @returns xcb_xkb_string8_t * - ** - *****************************************************************************/ - -xcb_xkb_string8_t * -xcb_xkb_property_value (const xcb_xkb_property_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_property_value_length - ** - ** @param const xcb_xkb_property_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_property_value_length (const xcb_xkb_property_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_property_value_end - ** - ** @param const xcb_xkb_property_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_property_value_end (const xcb_xkb_property_t *R /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_property_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_property_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_property_next - ** - ** @param xcb_xkb_property_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_property_next (xcb_xkb_property_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_property_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_property_end - ** - ** @param xcb_xkb_property_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_property_end (xcb_xkb_property_iterator_t i /**< */); - int xcb_xkb_outline_sizeof (const void *_buffer /**< */); @@ -5796,397 +5025,6 @@ xcb_xkb_row_next (xcb_xkb_row_iterator_t *i /**< */); xcb_generic_iterator_t xcb_xkb_row_end (xcb_xkb_row_iterator_t i /**< */); -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_common_doodad_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_common_doodad_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_common_doodad_next - ** - ** @param xcb_xkb_common_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_common_doodad_next (xcb_xkb_common_doodad_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_common_doodad_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_common_doodad_end - ** - ** @param xcb_xkb_common_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_common_doodad_end (xcb_xkb_common_doodad_iterator_t i /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_shape_doodad_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_shape_doodad_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_shape_doodad_next - ** - ** @param xcb_xkb_shape_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_shape_doodad_next (xcb_xkb_shape_doodad_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_shape_doodad_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_shape_doodad_end - ** - ** @param xcb_xkb_shape_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_shape_doodad_end (xcb_xkb_shape_doodad_iterator_t i /**< */); - -int -xcb_xkb_text_doodad_sizeof (const void *_buffer /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_text_doodad_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_text_doodad_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_text_doodad_next - ** - ** @param xcb_xkb_text_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_text_doodad_next (xcb_xkb_text_doodad_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_text_doodad_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_text_doodad_end - ** - ** @param xcb_xkb_text_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_text_doodad_end (xcb_xkb_text_doodad_iterator_t i /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_indicator_doodad_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_indicator_doodad_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_indicator_doodad_next - ** - ** @param xcb_xkb_indicator_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_indicator_doodad_next (xcb_xkb_indicator_doodad_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_indicator_doodad_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_indicator_doodad_end - ** - ** @param xcb_xkb_indicator_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_indicator_doodad_end (xcb_xkb_indicator_doodad_iterator_t i /**< */); - -int -xcb_xkb_logo_doodad_sizeof (const void *_buffer /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_logo_doodad_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_logo_doodad_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_logo_doodad_next - ** - ** @param xcb_xkb_logo_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_logo_doodad_next (xcb_xkb_logo_doodad_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_logo_doodad_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_logo_doodad_end - ** - ** @param xcb_xkb_logo_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_logo_doodad_end (xcb_xkb_logo_doodad_iterator_t i /**< */); - -int -xcb_xkb_doodad_sizeof (const void *_buffer /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_doodad_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_doodad_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_doodad_next - ** - ** @param xcb_xkb_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_doodad_next (xcb_xkb_doodad_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_doodad_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_doodad_end - ** - ** @param xcb_xkb_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_doodad_end (xcb_xkb_doodad_iterator_t i /**< */); - -int -xcb_xkb_section_sizeof (const void *_buffer /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_section_rows_length - ** - ** @param const xcb_xkb_section_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_section_rows_length (const xcb_xkb_section_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_row_iterator_t xcb_xkb_section_rows_iterator - ** - ** @param const xcb_xkb_section_t *R - ** @returns xcb_xkb_row_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_row_iterator_t -xcb_xkb_section_rows_iterator (const xcb_xkb_section_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_section_doodads_length - ** - ** @param const xcb_xkb_section_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_section_doodads_length (const xcb_xkb_section_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_doodad_iterator_t xcb_xkb_section_doodads_iterator - ** - ** @param const xcb_xkb_section_t *R - ** @returns xcb_xkb_doodad_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_doodad_iterator_t -xcb_xkb_section_doodads_iterator (const xcb_xkb_section_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_section_overlays_length - ** - ** @param const xcb_xkb_section_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_section_overlays_length (const xcb_xkb_section_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_overlay_iterator_t xcb_xkb_section_overlays_iterator - ** - ** @param const xcb_xkb_section_t *R - ** @returns xcb_xkb_overlay_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_overlay_iterator_t -xcb_xkb_section_overlays_iterator (const xcb_xkb_section_t *R /**< */); - -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_xkb_section_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_xkb_section_t) - */ - -/***************************************************************************** - ** - ** void xcb_xkb_section_next - ** - ** @param xcb_xkb_section_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_section_next (xcb_xkb_section_iterator_t *i /**< */); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_xkb_section_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_section_end - ** - ** @param xcb_xkb_section_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_section_end (xcb_xkb_section_iterator_t i /**< */); - int xcb_xkb_listing_sizeof (const void *_buffer /**< */); @@ -7299,6 +6137,92 @@ xcb_xkb_sa_device_valuator_next (xcb_xkb_sa_device_valuator_iterator_t *i /**< xcb_generic_iterator_t xcb_xkb_sa_device_valuator_end (xcb_xkb_sa_device_valuator_iterator_t i /**< */); +/** + * Get the next element of the iterator + * @param i Pointer to a xcb_xkb_si_action_iterator_t + * + * Get the next element in the iterator. The member rem is + * decreased by one. The member data points to the next + * element. The member index is increased by sizeof(xcb_xkb_si_action_t) + */ + +/***************************************************************************** + ** + ** void xcb_xkb_si_action_next + ** + ** @param xcb_xkb_si_action_iterator_t *i + ** @returns void + ** + *****************************************************************************/ + +void +xcb_xkb_si_action_next (xcb_xkb_si_action_iterator_t *i /**< */); + +/** + * Return the iterator pointing to the last element + * @param i An xcb_xkb_si_action_iterator_t + * @return The iterator pointing to the last element + * + * Set the current element in the iterator to the last element. + * The member rem is set to 0. The member data points to the + * last element. + */ + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_si_action_end + ** + ** @param xcb_xkb_si_action_iterator_t i + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_si_action_end (xcb_xkb_si_action_iterator_t i /**< */); + +/** + * Get the next element of the iterator + * @param i Pointer to a xcb_xkb_sym_interpret_iterator_t + * + * Get the next element in the iterator. The member rem is + * decreased by one. The member data points to the next + * element. The member index is increased by sizeof(xcb_xkb_sym_interpret_t) + */ + +/***************************************************************************** + ** + ** void xcb_xkb_sym_interpret_next + ** + ** @param xcb_xkb_sym_interpret_iterator_t *i + ** @returns void + ** + *****************************************************************************/ + +void +xcb_xkb_sym_interpret_next (xcb_xkb_sym_interpret_iterator_t *i /**< */); + +/** + * Return the iterator pointing to the last element + * @param i An xcb_xkb_sym_interpret_iterator_t + * @return The iterator pointing to the last element + * + * Set the current element in the iterator to the last element. + * The member rem is set to 0. The member data points to the + * last element. + */ + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_sym_interpret_end + ** + ** @param xcb_xkb_sym_interpret_iterator_t i + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_sym_interpret_end (xcb_xkb_sym_interpret_iterator_t i /**< */); + /** * Get the next element of the iterator * @param i Pointer to a xcb_xkb_action_iterator_t @@ -7343,7 +6267,7 @@ xcb_generic_iterator_t xcb_xkb_action_end (xcb_xkb_action_iterator_t i /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7368,7 +6292,7 @@ xcb_xkb_use_extension (xcb_connection_t *c /**< */, uint16_t wantedMinor /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7447,7 +6371,7 @@ xcb_xkb_select_events_details_sizeof (const void *_buffer /**< */, uint16_t selectAll /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7485,7 +6409,7 @@ xcb_xkb_select_events_checked (xcb_connection_t *c /**< */, const void *details /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7520,7 +6444,7 @@ xcb_xkb_select_events (xcb_connection_t *c /**< */, const void *details /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7558,7 +6482,7 @@ xcb_xkb_select_events_aux_checked (xcb_connection_t *c /** const xcb_xkb_select_events_details_t *details /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7593,7 +6517,7 @@ xcb_xkb_select_events_aux (xcb_connection_t *c /**< */, const xcb_xkb_select_events_details_t *details /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7637,7 +6561,7 @@ xcb_xkb_bell_checked (xcb_connection_t *c /**< */, xcb_window_t window /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7678,7 +6602,7 @@ xcb_xkb_bell (xcb_connection_t *c /**< */, xcb_window_t window /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7701,7 +6625,7 @@ xcb_xkb_get_state (xcb_connection_t *c /**< */, xcb_xkb_device_spec_t deviceSpec /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7758,7 +6682,7 @@ xcb_xkb_get_state_reply (xcb_connection_t *c /**< */, xcb_generic_error_t **e /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7798,7 +6722,7 @@ xcb_xkb_latch_lock_state_checked (xcb_connection_t *c /**< */, uint16_t groupLatch /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7835,7 +6759,7 @@ xcb_xkb_latch_lock_state (xcb_connection_t *c /**< */, uint16_t groupLatch /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7858,7 +6782,7 @@ xcb_xkb_get_controls (xcb_connection_t *c /**< */, xcb_xkb_device_spec_t deviceSpec /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7915,7 +6839,7 @@ xcb_xkb_get_controls_reply (xcb_connection_t *c /**< */, xcb_generic_error_t **e /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -7942,7 +6866,7 @@ xcb_xkb_get_controls_reply (xcb_connection_t *c /**< */, ** @param uint16_t ignoreLockVirtualMods ** @param uint8_t mouseKeysDfltBtn ** @param uint8_t groupsWrap - ** @param xcb_xkb_ax_option_t accessXOptions + ** @param uint16_t accessXOptions ** @param uint32_t affectEnabledControls ** @param uint32_t enabledControls ** @param uint32_t changeControls @@ -7958,8 +6882,8 @@ xcb_xkb_get_controls_reply (xcb_connection_t *c /**< */, ** @param uint16_t accessXTimeout ** @param uint32_t accessXTimeoutMask ** @param uint32_t accessXTimeoutValues - ** @param xcb_xkb_ax_option_t accessXTimeoutOptionsMask - ** @param xcb_xkb_ax_option_t accessXTimeoutOptionsValues + ** @param uint16_t accessXTimeoutOptionsMask + ** @param uint16_t accessXTimeoutOptionsValues ** @param const uint8_t *perKeyRepeat ** @returns xcb_void_cookie_t ** @@ -7978,7 +6902,7 @@ xcb_xkb_set_controls_checked (xcb_connection_t *c /**< */, uint16_t ignoreLockVirtualMods /**< */, uint8_t mouseKeysDfltBtn /**< */, uint8_t groupsWrap /**< */, - xcb_xkb_ax_option_t accessXOptions /**< */, + uint16_t accessXOptions /**< */, uint32_t affectEnabledControls /**< */, uint32_t enabledControls /**< */, uint32_t changeControls /**< */, @@ -7994,12 +6918,12 @@ xcb_xkb_set_controls_checked (xcb_connection_t *c /**< */, uint16_t accessXTimeout /**< */, uint32_t accessXTimeoutMask /**< */, uint32_t accessXTimeoutValues /**< */, - xcb_xkb_ax_option_t accessXTimeoutOptionsMask /**< */, - xcb_xkb_ax_option_t accessXTimeoutOptionsValues /**< */, + uint16_t accessXTimeoutOptionsMask /**< */, + uint16_t accessXTimeoutOptionsValues /**< */, const uint8_t *perKeyRepeat /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -8023,7 +6947,7 @@ xcb_xkb_set_controls_checked (xcb_connection_t *c /**< */, ** @param uint16_t ignoreLockVirtualMods ** @param uint8_t mouseKeysDfltBtn ** @param uint8_t groupsWrap - ** @param xcb_xkb_ax_option_t accessXOptions + ** @param uint16_t accessXOptions ** @param uint32_t affectEnabledControls ** @param uint32_t enabledControls ** @param uint32_t changeControls @@ -8039,8 +6963,8 @@ xcb_xkb_set_controls_checked (xcb_connection_t *c /**< */, ** @param uint16_t accessXTimeout ** @param uint32_t accessXTimeoutMask ** @param uint32_t accessXTimeoutValues - ** @param xcb_xkb_ax_option_t accessXTimeoutOptionsMask - ** @param xcb_xkb_ax_option_t accessXTimeoutOptionsValues + ** @param uint16_t accessXTimeoutOptionsMask + ** @param uint16_t accessXTimeoutOptionsValues ** @param const uint8_t *perKeyRepeat ** @returns xcb_void_cookie_t ** @@ -8059,7 +6983,7 @@ xcb_xkb_set_controls (xcb_connection_t *c /**< */, uint16_t ignoreLockVirtualMods /**< */, uint8_t mouseKeysDfltBtn /**< */, uint8_t groupsWrap /**< */, - xcb_xkb_ax_option_t accessXOptions /**< */, + uint16_t accessXOptions /**< */, uint32_t affectEnabledControls /**< */, uint32_t enabledControls /**< */, uint32_t changeControls /**< */, @@ -8075,8 +6999,8 @@ xcb_xkb_set_controls (xcb_connection_t *c /**< */, uint16_t accessXTimeout /**< */, uint32_t accessXTimeoutMask /**< */, uint32_t accessXTimeoutValues /**< */, - xcb_xkb_ax_option_t accessXTimeoutOptionsMask /**< */, - xcb_xkb_ax_option_t accessXTimeoutOptionsValues /**< */, + uint16_t accessXTimeoutOptionsMask /**< */, + uint16_t accessXTimeoutOptionsValues /**< */, const uint8_t *perKeyRepeat /**< */); @@ -8177,6 +7101,47 @@ xcb_xkb_get_map_map_acts_rtrn_count_end (const xcb_xkb_get_map_reply_t *R /**< const xcb_xkb_get_map_map_t *S /**< */); +/***************************************************************************** + ** + ** uint8_t * xcb_xkb_get_map_map_alignment_pad + ** + ** @param const xcb_xkb_get_map_map_t *S + ** @returns uint8_t * + ** + *****************************************************************************/ + +uint8_t * +xcb_xkb_get_map_map_alignment_pad (const xcb_xkb_get_map_map_t *S /**< */); + + +/***************************************************************************** + ** + ** int xcb_xkb_get_map_map_alignment_pad_length + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_map_map_alignment_pad_length (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */); + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_map_map_alignment_pad_end + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_map_map_alignment_pad_end (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */); + + /***************************************************************************** ** ** xcb_xkb_action_t * xcb_xkb_get_map_map_acts_rtrn_acts @@ -8300,6 +7265,47 @@ xcb_xkb_get_map_map_vmods_rtrn_end (const xcb_xkb_get_map_reply_t *R /**< */, const xcb_xkb_get_map_map_t *S /**< */); +/***************************************************************************** + ** + ** uint8_t * xcb_xkb_get_map_map_alignment_pad_2 + ** + ** @param const xcb_xkb_get_map_map_t *S + ** @returns uint8_t * + ** + *****************************************************************************/ + +uint8_t * +xcb_xkb_get_map_map_alignment_pad_2 (const xcb_xkb_get_map_map_t *S /**< */); + + +/***************************************************************************** + ** + ** int xcb_xkb_get_map_map_alignment_pad_2_length + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_map_map_alignment_pad_2_length (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */); + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_map_map_alignment_pad_2_end + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_map_map_alignment_pad_2_end (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */); + + /***************************************************************************** ** ** xcb_xkb_set_explicit_t * xcb_xkb_get_map_map_explicit_rtrn @@ -8341,6 +7347,47 @@ xcb_xkb_get_map_map_explicit_rtrn_iterator (const xcb_xkb_get_map_reply_t *R /* const xcb_xkb_get_map_map_t *S /**< */); +/***************************************************************************** + ** + ** uint16_t * xcb_xkb_get_map_map_alignment_pad_3 + ** + ** @param const xcb_xkb_get_map_map_t *S + ** @returns uint16_t * + ** + *****************************************************************************/ + +uint16_t * +xcb_xkb_get_map_map_alignment_pad_3 (const xcb_xkb_get_map_map_t *S /**< */); + + +/***************************************************************************** + ** + ** int xcb_xkb_get_map_map_alignment_pad_3_length + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_map_map_alignment_pad_3_length (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */); + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_map_map_alignment_pad_3_end + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_map_map_alignment_pad_3_end (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */); + + /***************************************************************************** ** ** xcb_xkb_key_mod_map_t * xcb_xkb_get_map_map_modmap_rtrn @@ -8382,6 +7429,47 @@ xcb_xkb_get_map_map_modmap_rtrn_iterator (const xcb_xkb_get_map_reply_t *R /**< const xcb_xkb_get_map_map_t *S /**< */); +/***************************************************************************** + ** + ** uint16_t * xcb_xkb_get_map_map_alignment_pad_4 + ** + ** @param const xcb_xkb_get_map_map_t *S + ** @returns uint16_t * + ** + *****************************************************************************/ + +uint16_t * +xcb_xkb_get_map_map_alignment_pad_4 (const xcb_xkb_get_map_map_t *S /**< */); + + +/***************************************************************************** + ** + ** int xcb_xkb_get_map_map_alignment_pad_4_length + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_map_map_alignment_pad_4_length (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */); + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_map_map_alignment_pad_4_end + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_map_map_alignment_pad_4_end (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */); + + /***************************************************************************** ** ** xcb_xkb_key_v_mod_map_t * xcb_xkb_get_map_map_vmodmap_rtrn @@ -8429,7 +7517,7 @@ xcb_xkb_get_map_map_serialize (void **_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -8443,7 +7531,7 @@ xcb_xkb_get_map_map_unpack (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -8457,14 +7545,14 @@ xcb_xkb_get_map_map_sizeof (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, uint16_t present /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -8521,7 +7609,7 @@ xcb_xkb_get_map (xcb_connection_t *c /**< */, uint8_t nVModMapKeys /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -8974,7 +8062,7 @@ xcb_xkb_set_map_values_serialize (void **_buffer /**< uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -8988,7 +8076,7 @@ xcb_xkb_set_map_values_unpack (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -9002,14 +8090,14 @@ xcb_xkb_set_map_values_sizeof (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, uint16_t present /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9087,7 +8175,7 @@ xcb_xkb_set_map_checked (xcb_connection_t *c /**< */, const void *values /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9162,7 +8250,7 @@ xcb_xkb_set_map (xcb_connection_t *c /**< */, const void *values /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9240,7 +8328,7 @@ xcb_xkb_set_map_aux_checked (xcb_connection_t *c /**< */, const xcb_xkb_set_map_values_t *values /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9318,7 +8406,7 @@ int xcb_xkb_get_compat_map_sizeof (const void *_buffer /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9349,7 +8437,7 @@ xcb_xkb_get_compat_map (xcb_connection_t *c /**< */, uint16_t nSI /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9385,14 +8473,14 @@ xcb_xkb_get_compat_map_unchecked (xcb_connection_t *c /**< */, /***************************************************************************** ** - ** uint8_t * xcb_xkb_get_compat_map_si_rtrn + ** xcb_xkb_sym_interpret_t * xcb_xkb_get_compat_map_si_rtrn ** ** @param const xcb_xkb_get_compat_map_reply_t *R - ** @returns uint8_t * + ** @returns xcb_xkb_sym_interpret_t * ** *****************************************************************************/ -uint8_t * +xcb_xkb_sym_interpret_t * xcb_xkb_get_compat_map_si_rtrn (const xcb_xkb_get_compat_map_reply_t *R /**< */); @@ -9411,15 +8499,15 @@ xcb_xkb_get_compat_map_si_rtrn_length (const xcb_xkb_get_compat_map_reply_t *R /***************************************************************************** ** - ** xcb_generic_iterator_t xcb_xkb_get_compat_map_si_rtrn_end + ** xcb_xkb_sym_interpret_iterator_t xcb_xkb_get_compat_map_si_rtrn_iterator ** ** @param const xcb_xkb_get_compat_map_reply_t *R - ** @returns xcb_generic_iterator_t + ** @returns xcb_xkb_sym_interpret_iterator_t ** *****************************************************************************/ -xcb_generic_iterator_t -xcb_xkb_get_compat_map_si_rtrn_end (const xcb_xkb_get_compat_map_reply_t *R /**< */); +xcb_xkb_sym_interpret_iterator_t +xcb_xkb_get_compat_map_si_rtrn_iterator (const xcb_xkb_get_compat_map_reply_t *R /**< */); /***************************************************************************** @@ -9495,7 +8583,7 @@ int xcb_xkb_set_compat_map_sizeof (const void *_buffer /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9510,32 +8598,32 @@ xcb_xkb_set_compat_map_sizeof (const void *_buffer /**< */); ** ** xcb_void_cookie_t xcb_xkb_set_compat_map_checked ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint8_t recomputeActions - ** @param uint8_t truncateSI - ** @param uint8_t groups - ** @param uint16_t firstSI - ** @param uint16_t nSI - ** @param const uint8_t *si - ** @param const xcb_xkb_mod_def_t *groupMaps + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint8_t recomputeActions + ** @param uint8_t truncateSI + ** @param uint8_t groups + ** @param uint16_t firstSI + ** @param uint16_t nSI + ** @param const xcb_xkb_sym_interpret_t *si + ** @param const xcb_xkb_mod_def_t *groupMaps ** @returns xcb_void_cookie_t ** *****************************************************************************/ xcb_void_cookie_t -xcb_xkb_set_compat_map_checked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint8_t recomputeActions /**< */, - uint8_t truncateSI /**< */, - uint8_t groups /**< */, - uint16_t firstSI /**< */, - uint16_t nSI /**< */, - const uint8_t *si /**< */, - const xcb_xkb_mod_def_t *groupMaps /**< */); +xcb_xkb_set_compat_map_checked (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint8_t recomputeActions /**< */, + uint8_t truncateSI /**< */, + uint8_t groups /**< */, + uint16_t firstSI /**< */, + uint16_t nSI /**< */, + const xcb_xkb_sym_interpret_t *si /**< */, + const xcb_xkb_mod_def_t *groupMaps /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9547,32 +8635,32 @@ xcb_xkb_set_compat_map_checked (xcb_connection_t *c /**< */, ** ** xcb_void_cookie_t xcb_xkb_set_compat_map ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint8_t recomputeActions - ** @param uint8_t truncateSI - ** @param uint8_t groups - ** @param uint16_t firstSI - ** @param uint16_t nSI - ** @param const uint8_t *si - ** @param const xcb_xkb_mod_def_t *groupMaps + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint8_t recomputeActions + ** @param uint8_t truncateSI + ** @param uint8_t groups + ** @param uint16_t firstSI + ** @param uint16_t nSI + ** @param const xcb_xkb_sym_interpret_t *si + ** @param const xcb_xkb_mod_def_t *groupMaps ** @returns xcb_void_cookie_t ** *****************************************************************************/ xcb_void_cookie_t -xcb_xkb_set_compat_map (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint8_t recomputeActions /**< */, - uint8_t truncateSI /**< */, - uint8_t groups /**< */, - uint16_t firstSI /**< */, - uint16_t nSI /**< */, - const uint8_t *si /**< */, - const xcb_xkb_mod_def_t *groupMaps /**< */); +xcb_xkb_set_compat_map (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint8_t recomputeActions /**< */, + uint8_t truncateSI /**< */, + uint8_t groups /**< */, + uint16_t firstSI /**< */, + uint16_t nSI /**< */, + const xcb_xkb_sym_interpret_t *si /**< */, + const xcb_xkb_mod_def_t *groupMaps /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9595,7 +8683,7 @@ xcb_xkb_get_indicator_state (xcb_connection_t *c /**< */, xcb_xkb_device_spec_t deviceSpec /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9655,7 +8743,7 @@ int xcb_xkb_get_indicator_map_sizeof (const void *_buffer /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9680,7 +8768,7 @@ xcb_xkb_get_indicator_map (xcb_connection_t *c /**< */, uint32_t which /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9781,7 +8869,7 @@ int xcb_xkb_set_indicator_map_sizeof (const void *_buffer /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9811,7 +8899,7 @@ xcb_xkb_set_indicator_map_checked (xcb_connection_t *c /**< */, const xcb_xkb_indicator_map_t *maps /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9838,7 +8926,7 @@ xcb_xkb_set_indicator_map (xcb_connection_t *c /**< */, const xcb_xkb_indicator_map_t *maps /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9867,7 +8955,7 @@ xcb_xkb_get_named_indicator (xcb_connection_t *c /**< */, xcb_atom_t indicator /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9930,7 +9018,7 @@ xcb_xkb_get_named_indicator_reply (xcb_connection_t *c /** xcb_generic_error_t **e /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -9984,7 +9072,7 @@ xcb_xkb_set_named_indicator_checked (xcb_connection_t *c /**< */, uint32_t map_ctrls /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -10117,6 +9205,47 @@ xcb_xkb_get_names_value_list_n_levels_per_type_end (const xcb_xkb_get_names_repl const xcb_xkb_get_names_value_list_t *S /**< */); +/***************************************************************************** + ** + ** uint8_t * xcb_xkb_get_names_value_list_alignment_pad + ** + ** @param const xcb_xkb_get_names_value_list_t *S + ** @returns uint8_t * + ** + *****************************************************************************/ + +uint8_t * +xcb_xkb_get_names_value_list_alignment_pad (const xcb_xkb_get_names_value_list_t *S /**< */); + + +/***************************************************************************** + ** + ** int xcb_xkb_get_names_value_list_alignment_pad_length + ** + ** @param const xcb_xkb_get_names_value_list_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_names_value_list_alignment_pad_length (const xcb_xkb_get_names_reply_t *R /**< */, + const xcb_xkb_get_names_value_list_t *S /**< */); + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_names_value_list_alignment_pad_end + ** + ** @param const xcb_xkb_get_names_value_list_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_names_value_list_alignment_pad_end (const xcb_xkb_get_names_reply_t *R /**< */, + const xcb_xkb_get_names_value_list_t *S /**< */); + + /***************************************************************************** ** ** xcb_atom_t * xcb_xkb_get_names_value_list_kt_level_names @@ -10439,7 +9568,7 @@ xcb_xkb_get_names_value_list_sizeof (const void *_buffer /**< */, uint32_t which /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -10464,7 +9593,7 @@ xcb_xkb_get_names (xcb_connection_t *c /**< */, uint32_t which /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -10943,7 +10072,7 @@ xcb_xkb_set_names_values_sizeof (const void *_buffer /**< */, uint32_t which /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -10997,7 +10126,7 @@ xcb_xkb_set_names_checked (xcb_connection_t *c /**< */, const void *values /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -11048,7 +10177,7 @@ xcb_xkb_set_names (xcb_connection_t *c /**< */, const void *values /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -11102,7 +10231,7 @@ xcb_xkb_set_names_aux_checked (xcb_connection_t *c /**< */, const xcb_xkb_set_names_values_t *values /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -11152,401 +10281,8 @@ xcb_xkb_set_names_aux (xcb_connection_t *c /**< */, uint16_t totalKTLevelNames /**< */, const xcb_xkb_set_names_values_t *values /**< */); -int -xcb_xkb_get_geometry_sizeof (const void *_buffer /**< */); - /** - * Delivers a request to the X server - * @param c The connection - * @return A cookie * - * Delivers a request to the X server. - * - */ - -/***************************************************************************** - ** - ** xcb_xkb_get_geometry_cookie_t xcb_xkb_get_geometry - ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param xcb_atom_t name - ** @returns xcb_xkb_get_geometry_cookie_t - ** - *****************************************************************************/ - -xcb_xkb_get_geometry_cookie_t -xcb_xkb_get_geometry (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - xcb_atom_t name /**< */); - -/** - * Delivers a request to the X server - * @param c The connection - * @return A cookie - * - * Delivers a request to the X server. - * - * This form can be used only if the request will cause - * a reply to be generated. Any returned error will be - * placed in the event queue. - */ - -/***************************************************************************** - ** - ** xcb_xkb_get_geometry_cookie_t xcb_xkb_get_geometry_unchecked - ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param xcb_atom_t name - ** @returns xcb_xkb_get_geometry_cookie_t - ** - *****************************************************************************/ - -xcb_xkb_get_geometry_cookie_t -xcb_xkb_get_geometry_unchecked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - xcb_atom_t name /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_t * xcb_xkb_get_geometry_label_font - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_counted_string_16_t * - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_t * -xcb_xkb_get_geometry_label_font (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_properties_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_properties_length (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_property_iterator_t xcb_xkb_get_geometry_properties_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_property_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_property_iterator_t -xcb_xkb_get_geometry_properties_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_colors_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_colors_length (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_iterator_t xcb_xkb_get_geometry_colors_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_counted_string_16_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_iterator_t -xcb_xkb_get_geometry_colors_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_shapes_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_shapes_length (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_shape_iterator_t xcb_xkb_get_geometry_shapes_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_shape_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_shape_iterator_t -xcb_xkb_get_geometry_shapes_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_sections_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_sections_length (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_section_iterator_t xcb_xkb_get_geometry_sections_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_section_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_section_iterator_t -xcb_xkb_get_geometry_sections_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_doodads_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_doodads_length (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_doodad_iterator_t xcb_xkb_get_geometry_doodads_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_doodad_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_doodad_iterator_t -xcb_xkb_get_geometry_doodads_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_t * xcb_xkb_get_geometry_key_aliases - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_key_alias_t * - ** - *****************************************************************************/ - -xcb_xkb_key_alias_t * -xcb_xkb_get_geometry_key_aliases (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_key_aliases_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_key_aliases_length (const xcb_xkb_get_geometry_reply_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_iterator_t xcb_xkb_get_geometry_key_aliases_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_key_alias_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_alias_iterator_t -xcb_xkb_get_geometry_key_aliases_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */); - -/** - * Return the reply - * @param c The connection - * @param cookie The cookie - * @param e The xcb_generic_error_t supplied - * - * Returns the reply of the request asked by - * - * The parameter @p e supplied to this function must be NULL if - * xcb_xkb_get_geometry_unchecked(). is used. - * Otherwise, it stores the error if any. - * - * The returned value must be freed by the caller using free(). - */ - -/***************************************************************************** - ** - ** xcb_xkb_get_geometry_reply_t * xcb_xkb_get_geometry_reply - ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_get_geometry_cookie_t cookie - ** @param xcb_generic_error_t **e - ** @returns xcb_xkb_get_geometry_reply_t * - ** - *****************************************************************************/ - -xcb_xkb_get_geometry_reply_t * -xcb_xkb_get_geometry_reply (xcb_connection_t *c /**< */, - xcb_xkb_get_geometry_cookie_t cookie /**< */, - xcb_generic_error_t **e /**< */); - -int -xcb_xkb_set_geometry_sizeof (const void *_buffer /**< */); - -/** - * Delivers a request to the X server - * @param c The connection - * @return A cookie - * - * Delivers a request to the X server. - * - * This form can be used only if the request will not cause - * a reply to be generated. Any returned error will be - * saved for handling by xcb_request_check(). - */ - -/***************************************************************************** - ** - ** xcb_void_cookie_t xcb_xkb_set_geometry_checked - ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint8_t nShapes - ** @param uint8_t nSections - ** @param xcb_atom_t name - ** @param uint16_t widthMM - ** @param uint16_t heightMM - ** @param uint16_t nProperties - ** @param uint16_t nColors - ** @param uint16_t nDoodads - ** @param uint16_t nKeyAliases - ** @param uint8_t baseColorNdx - ** @param uint8_t labelColorNdx - ** @param xcb_xkb_counted_string_16_t *labelFont - ** @param const xcb_xkb_property_t *properties - ** @param const xcb_xkb_counted_string_16_t *colors - ** @param const xcb_xkb_shape_t *shapes - ** @param const xcb_xkb_section_t *sections - ** @param const xcb_xkb_doodad_t *doodads - ** @param const xcb_xkb_key_alias_t *keyAliases - ** @returns xcb_void_cookie_t - ** - *****************************************************************************/ - -xcb_void_cookie_t -xcb_xkb_set_geometry_checked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint8_t nShapes /**< */, - uint8_t nSections /**< */, - xcb_atom_t name /**< */, - uint16_t widthMM /**< */, - uint16_t heightMM /**< */, - uint16_t nProperties /**< */, - uint16_t nColors /**< */, - uint16_t nDoodads /**< */, - uint16_t nKeyAliases /**< */, - uint8_t baseColorNdx /**< */, - uint8_t labelColorNdx /**< */, - xcb_xkb_counted_string_16_t *labelFont /**< */, - const xcb_xkb_property_t *properties /**< */, - const xcb_xkb_counted_string_16_t *colors /**< */, - const xcb_xkb_shape_t *shapes /**< */, - const xcb_xkb_section_t *sections /**< */, - const xcb_xkb_doodad_t *doodads /**< */, - const xcb_xkb_key_alias_t *keyAliases /**< */); - -/** - * Delivers a request to the X server - * @param c The connection - * @return A cookie - * - * Delivers a request to the X server. - * - */ - -/***************************************************************************** - ** - ** xcb_void_cookie_t xcb_xkb_set_geometry - ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint8_t nShapes - ** @param uint8_t nSections - ** @param xcb_atom_t name - ** @param uint16_t widthMM - ** @param uint16_t heightMM - ** @param uint16_t nProperties - ** @param uint16_t nColors - ** @param uint16_t nDoodads - ** @param uint16_t nKeyAliases - ** @param uint8_t baseColorNdx - ** @param uint8_t labelColorNdx - ** @param xcb_xkb_counted_string_16_t *labelFont - ** @param const xcb_xkb_property_t *properties - ** @param const xcb_xkb_counted_string_16_t *colors - ** @param const xcb_xkb_shape_t *shapes - ** @param const xcb_xkb_section_t *sections - ** @param const xcb_xkb_doodad_t *doodads - ** @param const xcb_xkb_key_alias_t *keyAliases - ** @returns xcb_void_cookie_t - ** - *****************************************************************************/ - -xcb_void_cookie_t -xcb_xkb_set_geometry (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint8_t nShapes /**< */, - uint8_t nSections /**< */, - xcb_atom_t name /**< */, - uint16_t widthMM /**< */, - uint16_t heightMM /**< */, - uint16_t nProperties /**< */, - uint16_t nColors /**< */, - uint16_t nDoodads /**< */, - uint16_t nKeyAliases /**< */, - uint8_t baseColorNdx /**< */, - uint8_t labelColorNdx /**< */, - xcb_xkb_counted_string_16_t *labelFont /**< */, - const xcb_xkb_property_t *properties /**< */, - const xcb_xkb_counted_string_16_t *colors /**< */, - const xcb_xkb_shape_t *shapes /**< */, - const xcb_xkb_section_t *sections /**< */, - const xcb_xkb_doodad_t *doodads /**< */, - const xcb_xkb_key_alias_t *keyAliases /**< */); - -/** - * Delivers a request to the X server * @param c The connection * @return A cookie * @@ -11579,7 +10315,7 @@ xcb_xkb_per_client_flags (xcb_connection_t *c /**< */, uint32_t autoCtrlsValues /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -11645,25 +10381,11 @@ xcb_xkb_per_client_flags_reply (xcb_connection_t *c /**< */, xcb_xkb_per_client_flags_cookie_t cookie /**< */, xcb_generic_error_t **e /**< */); -int -xcb_xkb_list_components_serialize (void **_buffer /**< */, - const xcb_xkb_list_components_request_t *_aux /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */); - -int -xcb_xkb_list_components_unserialize (const void *_buffer /**< */, - xcb_xkb_list_components_request_t **_aux /**< */); - int xcb_xkb_list_components_sizeof (const void *_buffer /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -11675,44 +10397,20 @@ xcb_xkb_list_components_sizeof (const void *_buffer /**< */); ** ** xcb_xkb_list_components_cookie_t xcb_xkb_list_components ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint16_t maxNames - ** @param uint8_t keymapsSpecLen - ** @param const xcb_xkb_string8_t *keymapsSpec - ** @param uint8_t keycodesSpecLen - ** @param const xcb_xkb_string8_t *keycodesSpec - ** @param uint8_t typesSpecLen - ** @param const xcb_xkb_string8_t *typesSpec - ** @param uint8_t compatMapSpecLen - ** @param const xcb_xkb_string8_t *compatMapSpec - ** @param uint8_t symbolsSpecLen - ** @param const xcb_xkb_string8_t *symbolsSpec - ** @param uint8_t geometrySpecLen - ** @param const xcb_xkb_string8_t *geometrySpec + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint16_t maxNames ** @returns xcb_xkb_list_components_cookie_t ** *****************************************************************************/ xcb_xkb_list_components_cookie_t -xcb_xkb_list_components (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint16_t maxNames /**< */, - uint8_t keymapsSpecLen /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - uint8_t keycodesSpecLen /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - uint8_t typesSpecLen /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - uint8_t compatMapSpecLen /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - uint8_t symbolsSpecLen /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - uint8_t geometrySpecLen /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */); +xcb_xkb_list_components (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint16_t maxNames /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -11727,41 +10425,17 @@ xcb_xkb_list_components (xcb_connection_t *c /**< */, ** ** xcb_xkb_list_components_cookie_t xcb_xkb_list_components_unchecked ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint16_t maxNames - ** @param uint8_t keymapsSpecLen - ** @param const xcb_xkb_string8_t *keymapsSpec - ** @param uint8_t keycodesSpecLen - ** @param const xcb_xkb_string8_t *keycodesSpec - ** @param uint8_t typesSpecLen - ** @param const xcb_xkb_string8_t *typesSpec - ** @param uint8_t compatMapSpecLen - ** @param const xcb_xkb_string8_t *compatMapSpec - ** @param uint8_t symbolsSpecLen - ** @param const xcb_xkb_string8_t *symbolsSpec - ** @param uint8_t geometrySpecLen - ** @param const xcb_xkb_string8_t *geometrySpec + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint16_t maxNames ** @returns xcb_xkb_list_components_cookie_t ** *****************************************************************************/ xcb_xkb_list_components_cookie_t -xcb_xkb_list_components_unchecked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint16_t maxNames /**< */, - uint8_t keymapsSpecLen /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - uint8_t keycodesSpecLen /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - uint8_t typesSpecLen /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - uint8_t compatMapSpecLen /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - uint8_t symbolsSpecLen /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - uint8_t geometrySpecLen /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */); +xcb_xkb_list_components_unchecked (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint16_t maxNames /**< */); /***************************************************************************** @@ -11950,23 +10624,6 @@ xcb_xkb_list_components_reply (xcb_connection_t *c /**< */, xcb_xkb_list_components_cookie_t cookie /**< */, xcb_generic_error_t **e /**< */); -int -xcb_xkb_get_kbd_by_name_serialize (void **_buffer /**< */, - const xcb_xkb_get_kbd_by_name_request_t *_aux /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */); - -int -xcb_xkb_get_kbd_by_name_unserialize (const void *_buffer /**< */, - xcb_xkb_get_kbd_by_name_request_t **_aux /**< */); - -int -xcb_xkb_get_kbd_by_name_sizeof (const void *_buffer /**< */); - /***************************************************************************** ** @@ -12317,7 +10974,7 @@ xcb_xkb_get_kbd_by_name_replies_types_map_serialize (void uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -12331,7 +10988,7 @@ xcb_xkb_get_kbd_by_name_replies_types_map_unpack (const void uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -12345,781 +11002,13 @@ xcb_xkb_get_kbd_by_name_replies_types_map_sizeof (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, uint16_t present /**< */); -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_types_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_types_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_type_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_types_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_key_type_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_type_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_types_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_syms_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_syms_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_sym_map_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_syms_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_key_sym_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_sym_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_syms_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_action_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_action_t * - ** - *****************************************************************************/ - -xcb_xkb_action_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_action_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_action_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_action_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_set_behavior_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_set_behavior_t * - ** - *****************************************************************************/ - -xcb_xkb_set_behavior_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_set_behavior_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_set_behavior_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_set_behavior_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_set_explicit_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_set_explicit_t * - ** - *****************************************************************************/ - -xcb_xkb_set_explicit_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_set_explicit_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_set_explicit_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_set_explicit_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_mod_map_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_mod_map_t * - ** - *****************************************************************************/ - -xcb_xkb_key_mod_map_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_key_mod_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_mod_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_v_mod_map_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_v_mod_map_t * - ** - *****************************************************************************/ - -xcb_xkb_key_v_mod_map_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_v_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_key_v_mod_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_v_mod_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_serialize (void **_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */, - const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *_aux /**< */); - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_unpack (const void *_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */, - xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *_aux /**< */); - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_sizeof (const void *_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_types_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_types_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_type_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_types_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_key_type_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_type_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_types_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_syms_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_syms_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_sym_map_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_syms_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_key_sym_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_sym_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_syms_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_action_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_action_t * - ** - *****************************************************************************/ - -xcb_xkb_action_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_action_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_action_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_action_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_set_behavior_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_set_behavior_t * - ** - *****************************************************************************/ - -xcb_xkb_set_behavior_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_set_behavior_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_set_behavior_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_set_behavior_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_set_explicit_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_set_explicit_t * - ** - *****************************************************************************/ - -xcb_xkb_set_explicit_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_set_explicit_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_set_explicit_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_set_explicit_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_mod_map_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_mod_map_t * - ** - *****************************************************************************/ - -xcb_xkb_key_mod_map_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_key_mod_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_mod_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_v_mod_map_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_v_mod_map_t * - ** - *****************************************************************************/ - -xcb_xkb_key_v_mod_map_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_v_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_key_v_mod_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_v_mod_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_serialize (void **_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */, - const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *_aux /**< */); - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_unpack (const void *_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */, - xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *_aux /**< */); - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_sizeof (const void *_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */); - - /***************************************************************************** ** ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names @@ -13529,421 +11418,14 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof (const void *_buffe /***************************************************************************** ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names + ** xcb_xkb_sym_interpret_t * xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn ** ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * + ** @returns xcb_xkb_sym_interpret_t * ** *****************************************************************************/ -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_name_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_name_t * - ** - *****************************************************************************/ - -xcb_xkb_key_name_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_name_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_xkb_key_name_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_name_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_alias_t * - ** - *****************************************************************************/ - -xcb_xkb_key_alias_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_xkb_key_alias_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_alias_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_serialize (void **_buffer /**< */, - uint8_t nTypes /**< */, - uint16_t nKTLevels /**< */, - uint32_t indicators /**< */, - uint16_t virtualMods /**< */, - uint8_t groupNames /**< */, - uint8_t nKeys /**< */, - uint8_t nKeyAliases /**< */, - uint8_t nRadioGroups /**< */, - uint32_t which /**< */, - const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *_aux /**< */); - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_unpack (const void *_buffer /**< */, - uint8_t nTypes /**< */, - uint16_t nKTLevels /**< */, - uint32_t indicators /**< */, - uint16_t virtualMods /**< */, - uint8_t groupNames /**< */, - uint8_t nKeys /**< */, - uint8_t nKeyAliases /**< */, - uint8_t nRadioGroups /**< */, - uint32_t which /**< */, - xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *_aux /**< */); - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_sizeof (const void *_buffer /**< */, - uint8_t nTypes /**< */, - uint16_t nKTLevels /**< */, - uint32_t indicators /**< */, - uint16_t virtualMods /**< */, - uint8_t groupNames /**< */, - uint8_t nKeys /**< */, - uint8_t nKeyAliases /**< */, - uint8_t nRadioGroups /**< */, - uint32_t which /**< */); - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * +xcb_xkb_sym_interpret_t * xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); @@ -13963,16 +11445,16 @@ xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_length (const xcb_xkb_get_kbd /***************************************************************************** ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_end + ** xcb_xkb_sym_interpret_iterator_t xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_iterator ** ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_generic_iterator_t + ** @returns xcb_xkb_sym_interpret_iterator_t ** *****************************************************************************/ -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); +xcb_xkb_sym_interpret_iterator_t +xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, + const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); /***************************************************************************** @@ -14016,32 +11498,6 @@ xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_iterator (const xcb_xkb_ge const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); -/***************************************************************************** - ** - ** xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t * - ** - *****************************************************************************/ - -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map (const xcb_xkb_get_kbd_by_name_replies_t *R /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t * - ** - *****************************************************************************/ - -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map (const xcb_xkb_get_kbd_by_name_replies_t *R /**< */); - - /***************************************************************************** ** ** xcb_xkb_indicator_map_t * xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps @@ -14096,19 +11552,6 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t * xcb_xkb_get_kbd_by_name_replies_key_names_value_list (const xcb_xkb_get_kbd_by_name_replies_t *R /**< */); -/***************************************************************************** - ** - ** xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t * - ** - *****************************************************************************/ - -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list (const xcb_xkb_get_kbd_by_name_replies_t *R /**< */); - - /***************************************************************************** ** ** xcb_xkb_counted_string_16_t * xcb_xkb_get_kbd_by_name_replies_geometry_label_font @@ -14121,187 +11564,6 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list (const xcb_xkb_get_kbd_by xcb_xkb_counted_string_16_t * xcb_xkb_get_kbd_by_name_replies_geometry_label_font (const xcb_xkb_get_kbd_by_name_replies_t *R /**< */); - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_properties_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_properties_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_property_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_properties_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_property_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_property_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_properties_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_colors_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_colors_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_colors_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_counted_string_16_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_colors_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_shapes_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_shapes_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_shape_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_shapes_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_shape_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_shape_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_shapes_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_sections_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_sections_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_section_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_sections_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_section_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_section_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_sections_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_doodads_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_doodads_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_doodad_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_doodads_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_doodad_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_doodad_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_doodads_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_t * xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_alias_t * - ** - *****************************************************************************/ - -xcb_xkb_key_alias_t * -xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_key_alias_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_alias_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */); - int xcb_xkb_get_kbd_by_name_replies_serialize (void **_buffer /**< */, uint16_t reported /**< */, @@ -14317,7 +11579,7 @@ xcb_xkb_get_kbd_by_name_replies_sizeof (const void *_buffer /**< */, uint16_t reported /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -14329,48 +11591,24 @@ xcb_xkb_get_kbd_by_name_replies_sizeof (const void *_buffer /**< */, ** ** xcb_xkb_get_kbd_by_name_cookie_t xcb_xkb_get_kbd_by_name ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint16_t need - ** @param uint16_t want - ** @param uint8_t load - ** @param uint8_t keymapsSpecLen - ** @param const xcb_xkb_string8_t *keymapsSpec - ** @param uint8_t keycodesSpecLen - ** @param const xcb_xkb_string8_t *keycodesSpec - ** @param uint8_t typesSpecLen - ** @param const xcb_xkb_string8_t *typesSpec - ** @param uint8_t compatMapSpecLen - ** @param const xcb_xkb_string8_t *compatMapSpec - ** @param uint8_t symbolsSpecLen - ** @param const xcb_xkb_string8_t *symbolsSpec - ** @param uint8_t geometrySpecLen - ** @param const xcb_xkb_string8_t *geometrySpec + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint16_t need + ** @param uint16_t want + ** @param uint8_t load ** @returns xcb_xkb_get_kbd_by_name_cookie_t ** *****************************************************************************/ xcb_xkb_get_kbd_by_name_cookie_t -xcb_xkb_get_kbd_by_name (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint16_t need /**< */, - uint16_t want /**< */, - uint8_t load /**< */, - uint8_t keymapsSpecLen /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - uint8_t keycodesSpecLen /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - uint8_t typesSpecLen /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - uint8_t compatMapSpecLen /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - uint8_t symbolsSpecLen /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - uint8_t geometrySpecLen /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */); +xcb_xkb_get_kbd_by_name (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint16_t need /**< */, + uint16_t want /**< */, + uint8_t load /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -14385,45 +11623,21 @@ xcb_xkb_get_kbd_by_name (xcb_connection_t *c /**< */, ** ** xcb_xkb_get_kbd_by_name_cookie_t xcb_xkb_get_kbd_by_name_unchecked ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint16_t need - ** @param uint16_t want - ** @param uint8_t load - ** @param uint8_t keymapsSpecLen - ** @param const xcb_xkb_string8_t *keymapsSpec - ** @param uint8_t keycodesSpecLen - ** @param const xcb_xkb_string8_t *keycodesSpec - ** @param uint8_t typesSpecLen - ** @param const xcb_xkb_string8_t *typesSpec - ** @param uint8_t compatMapSpecLen - ** @param const xcb_xkb_string8_t *compatMapSpec - ** @param uint8_t symbolsSpecLen - ** @param const xcb_xkb_string8_t *symbolsSpec - ** @param uint8_t geometrySpecLen - ** @param const xcb_xkb_string8_t *geometrySpec + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint16_t need + ** @param uint16_t want + ** @param uint8_t load ** @returns xcb_xkb_get_kbd_by_name_cookie_t ** *****************************************************************************/ xcb_xkb_get_kbd_by_name_cookie_t -xcb_xkb_get_kbd_by_name_unchecked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint16_t need /**< */, - uint16_t want /**< */, - uint8_t load /**< */, - uint8_t keymapsSpecLen /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - uint8_t keycodesSpecLen /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - uint8_t typesSpecLen /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - uint8_t compatMapSpecLen /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - uint8_t symbolsSpecLen /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - uint8_t geometrySpecLen /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */); +xcb_xkb_get_kbd_by_name_unchecked (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint16_t need /**< */, + uint16_t want /**< */, + uint8_t load /**< */); /***************************************************************************** @@ -14473,7 +11687,7 @@ int xcb_xkb_get_device_info_sizeof (const void *_buffer /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -14508,7 +11722,7 @@ xcb_xkb_get_device_info (xcb_connection_t *c /**< */, xcb_xkb_id_spec_t ledID /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -14684,7 +11898,7 @@ int xcb_xkb_set_device_info_sizeof (const void *_buffer /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -14722,7 +11936,7 @@ xcb_xkb_set_device_info_checked (xcb_connection_t *c /**< */, const xcb_xkb_device_led_info_t *leds /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -14760,7 +11974,7 @@ int xcb_xkb_set_debugging_flags_sizeof (const void *_buffer /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * @@ -14793,7 +12007,7 @@ xcb_xkb_set_debugging_flags (xcb_connection_t *c /**< */, const xcb_xkb_string8_t *message /**< */); /** - * Delivers a request to the X server + * * @param c The connection * @return A cookie * diff --git a/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch b/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch new file mode 100644 index 00000000000..a73e633e73b --- /dev/null +++ b/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch @@ -0,0 +1,273 @@ +diff --git a/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch b/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch +index f63719d..e69de29 100644 +--- a/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch ++++ b/src/3rdparty/xcb/libxcb/support_libxcb_versions_where_xcb_sumof_not_available.patch +@@ -1,134 +0,0 @@ +-diff --git a/src/3rdparty/xcb/libxcb/xkb.c b/src/3rdparty/xcb/libxcb/xkb.c +-index d55bd76..2e3a24a 100644 +---- a/src/3rdparty/xcb/libxcb/xkb.c +-+++ b/src/3rdparty/xcb/libxcb/xkb.c +-@@ -18,6 +18,15 @@ +- +- xcb_extension_t xcb_xkb_id = { "XKEYBOARD", 0 }; +- +-+int qt_xcb_sumof(uint8_t *list, int len) +-+{ +-+ int i, s = 0; +-+ for(i=0; inLevelsPerType, R->nTypes); +-+ return (/* valueList */ S->nLevelsPerType, R->nTypes); +- } +- +- +-@@ -9043,7 +9052,7 @@ xcb_xkb_get_names_value_list_kt_level_names_end (const xcb_xkb_get_names_reply_t +- const xcb_xkb_get_names_value_list_t *S /**< */) +- { +- xcb_generic_iterator_t i; +-- i.data = /* valueList */ S->ktLevelNames + xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes); +-+ i.data = /* valueList */ S->ktLevelNames + qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes); +- i.rem = 0; +- i.index = (char *) i.data - (char *) S; +- return i; +-@@ -9508,8 +9517,8 @@ xcb_xkb_get_names_value_list_serialize (void **_ +- xcb_block_len = 0; +- /* ktLevelNames */ +- xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; +-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); +-- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); +-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); +-+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); +- xcb_parts_idx++; +- xcb_align_to = ALIGNOF(xcb_atom_t); +- } +-@@ -9762,7 +9771,7 @@ xcb_xkb_get_names_value_list_unpack (const void *_buffer / +- xcb_block_len = 0; +- /* ktLevelNames */ +- _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; +-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); +-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); +- xcb_tmp += xcb_block_len; +- xcb_align_to = ALIGNOF(xcb_atom_t); +- } +-@@ -10139,7 +10148,7 @@ int +- xcb_xkb_set_names_values_kt_level_names_length (const xcb_xkb_set_names_request_t *R /**< */, +- const xcb_xkb_set_names_values_t *S /**< */) +- { +-- return xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); +-+ return qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); +- } +- +- +-@@ -10157,7 +10166,7 @@ xcb_xkb_set_names_values_kt_level_names_end (const xcb_xkb_set_names_request_t * +- const xcb_xkb_set_names_values_t *S /**< */) +- { +- xcb_generic_iterator_t i; +-- i.data = /* values */ S->ktLevelNames + xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); +-+ i.data = /* values */ S->ktLevelNames + qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); +- i.rem = 0; +- i.index = (char *) i.data - (char *) S; +- return i; +-@@ -10607,8 +10616,8 @@ xcb_xkb_set_names_values_serialize (void **_buffer +- xcb_block_len = 0; +- /* ktLevelNames */ +- xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; +-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +-- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +-+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +- xcb_parts_idx++; +- xcb_align_to = ALIGNOF(xcb_atom_t); +- } +-@@ -10849,7 +10858,7 @@ xcb_xkb_set_names_values_unpack (const void *_buffer /**< */, +- xcb_block_len = 0; +- /* ktLevelNames */ +- _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; +-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +- xcb_tmp += xcb_block_len; +- xcb_align_to = ALIGNOF(xcb_atom_t); +- } +-@@ -12872,7 +12881,7 @@ int +- xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, +- const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) +- { +-- return xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); +-+ return qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); +- } +- +- +-@@ -12890,7 +12899,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (const x +- const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) +- { +- xcb_generic_iterator_t i; +-- i.data = /* replies */ S->key_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); +-+ i.data = /* replies */ S->key_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); +- i.rem = 0; +- i.index = (char *) i.data - (char *) S; +- return i; +-@@ -13340,8 +13349,8 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void +- xcb_block_len = 0; +- /* ktLevelNames */ +- xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; +-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +-- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +-+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +- xcb_parts_idx++; +- xcb_align_to = ALIGNOF(xcb_atom_t); +- } +-@@ -13582,7 +13591,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void +- xcb_block_len = 0; +- /* ktLevelNames */ +- _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; +-- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +-+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +- xcb_tmp += xcb_block_len; +- xcb_align_to = ALIGNOF(xcb_atom_t); +- } +diff --git a/src/3rdparty/xcb/libxcb/xkb.c b/src/3rdparty/xcb/libxcb/xkb.c +index d55bd76..ff025f6 100644 +--- a/src/3rdparty/xcb/libxcb/xkb.c ++++ b/src/3rdparty/xcb/libxcb/xkb.c +@@ -18,6 +18,15 @@ + + xcb_extension_t xcb_xkb_id = { "XKEYBOARD", 0 }; + ++int qt_xcb_sumof(uint8_t *list, int len) ++{ ++ int i, s = 0; ++ for(i=0; inLevelsPerType, R->nTypes); ++ return qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes); + } + + +@@ -9043,7 +9052,7 @@ xcb_xkb_get_names_value_list_kt_level_names_end (const xcb_xkb_get_names_reply_t + const xcb_xkb_get_names_value_list_t *S /**< */) + { + xcb_generic_iterator_t i; +- i.data = /* valueList */ S->ktLevelNames + xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes); ++ i.data = /* valueList */ S->ktLevelNames + qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +@@ -9508,8 +9517,8 @@ xcb_xkb_get_names_value_list_serialize (void **_ + xcb_block_len = 0; + /* ktLevelNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; +- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); +- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); ++ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); ++ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } +@@ -9762,7 +9771,7 @@ xcb_xkb_get_names_value_list_unpack (const void *_buffer / + xcb_block_len = 0; + /* ktLevelNames */ + _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; +- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); ++ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } +@@ -10139,7 +10148,7 @@ int + xcb_xkb_set_names_values_kt_level_names_length (const xcb_xkb_set_names_request_t *R /**< */, + const xcb_xkb_set_names_values_t *S /**< */) + { +- return xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); ++ return qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); + } + + +@@ -10157,7 +10166,7 @@ xcb_xkb_set_names_values_kt_level_names_end (const xcb_xkb_set_names_request_t * + const xcb_xkb_set_names_values_t *S /**< */) + { + xcb_generic_iterator_t i; +- i.data = /* values */ S->ktLevelNames + xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); ++ i.data = /* values */ S->ktLevelNames + qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +@@ -10607,8 +10616,8 @@ xcb_xkb_set_names_values_serialize (void **_buffer + xcb_block_len = 0; + /* ktLevelNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; +- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); ++ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); ++ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } +@@ -10849,7 +10858,7 @@ xcb_xkb_set_names_values_unpack (const void *_buffer /**< */, + xcb_block_len = 0; + /* ktLevelNames */ + _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; +- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); ++ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } +@@ -12872,7 +12881,7 @@ int + xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, + const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) + { +- return xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); ++ return qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); + } + + +@@ -12890,7 +12899,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (const x + const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) + { + xcb_generic_iterator_t i; +- i.data = /* replies */ S->key_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); ++ i.data = /* replies */ S->key_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +@@ -13340,8 +13349,8 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void + xcb_block_len = 0; + /* ktLevelNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; +- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); +- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); ++ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); ++ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } +@@ -13582,7 +13591,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void + xcb_block_len = 0; + /* ktLevelNames */ + _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; +- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); ++ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } diff --git a/src/3rdparty/xcb/libxcb/xkb.c b/src/3rdparty/xcb/libxcb/xkb.c index 3e07d6df84e..ff025f6b60d 100644 --- a/src/3rdparty/xcb/libxcb/xkb.c +++ b/src/3rdparty/xcb/libxcb/xkb.c @@ -3,6 +3,9 @@ * Edit at your peril. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include #include @@ -25,44 +28,6 @@ int qt_xcb_sumof(uint8_t *list, int len) return s; } -/***************************************************************************** - ** - ** void xcb_xkb_ax_option_next - ** - ** @param xcb_xkb_ax_option_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_ax_option_next (xcb_xkb_ax_option_iterator_t *i /**< */) -{ - --i->rem; - ++i->data; - i->index += sizeof(xcb_xkb_ax_option_t); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_ax_option_end - ** - ** @param xcb_xkb_ax_option_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_ax_option_end (xcb_xkb_ax_option_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - ret.data = i.data + i.rem; - ret.index = i.index + ((char *) ret.data - (char *) i.data); - ret.rem = 0; - return ret; -} - - /***************************************************************************** ** ** void xcb_xkb_device_spec_next @@ -366,130 +331,6 @@ xcb_xkb_key_alias_end (xcb_xkb_key_alias_iterator_t i /**< */) return ret; } -int -xcb_xkb_counted_string_8_sizeof (const void *_buffer /**< */) -{ - char *xcb_tmp = (char *)_buffer; - const xcb_xkb_counted_string_8_t *_aux = (xcb_xkb_counted_string_8_t *)_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_block_len = 0; - unsigned int xcb_pad = 0; - unsigned int xcb_align_to; - - - xcb_block_len += sizeof(xcb_xkb_counted_string_8_t); - xcb_tmp += xcb_block_len; - /* string */ - xcb_block_len += _aux->length * sizeof(uint8_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_counted_string_8_string - ** - ** @param const xcb_xkb_counted_string_8_t *R - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_counted_string_8_string (const xcb_xkb_counted_string_8_t *R /**< */) -{ - return (uint8_t *) (R + 1); -} - - -/***************************************************************************** - ** - ** int xcb_xkb_counted_string_8_string_length - ** - ** @param const xcb_xkb_counted_string_8_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_counted_string_8_string_length (const xcb_xkb_counted_string_8_t *R /**< */) -{ - return R->length; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_counted_string_8_string_end - ** - ** @param const xcb_xkb_counted_string_8_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_counted_string_8_string_end (const xcb_xkb_counted_string_8_t *R /**< */) -{ - xcb_generic_iterator_t i; - i.data = ((uint8_t *) (R + 1)) + (R->length); - i.rem = 0; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** void xcb_xkb_counted_string_8_next - ** - ** @param xcb_xkb_counted_string_8_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_counted_string_8_next (xcb_xkb_counted_string_8_iterator_t *i /**< */) -{ - xcb_xkb_counted_string_8_t *R = i->data; - xcb_generic_iterator_t child; - child.data = (xcb_xkb_counted_string_8_t *)(((char *)R) + xcb_xkb_counted_string_8_sizeof(R)); - i->index = (char *) child.data - (char *) i->data; - --i->rem; - i->data = (xcb_xkb_counted_string_8_t *) child.data; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_counted_string_8_end - ** - ** @param xcb_xkb_counted_string_8_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_counted_string_8_end (xcb_xkb_counted_string_8_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - while(i.rem > 0) - xcb_xkb_counted_string_8_next(&i); - ret.data = i.data; - ret.rem = i.rem; - ret.index = i.index; - return ret; -} - int xcb_xkb_counted_string_16_sizeof (const void *_buffer /**< */) { @@ -498,15 +339,29 @@ xcb_xkb_counted_string_16_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_counted_string_16_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* string */ - xcb_block_len += _aux->length * sizeof(uint8_t); + xcb_block_len += _aux->length * sizeof(char); xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = ALIGNOF(char); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + /* alignment_pad */ + xcb_block_len += (((_aux->length + 5) & (~3)) - (_aux->length + 2)) * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); /* insert padding */ xcb_pad = -xcb_block_len & (xcb_align_to - 1); xcb_buffer_len += xcb_block_len + xcb_pad; @@ -522,17 +377,17 @@ xcb_xkb_counted_string_16_sizeof (const void *_buffer /**< */) /***************************************************************************** ** - ** uint8_t * xcb_xkb_counted_string_16_string + ** char * xcb_xkb_counted_string_16_string ** ** @param const xcb_xkb_counted_string_16_t *R - ** @returns uint8_t * + ** @returns char * ** *****************************************************************************/ -uint8_t * +char * xcb_xkb_counted_string_16_string (const xcb_xkb_counted_string_16_t *R /**< */) { - return (uint8_t *) (R + 1); + return (char *) (R + 1); } @@ -565,7 +420,7 @@ xcb_generic_iterator_t xcb_xkb_counted_string_16_string_end (const xcb_xkb_counted_string_16_t *R /**< */) { xcb_generic_iterator_t i; - i.data = ((uint8_t *) (R + 1)) + (R->length); + i.data = ((char *) (R + 1)) + (R->length); i.rem = 0; i.index = (char *) i.data - (char *) R; return i; @@ -574,18 +429,55 @@ xcb_xkb_counted_string_16_string_end (const xcb_xkb_counted_string_16_t *R /**< /***************************************************************************** ** - ** uint8_t * xcb_xkb_counted_string_16_pad_0 + ** void * xcb_xkb_counted_string_16_alignment_pad ** ** @param const xcb_xkb_counted_string_16_t *R - ** @returns uint8_t * + ** @returns void * ** *****************************************************************************/ -uint8_t * -xcb_xkb_counted_string_16_pad_0 (const xcb_xkb_counted_string_16_t *R /**< */) +void * +xcb_xkb_counted_string_16_alignment_pad (const xcb_xkb_counted_string_16_t *R /**< */) { xcb_generic_iterator_t prev = xcb_xkb_counted_string_16_string_end(R); - return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0); + return (void *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + + +/***************************************************************************** + ** + ** int xcb_xkb_counted_string_16_alignment_pad_length + ** + ** @param const xcb_xkb_counted_string_16_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_counted_string_16_alignment_pad_length (const xcb_xkb_counted_string_16_t *R /**< */) +{ + return (((R->length + 5) & (~3)) - (R->length + 2)); +} + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_counted_string_16_alignment_pad_end + ** + ** @param const xcb_xkb_counted_string_16_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_counted_string_16_alignment_pad_end (const xcb_xkb_counted_string_16_t *R /**< */) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t child = xcb_xkb_counted_string_16_string_end(R); + i.data = ((char *) child.data) + ((((R->length + 5) & (~3)) - (R->length + 2))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; } @@ -677,11 +569,13 @@ xcb_xkb_key_type_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_key_type_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* map */ xcb_block_len += _aux->nMapEntries * sizeof(xcb_xkb_kt_map_entry_t); xcb_tmp += xcb_block_len; @@ -867,11 +761,13 @@ xcb_xkb_key_sym_map_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_key_sym_map_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* syms */ xcb_block_len += _aux->nSyms * sizeof(xcb_keysym_t); xcb_tmp += xcb_block_len; @@ -1138,71 +1034,33 @@ xcb_xkb_radio_group_behavior_end (xcb_xkb_radio_group_behavior_iterator_t i /** /***************************************************************************** ** - ** void xcb_xkb_overlay_1_behavior_next + ** void xcb_xkb_overlay_behavior_next ** - ** @param xcb_xkb_overlay_1_behavior_iterator_t *i + ** @param xcb_xkb_overlay_behavior_iterator_t *i ** @returns void ** *****************************************************************************/ void -xcb_xkb_overlay_1_behavior_next (xcb_xkb_overlay_1_behavior_iterator_t *i /**< */) +xcb_xkb_overlay_behavior_next (xcb_xkb_overlay_behavior_iterator_t *i /**< */) { --i->rem; ++i->data; - i->index += sizeof(xcb_xkb_overlay_1_behavior_t); + i->index += sizeof(xcb_xkb_overlay_behavior_t); } /***************************************************************************** ** - ** xcb_generic_iterator_t xcb_xkb_overlay_1_behavior_end + ** xcb_generic_iterator_t xcb_xkb_overlay_behavior_end ** - ** @param xcb_xkb_overlay_1_behavior_iterator_t i + ** @param xcb_xkb_overlay_behavior_iterator_t i ** @returns xcb_generic_iterator_t ** *****************************************************************************/ xcb_generic_iterator_t -xcb_xkb_overlay_1_behavior_end (xcb_xkb_overlay_1_behavior_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - ret.data = i.data + i.rem; - ret.index = i.index + ((char *) ret.data - (char *) i.data); - ret.rem = 0; - return ret; -} - - -/***************************************************************************** - ** - ** void xcb_xkb_overlay_2_behavior_next - ** - ** @param xcb_xkb_overlay_2_behavior_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_overlay_2_behavior_next (xcb_xkb_overlay_2_behavior_iterator_t *i /**< */) -{ - --i->rem; - ++i->data; - i->index += sizeof(xcb_xkb_overlay_2_behavior_t); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_overlay_2_behavior_end - ** - ** @param xcb_xkb_overlay_2_behavior_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_overlay_2_behavior_end (xcb_xkb_overlay_2_behavior_iterator_t i /**< */) +xcb_xkb_overlay_behavior_end (xcb_xkb_overlay_behavior_iterator_t i /**< */) { xcb_generic_iterator_t ret; ret.data = i.data + i.rem; @@ -1290,71 +1148,33 @@ xcb_xkb_permament_radio_group_behavior_end (xcb_xkb_permament_radio_group_behavi /***************************************************************************** ** - ** void xcb_xkb_permament_overlay_1_behavior_next + ** void xcb_xkb_permament_overlay_behavior_next ** - ** @param xcb_xkb_permament_overlay_1_behavior_iterator_t *i + ** @param xcb_xkb_permament_overlay_behavior_iterator_t *i ** @returns void ** *****************************************************************************/ void -xcb_xkb_permament_overlay_1_behavior_next (xcb_xkb_permament_overlay_1_behavior_iterator_t *i /**< */) +xcb_xkb_permament_overlay_behavior_next (xcb_xkb_permament_overlay_behavior_iterator_t *i /**< */) { --i->rem; ++i->data; - i->index += sizeof(xcb_xkb_permament_overlay_1_behavior_t); + i->index += sizeof(xcb_xkb_permament_overlay_behavior_t); } /***************************************************************************** ** - ** xcb_generic_iterator_t xcb_xkb_permament_overlay_1_behavior_end + ** xcb_generic_iterator_t xcb_xkb_permament_overlay_behavior_end ** - ** @param xcb_xkb_permament_overlay_1_behavior_iterator_t i + ** @param xcb_xkb_permament_overlay_behavior_iterator_t i ** @returns xcb_generic_iterator_t ** *****************************************************************************/ xcb_generic_iterator_t -xcb_xkb_permament_overlay_1_behavior_end (xcb_xkb_permament_overlay_1_behavior_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - ret.data = i.data + i.rem; - ret.index = i.index + ((char *) ret.data - (char *) i.data); - ret.rem = 0; - return ret; -} - - -/***************************************************************************** - ** - ** void xcb_xkb_permament_overlay_2_behavior_next - ** - ** @param xcb_xkb_permament_overlay_2_behavior_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_permament_overlay_2_behavior_next (xcb_xkb_permament_overlay_2_behavior_iterator_t *i /**< */) -{ - --i->rem; - ++i->data; - i->index += sizeof(xcb_xkb_permament_overlay_2_behavior_t); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_permament_overlay_2_behavior_end - ** - ** @param xcb_xkb_permament_overlay_2_behavior_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_permament_overlay_2_behavior_end (xcb_xkb_permament_overlay_2_behavior_iterator_t i /**< */) +xcb_xkb_permament_overlay_behavior_end (xcb_xkb_permament_overlay_behavior_iterator_t i /**< */) { xcb_generic_iterator_t ret; ret.data = i.data + i.rem; @@ -1599,11 +1419,13 @@ xcb_xkb_set_key_type_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_set_key_type_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* entries */ xcb_block_len += _aux->nMapEntries * sizeof(xcb_xkb_kt_set_map_entry_t); xcb_tmp += xcb_block_len; @@ -1819,296 +1641,6 @@ xcb_xkb_string8_end (xcb_xkb_string8_iterator_t i /**< */) return ret; } -int -xcb_xkb_property_serialize (void **_buffer /**< */, - const xcb_xkb_property_t *_aux /**< */, - const xcb_xkb_string8_t *name /**< */, - const xcb_xkb_string8_t *value /**< */) -{ - char *xcb_out = *_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; - - unsigned int xcb_pad = 0; - char xcb_pad0[3] = {0, 0, 0}; - struct iovec xcb_parts[5]; - unsigned int xcb_parts_idx = 0; - unsigned int xcb_block_len = 0; - unsigned int i; - char *xcb_tmp; - - /* xcb_xkb_property_t.nameLength */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->nameLength; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* name */ - xcb_parts[xcb_parts_idx].iov_base = (char *) name; - xcb_block_len += _aux->nameLength * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->nameLength * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_property_t.valueLength */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valueLength; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* value */ - xcb_parts[xcb_parts_idx].iov_base = (char *) value; - xcb_block_len += _aux->valueLength * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->valueLength * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - - if (NULL == xcb_out) { - /* allocate memory */ - xcb_out = malloc(xcb_buffer_len); - *_buffer = xcb_out; - } - - xcb_tmp = xcb_out; - for(i=0; inameLength; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_property_name_end - ** - ** @param const xcb_xkb_property_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_property_name_end (const xcb_xkb_property_t *R /**< */) -{ - xcb_generic_iterator_t i; - i.data = ((xcb_xkb_string8_t *) (R + 1)) + (R->nameLength); - i.rem = 0; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_string8_t * xcb_xkb_property_value - ** - ** @param const xcb_xkb_property_t *R - ** @returns xcb_xkb_string8_t * - ** - *****************************************************************************/ - -xcb_xkb_string8_t * -xcb_xkb_property_value (const xcb_xkb_property_t *R /**< */) -{ - xcb_generic_iterator_t prev = xcb_xkb_property_name_end(R); - return (xcb_xkb_string8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint16_t, prev.index) + 2); -} - - -/***************************************************************************** - ** - ** int xcb_xkb_property_value_length - ** - ** @param const xcb_xkb_property_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_property_value_length (const xcb_xkb_property_t *R /**< */) -{ - return R->valueLength; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_property_value_end - ** - ** @param const xcb_xkb_property_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_property_value_end (const xcb_xkb_property_t *R /**< */) -{ - xcb_generic_iterator_t i; - xcb_generic_iterator_t child = xcb_xkb_property_name_end(R); - i.data = ((xcb_xkb_string8_t *) child.data) + (R->valueLength); - i.rem = 0; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** void xcb_xkb_property_next - ** - ** @param xcb_xkb_property_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_property_next (xcb_xkb_property_iterator_t *i /**< */) -{ - xcb_xkb_property_t *R = i->data; - xcb_generic_iterator_t child; - child.data = (xcb_xkb_property_t *)(((char *)R) + xcb_xkb_property_sizeof(R)); - i->index = (char *) child.data - (char *) i->data; - --i->rem; - i->data = (xcb_xkb_property_t *) child.data; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_property_end - ** - ** @param xcb_xkb_property_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_property_end (xcb_xkb_property_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - while(i.rem > 0) - xcb_xkb_property_next(&i); - ret.data = i.data; - ret.rem = i.rem; - ret.index = i.index; - return ret; -} - int xcb_xkb_outline_sizeof (const void *_buffer /**< */) { @@ -2117,11 +1649,13 @@ xcb_xkb_outline_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_outline_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* points */ xcb_block_len += _aux->nPoints * sizeof(xcb_point_t); xcb_tmp += xcb_block_len; @@ -2241,13 +1775,15 @@ xcb_xkb_shape_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int i; unsigned int xcb_tmp_len; xcb_block_len += sizeof(xcb_xkb_shape_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* outlines */ for(i=0; i<_aux->nOutlines; i++) { xcb_tmp_len = xcb_xkb_outline_sizeof(xcb_tmp); @@ -2430,11 +1966,13 @@ xcb_xkb_overlay_row_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_overlay_row_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* keys */ xcb_block_len += _aux->nKeys * sizeof(xcb_xkb_overlay_key_t); xcb_tmp += xcb_block_len; @@ -2554,13 +2092,15 @@ xcb_xkb_overlay_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int i; unsigned int xcb_tmp_len; xcb_block_len += sizeof(xcb_xkb_overlay_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* rows */ for(i=0; i<_aux->nRows; i++) { xcb_tmp_len = xcb_xkb_overlay_row_sizeof(xcb_tmp); @@ -2667,11 +2207,13 @@ xcb_xkb_row_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_row_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* keys */ xcb_block_len += _aux->nKeys * sizeof(xcb_xkb_key_t); xcb_tmp += xcb_block_len; @@ -2783,619 +2325,6 @@ xcb_xkb_row_end (xcb_xkb_row_iterator_t i /**< */) return ret; } - -/***************************************************************************** - ** - ** void xcb_xkb_common_doodad_next - ** - ** @param xcb_xkb_common_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_common_doodad_next (xcb_xkb_common_doodad_iterator_t *i /**< */) -{ - --i->rem; - ++i->data; - i->index += sizeof(xcb_xkb_common_doodad_t); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_common_doodad_end - ** - ** @param xcb_xkb_common_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_common_doodad_end (xcb_xkb_common_doodad_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - ret.data = i.data + i.rem; - ret.index = i.index + ((char *) ret.data - (char *) i.data); - ret.rem = 0; - return ret; -} - - -/***************************************************************************** - ** - ** void xcb_xkb_shape_doodad_next - ** - ** @param xcb_xkb_shape_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_shape_doodad_next (xcb_xkb_shape_doodad_iterator_t *i /**< */) -{ - --i->rem; - ++i->data; - i->index += sizeof(xcb_xkb_shape_doodad_t); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_shape_doodad_end - ** - ** @param xcb_xkb_shape_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_shape_doodad_end (xcb_xkb_shape_doodad_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - ret.data = i.data + i.rem; - ret.index = i.index + ((char *) ret.data - (char *) i.data); - ret.rem = 0; - return ret; -} - -int -xcb_xkb_text_doodad_sizeof (const void *_buffer /**< */) -{ - char *xcb_tmp = (char *)_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_block_len = 0; - unsigned int xcb_pad = 0; - unsigned int xcb_align_to; - - - xcb_block_len += sizeof(xcb_xkb_text_doodad_t); - xcb_tmp += xcb_block_len; - /* text */ - xcb_block_len += xcb_xkb_counted_string_16_sizeof(xcb_tmp); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* font */ - xcb_block_len += xcb_xkb_counted_string_16_sizeof(xcb_tmp); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_t * xcb_xkb_text_doodad_text - ** - ** @param const xcb_xkb_text_doodad_t *R - ** @returns xcb_xkb_counted_string_16_t * - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_t * -xcb_xkb_text_doodad_text (const xcb_xkb_text_doodad_t *R /**< */) -{ - return (xcb_xkb_counted_string_16_t *) (R + 1); -} - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_t * xcb_xkb_text_doodad_font - ** - ** @param const xcb_xkb_text_doodad_t *R - ** @returns xcb_xkb_counted_string_16_t * - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_t * -xcb_xkb_text_doodad_font (const xcb_xkb_text_doodad_t *R /**< */) -{ - xcb_generic_iterator_t prev = xcb_xkb_counted_string_16_string_end(xcb_xkb_text_doodad_text(R)); - return (xcb_xkb_counted_string_16_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_counted_string_16_t, prev.index) + 0); -} - - -/***************************************************************************** - ** - ** void xcb_xkb_text_doodad_next - ** - ** @param xcb_xkb_text_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_text_doodad_next (xcb_xkb_text_doodad_iterator_t *i /**< */) -{ - xcb_xkb_text_doodad_t *R = i->data; - xcb_generic_iterator_t child; - child.data = (xcb_xkb_text_doodad_t *)(((char *)R) + xcb_xkb_text_doodad_sizeof(R)); - i->index = (char *) child.data - (char *) i->data; - --i->rem; - i->data = (xcb_xkb_text_doodad_t *) child.data; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_text_doodad_end - ** - ** @param xcb_xkb_text_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_text_doodad_end (xcb_xkb_text_doodad_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - while(i.rem > 0) - xcb_xkb_text_doodad_next(&i); - ret.data = i.data; - ret.rem = i.rem; - ret.index = i.index; - return ret; -} - - -/***************************************************************************** - ** - ** void xcb_xkb_indicator_doodad_next - ** - ** @param xcb_xkb_indicator_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_indicator_doodad_next (xcb_xkb_indicator_doodad_iterator_t *i /**< */) -{ - --i->rem; - ++i->data; - i->index += sizeof(xcb_xkb_indicator_doodad_t); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_indicator_doodad_end - ** - ** @param xcb_xkb_indicator_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_indicator_doodad_end (xcb_xkb_indicator_doodad_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - ret.data = i.data + i.rem; - ret.index = i.index + ((char *) ret.data - (char *) i.data); - ret.rem = 0; - return ret; -} - -int -xcb_xkb_logo_doodad_sizeof (const void *_buffer /**< */) -{ - char *xcb_tmp = (char *)_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_block_len = 0; - unsigned int xcb_pad = 0; - unsigned int xcb_align_to; - - - xcb_block_len += sizeof(xcb_xkb_logo_doodad_t); - xcb_tmp += xcb_block_len; - /* logoName */ - xcb_block_len += xcb_xkb_counted_string_16_sizeof(xcb_tmp); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_t * xcb_xkb_logo_doodad_logo_name - ** - ** @param const xcb_xkb_logo_doodad_t *R - ** @returns xcb_xkb_counted_string_16_t * - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_t * -xcb_xkb_logo_doodad_logo_name (const xcb_xkb_logo_doodad_t *R /**< */) -{ - return (xcb_xkb_counted_string_16_t *) (R + 1); -} - - -/***************************************************************************** - ** - ** void xcb_xkb_logo_doodad_next - ** - ** @param xcb_xkb_logo_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_logo_doodad_next (xcb_xkb_logo_doodad_iterator_t *i /**< */) -{ - xcb_xkb_logo_doodad_t *R = i->data; - xcb_generic_iterator_t child; - child.data = (xcb_xkb_logo_doodad_t *)(((char *)R) + xcb_xkb_logo_doodad_sizeof(R)); - i->index = (char *) child.data - (char *) i->data; - --i->rem; - i->data = (xcb_xkb_logo_doodad_t *) child.data; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_logo_doodad_end - ** - ** @param xcb_xkb_logo_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_logo_doodad_end (xcb_xkb_logo_doodad_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - while(i.rem > 0) - xcb_xkb_logo_doodad_next(&i); - ret.data = i.data; - ret.rem = i.rem; - ret.index = i.index; - return ret; -} - -int -xcb_xkb_doodad_sizeof (const void *_buffer /**< */) -{ - char *xcb_tmp = (char *)_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_block_len = 0; - unsigned int xcb_pad = 0; - unsigned int xcb_align_to; - - - xcb_block_len += sizeof(xcb_xkb_doodad_t); - xcb_tmp += xcb_block_len; - /* text */ - xcb_block_len += xcb_xkb_text_doodad_sizeof(xcb_tmp); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_text_doodad_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* logo */ - xcb_block_len += xcb_xkb_logo_doodad_sizeof(xcb_tmp); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_logo_doodad_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - - -/***************************************************************************** - ** - ** void xcb_xkb_doodad_next - ** - ** @param xcb_xkb_doodad_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_doodad_next (xcb_xkb_doodad_iterator_t *i /**< */) -{ - xcb_xkb_doodad_t *R = i->data; - /* FIXME - determine the size of the union xcb_xkb_doodad_t */ -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_doodad_end - ** - ** @param xcb_xkb_doodad_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_doodad_end (xcb_xkb_doodad_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - while(i.rem > 0) - xcb_xkb_doodad_next(&i); - ret.data = i.data; - ret.rem = i.rem; - ret.index = i.index; - return ret; -} - -int -xcb_xkb_section_sizeof (const void *_buffer /**< */) -{ - char *xcb_tmp = (char *)_buffer; - const xcb_xkb_section_t *_aux = (xcb_xkb_section_t *)_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_block_len = 0; - unsigned int xcb_pad = 0; - unsigned int xcb_align_to; - - unsigned int i; - unsigned int xcb_tmp_len; - - xcb_block_len += sizeof(xcb_xkb_section_t); - xcb_tmp += xcb_block_len; - /* rows */ - for(i=0; i<_aux->nRows; i++) { - xcb_tmp_len = xcb_xkb_row_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_row_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* doodads */ - for(i=0; i<_aux->nDoodads; i++) { - xcb_tmp_len = xcb_xkb_doodad_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_doodad_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* overlays */ - for(i=0; i<_aux->nOverlays; i++) { - xcb_tmp_len = xcb_xkb_overlay_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_overlay_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_section_rows_length - ** - ** @param const xcb_xkb_section_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_section_rows_length (const xcb_xkb_section_t *R /**< */) -{ - return R->nRows; -} - - -/***************************************************************************** - ** - ** xcb_xkb_row_iterator_t xcb_xkb_section_rows_iterator - ** - ** @param const xcb_xkb_section_t *R - ** @returns xcb_xkb_row_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_row_iterator_t -xcb_xkb_section_rows_iterator (const xcb_xkb_section_t *R /**< */) -{ - xcb_xkb_row_iterator_t i; - i.data = (xcb_xkb_row_t *) (R + 1); - i.rem = R->nRows; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_section_doodads_length - ** - ** @param const xcb_xkb_section_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_section_doodads_length (const xcb_xkb_section_t *R /**< */) -{ - return R->nDoodads; -} - - -/***************************************************************************** - ** - ** xcb_xkb_doodad_iterator_t xcb_xkb_section_doodads_iterator - ** - ** @param const xcb_xkb_section_t *R - ** @returns xcb_xkb_doodad_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_doodad_iterator_t -xcb_xkb_section_doodads_iterator (const xcb_xkb_section_t *R /**< */) -{ - xcb_xkb_doodad_iterator_t i; - xcb_generic_iterator_t prev = xcb_xkb_row_end(xcb_xkb_section_rows_iterator(R)); - i.data = (xcb_xkb_doodad_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_doodad_t, prev.index)); - i.rem = R->nDoodads; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_section_overlays_length - ** - ** @param const xcb_xkb_section_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_section_overlays_length (const xcb_xkb_section_t *R /**< */) -{ - return R->nOverlays; -} - - -/***************************************************************************** - ** - ** xcb_xkb_overlay_iterator_t xcb_xkb_section_overlays_iterator - ** - ** @param const xcb_xkb_section_t *R - ** @returns xcb_xkb_overlay_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_overlay_iterator_t -xcb_xkb_section_overlays_iterator (const xcb_xkb_section_t *R /**< */) -{ - xcb_xkb_overlay_iterator_t i; - xcb_generic_iterator_t prev = xcb_xkb_doodad_end(xcb_xkb_section_doodads_iterator(R)); - i.data = (xcb_xkb_overlay_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_overlay_t, prev.index)); - i.rem = R->nOverlays; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** void xcb_xkb_section_next - ** - ** @param xcb_xkb_section_iterator_t *i - ** @returns void - ** - *****************************************************************************/ - -void -xcb_xkb_section_next (xcb_xkb_section_iterator_t *i /**< */) -{ - xcb_xkb_section_t *R = i->data; - xcb_generic_iterator_t child; - child.data = (xcb_xkb_section_t *)(((char *)R) + xcb_xkb_section_sizeof(R)); - i->index = (char *) child.data - (char *) i->data; - --i->rem; - i->data = (xcb_xkb_section_t *) child.data; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_section_end - ** - ** @param xcb_xkb_section_iterator_t i - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_section_end (xcb_xkb_section_iterator_t i /**< */) -{ - xcb_generic_iterator_t ret; - while(i.rem > 0) - xcb_xkb_section_next(&i); - ret.data = i.data; - ret.rem = i.rem; - ret.index = i.index; - return ret; -} - int xcb_xkb_listing_sizeof (const void *_buffer /**< */) { @@ -3404,11 +2333,13 @@ xcb_xkb_listing_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_listing_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* string */ xcb_block_len += _aux->length * sizeof(xcb_xkb_string8_t); xcb_tmp += xcb_block_len; @@ -3528,11 +2459,13 @@ xcb_xkb_device_led_info_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_device_led_info_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* names */ xcb_block_len += xcb_popcount(_aux->namesPresent) * sizeof(uint32_t); xcb_tmp += xcb_block_len; @@ -4509,6 +3442,82 @@ xcb_xkb_sa_device_valuator_end (xcb_xkb_sa_device_valuator_iterator_t i /**< */ } +/***************************************************************************** + ** + ** void xcb_xkb_si_action_next + ** + ** @param xcb_xkb_si_action_iterator_t *i + ** @returns void + ** + *****************************************************************************/ + +void +xcb_xkb_si_action_next (xcb_xkb_si_action_iterator_t *i /**< */) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_si_action_t); +} + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_si_action_end + ** + ** @param xcb_xkb_si_action_iterator_t i + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_si_action_end (xcb_xkb_si_action_iterator_t i /**< */) +{ + xcb_generic_iterator_t ret; + ret.data = i.data + i.rem; + ret.index = i.index + ((char *) ret.data - (char *) i.data); + ret.rem = 0; + return ret; +} + + +/***************************************************************************** + ** + ** void xcb_xkb_sym_interpret_next + ** + ** @param xcb_xkb_sym_interpret_iterator_t *i + ** @returns void + ** + *****************************************************************************/ + +void +xcb_xkb_sym_interpret_next (xcb_xkb_sym_interpret_iterator_t *i /**< */) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sym_interpret_t); +} + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_sym_interpret_end + ** + ** @param xcb_xkb_sym_interpret_iterator_t i + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_sym_interpret_end (xcb_xkb_sym_interpret_iterator_t i /**< */) +{ + xcb_generic_iterator_t ret; + ret.data = i.data + i.rem; + ret.index = i.index + ((char *) ret.data - (char *) i.data); + ret.rem = 0; + return ret; +} + + /***************************************************************************** ** ** void xcb_xkb_action_next @@ -4655,7 +3664,7 @@ xcb_xkb_select_events_details_serialize (void * { char *xcb_out = *_buffer; unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int xcb_pad = 0; char xcb_pad0[3] = {0, 0, 0}; @@ -4858,7 +3867,7 @@ xcb_xkb_select_events_details_unpack (const void *_buffer unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY) { @@ -5710,7 +4719,7 @@ xcb_xkb_get_controls_reply (xcb_connection_t *c /**< */, ** @param uint16_t ignoreLockVirtualMods ** @param uint8_t mouseKeysDfltBtn ** @param uint8_t groupsWrap - ** @param xcb_xkb_ax_option_t accessXOptions + ** @param uint16_t accessXOptions ** @param uint32_t affectEnabledControls ** @param uint32_t enabledControls ** @param uint32_t changeControls @@ -5726,8 +4735,8 @@ xcb_xkb_get_controls_reply (xcb_connection_t *c /**< */, ** @param uint16_t accessXTimeout ** @param uint32_t accessXTimeoutMask ** @param uint32_t accessXTimeoutValues - ** @param xcb_xkb_ax_option_t accessXTimeoutOptionsMask - ** @param xcb_xkb_ax_option_t accessXTimeoutOptionsValues + ** @param uint16_t accessXTimeoutOptionsMask + ** @param uint16_t accessXTimeoutOptionsValues ** @param const uint8_t *perKeyRepeat ** @returns xcb_void_cookie_t ** @@ -5746,7 +4755,7 @@ xcb_xkb_set_controls_checked (xcb_connection_t *c /**< */, uint16_t ignoreLockVirtualMods /**< */, uint8_t mouseKeysDfltBtn /**< */, uint8_t groupsWrap /**< */, - xcb_xkb_ax_option_t accessXOptions /**< */, + uint16_t accessXOptions /**< */, uint32_t affectEnabledControls /**< */, uint32_t enabledControls /**< */, uint32_t changeControls /**< */, @@ -5762,8 +4771,8 @@ xcb_xkb_set_controls_checked (xcb_connection_t *c /**< */, uint16_t accessXTimeout /**< */, uint32_t accessXTimeoutMask /**< */, uint32_t accessXTimeoutValues /**< */, - xcb_xkb_ax_option_t accessXTimeoutOptionsMask /**< */, - xcb_xkb_ax_option_t accessXTimeoutOptionsValues /**< */, + uint16_t accessXTimeoutOptionsMask /**< */, + uint16_t accessXTimeoutOptionsValues /**< */, const uint8_t *perKeyRepeat /**< */) { static const xcb_protocol_request_t xcb_req = { @@ -5835,7 +4844,7 @@ xcb_xkb_set_controls_checked (xcb_connection_t *c /**< */, ** @param uint16_t ignoreLockVirtualMods ** @param uint8_t mouseKeysDfltBtn ** @param uint8_t groupsWrap - ** @param xcb_xkb_ax_option_t accessXOptions + ** @param uint16_t accessXOptions ** @param uint32_t affectEnabledControls ** @param uint32_t enabledControls ** @param uint32_t changeControls @@ -5851,8 +4860,8 @@ xcb_xkb_set_controls_checked (xcb_connection_t *c /**< */, ** @param uint16_t accessXTimeout ** @param uint32_t accessXTimeoutMask ** @param uint32_t accessXTimeoutValues - ** @param xcb_xkb_ax_option_t accessXTimeoutOptionsMask - ** @param xcb_xkb_ax_option_t accessXTimeoutOptionsValues + ** @param uint16_t accessXTimeoutOptionsMask + ** @param uint16_t accessXTimeoutOptionsValues ** @param const uint8_t *perKeyRepeat ** @returns xcb_void_cookie_t ** @@ -5871,7 +4880,7 @@ xcb_xkb_set_controls (xcb_connection_t *c /**< */, uint16_t ignoreLockVirtualMods /**< */, uint8_t mouseKeysDfltBtn /**< */, uint8_t groupsWrap /**< */, - xcb_xkb_ax_option_t accessXOptions /**< */, + uint16_t accessXOptions /**< */, uint32_t affectEnabledControls /**< */, uint32_t enabledControls /**< */, uint32_t changeControls /**< */, @@ -5887,8 +4896,8 @@ xcb_xkb_set_controls (xcb_connection_t *c /**< */, uint16_t accessXTimeout /**< */, uint32_t accessXTimeoutMask /**< */, uint32_t accessXTimeoutValues /**< */, - xcb_xkb_ax_option_t accessXTimeoutOptionsMask /**< */, - xcb_xkb_ax_option_t accessXTimeoutOptionsValues /**< */, + uint16_t accessXTimeoutOptionsMask /**< */, + uint16_t accessXTimeoutOptionsValues /**< */, const uint8_t *perKeyRepeat /**< */) { static const xcb_protocol_request_t xcb_req = { @@ -6074,6 +5083,60 @@ xcb_xkb_get_map_map_acts_rtrn_count_end (const xcb_xkb_get_map_reply_t *R /**< } +/***************************************************************************** + ** + ** uint8_t * xcb_xkb_get_map_map_alignment_pad + ** + ** @param const xcb_xkb_get_map_map_t *S + ** @returns uint8_t * + ** + *****************************************************************************/ + +uint8_t * +xcb_xkb_get_map_map_alignment_pad (const xcb_xkb_get_map_map_t *S /**< */) +{ + return /* map */ S->alignment_pad; +} + + +/***************************************************************************** + ** + ** int xcb_xkb_get_map_map_alignment_pad_length + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_map_map_alignment_pad_length (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */) +{ + return (((R->nKeyActions + 3) & (~3)) - R->nKeyActions); +} + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_map_map_alignment_pad_end + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_map_map_alignment_pad_end (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */) +{ + xcb_generic_iterator_t i; + i.data = /* map */ S->alignment_pad + (((R->nKeyActions + 3) & (~3)) - R->nKeyActions); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + + /***************************************************************************** ** ** xcb_xkb_action_t * xcb_xkb_get_map_map_acts_rtrn_acts @@ -6211,7 +5274,7 @@ int xcb_xkb_get_map_map_vmods_rtrn_length (const xcb_xkb_get_map_reply_t *R /**< */, const xcb_xkb_get_map_map_t *S /**< */) { - return R->nVModMapKeys; + return xcb_popcount(R->virtualMods); } @@ -6229,7 +5292,61 @@ xcb_xkb_get_map_map_vmods_rtrn_end (const xcb_xkb_get_map_reply_t *R /**< */, const xcb_xkb_get_map_map_t *S /**< */) { xcb_generic_iterator_t i; - i.data = /* map */ S->vmods_rtrn + R->nVModMapKeys; + i.data = /* map */ S->vmods_rtrn + xcb_popcount(R->virtualMods); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + + +/***************************************************************************** + ** + ** uint8_t * xcb_xkb_get_map_map_alignment_pad_2 + ** + ** @param const xcb_xkb_get_map_map_t *S + ** @returns uint8_t * + ** + *****************************************************************************/ + +uint8_t * +xcb_xkb_get_map_map_alignment_pad_2 (const xcb_xkb_get_map_map_t *S /**< */) +{ + return /* map */ S->alignment_pad2; +} + + +/***************************************************************************** + ** + ** int xcb_xkb_get_map_map_alignment_pad_2_length + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_map_map_alignment_pad_2_length (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */) +{ + return (((xcb_popcount(R->virtualMods) + 3) & (~3)) - xcb_popcount(R->virtualMods)); +} + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_map_map_alignment_pad_2_end + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_map_map_alignment_pad_2_end (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */) +{ + xcb_generic_iterator_t i; + i.data = /* map */ S->alignment_pad2 + (((xcb_popcount(R->virtualMods) + 3) & (~3)) - xcb_popcount(R->virtualMods)); i.rem = 0; i.index = (char *) i.data - (char *) S; return i; @@ -6290,6 +5407,60 @@ xcb_xkb_get_map_map_explicit_rtrn_iterator (const xcb_xkb_get_map_reply_t *R /* } +/***************************************************************************** + ** + ** uint16_t * xcb_xkb_get_map_map_alignment_pad_3 + ** + ** @param const xcb_xkb_get_map_map_t *S + ** @returns uint16_t * + ** + *****************************************************************************/ + +uint16_t * +xcb_xkb_get_map_map_alignment_pad_3 (const xcb_xkb_get_map_map_t *S /**< */) +{ + return /* map */ S->alignment_pad3; +} + + +/***************************************************************************** + ** + ** int xcb_xkb_get_map_map_alignment_pad_3_length + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_map_map_alignment_pad_3_length (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */) +{ + return (((R->totalKeyExplicit + 1) & (~1)) - R->totalKeyExplicit); +} + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_map_map_alignment_pad_3_end + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_map_map_alignment_pad_3_end (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */) +{ + xcb_generic_iterator_t i; + i.data = /* map */ S->alignment_pad3 + (((R->totalKeyExplicit + 1) & (~1)) - R->totalKeyExplicit); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + + /***************************************************************************** ** ** xcb_xkb_key_mod_map_t * xcb_xkb_get_map_map_modmap_rtrn @@ -6344,6 +5515,60 @@ xcb_xkb_get_map_map_modmap_rtrn_iterator (const xcb_xkb_get_map_reply_t *R /**< } +/***************************************************************************** + ** + ** uint16_t * xcb_xkb_get_map_map_alignment_pad_4 + ** + ** @param const xcb_xkb_get_map_map_t *S + ** @returns uint16_t * + ** + *****************************************************************************/ + +uint16_t * +xcb_xkb_get_map_map_alignment_pad_4 (const xcb_xkb_get_map_map_t *S /**< */) +{ + return /* map */ S->alignment_pad4; +} + + +/***************************************************************************** + ** + ** int xcb_xkb_get_map_map_alignment_pad_4_length + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_map_map_alignment_pad_4_length (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */) +{ + return (((R->totalModMapKeys + 1) & (~1)) - R->totalModMapKeys); +} + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_map_map_alignment_pad_4_end + ** + ** @param const xcb_xkb_get_map_map_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_map_map_alignment_pad_4_end (const xcb_xkb_get_map_reply_t *R /**< */, + const xcb_xkb_get_map_map_t *S /**< */) +{ + xcb_generic_iterator_t i; + i.data = /* map */ S->alignment_pad4 + (((R->totalModMapKeys + 1) & (~1)) - R->totalModMapKeys); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + + /***************************************************************************** ** ** xcb_xkb_key_v_mod_map_t * xcb_xkb_get_map_map_vmodmap_rtrn @@ -6404,7 +5629,7 @@ xcb_xkb_get_map_map_serialize (void **_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -6413,11 +5638,11 @@ xcb_xkb_get_map_map_serialize (void **_buffer /**< */, { char *xcb_out = *_buffer; unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int xcb_pad = 0; char xcb_pad0[3] = {0, 0, 0}; - struct iovec xcb_parts[19]; + struct iovec xcb_parts[27]; unsigned int xcb_parts_idx = 0; unsigned int xcb_block_len = 0; unsigned int i; @@ -6496,6 +5721,22 @@ xcb_xkb_get_map_map_serialize (void **_buffer /**< */, xcb_pad = 0; } xcb_block_len = 0; + /* alignment_pad */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->alignment_pad; + xcb_block_len += (((nKeyActions + 3) & (~3)) - nKeyActions) * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = (((nKeyActions + 3) & (~3)) - nKeyActions) * sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_parts[xcb_parts_idx].iov_len = xcb_pad; + xcb_parts_idx++; + xcb_pad = 0; + } + xcb_block_len = 0; /* acts_rtrn_acts */ xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->acts_rtrn_acts; xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); @@ -6534,8 +5775,24 @@ xcb_xkb_get_map_map_serialize (void **_buffer /**< */, xcb_block_len = 0; /* vmods_rtrn */ xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmods_rtrn; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = nVModMapKeys * sizeof(xcb_keycode_t); + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_parts[xcb_parts_idx].iov_len = xcb_pad; + xcb_parts_idx++; + xcb_pad = 0; + } + xcb_block_len = 0; + /* alignment_pad2 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->alignment_pad2; + xcb_block_len += (((xcb_popcount(virtualMods) + 3) & (~3)) - xcb_popcount(virtualMods)) * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = (((xcb_popcount(virtualMods) + 3) & (~3)) - xcb_popcount(virtualMods)) * sizeof(xcb_keycode_t); xcb_parts_idx++; xcb_align_to = ALIGNOF(uint8_t); } @@ -6556,6 +5813,22 @@ xcb_xkb_get_map_map_serialize (void **_buffer /**< */, xcb_parts[xcb_parts_idx].iov_len = totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); xcb_parts_idx++; xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_parts[xcb_parts_idx].iov_len = xcb_pad; + xcb_parts_idx++; + xcb_pad = 0; + } + xcb_block_len = 0; + /* alignment_pad3 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->alignment_pad3; + xcb_block_len += (((totalKeyExplicit + 1) & (~1)) - totalKeyExplicit) * sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = (((totalKeyExplicit + 1) & (~1)) - totalKeyExplicit) * sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); } if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { /* insert padding */ @@ -6574,6 +5847,22 @@ xcb_xkb_get_map_map_serialize (void **_buffer /**< */, xcb_parts[xcb_parts_idx].iov_len = totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); xcb_parts_idx++; xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_parts[xcb_parts_idx].iov_len = xcb_pad; + xcb_parts_idx++; + xcb_pad = 0; + } + xcb_block_len = 0; + /* alignment_pad4 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->alignment_pad4; + xcb_block_len += (((totalModMapKeys + 1) & (~1)) - totalModMapKeys) * sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = (((totalModMapKeys + 1) & (~1)) - totalModMapKeys) * sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); } if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { /* insert padding */ @@ -6628,7 +5917,7 @@ xcb_xkb_get_map_map_unpack (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -6639,7 +5928,7 @@ xcb_xkb_get_map_map_unpack (const void *_buffer /**< */, unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int i; unsigned int xcb_tmp_len; @@ -6702,6 +5991,19 @@ xcb_xkb_get_map_map_unpack (const void *_buffer /**< */, xcb_pad = 0; } xcb_block_len = 0; + /* alignment_pad */ + _aux->alignment_pad = (uint8_t *)xcb_tmp; + xcb_block_len += (((nKeyActions + 3) & (~3)) - nKeyActions) * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; /* acts_rtrn_acts */ _aux->acts_rtrn_acts = (xcb_xkb_action_t *)xcb_tmp; xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); @@ -6734,7 +6036,20 @@ xcb_xkb_get_map_map_unpack (const void *_buffer /**< */, xcb_block_len = 0; /* vmods_rtrn */ _aux->vmods_rtrn = (uint8_t *)xcb_tmp; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + /* alignment_pad2 */ + _aux->alignment_pad2 = (uint8_t *)xcb_tmp; + xcb_block_len += (((xcb_popcount(virtualMods) + 3) & (~3)) - xcb_popcount(virtualMods)) * sizeof(xcb_keycode_t); xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(uint8_t); } @@ -6752,6 +6067,19 @@ xcb_xkb_get_map_map_unpack (const void *_buffer /**< */, xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + /* alignment_pad3 */ + _aux->alignment_pad3 = (uint16_t *)xcb_tmp; + xcb_block_len += (((totalKeyExplicit + 1) & (~1)) - totalKeyExplicit) * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_t); } if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { /* insert padding */ @@ -6767,6 +6095,19 @@ xcb_xkb_get_map_map_unpack (const void *_buffer /**< */, xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + /* alignment_pad4 */ + _aux->alignment_pad4 = (uint16_t *)xcb_tmp; + xcb_block_len += (((totalModMapKeys + 1) & (~1)) - totalModMapKeys) * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_t); } if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { /* insert padding */ @@ -6802,14 +6143,14 @@ xcb_xkb_get_map_map_sizeof (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, uint16_t present /**< */) { xcb_xkb_get_map_map_t _aux; - return xcb_xkb_get_map_map_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, nVModMapKeys, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); + return xcb_xkb_get_map_map_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); } @@ -7294,7 +6635,7 @@ int xcb_xkb_set_map_values_vmods_length (const xcb_xkb_set_map_request_t *R /**< */, const xcb_xkb_set_map_values_t *S /**< */) { - return R->nVModMapKeys; + return xcb_popcount(R->virtualMods); } @@ -7312,7 +6653,7 @@ xcb_xkb_set_map_values_vmods_end (const xcb_xkb_set_map_request_t *R /**< */, const xcb_xkb_set_map_values_t *S /**< */) { xcb_generic_iterator_t i; - i.data = /* values */ S->vmods + R->nVModMapKeys; + i.data = /* values */ S->vmods + xcb_popcount(R->virtualMods); i.rem = 0; i.index = (char *) i.data - (char *) S; return i; @@ -7487,7 +6828,7 @@ xcb_xkb_set_map_values_serialize (void **_buffer /**< uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -7496,7 +6837,7 @@ xcb_xkb_set_map_values_serialize (void **_buffer /**< { char *xcb_out = *_buffer; unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int xcb_pad = 0; char xcb_pad0[3] = {0, 0, 0}; @@ -7617,8 +6958,8 @@ xcb_xkb_set_map_values_serialize (void **_buffer /**< xcb_block_len = 0; /* vmods */ xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmods; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = nVModMapKeys * sizeof(xcb_keycode_t); + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); xcb_parts_idx++; xcb_align_to = ALIGNOF(uint8_t); } @@ -7711,7 +7052,7 @@ xcb_xkb_set_map_values_unpack (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -7722,7 +7063,7 @@ xcb_xkb_set_map_values_unpack (const void *_buffer /**< */, unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int i; unsigned int xcb_tmp_len; @@ -7817,7 +7158,7 @@ xcb_xkb_set_map_values_unpack (const void *_buffer /**< */, xcb_block_len = 0; /* vmods */ _aux->vmods = (uint8_t *)xcb_tmp; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(uint8_t); } @@ -7885,14 +7226,14 @@ xcb_xkb_set_map_values_sizeof (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, uint16_t present /**< */) { xcb_xkb_set_map_values_t _aux; - return xcb_xkb_set_map_values_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, nVModMapKeys, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); + return xcb_xkb_set_map_values_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); } @@ -8007,7 +7348,7 @@ xcb_xkb_set_map_checked (xcb_connection_t *c /**< */, /* xcb_xkb_set_map_values_t values */ xcb_parts[4].iov_base = (char *) values; xcb_parts[4].iov_len = - xcb_xkb_set_map_values_sizeof (values, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, nVModMapKeys, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present); + xcb_xkb_set_map_values_sizeof (values, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present); xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; @@ -8125,7 +7466,7 @@ xcb_xkb_set_map (xcb_connection_t *c /**< */, /* xcb_xkb_set_map_values_t values */ xcb_parts[4].iov_base = (char *) values; xcb_parts[4].iov_len = - xcb_xkb_set_map_values_sizeof (values, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, nVModMapKeys, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present); + xcb_xkb_set_map_values_sizeof (values, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present); xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; @@ -8243,7 +7584,7 @@ xcb_xkb_set_map_aux_checked (xcb_connection_t *c /**< */, xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; /* xcb_xkb_set_map_values_t values */ xcb_parts[4].iov_len = - xcb_xkb_set_map_values_serialize (&xcb_aux0, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, nVModMapKeys, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, values); + xcb_xkb_set_map_values_serialize (&xcb_aux0, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, values); xcb_parts[4].iov_base = xcb_aux0; xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); @@ -8363,7 +7704,7 @@ xcb_xkb_set_map_aux (xcb_connection_t *c /**< */, xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; /* xcb_xkb_set_map_values_t values */ xcb_parts[4].iov_len = - xcb_xkb_set_map_values_serialize (&xcb_aux0, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, nVModMapKeys, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, values); + xcb_xkb_set_map_values_serialize (&xcb_aux0, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, values); xcb_parts[4].iov_base = xcb_aux0; xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); @@ -8379,15 +7720,17 @@ xcb_xkb_get_compat_map_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_get_compat_map_reply_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* si_rtrn */ - xcb_block_len += (16 * _aux->nSIRtrn) * sizeof(uint8_t); + xcb_block_len += _aux->nSIRtrn * sizeof(xcb_xkb_sym_interpret_t); xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = ALIGNOF(xcb_xkb_sym_interpret_t); /* insert padding */ xcb_pad = -xcb_block_len & (xcb_align_to - 1); xcb_buffer_len += xcb_block_len + xcb_pad; @@ -8513,17 +7856,17 @@ xcb_xkb_get_compat_map_unchecked (xcb_connection_t *c /**< */, /***************************************************************************** ** - ** uint8_t * xcb_xkb_get_compat_map_si_rtrn + ** xcb_xkb_sym_interpret_t * xcb_xkb_get_compat_map_si_rtrn ** ** @param const xcb_xkb_get_compat_map_reply_t *R - ** @returns uint8_t * + ** @returns xcb_xkb_sym_interpret_t * ** *****************************************************************************/ -uint8_t * +xcb_xkb_sym_interpret_t * xcb_xkb_get_compat_map_si_rtrn (const xcb_xkb_get_compat_map_reply_t *R /**< */) { - return (uint8_t *) (R + 1); + return (xcb_xkb_sym_interpret_t *) (R + 1); } @@ -8539,25 +7882,25 @@ xcb_xkb_get_compat_map_si_rtrn (const xcb_xkb_get_compat_map_reply_t *R /**< */ int xcb_xkb_get_compat_map_si_rtrn_length (const xcb_xkb_get_compat_map_reply_t *R /**< */) { - return (16 * R->nSIRtrn); + return R->nSIRtrn; } /***************************************************************************** ** - ** xcb_generic_iterator_t xcb_xkb_get_compat_map_si_rtrn_end + ** xcb_xkb_sym_interpret_iterator_t xcb_xkb_get_compat_map_si_rtrn_iterator ** ** @param const xcb_xkb_get_compat_map_reply_t *R - ** @returns xcb_generic_iterator_t + ** @returns xcb_xkb_sym_interpret_iterator_t ** *****************************************************************************/ -xcb_generic_iterator_t -xcb_xkb_get_compat_map_si_rtrn_end (const xcb_xkb_get_compat_map_reply_t *R /**< */) +xcb_xkb_sym_interpret_iterator_t +xcb_xkb_get_compat_map_si_rtrn_iterator (const xcb_xkb_get_compat_map_reply_t *R /**< */) { - xcb_generic_iterator_t i; - i.data = ((uint8_t *) (R + 1)) + ((16 * R->nSIRtrn)); - i.rem = 0; + xcb_xkb_sym_interpret_iterator_t i; + i.data = (xcb_xkb_sym_interpret_t *) (R + 1); + i.rem = R->nSIRtrn; i.index = (char *) i.data - (char *) R; return i; } @@ -8575,7 +7918,7 @@ xcb_xkb_get_compat_map_si_rtrn_end (const xcb_xkb_get_compat_map_reply_t *R /** xcb_xkb_mod_def_t * xcb_xkb_get_compat_map_group_rtrn (const xcb_xkb_get_compat_map_reply_t *R /**< */) { - xcb_generic_iterator_t prev = xcb_xkb_get_compat_map_si_rtrn_end(R); + xcb_generic_iterator_t prev = xcb_xkb_sym_interpret_end(xcb_xkb_get_compat_map_si_rtrn_iterator(R)); return (xcb_xkb_mod_def_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_mod_def_t, prev.index) + 0); } @@ -8609,7 +7952,7 @@ xcb_xkb_mod_def_iterator_t xcb_xkb_get_compat_map_group_rtrn_iterator (const xcb_xkb_get_compat_map_reply_t *R /**< */) { xcb_xkb_mod_def_iterator_t i; - xcb_generic_iterator_t prev = xcb_xkb_get_compat_map_si_rtrn_end(R); + xcb_generic_iterator_t prev = xcb_xkb_sym_interpret_end(xcb_xkb_get_compat_map_si_rtrn_iterator(R)); i.data = (xcb_xkb_mod_def_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_mod_def_t, prev.index)); i.rem = xcb_popcount(R->groupsRtrn); i.index = (char *) i.data - (char *) R; @@ -8644,15 +7987,17 @@ xcb_xkb_set_compat_map_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_set_compat_map_request_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* si */ - xcb_block_len += (16 * _aux->nSI) * sizeof(uint8_t); + xcb_block_len += _aux->nSI * sizeof(xcb_xkb_sym_interpret_t); xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = ALIGNOF(xcb_xkb_sym_interpret_t); /* insert padding */ xcb_pad = -xcb_block_len & (xcb_align_to - 1); xcb_buffer_len += xcb_block_len + xcb_pad; @@ -8682,29 +8027,29 @@ xcb_xkb_set_compat_map_sizeof (const void *_buffer /**< */) ** ** xcb_void_cookie_t xcb_xkb_set_compat_map_checked ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint8_t recomputeActions - ** @param uint8_t truncateSI - ** @param uint8_t groups - ** @param uint16_t firstSI - ** @param uint16_t nSI - ** @param const uint8_t *si - ** @param const xcb_xkb_mod_def_t *groupMaps + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint8_t recomputeActions + ** @param uint8_t truncateSI + ** @param uint8_t groups + ** @param uint16_t firstSI + ** @param uint16_t nSI + ** @param const xcb_xkb_sym_interpret_t *si + ** @param const xcb_xkb_mod_def_t *groupMaps ** @returns xcb_void_cookie_t ** *****************************************************************************/ xcb_void_cookie_t -xcb_xkb_set_compat_map_checked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint8_t recomputeActions /**< */, - uint8_t truncateSI /**< */, - uint8_t groups /**< */, - uint16_t firstSI /**< */, - uint16_t nSI /**< */, - const uint8_t *si /**< */, - const xcb_xkb_mod_def_t *groupMaps /**< */) +xcb_xkb_set_compat_map_checked (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint8_t recomputeActions /**< */, + uint8_t truncateSI /**< */, + uint8_t groups /**< */, + uint16_t firstSI /**< */, + uint16_t nSI /**< */, + const xcb_xkb_sym_interpret_t *si /**< */, + const xcb_xkb_mod_def_t *groupMaps /**< */) { static const xcb_protocol_request_t xcb_req = { /* count */ 6, @@ -8730,9 +8075,9 @@ xcb_xkb_set_compat_map_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - /* uint8_t si */ + /* xcb_xkb_sym_interpret_t si */ xcb_parts[4].iov_base = (char *) si; - xcb_parts[4].iov_len = (16 * nSI) * sizeof(uint8_t); + xcb_parts[4].iov_len = nSI * sizeof(xcb_xkb_sym_interpret_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; /* xcb_xkb_mod_def_t groupMaps */ @@ -8750,29 +8095,29 @@ xcb_xkb_set_compat_map_checked (xcb_connection_t *c /**< */, ** ** xcb_void_cookie_t xcb_xkb_set_compat_map ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint8_t recomputeActions - ** @param uint8_t truncateSI - ** @param uint8_t groups - ** @param uint16_t firstSI - ** @param uint16_t nSI - ** @param const uint8_t *si - ** @param const xcb_xkb_mod_def_t *groupMaps + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint8_t recomputeActions + ** @param uint8_t truncateSI + ** @param uint8_t groups + ** @param uint16_t firstSI + ** @param uint16_t nSI + ** @param const xcb_xkb_sym_interpret_t *si + ** @param const xcb_xkb_mod_def_t *groupMaps ** @returns xcb_void_cookie_t ** *****************************************************************************/ xcb_void_cookie_t -xcb_xkb_set_compat_map (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint8_t recomputeActions /**< */, - uint8_t truncateSI /**< */, - uint8_t groups /**< */, - uint16_t firstSI /**< */, - uint16_t nSI /**< */, - const uint8_t *si /**< */, - const xcb_xkb_mod_def_t *groupMaps /**< */) +xcb_xkb_set_compat_map (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint8_t recomputeActions /**< */, + uint8_t truncateSI /**< */, + uint8_t groups /**< */, + uint16_t firstSI /**< */, + uint16_t nSI /**< */, + const xcb_xkb_sym_interpret_t *si /**< */, + const xcb_xkb_mod_def_t *groupMaps /**< */) { static const xcb_protocol_request_t xcb_req = { /* count */ 6, @@ -8798,9 +8143,9 @@ xcb_xkb_set_compat_map (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - /* uint8_t si */ + /* xcb_xkb_sym_interpret_t si */ xcb_parts[4].iov_base = (char *) si; - xcb_parts[4].iov_len = (16 * nSI) * sizeof(uint8_t); + xcb_parts[4].iov_len = nSI * sizeof(xcb_xkb_sym_interpret_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; /* xcb_xkb_mod_def_t groupMaps */ @@ -8917,13 +8262,15 @@ xcb_xkb_get_indicator_map_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_get_indicator_map_reply_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* maps */ - xcb_block_len += _aux->nIndicators * sizeof(xcb_xkb_indicator_map_t); + xcb_block_len += xcb_popcount(_aux->which) * sizeof(xcb_xkb_indicator_map_t); xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(xcb_xkb_indicator_map_t); /* insert padding */ @@ -9049,7 +8396,7 @@ xcb_xkb_get_indicator_map_maps (const xcb_xkb_get_indicator_map_reply_t *R /**< int xcb_xkb_get_indicator_map_maps_length (const xcb_xkb_get_indicator_map_reply_t *R /**< */) { - return R->nIndicators; + return xcb_popcount(R->which); } @@ -9067,7 +8414,7 @@ xcb_xkb_get_indicator_map_maps_iterator (const xcb_xkb_get_indicator_map_reply_t { xcb_xkb_indicator_map_iterator_t i; i.data = (xcb_xkb_indicator_map_t *) (R + 1); - i.rem = R->nIndicators; + i.rem = xcb_popcount(R->which); i.index = (char *) i.data - (char *) R; return i; } @@ -9100,11 +8447,13 @@ xcb_xkb_set_indicator_map_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_set_indicator_map_request_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* maps */ xcb_block_len += xcb_popcount(_aux->which) * sizeof(xcb_xkb_indicator_map_t); xcb_tmp += xcb_block_len; @@ -9602,6 +8951,60 @@ xcb_xkb_get_names_value_list_n_levels_per_type_end (const xcb_xkb_get_names_repl } +/***************************************************************************** + ** + ** uint8_t * xcb_xkb_get_names_value_list_alignment_pad + ** + ** @param const xcb_xkb_get_names_value_list_t *S + ** @returns uint8_t * + ** + *****************************************************************************/ + +uint8_t * +xcb_xkb_get_names_value_list_alignment_pad (const xcb_xkb_get_names_value_list_t *S /**< */) +{ + return /* valueList */ S->alignment_pad; +} + + +/***************************************************************************** + ** + ** int xcb_xkb_get_names_value_list_alignment_pad_length + ** + ** @param const xcb_xkb_get_names_value_list_t *R + ** @returns int + ** + *****************************************************************************/ + +int +xcb_xkb_get_names_value_list_alignment_pad_length (const xcb_xkb_get_names_reply_t *R /**< */, + const xcb_xkb_get_names_value_list_t *S /**< */) +{ + return (((R->nTypes + 3) & (~3)) - R->nTypes); +} + + +/***************************************************************************** + ** + ** xcb_generic_iterator_t xcb_xkb_get_names_value_list_alignment_pad_end + ** + ** @param const xcb_xkb_get_names_value_list_t *R + ** @returns xcb_generic_iterator_t + ** + *****************************************************************************/ + +xcb_generic_iterator_t +xcb_xkb_get_names_value_list_alignment_pad_end (const xcb_xkb_get_names_reply_t *R /**< */, + const xcb_xkb_get_names_value_list_t *S /**< */) +{ + xcb_generic_iterator_t i; + i.data = /* valueList */ S->alignment_pad + (((R->nTypes + 3) & (~3)) - R->nTypes); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + + /***************************************************************************** ** ** xcb_atom_t * xcb_xkb_get_names_value_list_kt_level_names @@ -9993,11 +9396,11 @@ xcb_xkb_get_names_value_list_serialize (void **_ { char *xcb_out = *_buffer; unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int xcb_pad = 0; char xcb_pad0[3] = {0, 0, 0}; - struct iovec xcb_parts[25]; + struct iovec xcb_parts[27]; unsigned int xcb_parts_idx = 0; unsigned int xcb_block_len = 0; unsigned int i; @@ -10096,6 +9499,22 @@ xcb_xkb_get_names_value_list_serialize (void **_ xcb_pad = 0; } xcb_block_len = 0; + /* alignment_pad */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->alignment_pad; + xcb_block_len += (((nTypes + 3) & (~3)) - nTypes) * sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = (((nTypes + 3) & (~3)) - nTypes) * sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_parts[xcb_parts_idx].iov_len = xcb_pad; + xcb_parts_idx++; + xcb_pad = 0; + } + xcb_block_len = 0; /* ktLevelNames */ xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); @@ -10255,7 +9674,7 @@ xcb_xkb_get_names_value_list_unpack (const void *_buffer / unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { @@ -10337,6 +9756,19 @@ xcb_xkb_get_names_value_list_unpack (const void *_buffer / xcb_pad = 0; } xcb_block_len = 0; + /* alignment_pad */ + _aux->alignment_pad = (uint8_t *)xcb_tmp; + xcb_block_len += (((nTypes + 3) & (~3)) - nTypes) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; /* ktLevelNames */ _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); @@ -11079,7 +10511,7 @@ xcb_xkb_set_names_values_serialize (void **_buffer { char *xcb_out = *_buffer; unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int xcb_pad = 0; char xcb_pad0[3] = {0, 0, 0}; @@ -11342,7 +10774,7 @@ xcb_xkb_set_names_values_unpack (const void *_buffer /**< */, unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { @@ -11884,914 +11316,6 @@ xcb_xkb_set_names_aux (xcb_connection_t *c /**< */, return xcb_ret; } -int -xcb_xkb_get_geometry_sizeof (const void *_buffer /**< */) -{ - char *xcb_tmp = (char *)_buffer; - const xcb_xkb_get_geometry_reply_t *_aux = (xcb_xkb_get_geometry_reply_t *)_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_block_len = 0; - unsigned int xcb_pad = 0; - unsigned int xcb_align_to; - - unsigned int i; - unsigned int xcb_tmp_len; - - xcb_block_len += sizeof(xcb_xkb_get_geometry_reply_t); - xcb_tmp += xcb_block_len; - /* labelFont */ - xcb_block_len += xcb_xkb_counted_string_16_sizeof(xcb_tmp); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* properties */ - for(i=0; i<_aux->nProperties; i++) { - xcb_tmp_len = xcb_xkb_property_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_property_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* colors */ - for(i=0; i<_aux->nColors; i++) { - xcb_tmp_len = xcb_xkb_counted_string_16_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* shapes */ - for(i=0; i<_aux->nShapes; i++) { - xcb_tmp_len = xcb_xkb_shape_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_shape_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* sections */ - for(i=0; i<_aux->nSections; i++) { - xcb_tmp_len = xcb_xkb_section_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_section_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* doodads */ - for(i=0; i<_aux->nDoodads; i++) { - xcb_tmp_len = xcb_xkb_doodad_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_doodad_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* keyAliases */ - xcb_block_len += _aux->nKeyAliases * sizeof(xcb_xkb_key_alias_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - - -/***************************************************************************** - ** - ** xcb_xkb_get_geometry_cookie_t xcb_xkb_get_geometry - ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param xcb_atom_t name - ** @returns xcb_xkb_get_geometry_cookie_t - ** - *****************************************************************************/ - -xcb_xkb_get_geometry_cookie_t -xcb_xkb_get_geometry (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - xcb_atom_t name /**< */) -{ - static const xcb_protocol_request_t xcb_req = { - /* count */ 2, - /* ext */ &xcb_xkb_id, - /* opcode */ XCB_XKB_GET_GEOMETRY, - /* isvoid */ 0 - }; - - struct iovec xcb_parts[4]; - xcb_xkb_get_geometry_cookie_t xcb_ret; - xcb_xkb_get_geometry_request_t xcb_out; - - xcb_out.deviceSpec = deviceSpec; - memset(xcb_out.pad0, 0, 2); - xcb_out.name = name; - - xcb_parts[2].iov_base = (char *) &xcb_out; - xcb_parts[2].iov_len = sizeof(xcb_out); - xcb_parts[3].iov_base = 0; - xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - - xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); - return xcb_ret; -} - - -/***************************************************************************** - ** - ** xcb_xkb_get_geometry_cookie_t xcb_xkb_get_geometry_unchecked - ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param xcb_atom_t name - ** @returns xcb_xkb_get_geometry_cookie_t - ** - *****************************************************************************/ - -xcb_xkb_get_geometry_cookie_t -xcb_xkb_get_geometry_unchecked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - xcb_atom_t name /**< */) -{ - static const xcb_protocol_request_t xcb_req = { - /* count */ 2, - /* ext */ &xcb_xkb_id, - /* opcode */ XCB_XKB_GET_GEOMETRY, - /* isvoid */ 0 - }; - - struct iovec xcb_parts[4]; - xcb_xkb_get_geometry_cookie_t xcb_ret; - xcb_xkb_get_geometry_request_t xcb_out; - - xcb_out.deviceSpec = deviceSpec; - memset(xcb_out.pad0, 0, 2); - xcb_out.name = name; - - xcb_parts[2].iov_base = (char *) &xcb_out; - xcb_parts[2].iov_len = sizeof(xcb_out); - xcb_parts[3].iov_base = 0; - xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - - xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); - return xcb_ret; -} - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_t * xcb_xkb_get_geometry_label_font - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_counted_string_16_t * - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_t * -xcb_xkb_get_geometry_label_font (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - return (xcb_xkb_counted_string_16_t *) (R + 1); -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_properties_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_properties_length (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - return R->nProperties; -} - - -/***************************************************************************** - ** - ** xcb_xkb_property_iterator_t xcb_xkb_get_geometry_properties_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_property_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_property_iterator_t -xcb_xkb_get_geometry_properties_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - xcb_xkb_property_iterator_t i; - xcb_generic_iterator_t prev = xcb_xkb_counted_string_16_string_end(xcb_xkb_get_geometry_label_font(R)); - i.data = (xcb_xkb_property_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_property_t, prev.index)); - i.rem = R->nProperties; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_colors_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_colors_length (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - return R->nColors; -} - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_iterator_t xcb_xkb_get_geometry_colors_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_counted_string_16_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_iterator_t -xcb_xkb_get_geometry_colors_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - xcb_xkb_counted_string_16_iterator_t i; - xcb_generic_iterator_t prev = xcb_xkb_property_end(xcb_xkb_get_geometry_properties_iterator(R)); - i.data = (xcb_xkb_counted_string_16_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_counted_string_16_t, prev.index)); - i.rem = R->nColors; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_shapes_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_shapes_length (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - return R->nShapes; -} - - -/***************************************************************************** - ** - ** xcb_xkb_shape_iterator_t xcb_xkb_get_geometry_shapes_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_shape_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_shape_iterator_t -xcb_xkb_get_geometry_shapes_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - xcb_xkb_shape_iterator_t i; - xcb_generic_iterator_t prev = xcb_xkb_counted_string_16_end(xcb_xkb_get_geometry_colors_iterator(R)); - i.data = (xcb_xkb_shape_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_shape_t, prev.index)); - i.rem = R->nShapes; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_sections_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_sections_length (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - return R->nSections; -} - - -/***************************************************************************** - ** - ** xcb_xkb_section_iterator_t xcb_xkb_get_geometry_sections_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_section_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_section_iterator_t -xcb_xkb_get_geometry_sections_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - xcb_xkb_section_iterator_t i; - xcb_generic_iterator_t prev = xcb_xkb_shape_end(xcb_xkb_get_geometry_shapes_iterator(R)); - i.data = (xcb_xkb_section_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_section_t, prev.index)); - i.rem = R->nSections; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_doodads_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_doodads_length (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - return R->nDoodads; -} - - -/***************************************************************************** - ** - ** xcb_xkb_doodad_iterator_t xcb_xkb_get_geometry_doodads_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_doodad_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_doodad_iterator_t -xcb_xkb_get_geometry_doodads_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - xcb_xkb_doodad_iterator_t i; - xcb_generic_iterator_t prev = xcb_xkb_section_end(xcb_xkb_get_geometry_sections_iterator(R)); - i.data = (xcb_xkb_doodad_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_doodad_t, prev.index)); - i.rem = R->nDoodads; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_t * xcb_xkb_get_geometry_key_aliases - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_key_alias_t * - ** - *****************************************************************************/ - -xcb_xkb_key_alias_t * -xcb_xkb_get_geometry_key_aliases (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - xcb_generic_iterator_t prev = xcb_xkb_doodad_end(xcb_xkb_get_geometry_doodads_iterator(R)); - return (xcb_xkb_key_alias_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_key_alias_t, prev.index) + 0); -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_geometry_key_aliases_length - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_geometry_key_aliases_length (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - return R->nKeyAliases; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_iterator_t xcb_xkb_get_geometry_key_aliases_iterator - ** - ** @param const xcb_xkb_get_geometry_reply_t *R - ** @returns xcb_xkb_key_alias_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_alias_iterator_t -xcb_xkb_get_geometry_key_aliases_iterator (const xcb_xkb_get_geometry_reply_t *R /**< */) -{ - xcb_xkb_key_alias_iterator_t i; - xcb_generic_iterator_t prev = xcb_xkb_doodad_end(xcb_xkb_get_geometry_doodads_iterator(R)); - i.data = (xcb_xkb_key_alias_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_key_alias_t, prev.index)); - i.rem = R->nKeyAliases; - i.index = (char *) i.data - (char *) R; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_get_geometry_reply_t * xcb_xkb_get_geometry_reply - ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_get_geometry_cookie_t cookie - ** @param xcb_generic_error_t **e - ** @returns xcb_xkb_get_geometry_reply_t * - ** - *****************************************************************************/ - -xcb_xkb_get_geometry_reply_t * -xcb_xkb_get_geometry_reply (xcb_connection_t *c /**< */, - xcb_xkb_get_geometry_cookie_t cookie /**< */, - xcb_generic_error_t **e /**< */) -{ - xcb_xkb_get_geometry_reply_t *reply = (xcb_xkb_get_geometry_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); - int i; - xcb_xkb_property_iterator_t properties_iter = xcb_xkb_get_geometry_properties_iterator(reply); - int properties_len = xcb_xkb_get_geometry_properties_length(reply); - xcb_xkb_property_t *properties_data; - /* special cases: transform parts of the reply to match XCB data structures */ - for(i=0; inProperties; i++) { - xcb_tmp_len = xcb_xkb_property_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_property_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* colors */ - for(i=0; i<_aux->nColors; i++) { - xcb_tmp_len = xcb_xkb_counted_string_16_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* shapes */ - for(i=0; i<_aux->nShapes; i++) { - xcb_tmp_len = xcb_xkb_shape_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_shape_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* sections */ - for(i=0; i<_aux->nSections; i++) { - xcb_tmp_len = xcb_xkb_section_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_section_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* doodads */ - for(i=0; i<_aux->nDoodads; i++) { - xcb_tmp_len = xcb_xkb_doodad_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_doodad_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* keyAliases */ - xcb_block_len += _aux->nKeyAliases * sizeof(xcb_xkb_key_alias_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - - -/***************************************************************************** - ** - ** xcb_void_cookie_t xcb_xkb_set_geometry_checked - ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint8_t nShapes - ** @param uint8_t nSections - ** @param xcb_atom_t name - ** @param uint16_t widthMM - ** @param uint16_t heightMM - ** @param uint16_t nProperties - ** @param uint16_t nColors - ** @param uint16_t nDoodads - ** @param uint16_t nKeyAliases - ** @param uint8_t baseColorNdx - ** @param uint8_t labelColorNdx - ** @param xcb_xkb_counted_string_16_t *labelFont - ** @param const xcb_xkb_property_t *properties - ** @param const xcb_xkb_counted_string_16_t *colors - ** @param const xcb_xkb_shape_t *shapes - ** @param const xcb_xkb_section_t *sections - ** @param const xcb_xkb_doodad_t *doodads - ** @param const xcb_xkb_key_alias_t *keyAliases - ** @returns xcb_void_cookie_t - ** - *****************************************************************************/ - -xcb_void_cookie_t -xcb_xkb_set_geometry_checked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint8_t nShapes /**< */, - uint8_t nSections /**< */, - xcb_atom_t name /**< */, - uint16_t widthMM /**< */, - uint16_t heightMM /**< */, - uint16_t nProperties /**< */, - uint16_t nColors /**< */, - uint16_t nDoodads /**< */, - uint16_t nKeyAliases /**< */, - uint8_t baseColorNdx /**< */, - uint8_t labelColorNdx /**< */, - xcb_xkb_counted_string_16_t *labelFont /**< */, - const xcb_xkb_property_t *properties /**< */, - const xcb_xkb_counted_string_16_t *colors /**< */, - const xcb_xkb_shape_t *shapes /**< */, - const xcb_xkb_section_t *sections /**< */, - const xcb_xkb_doodad_t *doodads /**< */, - const xcb_xkb_key_alias_t *keyAliases /**< */) -{ - static const xcb_protocol_request_t xcb_req = { - /* count */ 16, - /* ext */ &xcb_xkb_id, - /* opcode */ XCB_XKB_SET_GEOMETRY, - /* isvoid */ 1 - }; - - struct iovec xcb_parts[18]; - xcb_void_cookie_t xcb_ret; - xcb_xkb_set_geometry_request_t xcb_out; - unsigned int i; - unsigned int xcb_tmp_len; - char *xcb_tmp; - - xcb_out.deviceSpec = deviceSpec; - xcb_out.nShapes = nShapes; - xcb_out.nSections = nSections; - xcb_out.name = name; - xcb_out.widthMM = widthMM; - xcb_out.heightMM = heightMM; - xcb_out.nProperties = nProperties; - xcb_out.nColors = nColors; - xcb_out.nDoodads = nDoodads; - xcb_out.nKeyAliases = nKeyAliases; - xcb_out.baseColorNdx = baseColorNdx; - xcb_out.labelColorNdx = labelColorNdx; - memset(xcb_out.pad0, 0, 2); - - xcb_parts[2].iov_base = (char *) &xcb_out; - xcb_parts[2].iov_len = sizeof(xcb_out); - xcb_parts[3].iov_base = 0; - xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - /* xcb_xkb_counted_string_16_t labelFont */ - xcb_parts[4].iov_base = (char *) labelFont; - xcb_parts[4].iov_len = - xcb_xkb_counted_string_16_sizeof (labelFont); - /* xcb_xkb_property_t properties */ - xcb_parts[5].iov_base = (char *) properties; - xcb_parts[5].iov_len = 0; - xcb_tmp = (char *)properties; - for(i=0; ideviceSpec; - xcb_block_len += sizeof(xcb_xkb_device_spec_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_xkb_device_spec_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_device_spec_t); - /* xcb_xkb_list_components_request_t.maxNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->maxNames; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_list_components_request_t.keymapsSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keymapsSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* keymapsSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) keymapsSpec; - xcb_block_len += _aux->keymapsSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->keymapsSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_list_components_request_t.keycodesSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keycodesSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* keycodesSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) keycodesSpec; - xcb_block_len += _aux->keycodesSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->keycodesSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_list_components_request_t.typesSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->typesSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* typesSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) typesSpec; - xcb_block_len += _aux->typesSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->typesSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_list_components_request_t.compatMapSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compatMapSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* compatMapSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) compatMapSpec; - xcb_block_len += _aux->compatMapSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->compatMapSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_list_components_request_t.symbolsSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->symbolsSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* symbolsSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) symbolsSpec; - xcb_block_len += _aux->symbolsSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->symbolsSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_list_components_request_t.geometrySpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometrySpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* geometrySpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) geometrySpec; - xcb_block_len += _aux->geometrySpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->geometrySpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_xkb_list_components_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keymaps */ + for(i=0; i<_aux->nKeymaps; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_t); /* insert padding */ xcb_pad = -xcb_block_len & (xcb_align_to - 1); xcb_buffer_len += xcb_block_len + xcb_pad; if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; + xcb_tmp += xcb_pad; xcb_pad = 0; } xcb_block_len = 0; - - if (NULL == xcb_out) { - /* allocate memory */ - xcb_out = malloc(xcb_buffer_len); - *_buffer = xcb_out; + /* keycodes */ + for(i=0; i<_aux->nKeycodes; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; } - - xcb_tmp = xcb_out; - for(i=0; inTypes; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + /* compatMaps */ + for(i=0; i<_aux->nCompatMaps; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + /* symbols */ + for(i=0; i<_aux->nSymbols; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + /* geometries */ + for(i=0; i<_aux->nGeometries; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_t); /* insert padding */ xcb_pad = -xcb_block_len & (xcb_align_to - 1); xcb_buffer_len += xcb_block_len + xcb_pad; @@ -13176,78 +11550,25 @@ xcb_xkb_list_components_unserialize (const void *_buffe } xcb_block_len = 0; - if (NULL == _aux) - return xcb_buffer_len; - - if (NULL == *_aux) { - /* allocate memory */ - *_aux = malloc(xcb_buffer_len); - } - - xcb_tmp = ((char *)*_aux)+xcb_buffer_len; - xcb_tmp -= geometrySpec_len; - memmove(xcb_tmp, geometrySpec, geometrySpec_len); - xcb_tmp -= symbolsSpec_len; - memmove(xcb_tmp, symbolsSpec, symbolsSpec_len); - xcb_tmp -= compatMapSpec_len; - memmove(xcb_tmp, compatMapSpec, compatMapSpec_len); - xcb_tmp -= typesSpec_len; - memmove(xcb_tmp, typesSpec, typesSpec_len); - xcb_tmp -= keycodesSpec_len; - memmove(xcb_tmp, keycodesSpec, keycodesSpec_len); - xcb_tmp -= keymapsSpec_len; - memmove(xcb_tmp, keymapsSpec, keymapsSpec_len); - **_aux = xcb_out; - return xcb_buffer_len; } -int -xcb_xkb_list_components_sizeof (const void *_buffer /**< */) -{ - return xcb_xkb_list_components_unserialize(_buffer, NULL); -} - /***************************************************************************** ** ** xcb_xkb_list_components_cookie_t xcb_xkb_list_components ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint16_t maxNames - ** @param uint8_t keymapsSpecLen - ** @param const xcb_xkb_string8_t *keymapsSpec - ** @param uint8_t keycodesSpecLen - ** @param const xcb_xkb_string8_t *keycodesSpec - ** @param uint8_t typesSpecLen - ** @param const xcb_xkb_string8_t *typesSpec - ** @param uint8_t compatMapSpecLen - ** @param const xcb_xkb_string8_t *compatMapSpec - ** @param uint8_t symbolsSpecLen - ** @param const xcb_xkb_string8_t *symbolsSpec - ** @param uint8_t geometrySpecLen - ** @param const xcb_xkb_string8_t *geometrySpec + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint16_t maxNames ** @returns xcb_xkb_list_components_cookie_t ** *****************************************************************************/ xcb_xkb_list_components_cookie_t -xcb_xkb_list_components (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint16_t maxNames /**< */, - uint8_t keymapsSpecLen /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - uint8_t keycodesSpecLen /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - uint8_t typesSpecLen /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - uint8_t compatMapSpecLen /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - uint8_t symbolsSpecLen /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - uint8_t geometrySpecLen /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */) +xcb_xkb_list_components (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint16_t maxNames /**< */) { static const xcb_protocol_request_t xcb_req = { /* count */ 2, @@ -13259,25 +11580,16 @@ xcb_xkb_list_components (xcb_connection_t *c /**< */, struct iovec xcb_parts[4]; xcb_xkb_list_components_cookie_t xcb_ret; xcb_xkb_list_components_request_t xcb_out; - /* in the protocol description, variable size fields are followed by fixed size fields */ - void *xcb_aux = 0; xcb_out.deviceSpec = deviceSpec; xcb_out.maxNames = maxNames; - xcb_out.keymapsSpecLen = keymapsSpecLen; - xcb_out.keycodesSpecLen = keycodesSpecLen; - xcb_out.typesSpecLen = typesSpecLen; - xcb_out.compatMapSpecLen = compatMapSpecLen; - xcb_out.symbolsSpecLen = symbolsSpecLen; - xcb_out.geometrySpecLen = geometrySpecLen; xcb_parts[2].iov_base = (char *) &xcb_out; - xcb_parts[2].iov_len = 2*sizeof(uint8_t) + sizeof(uint16_t); - xcb_parts[3].iov_len = xcb_xkb_list_components_serialize (&xcb_aux, &xcb_out, keymapsSpec, keycodesSpec, typesSpec, compatMapSpec, symbolsSpec, geometrySpec); - xcb_parts[3].iov_base = (char *) xcb_aux; + xcb_parts[2].iov_len = sizeof(xcb_out); + xcb_parts[3].iov_base = 0; + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); - free(xcb_aux); return xcb_ret; } @@ -13286,41 +11598,17 @@ xcb_xkb_list_components (xcb_connection_t *c /**< */, ** ** xcb_xkb_list_components_cookie_t xcb_xkb_list_components_unchecked ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint16_t maxNames - ** @param uint8_t keymapsSpecLen - ** @param const xcb_xkb_string8_t *keymapsSpec - ** @param uint8_t keycodesSpecLen - ** @param const xcb_xkb_string8_t *keycodesSpec - ** @param uint8_t typesSpecLen - ** @param const xcb_xkb_string8_t *typesSpec - ** @param uint8_t compatMapSpecLen - ** @param const xcb_xkb_string8_t *compatMapSpec - ** @param uint8_t symbolsSpecLen - ** @param const xcb_xkb_string8_t *symbolsSpec - ** @param uint8_t geometrySpecLen - ** @param const xcb_xkb_string8_t *geometrySpec + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint16_t maxNames ** @returns xcb_xkb_list_components_cookie_t ** *****************************************************************************/ xcb_xkb_list_components_cookie_t -xcb_xkb_list_components_unchecked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint16_t maxNames /**< */, - uint8_t keymapsSpecLen /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - uint8_t keycodesSpecLen /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - uint8_t typesSpecLen /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - uint8_t compatMapSpecLen /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - uint8_t symbolsSpecLen /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - uint8_t geometrySpecLen /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */) +xcb_xkb_list_components_unchecked (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint16_t maxNames /**< */) { static const xcb_protocol_request_t xcb_req = { /* count */ 2, @@ -13332,25 +11620,16 @@ xcb_xkb_list_components_unchecked (xcb_connection_t *c /**< */, struct iovec xcb_parts[4]; xcb_xkb_list_components_cookie_t xcb_ret; xcb_xkb_list_components_request_t xcb_out; - /* in the protocol description, variable size fields are followed by fixed size fields */ - void *xcb_aux = 0; xcb_out.deviceSpec = deviceSpec; xcb_out.maxNames = maxNames; - xcb_out.keymapsSpecLen = keymapsSpecLen; - xcb_out.keycodesSpecLen = keycodesSpecLen; - xcb_out.typesSpecLen = typesSpecLen; - xcb_out.compatMapSpecLen = compatMapSpecLen; - xcb_out.symbolsSpecLen = symbolsSpecLen; - xcb_out.geometrySpecLen = geometrySpecLen; xcb_parts[2].iov_base = (char *) &xcb_out; - xcb_parts[2].iov_len = 2*sizeof(uint8_t) + sizeof(uint16_t); - xcb_parts[3].iov_len = xcb_xkb_list_components_serialize (&xcb_aux, &xcb_out, keymapsSpec, keycodesSpec, typesSpec, compatMapSpec, symbolsSpec, geometrySpec); - xcb_parts[3].iov_base = (char *) xcb_aux; + xcb_parts[2].iov_len = sizeof(xcb_out); + xcb_parts[3].iov_base = 0; + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); - free(xcb_aux); return xcb_ret; } @@ -13595,329 +11874,6 @@ xcb_xkb_list_components_reply (xcb_connection_t *c /**< */, return (xcb_xkb_list_components_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); } -int -xcb_xkb_get_kbd_by_name_serialize (void **_buffer /**< */, - const xcb_xkb_get_kbd_by_name_request_t *_aux /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */) -{ - char *xcb_out = *_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; - - unsigned int xcb_pad = 0; - char xcb_pad0[3] = {0, 0, 0}; - struct iovec xcb_parts[18]; - unsigned int xcb_parts_idx = 0; - unsigned int xcb_block_len = 0; - unsigned int i; - char *xcb_tmp; - - /* xcb_xkb_get_kbd_by_name_request_t.deviceSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->deviceSpec; - xcb_block_len += sizeof(xcb_xkb_device_spec_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_xkb_device_spec_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_device_spec_t); - /* xcb_xkb_get_kbd_by_name_request_t.need */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->need; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_request_t.want */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->want; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_request_t.load */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->load; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_request_t.pad0 */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_request_t.keymapsSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keymapsSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* keymapsSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) keymapsSpec; - xcb_block_len += _aux->keymapsSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->keymapsSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_get_kbd_by_name_request_t.keycodesSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keycodesSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* keycodesSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) keycodesSpec; - xcb_block_len += _aux->keycodesSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->keycodesSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_get_kbd_by_name_request_t.typesSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->typesSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* typesSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) typesSpec; - xcb_block_len += _aux->typesSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->typesSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_get_kbd_by_name_request_t.compatMapSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compatMapSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* compatMapSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) compatMapSpec; - xcb_block_len += _aux->compatMapSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->compatMapSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_get_kbd_by_name_request_t.symbolsSpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->symbolsSpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* symbolsSpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) symbolsSpec; - xcb_block_len += _aux->symbolsSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->symbolsSpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* xcb_xkb_get_kbd_by_name_request_t.geometrySpecLen */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometrySpecLen; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* geometrySpec */ - xcb_parts[xcb_parts_idx].iov_base = (char *) geometrySpec; - xcb_block_len += _aux->geometrySpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->geometrySpecLen * sizeof(xcb_xkb_string8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_string8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - - if (NULL == xcb_out) { - /* allocate memory */ - xcb_out = malloc(xcb_buffer_len); - *_buffer = xcb_out; - } - - xcb_tmp = xcb_out; - for(i=0; itypes.nVModMapKeys; + return xcb_popcount(/* replies */ S->types.virtualMods); } @@ -14204,7 +12160,7 @@ xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_end (const xcb_xkb_get_kbd_ const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) { xcb_generic_iterator_t i; - i.data = /* replies */ S->types.map.vmods_rtrn + /* replies */ S->types.nVModMapKeys; + i.data = /* replies */ S->types.map.vmods_rtrn + xcb_popcount(/* replies */ S->types.virtualMods); i.rem = 0; i.index = (char *) i.data - (char *) S; return i; @@ -14379,7 +12335,7 @@ xcb_xkb_get_kbd_by_name_replies_types_map_serialize (void uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -14388,7 +12344,7 @@ xcb_xkb_get_kbd_by_name_replies_types_map_serialize (void { char *xcb_out = *_buffer; unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int xcb_pad = 0; char xcb_pad0[3] = {0, 0, 0}; @@ -14509,8 +12465,8 @@ xcb_xkb_get_kbd_by_name_replies_types_map_serialize (void xcb_block_len = 0; /* vmods_rtrn */ xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmods_rtrn; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = nVModMapKeys * sizeof(xcb_keycode_t); + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); xcb_parts_idx++; xcb_align_to = ALIGNOF(uint8_t); } @@ -14603,7 +12559,7 @@ xcb_xkb_get_kbd_by_name_replies_types_map_unpack (const void uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, @@ -14614,7 +12570,7 @@ xcb_xkb_get_kbd_by_name_replies_types_map_unpack (const void unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int i; unsigned int xcb_tmp_len; @@ -14709,7 +12665,7 @@ xcb_xkb_get_kbd_by_name_replies_types_map_unpack (const void xcb_block_len = 0; /* vmods_rtrn */ _aux->vmods_rtrn = (uint8_t *)xcb_tmp; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(uint8_t); } @@ -14777,1752 +12733,14 @@ xcb_xkb_get_kbd_by_name_replies_types_map_sizeof (const void *_buffer /**< */, uint8_t nKeyActions /**< */, uint16_t totalActions /**< */, uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, + uint16_t virtualMods /**< */, uint8_t totalKeyExplicit /**< */, uint8_t totalModMapKeys /**< */, uint8_t totalVModMapKeys /**< */, uint16_t present /**< */) { xcb_xkb_get_kbd_by_name_replies_types_map_t _aux; - return xcb_xkb_get_kbd_by_name_replies_types_map_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, nVModMapKeys, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_types_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_types_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.nTypes; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_type_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_types_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_key_type_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_type_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_types_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_type_iterator_t i; - i.data = /* replies */ S->client_symbols.map.types_rtrn; - i.rem = /* replies */ S->client_symbols.nTypes; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_syms_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_syms_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.nKeySyms; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_sym_map_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_syms_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_key_sym_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_sym_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_syms_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_sym_map_iterator_t i; - i.data = /* replies */ S->client_symbols.map.syms_rtrn; - i.rem = /* replies */ S->client_symbols.nKeySyms; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.map.acts_rtrn_count; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.nKeyActions; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_count_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->client_symbols.map.acts_rtrn_count + /* replies */ S->client_symbols.nKeyActions; - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_action_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_action_t * - ** - *****************************************************************************/ - -xcb_xkb_action_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.map.acts_rtrn_acts; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.totalActions; -} - - -/***************************************************************************** - ** - ** xcb_xkb_action_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_action_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_action_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_acts_rtrn_acts_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_action_iterator_t i; - i.data = /* replies */ S->client_symbols.map.acts_rtrn_acts; - i.rem = /* replies */ S->client_symbols.totalActions; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_set_behavior_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_set_behavior_t * - ** - *****************************************************************************/ - -xcb_xkb_set_behavior_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.map.behaviors_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.totalKeyBehaviors; -} - - -/***************************************************************************** - ** - ** xcb_xkb_set_behavior_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_set_behavior_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_set_behavior_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_behaviors_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_set_behavior_iterator_t i; - i.data = /* replies */ S->client_symbols.map.behaviors_rtrn; - i.rem = /* replies */ S->client_symbols.totalKeyBehaviors; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.map.vmods_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.nVModMapKeys; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmods_rtrn_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->client_symbols.map.vmods_rtrn + /* replies */ S->client_symbols.nVModMapKeys; - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_set_explicit_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_set_explicit_t * - ** - *****************************************************************************/ - -xcb_xkb_set_explicit_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.map.explicit_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.totalKeyExplicit; -} - - -/***************************************************************************** - ** - ** xcb_xkb_set_explicit_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_set_explicit_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_set_explicit_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_explicit_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_set_explicit_iterator_t i; - i.data = /* replies */ S->client_symbols.map.explicit_rtrn; - i.rem = /* replies */ S->client_symbols.totalKeyExplicit; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_mod_map_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_mod_map_t * - ** - *****************************************************************************/ - -xcb_xkb_key_mod_map_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.map.modmap_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.totalModMapKeys; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_key_mod_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_mod_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_modmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_mod_map_iterator_t i; - i.data = /* replies */ S->client_symbols.map.modmap_rtrn; - i.rem = /* replies */ S->client_symbols.totalModMapKeys; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_v_mod_map_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_v_mod_map_t * - ** - *****************************************************************************/ - -xcb_xkb_key_v_mod_map_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.map.vmodmap_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->client_symbols.totalVModMapKeys; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_v_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *R - ** @returns xcb_xkb_key_v_mod_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_v_mod_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_vmodmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_v_mod_map_iterator_t i; - i.data = /* replies */ S->client_symbols.map.vmodmap_rtrn; - i.rem = /* replies */ S->client_symbols.totalVModMapKeys; - i.index = (char *) i.data - (char *) S; - return i; -} - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_serialize (void **_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */, - const xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *_aux /**< */) -{ - char *xcb_out = *_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; - - unsigned int xcb_pad = 0; - char xcb_pad0[3] = {0, 0, 0}; - struct iovec xcb_parts[19]; - unsigned int xcb_parts_idx = 0; - unsigned int xcb_block_len = 0; - unsigned int i; - char *xcb_tmp; - - if(present & XCB_XKB_MAP_PART_KEY_TYPES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* types_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->types_rtrn; - xcb_parts[xcb_parts_idx].iov_len = 0; - xcb_tmp = (char *) _aux->types_rtrn; - for(i=0; isyms_rtrn; - xcb_parts[xcb_parts_idx].iov_len = 0; - xcb_tmp = (char *) _aux->syms_rtrn; - for(i=0; iacts_rtrn_count; - xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = nKeyActions * sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* acts_rtrn_acts */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->acts_rtrn_acts; - xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); - xcb_parts[xcb_parts_idx].iov_len = totalActions * sizeof(xcb_xkb_action_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_action_t); - } - if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* behaviors_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->behaviors_rtrn; - xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); - xcb_parts[xcb_parts_idx].iov_len = totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); - } - if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* vmods_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmods_rtrn; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = nVModMapKeys * sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - } - if(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* explicit_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->explicit_rtrn; - xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); - xcb_parts[xcb_parts_idx].iov_len = totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); - } - if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* modmap_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->modmap_rtrn; - xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); - xcb_parts[xcb_parts_idx].iov_len = totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); - } - if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* vmodmap_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmodmap_rtrn; - xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); - xcb_parts[xcb_parts_idx].iov_len = totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_t); - } - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - - if (NULL == xcb_out) { - /* allocate memory */ - xcb_out = malloc(xcb_buffer_len); - *_buffer = xcb_out; - } - - xcb_tmp = xcb_out; - for(i=0; itypes_rtrn = (xcb_xkb_key_type_t *)xcb_tmp; - for(i=0; isyms_rtrn = (xcb_xkb_key_sym_map_t *)xcb_tmp; - for(i=0; iacts_rtrn_count = (uint8_t *)xcb_tmp; - xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* acts_rtrn_acts */ - _aux->acts_rtrn_acts = (xcb_xkb_action_t *)xcb_tmp; - xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_action_t); - } - if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* behaviors_rtrn */ - _aux->behaviors_rtrn = (xcb_xkb_set_behavior_t *)xcb_tmp; - xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); - } - if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* vmods_rtrn */ - _aux->vmods_rtrn = (uint8_t *)xcb_tmp; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); - } - if(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* explicit_rtrn */ - _aux->explicit_rtrn = (xcb_xkb_set_explicit_t *)xcb_tmp; - xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); - } - if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* modmap_rtrn */ - _aux->modmap_rtrn = (xcb_xkb_key_mod_map_t *)xcb_tmp; - xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); - } - if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* vmodmap_rtrn */ - _aux->vmodmap_rtrn = (xcb_xkb_key_v_mod_map_t *)xcb_tmp; - xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_t); - } - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - -int -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_sizeof (const void *_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */) -{ - xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t _aux; - return xcb_xkb_get_kbd_by_name_replies_client_symbols_map_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, nVModMapKeys, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_types_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_types_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.nTypes; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_type_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_types_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_key_type_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_type_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_types_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_type_iterator_t i; - i.data = /* replies */ S->server_symbols.map.types_rtrn; - i.rem = /* replies */ S->server_symbols.nTypes; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_syms_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_syms_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.nKeySyms; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_sym_map_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_syms_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_key_sym_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_sym_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_syms_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_sym_map_iterator_t i; - i.data = /* replies */ S->server_symbols.map.syms_rtrn; - i.rem = /* replies */ S->server_symbols.nKeySyms; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.map.acts_rtrn_count; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.nKeyActions; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_count_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->server_symbols.map.acts_rtrn_count + /* replies */ S->server_symbols.nKeyActions; - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_action_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_action_t * - ** - *****************************************************************************/ - -xcb_xkb_action_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.map.acts_rtrn_acts; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.totalActions; -} - - -/***************************************************************************** - ** - ** xcb_xkb_action_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_action_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_action_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_acts_rtrn_acts_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_action_iterator_t i; - i.data = /* replies */ S->server_symbols.map.acts_rtrn_acts; - i.rem = /* replies */ S->server_symbols.totalActions; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_set_behavior_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_set_behavior_t * - ** - *****************************************************************************/ - -xcb_xkb_set_behavior_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.map.behaviors_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.totalKeyBehaviors; -} - - -/***************************************************************************** - ** - ** xcb_xkb_set_behavior_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_set_behavior_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_set_behavior_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_behaviors_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_set_behavior_iterator_t i; - i.data = /* replies */ S->server_symbols.map.behaviors_rtrn; - i.rem = /* replies */ S->server_symbols.totalKeyBehaviors; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.map.vmods_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.nVModMapKeys; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmods_rtrn_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->server_symbols.map.vmods_rtrn + /* replies */ S->server_symbols.nVModMapKeys; - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_set_explicit_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_set_explicit_t * - ** - *****************************************************************************/ - -xcb_xkb_set_explicit_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.map.explicit_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.totalKeyExplicit; -} - - -/***************************************************************************** - ** - ** xcb_xkb_set_explicit_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_set_explicit_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_set_explicit_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_explicit_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_set_explicit_iterator_t i; - i.data = /* replies */ S->server_symbols.map.explicit_rtrn; - i.rem = /* replies */ S->server_symbols.totalKeyExplicit; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_mod_map_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_mod_map_t * - ** - *****************************************************************************/ - -xcb_xkb_key_mod_map_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.map.modmap_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.totalModMapKeys; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_key_mod_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_mod_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_modmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_mod_map_iterator_t i; - i.data = /* replies */ S->server_symbols.map.modmap_rtrn; - i.rem = /* replies */ S->server_symbols.totalModMapKeys; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_v_mod_map_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_v_mod_map_t * - ** - *****************************************************************************/ - -xcb_xkb_key_v_mod_map_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.map.vmodmap_rtrn; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->server_symbols.totalVModMapKeys; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_v_mod_map_iterator_t xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *R - ** @returns xcb_xkb_key_v_mod_map_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_v_mod_map_iterator_t -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_vmodmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_v_mod_map_iterator_t i; - i.data = /* replies */ S->server_symbols.map.vmodmap_rtrn; - i.rem = /* replies */ S->server_symbols.totalVModMapKeys; - i.index = (char *) i.data - (char *) S; - return i; -} - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_serialize (void **_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */, - const xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *_aux /**< */) -{ - char *xcb_out = *_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; - - unsigned int xcb_pad = 0; - char xcb_pad0[3] = {0, 0, 0}; - struct iovec xcb_parts[19]; - unsigned int xcb_parts_idx = 0; - unsigned int xcb_block_len = 0; - unsigned int i; - char *xcb_tmp; - - if(present & XCB_XKB_MAP_PART_KEY_TYPES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* types_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->types_rtrn; - xcb_parts[xcb_parts_idx].iov_len = 0; - xcb_tmp = (char *) _aux->types_rtrn; - for(i=0; isyms_rtrn; - xcb_parts[xcb_parts_idx].iov_len = 0; - xcb_tmp = (char *) _aux->syms_rtrn; - for(i=0; iacts_rtrn_count; - xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = nKeyActions * sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* acts_rtrn_acts */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->acts_rtrn_acts; - xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); - xcb_parts[xcb_parts_idx].iov_len = totalActions * sizeof(xcb_xkb_action_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_action_t); - } - if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* behaviors_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->behaviors_rtrn; - xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); - xcb_parts[xcb_parts_idx].iov_len = totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); - } - if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* vmods_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmods_rtrn; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = nVModMapKeys * sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - } - if(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* explicit_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->explicit_rtrn; - xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); - xcb_parts[xcb_parts_idx].iov_len = totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); - } - if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* modmap_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->modmap_rtrn; - xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); - xcb_parts[xcb_parts_idx].iov_len = totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); - } - if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* vmodmap_rtrn */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmodmap_rtrn; - xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); - xcb_parts[xcb_parts_idx].iov_len = totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_t); - } - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - - if (NULL == xcb_out) { - /* allocate memory */ - xcb_out = malloc(xcb_buffer_len); - *_buffer = xcb_out; - } - - xcb_tmp = xcb_out; - for(i=0; itypes_rtrn = (xcb_xkb_key_type_t *)xcb_tmp; - for(i=0; isyms_rtrn = (xcb_xkb_key_sym_map_t *)xcb_tmp; - for(i=0; iacts_rtrn_count = (uint8_t *)xcb_tmp; - xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* acts_rtrn_acts */ - _aux->acts_rtrn_acts = (xcb_xkb_action_t *)xcb_tmp; - xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_action_t); - } - if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* behaviors_rtrn */ - _aux->behaviors_rtrn = (xcb_xkb_set_behavior_t *)xcb_tmp; - xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); - } - if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* vmods_rtrn */ - _aux->vmods_rtrn = (uint8_t *)xcb_tmp; - xcb_block_len += nVModMapKeys * sizeof(xcb_keycode_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); - } - if(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* explicit_rtrn */ - _aux->explicit_rtrn = (xcb_xkb_set_explicit_t *)xcb_tmp; - xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); - } - if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* modmap_rtrn */ - _aux->modmap_rtrn = (xcb_xkb_key_mod_map_t *)xcb_tmp; - xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); - } - if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* vmodmap_rtrn */ - _aux->vmodmap_rtrn = (xcb_xkb_key_v_mod_map_t *)xcb_tmp; - xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_t); - } - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - -int -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_sizeof (const void *_buffer /**< */, - uint8_t nTypes /**< */, - uint8_t nKeySyms /**< */, - uint8_t nKeyActions /**< */, - uint16_t totalActions /**< */, - uint8_t totalKeyBehaviors /**< */, - uint8_t nVModMapKeys /**< */, - uint8_t totalKeyExplicit /**< */, - uint8_t totalModMapKeys /**< */, - uint8_t totalVModMapKeys /**< */, - uint16_t present /**< */) -{ - xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t _aux; - return xcb_xkb_get_kbd_by_name_replies_server_symbols_map_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, nVModMapKeys, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); + return xcb_xkb_get_kbd_by_name_replies_types_map_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); } @@ -17026,7 +13244,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void { char *xcb_out = *_buffer; unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int xcb_pad = 0; char xcb_pad0[3] = {0, 0, 0}; @@ -17289,7 +13507,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { @@ -17496,976 +13714,6 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof (const void *_buffe } -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.valueList.typeNames; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.nTypes; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_type_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->other_names.valueList.typeNames + /* replies */ S->other_names.nTypes; - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * - ** - *****************************************************************************/ - -uint8_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.valueList.nLevelsPerType; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.nKTLevels; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_n_levels_per_type_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->other_names.valueList.nLevelsPerType + /* replies */ S->other_names.nKTLevels; - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.valueList.ktLevelNames; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return qt_xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->other_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels); - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.valueList.indicatorNames; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return xcb_popcount(/* replies */ S->other_names.indicators); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_indicator_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->other_names.valueList.indicatorNames + xcb_popcount(/* replies */ S->other_names.indicators); - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.valueList.virtualModNames; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return xcb_popcount(/* replies */ S->other_names.virtualMods); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_virtual_mod_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->other_names.valueList.virtualModNames + xcb_popcount(/* replies */ S->other_names.virtualMods); - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.valueList.groups; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return xcb_popcount(/* replies */ S->other_names.groupNames); -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_groups_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->other_names.valueList.groups + xcb_popcount(/* replies */ S->other_names.groupNames); - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_name_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_name_t * - ** - *****************************************************************************/ - -xcb_xkb_key_name_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.valueList.keyNames; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.nKeys; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_name_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_xkb_key_name_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_name_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_names_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_name_iterator_t i; - i.data = /* replies */ S->other_names.valueList.keyNames; - i.rem = /* replies */ S->other_names.nKeys; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_alias_t * - ** - *****************************************************************************/ - -xcb_xkb_key_alias_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.valueList.keyAliases; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.nKeyAliases; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_xkb_key_alias_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_alias_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_key_aliases_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_alias_iterator_t i; - i.data = /* replies */ S->other_names.valueList.keyAliases; - i.rem = /* replies */ S->other_names.nKeyAliases; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_atom_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_atom_t * - ** - *****************************************************************************/ - -xcb_atom_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.valueList.radioGroupNames; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->other_names.nRadioGroups; -} - - -/***************************************************************************** - ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names_end - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *R - ** @returns xcb_generic_iterator_t - ** - *****************************************************************************/ - -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_radio_group_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_generic_iterator_t i; - i.data = /* replies */ S->other_names.valueList.radioGroupNames + /* replies */ S->other_names.nRadioGroups; - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -} - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_serialize (void **_buffer /**< */, - uint8_t nTypes /**< */, - uint16_t nKTLevels /**< */, - uint32_t indicators /**< */, - uint16_t virtualMods /**< */, - uint8_t groupNames /**< */, - uint8_t nKeys /**< */, - uint8_t nKeyAliases /**< */, - uint8_t nRadioGroups /**< */, - uint32_t which /**< */, - const xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *_aux /**< */) -{ - char *xcb_out = *_buffer; - unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; - - unsigned int xcb_pad = 0; - char xcb_pad0[3] = {0, 0, 0}; - struct iovec xcb_parts[25]; - unsigned int xcb_parts_idx = 0; - unsigned int xcb_block_len = 0; - unsigned int i; - char *xcb_tmp; - - if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.keycodesName */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keycodesName; - xcb_block_len += sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_GEOMETRY) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.geometryName */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometryName; - xcb_block_len += sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_SYMBOLS) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.symbolsName */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->symbolsName; - xcb_block_len += sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.physSymbolsName */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->physSymbolsName; - xcb_block_len += sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_TYPES) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.typesName */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->typesName; - xcb_block_len += sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_COMPAT) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.compatName */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compatName; - xcb_block_len += sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* typeNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->typeNames; - xcb_block_len += nTypes * sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = nTypes * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* nLevelsPerType */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->nLevelsPerType; - xcb_block_len += nKTLevels * sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = nKTLevels * sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* ktLevelNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; - xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_INDICATOR_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* indicatorNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->indicatorNames; - xcb_block_len += xcb_popcount(indicators) * sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(indicators) * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* virtualModNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->virtualModNames; - xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_GROUP_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* groups */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->groups; - xcb_block_len += xcb_popcount(groupNames) * sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(groupNames) * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_KEY_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* keyNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->keyNames; - xcb_block_len += nKeys * sizeof(xcb_xkb_key_name_t); - xcb_parts[xcb_parts_idx].iov_len = nKeys * sizeof(xcb_xkb_key_name_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_key_name_t); - } - if(which & XCB_XKB_NAME_DETAIL_KEY_ALIASES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* keyAliases */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->keyAliases; - xcb_block_len += nKeyAliases * sizeof(xcb_xkb_key_alias_t); - xcb_parts[xcb_parts_idx].iov_len = nKeyAliases * sizeof(xcb_xkb_key_alias_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); - } - if(which & XCB_XKB_NAME_DETAIL_RG_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* radioGroupNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->radioGroupNames; - xcb_block_len += nRadioGroups * sizeof(xcb_atom_t); - xcb_parts[xcb_parts_idx].iov_len = nRadioGroups * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - - if (NULL == xcb_out) { - /* allocate memory */ - xcb_out = malloc(xcb_buffer_len); - *_buffer = xcb_out; - } - - xcb_tmp = xcb_out; - for(i=0; ikeycodesName = *(xcb_atom_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_atom_t); - xcb_tmp += sizeof(xcb_atom_t); - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_GEOMETRY) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.geometryName */ - _aux->geometryName = *(xcb_atom_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_atom_t); - xcb_tmp += sizeof(xcb_atom_t); - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_SYMBOLS) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.symbolsName */ - _aux->symbolsName = *(xcb_atom_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_atom_t); - xcb_tmp += sizeof(xcb_atom_t); - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.physSymbolsName */ - _aux->physSymbolsName = *(xcb_atom_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_atom_t); - xcb_tmp += sizeof(xcb_atom_t); - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_TYPES) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.typesName */ - _aux->typesName = *(xcb_atom_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_atom_t); - xcb_tmp += sizeof(xcb_atom_t); - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_COMPAT) { - /* xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t.compatName */ - _aux->compatName = *(xcb_atom_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_atom_t); - xcb_tmp += sizeof(xcb_atom_t); - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* typeNames */ - _aux->typeNames = (xcb_atom_t *)xcb_tmp; - xcb_block_len += nTypes * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* nLevelsPerType */ - _aux->nLevelsPerType = (uint8_t *)xcb_tmp; - xcb_block_len += nKTLevels * sizeof(uint8_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* ktLevelNames */ - _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; - xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_INDICATOR_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* indicatorNames */ - _aux->indicatorNames = (xcb_atom_t *)xcb_tmp; - xcb_block_len += xcb_popcount(indicators) * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* virtualModNames */ - _aux->virtualModNames = (xcb_atom_t *)xcb_tmp; - xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_GROUP_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* groups */ - _aux->groups = (xcb_atom_t *)xcb_tmp; - xcb_block_len += xcb_popcount(groupNames) * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - if(which & XCB_XKB_NAME_DETAIL_KEY_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* keyNames */ - _aux->keyNames = (xcb_xkb_key_name_t *)xcb_tmp; - xcb_block_len += nKeys * sizeof(xcb_xkb_key_name_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_key_name_t); - } - if(which & XCB_XKB_NAME_DETAIL_KEY_ALIASES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* keyAliases */ - _aux->keyAliases = (xcb_xkb_key_alias_t *)xcb_tmp; - xcb_block_len += nKeyAliases * sizeof(xcb_xkb_key_alias_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); - } - if(which & XCB_XKB_NAME_DETAIL_RG_NAMES) { - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* radioGroupNames */ - _aux->radioGroupNames = (xcb_atom_t *)xcb_tmp; - xcb_block_len += nRadioGroups * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - - return xcb_buffer_len; -} - -int -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_sizeof (const void *_buffer /**< */, - uint8_t nTypes /**< */, - uint16_t nKTLevels /**< */, - uint32_t indicators /**< */, - uint16_t virtualMods /**< */, - uint8_t groupNames /**< */, - uint8_t nKeys /**< */, - uint8_t nKeyAliases /**< */, - uint8_t nRadioGroups /**< */, - uint32_t which /**< */) -{ - xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t _aux; - return xcb_xkb_get_kbd_by_name_replies_other_names_value_list_unpack(_buffer, nTypes, nKTLevels, indicators, virtualMods, groupNames, nKeys, nKeyAliases, nRadioGroups, which, &_aux); -} - - /***************************************************************************** ** ** xcb_xkb_get_kbd_by_name_replies_types_map_t * xcb_xkb_get_kbd_by_name_replies_types_map @@ -18484,14 +13732,14 @@ xcb_xkb_get_kbd_by_name_replies_types_map (const xcb_xkb_get_kbd_by_name_replies /***************************************************************************** ** - ** uint8_t * xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn + ** xcb_xkb_sym_interpret_t * xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn ** ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns uint8_t * + ** @returns xcb_xkb_sym_interpret_t * ** *****************************************************************************/ -uint8_t * +xcb_xkb_sym_interpret_t * xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) { return /* replies */ S->compat_map.si_rtrn; @@ -18511,26 +13759,26 @@ int xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) { - return (16 * /* replies */ S->compat_map.nSIRtrn); + return /* replies */ S->compat_map.nSIRtrn; } /***************************************************************************** ** - ** xcb_generic_iterator_t xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_end + ** xcb_xkb_sym_interpret_iterator_t xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_iterator ** ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_generic_iterator_t + ** @returns xcb_xkb_sym_interpret_iterator_t ** *****************************************************************************/ -xcb_generic_iterator_t -xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_end (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) +xcb_xkb_sym_interpret_iterator_t +xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, + const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) { - xcb_generic_iterator_t i; - i.data = /* replies */ S->compat_map.si_rtrn + (16 * /* replies */ S->compat_map.nSIRtrn); - i.rem = 0; + xcb_xkb_sym_interpret_iterator_t i; + i.data = /* replies */ S->compat_map.si_rtrn; + i.rem = /* replies */ S->compat_map.nSIRtrn; i.index = (char *) i.data - (char *) S; return i; } @@ -18590,38 +13838,6 @@ xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_iterator (const xcb_xkb_ge } -/***************************************************************************** - ** - ** xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t * xcb_xkb_get_kbd_by_name_replies_client_symbols_map - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t * - ** - *****************************************************************************/ - -xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t * -xcb_xkb_get_kbd_by_name_replies_client_symbols_map (const xcb_xkb_get_kbd_by_name_replies_t *R /**< */) -{ - return (xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t *) (R + 1); -} - - -/***************************************************************************** - ** - ** xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t * xcb_xkb_get_kbd_by_name_replies_server_symbols_map - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t * - ** - *****************************************************************************/ - -xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t * -xcb_xkb_get_kbd_by_name_replies_server_symbols_map (const xcb_xkb_get_kbd_by_name_replies_t *R /**< */) -{ - return (xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t *) (R + 1); -} - - /***************************************************************************** ** ** xcb_xkb_indicator_map_t * xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps @@ -18692,22 +13908,6 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list (const xcb_xkb_get_kbd_by_n } -/***************************************************************************** - ** - ** xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t * xcb_xkb_get_kbd_by_name_replies_other_names_value_list - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t * - ** - *****************************************************************************/ - -xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t * -xcb_xkb_get_kbd_by_name_replies_other_names_value_list (const xcb_xkb_get_kbd_by_name_replies_t *R /**< */) -{ - return (xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t *) (R + 1); -} - - /***************************************************************************** ** ** xcb_xkb_counted_string_16_t * xcb_xkb_get_kbd_by_name_replies_geometry_label_font @@ -18723,250 +13923,6 @@ xcb_xkb_get_kbd_by_name_replies_geometry_label_font (const xcb_xkb_get_kbd_by_na return (xcb_xkb_counted_string_16_t *) (R + 1); } - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_properties_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_properties_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->geometry.nProperties; -} - - -/***************************************************************************** - ** - ** xcb_xkb_property_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_properties_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_property_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_property_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_properties_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_property_iterator_t i; - i.data = /* replies */ S->geometry.properties; - i.rem = /* replies */ S->geometry.nProperties; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_colors_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_colors_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->geometry.nColors; -} - - -/***************************************************************************** - ** - ** xcb_xkb_counted_string_16_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_colors_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_counted_string_16_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_counted_string_16_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_colors_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_counted_string_16_iterator_t i; - i.data = /* replies */ S->geometry.colors; - i.rem = /* replies */ S->geometry.nColors; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_shapes_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_shapes_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->geometry.nShapes; -} - - -/***************************************************************************** - ** - ** xcb_xkb_shape_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_shapes_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_shape_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_shape_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_shapes_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_shape_iterator_t i; - i.data = /* replies */ S->geometry.shapes; - i.rem = /* replies */ S->geometry.nShapes; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_sections_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_sections_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->geometry.nSections; -} - - -/***************************************************************************** - ** - ** xcb_xkb_section_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_sections_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_section_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_section_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_sections_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_section_iterator_t i; - i.data = /* replies */ S->geometry.sections; - i.rem = /* replies */ S->geometry.nSections; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_doodads_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_doodads_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->geometry.nDoodads; -} - - -/***************************************************************************** - ** - ** xcb_xkb_doodad_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_doodads_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_doodad_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_doodad_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_doodads_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_doodad_iterator_t i; - i.data = /* replies */ S->geometry.doodads; - i.rem = /* replies */ S->geometry.nDoodads; - i.index = (char *) i.data - (char *) S; - return i; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_t * xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *S - ** @returns xcb_xkb_key_alias_t * - ** - *****************************************************************************/ - -xcb_xkb_key_alias_t * -xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases (const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->geometry.keyAliases; -} - - -/***************************************************************************** - ** - ** int xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases_length - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns int - ** - *****************************************************************************/ - -int -xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - return /* replies */ S->geometry.nKeyAliases; -} - - -/***************************************************************************** - ** - ** xcb_xkb_key_alias_iterator_t xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases_iterator - ** - ** @param const xcb_xkb_get_kbd_by_name_replies_t *R - ** @returns xcb_xkb_key_alias_iterator_t - ** - *****************************************************************************/ - -xcb_xkb_key_alias_iterator_t -xcb_xkb_get_kbd_by_name_replies_geometry_key_aliases_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) -{ - xcb_xkb_key_alias_iterator_t i; - i.data = /* replies */ S->geometry.keyAliases; - i.rem = /* replies */ S->geometry.nKeyAliases; - i.index = (char *) i.data - (char *) S; - return i; -} - int xcb_xkb_get_kbd_by_name_replies_serialize (void **_buffer /**< */, uint16_t reported /**< */, @@ -18974,17 +13930,19 @@ xcb_xkb_get_kbd_by_name_replies_serialize (void { char *xcb_out = *_buffer; unsigned int xcb_buffer_len = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int xcb_pad = 0; char xcb_pad0[3] = {0, 0, 0}; - struct iovec xcb_parts[172]; + struct iovec xcb_parts[96]; unsigned int xcb_parts_idx = 0; unsigned int xcb_block_len = 0; unsigned int i; char *xcb_tmp; - if(reported & XCB_XKB_GBN_DETAIL_TYPES) { + if((reported & XCB_XKB_GBN_DETAIL_TYPES) || + (reported & XCB_XKB_GBN_DETAIL_CLIENT_SYMBOLS) || + (reported & XCB_XKB_GBN_DETAIL_SERVER_SYMBOLS)) { /* xcb_xkb_get_kbd_by_name_replies_t.types.getmap_type */ xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.getmap_type; xcb_block_len += sizeof(uint8_t); @@ -19183,18 +14141,36 @@ xcb_xkb_get_kbd_by_name_replies_serialize (void xcb_block_len = 0; /* map */ xcb_parts[xcb_parts_idx].iov_base = (char *)0; - xcb_block_len += xcb_xkb_get_kbd_by_name_replies_types_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->types.nTypes, _aux->types.nKeySyms, _aux->types.nKeyActions, _aux->types.totalActions, _aux->types.totalKeyBehaviors, _aux->types.nVModMapKeys, _aux->types.totalKeyExplicit, _aux->types.totalModMapKeys, _aux->types.totalVModMapKeys, _aux->types.present, &_aux->types.map); - xcb_parts[xcb_parts_idx].iov_len = xcb_xkb_get_kbd_by_name_replies_types_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->types.nTypes, _aux->types.nKeySyms, _aux->types.nKeyActions, _aux->types.totalActions, _aux->types.totalKeyBehaviors, _aux->types.nVModMapKeys, _aux->types.totalKeyExplicit, _aux->types.totalModMapKeys, _aux->types.totalVModMapKeys, _aux->types.present, &_aux->types.map); + xcb_block_len += xcb_xkb_get_kbd_by_name_replies_types_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->types.nTypes, _aux->types.nKeySyms, _aux->types.nKeyActions, _aux->types.totalActions, _aux->types.totalKeyBehaviors, _aux->types.virtualMods, _aux->types.totalKeyExplicit, _aux->types.totalModMapKeys, _aux->types.totalVModMapKeys, _aux->types.present, &_aux->types.map); + xcb_parts[xcb_parts_idx].iov_len = xcb_xkb_get_kbd_by_name_replies_types_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->types.nTypes, _aux->types.nKeySyms, _aux->types.nKeyActions, _aux->types.totalActions, _aux->types.totalKeyBehaviors, _aux->types.virtualMods, _aux->types.totalKeyExplicit, _aux->types.totalModMapKeys, _aux->types.totalVModMapKeys, _aux->types.present, &_aux->types.map); xcb_parts_idx++; xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_types_map_t); } if(reported & XCB_XKB_GBN_DETAIL_COMPAT_MAP) { + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.compatmap_type; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatDeviceID */ xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.compatDeviceID; xcb_block_len += sizeof(uint8_t); xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); xcb_parts_idx++; xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_sequence */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.compatmap_sequence; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_length */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.compatmap_length; + xcb_block_len += sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_t); /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.groupsRtrn */ xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.groupsRtrn; xcb_block_len += sizeof(uint8_t); @@ -19243,10 +14219,10 @@ xcb_xkb_get_kbd_by_name_replies_serialize (void xcb_block_len = 0; /* si_rtrn */ xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->compat_map.si_rtrn; - xcb_block_len += (16 * _aux->compat_map.nSIRtrn) * sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = (16 * _aux->compat_map.nSIRtrn) * sizeof(uint8_t); + xcb_block_len += _aux->compat_map.nSIRtrn * sizeof(xcb_xkb_sym_interpret_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->compat_map.nSIRtrn * sizeof(xcb_xkb_sym_interpret_t); xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = ALIGNOF(xcb_xkb_sym_interpret_t); /* insert padding */ xcb_pad = -xcb_block_len & (xcb_align_to - 1); xcb_buffer_len += xcb_block_len + xcb_pad; @@ -19264,385 +14240,31 @@ xcb_xkb_get_kbd_by_name_replies_serialize (void xcb_parts_idx++; xcb_align_to = ALIGNOF(xcb_xkb_mod_def_t); } - if(reported & XCB_XKB_GBN_DETAIL_CLIENT_SYMBOLS) { - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.clientDeviceID */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.clientDeviceID; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.pad0 */ - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_block_len += sizeof(uint8_t)*2; - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.clientMinKeyCode */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.clientMinKeyCode; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.clientMaxKeyCode */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.clientMaxKeyCode; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.present */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.present; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstType */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.firstType; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nTypes */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.nTypes; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalTypes */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.totalTypes; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstKeySym */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.firstKeySym; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalSyms */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.totalSyms; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nKeySyms */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.nKeySyms; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstKeyAction */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.firstKeyAction; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalActions */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.totalActions; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nKeyActions */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.nKeyActions; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstKeyBehavior */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.firstKeyBehavior; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nKeyBehaviors */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.nKeyBehaviors; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalKeyBehaviors */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.totalKeyBehaviors; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstKeyExplicit */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.firstKeyExplicit; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nKeyExplicit */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.nKeyExplicit; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalKeyExplicit */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.totalKeyExplicit; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstModMapKey */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.firstModMapKey; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nModMapKeys */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.nModMapKeys; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalModMapKeys */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.totalModMapKeys; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstVModMapKey */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.firstVModMapKey; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nVModMapKeys */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.nVModMapKeys; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalVModMapKeys */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.totalVModMapKeys; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.pad1 */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.virtualMods */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->client_symbols.virtualMods; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* map */ - xcb_parts[xcb_parts_idx].iov_base = (char *)0; - xcb_block_len += xcb_xkb_get_kbd_by_name_replies_client_symbols_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->client_symbols.nTypes, _aux->client_symbols.nKeySyms, _aux->client_symbols.nKeyActions, _aux->client_symbols.totalActions, _aux->client_symbols.totalKeyBehaviors, _aux->client_symbols.nVModMapKeys, _aux->client_symbols.totalKeyExplicit, _aux->client_symbols.totalModMapKeys, _aux->client_symbols.totalVModMapKeys, _aux->client_symbols.present, &_aux->client_symbols.map); - xcb_parts[xcb_parts_idx].iov_len = xcb_xkb_get_kbd_by_name_replies_client_symbols_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->client_symbols.nTypes, _aux->client_symbols.nKeySyms, _aux->client_symbols.nKeyActions, _aux->client_symbols.totalActions, _aux->client_symbols.totalKeyBehaviors, _aux->client_symbols.nVModMapKeys, _aux->client_symbols.totalKeyExplicit, _aux->client_symbols.totalModMapKeys, _aux->client_symbols.totalVModMapKeys, _aux->client_symbols.present, &_aux->client_symbols.map); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t); - } - if(reported & XCB_XKB_GBN_DETAIL_SERVER_SYMBOLS) { - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.serverDeviceID */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.serverDeviceID; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.pad0 */ - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_block_len += sizeof(uint8_t)*2; - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.serverMinKeyCode */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.serverMinKeyCode; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.serverMaxKeyCode */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.serverMaxKeyCode; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.present */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.present; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstType */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.firstType; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nTypes */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.nTypes; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalTypes */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.totalTypes; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstKeySym */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.firstKeySym; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalSyms */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.totalSyms; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nKeySyms */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.nKeySyms; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstKeyAction */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.firstKeyAction; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalActions */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.totalActions; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nKeyActions */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.nKeyActions; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstKeyBehavior */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.firstKeyBehavior; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nKeyBehaviors */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.nKeyBehaviors; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalKeyBehaviors */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.totalKeyBehaviors; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstKeyExplicit */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.firstKeyExplicit; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nKeyExplicit */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.nKeyExplicit; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalKeyExplicit */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.totalKeyExplicit; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstModMapKey */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.firstModMapKey; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nModMapKeys */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.nModMapKeys; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalModMapKeys */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.totalModMapKeys; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstVModMapKey */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.firstVModMapKey; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nVModMapKeys */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.nVModMapKeys; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalVModMapKeys */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.totalVModMapKeys; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.pad1 */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.virtualMods */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->server_symbols.virtualMods; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* map */ - xcb_parts[xcb_parts_idx].iov_base = (char *)0; - xcb_block_len += xcb_xkb_get_kbd_by_name_replies_server_symbols_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->server_symbols.nTypes, _aux->server_symbols.nKeySyms, _aux->server_symbols.nKeyActions, _aux->server_symbols.totalActions, _aux->server_symbols.totalKeyBehaviors, _aux->server_symbols.nVModMapKeys, _aux->server_symbols.totalKeyExplicit, _aux->server_symbols.totalModMapKeys, _aux->server_symbols.totalVModMapKeys, _aux->server_symbols.present, &_aux->server_symbols.map); - xcb_parts[xcb_parts_idx].iov_len = xcb_xkb_get_kbd_by_name_replies_server_symbols_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->server_symbols.nTypes, _aux->server_symbols.nKeySyms, _aux->server_symbols.nKeyActions, _aux->server_symbols.totalActions, _aux->server_symbols.totalKeyBehaviors, _aux->server_symbols.nVModMapKeys, _aux->server_symbols.totalKeyExplicit, _aux->server_symbols.totalModMapKeys, _aux->server_symbols.totalVModMapKeys, _aux->server_symbols.present, &_aux->server_symbols.map); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t); - } if(reported & XCB_XKB_GBN_DETAIL_INDICATOR_MAPS) { + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.indicatormap_type; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatorDeviceID */ xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.indicatorDeviceID; xcb_block_len += sizeof(uint8_t); xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); xcb_parts_idx++; xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_sequence */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.indicatormap_sequence; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_length */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.indicatormap_length; + xcb_block_len += sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_t); /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.which */ xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.which; xcb_block_len += sizeof(uint32_t); @@ -19684,13 +14306,32 @@ xcb_xkb_get_kbd_by_name_replies_serialize (void xcb_parts_idx++; xcb_align_to = ALIGNOF(xcb_xkb_indicator_map_t); } - if(reported & XCB_XKB_GBN_DETAIL_KEY_NAMES) { + if((reported & XCB_XKB_GBN_DETAIL_KEY_NAMES) || + (reported & XCB_XKB_GBN_DETAIL_OTHER_NAMES)) { + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyname_type; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyDeviceID */ xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyDeviceID; xcb_block_len += sizeof(uint8_t); xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); xcb_parts_idx++; xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_sequence */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyname_sequence; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_length */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyname_length; + xcb_block_len += sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_t); /* xcb_xkb_get_kbd_by_name_replies_t.key_names.which */ xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.which; xcb_block_len += sizeof(uint32_t); @@ -19786,115 +14427,31 @@ xcb_xkb_get_kbd_by_name_replies_serialize (void xcb_parts_idx++; xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t); } - if(reported & XCB_XKB_GBN_DETAIL_OTHER_NAMES) { - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.otherDeviceID */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.otherDeviceID; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.which */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.which; - xcb_block_len += sizeof(uint32_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint32_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.otherMinKeyCode */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.otherMinKeyCode; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.otherMaxKeyCode */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.otherMaxKeyCode; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nTypes */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.nTypes; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.groupNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.groupNames; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.virtualMods */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.virtualMods; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.firstKey */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.firstKey; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nKeys */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.nKeys; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.indicators */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.indicators; - xcb_block_len += sizeof(uint32_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint32_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nRadioGroups */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.nRadioGroups; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nKeyAliases */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.nKeyAliases; - xcb_block_len += sizeof(uint8_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nKTLevels */ - xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->other_names.nKTLevels; - xcb_block_len += sizeof(uint16_t); - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.pad0 */ - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_block_len += sizeof(uint8_t)*4; - xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*4; - xcb_parts_idx++; - xcb_align_to = ALIGNOF(uint8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* valueList */ - xcb_parts[xcb_parts_idx].iov_base = (char *)0; - xcb_block_len += xcb_xkb_get_kbd_by_name_replies_other_names_value_list_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->other_names.nTypes, _aux->other_names.nKTLevels, _aux->other_names.indicators, _aux->other_names.virtualMods, _aux->other_names.groupNames, _aux->other_names.nKeys, _aux->other_names.nKeyAliases, _aux->other_names.nRadioGroups, _aux->other_names.which, &_aux->other_names.valueList); - xcb_parts[xcb_parts_idx].iov_len = xcb_xkb_get_kbd_by_name_replies_other_names_value_list_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->other_names.nTypes, _aux->other_names.nKTLevels, _aux->other_names.indicators, _aux->other_names.virtualMods, _aux->other_names.groupNames, _aux->other_names.nKeys, _aux->other_names.nKeyAliases, _aux->other_names.nRadioGroups, _aux->other_names.which, &_aux->other_names.valueList); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t); - } if(reported & XCB_XKB_GBN_DETAIL_GEOMETRY) { + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.geometry_type; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometryDeviceID */ xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.geometryDeviceID; xcb_block_len += sizeof(uint8_t); xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); xcb_parts_idx++; xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_sequence */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.geometry_sequence; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_length */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.geometry_length; + xcb_block_len += sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_t); /* xcb_xkb_get_kbd_by_name_replies_t.geometry.name */ xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.name; xcb_block_len += sizeof(xcb_atom_t); @@ -19989,127 +14546,6 @@ xcb_xkb_get_kbd_by_name_replies_serialize (void xcb_parts[xcb_parts_idx].iov_len = xcb_xkb_counted_string_16_sizeof(_aux->geometry.labelFont); xcb_parts_idx++; xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* properties */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->geometry.properties; - xcb_parts[xcb_parts_idx].iov_len = 0; - xcb_tmp = (char *) _aux->geometry.properties; - for(i=0; i<_aux->geometry.nProperties; i++) { - xcb_block_len = xcb_xkb_property_sizeof(xcb_tmp); - xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; - } - xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_property_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* colors */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->geometry.colors; - xcb_parts[xcb_parts_idx].iov_len = 0; - xcb_tmp = (char *) _aux->geometry.colors; - for(i=0; i<_aux->geometry.nColors; i++) { - xcb_block_len = xcb_xkb_counted_string_16_sizeof(xcb_tmp); - xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; - } - xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* shapes */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->geometry.shapes; - xcb_parts[xcb_parts_idx].iov_len = 0; - xcb_tmp = (char *) _aux->geometry.shapes; - for(i=0; i<_aux->geometry.nShapes; i++) { - xcb_block_len = xcb_xkb_shape_sizeof(xcb_tmp); - xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; - } - xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_shape_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* sections */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->geometry.sections; - xcb_parts[xcb_parts_idx].iov_len = 0; - xcb_tmp = (char *) _aux->geometry.sections; - for(i=0; i<_aux->geometry.nSections; i++) { - xcb_block_len = xcb_xkb_section_sizeof(xcb_tmp); - xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; - } - xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_section_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* doodads */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->geometry.doodads; - xcb_parts[xcb_parts_idx].iov_len = 0; - xcb_tmp = (char *) _aux->geometry.doodads; - for(i=0; i<_aux->geometry.nDoodads; i++) { - xcb_block_len = xcb_xkb_doodad_sizeof(xcb_tmp); - xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; - } - xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_doodad_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; - xcb_parts[xcb_parts_idx].iov_len = xcb_pad; - xcb_parts_idx++; - xcb_pad = 0; - } - xcb_block_len = 0; - /* keyAliases */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->geometry.keyAliases; - xcb_block_len += _aux->geometry.nKeyAliases * sizeof(xcb_xkb_key_alias_t); - xcb_parts[xcb_parts_idx].iov_len = _aux->geometry.nKeyAliases * sizeof(xcb_xkb_key_alias_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); } /* insert padding */ xcb_pad = -xcb_block_len & (xcb_align_to - 1); @@ -20148,12 +14584,12 @@ xcb_xkb_get_kbd_by_name_replies_unpack (const void *_buf unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; - unsigned int i; - unsigned int xcb_tmp_len; - if(reported & XCB_XKB_GBN_DETAIL_TYPES) { + if((reported & XCB_XKB_GBN_DETAIL_TYPES) || + (reported & XCB_XKB_GBN_DETAIL_CLIENT_SYMBOLS) || + (reported & XCB_XKB_GBN_DETAIL_SERVER_SYMBOLS)) { /* xcb_xkb_get_kbd_by_name_replies_t.types.getmap_type */ _aux->types.getmap_type = *(uint8_t *)xcb_tmp; xcb_block_len += sizeof(uint8_t); @@ -20319,16 +14755,31 @@ xcb_xkb_get_kbd_by_name_replies_unpack (const void *_buf } xcb_block_len = 0; /* map */ - xcb_block_len += xcb_xkb_get_kbd_by_name_replies_types_map_unpack(xcb_tmp, _aux->types.nTypes, _aux->types.nKeySyms, _aux->types.nKeyActions, _aux->types.totalActions, _aux->types.totalKeyBehaviors, _aux->types.nVModMapKeys, _aux->types.totalKeyExplicit, _aux->types.totalModMapKeys, _aux->types.totalVModMapKeys, _aux->types.present, &_aux->types.map); + xcb_block_len += xcb_xkb_get_kbd_by_name_replies_types_map_unpack(xcb_tmp, _aux->types.nTypes, _aux->types.nKeySyms, _aux->types.nKeyActions, _aux->types.totalActions, _aux->types.totalKeyBehaviors, _aux->types.virtualMods, _aux->types.totalKeyExplicit, _aux->types.totalModMapKeys, _aux->types.totalVModMapKeys, _aux->types.present, &_aux->types.map); xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_types_map_t); } if(reported & XCB_XKB_GBN_DETAIL_COMPAT_MAP) { + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_type */ + _aux->compat_map.compatmap_type = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatDeviceID */ _aux->compat_map.compatDeviceID = *(uint8_t *)xcb_tmp; xcb_block_len += sizeof(uint8_t); xcb_tmp += sizeof(uint8_t); xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_sequence */ + _aux->compat_map.compatmap_sequence = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_length */ + _aux->compat_map.compatmap_length = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.groupsRtrn */ _aux->compat_map.groupsRtrn = *(uint8_t *)xcb_tmp; xcb_block_len += sizeof(uint8_t); @@ -20383,10 +14834,10 @@ xcb_xkb_get_kbd_by_name_replies_unpack (const void *_buf } xcb_block_len = 0; /* si_rtrn */ - _aux->compat_map.si_rtrn = (uint8_t *)xcb_tmp; - xcb_block_len += (16 * _aux->compat_map.nSIRtrn) * sizeof(uint8_t); + _aux->compat_map.si_rtrn = (xcb_xkb_sym_interpret_t *)xcb_tmp; + xcb_block_len += _aux->compat_map.nSIRtrn * sizeof(xcb_xkb_sym_interpret_t); xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = ALIGNOF(xcb_xkb_sym_interpret_t); /* insert padding */ xcb_pad = -xcb_block_len & (xcb_align_to - 1); xcb_buffer_len += xcb_block_len + xcb_pad; @@ -20401,322 +14852,27 @@ xcb_xkb_get_kbd_by_name_replies_unpack (const void *_buf xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(xcb_xkb_mod_def_t); } - if(reported & XCB_XKB_GBN_DETAIL_CLIENT_SYMBOLS) { - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.clientDeviceID */ - _aux->client_symbols.clientDeviceID = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.pad0 */ - _aux->client_symbols.pad0[0] = *(uint8_t *)xcb_tmp; - _aux->client_symbols.pad0[1] = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t) * 2; - xcb_tmp += sizeof(uint8_t) * 2; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.clientMinKeyCode */ - _aux->client_symbols.clientMinKeyCode = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.clientMaxKeyCode */ - _aux->client_symbols.clientMaxKeyCode = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.present */ - _aux->client_symbols.present = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstType */ - _aux->client_symbols.firstType = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nTypes */ - _aux->client_symbols.nTypes = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalTypes */ - _aux->client_symbols.totalTypes = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstKeySym */ - _aux->client_symbols.firstKeySym = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalSyms */ - _aux->client_symbols.totalSyms = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nKeySyms */ - _aux->client_symbols.nKeySyms = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstKeyAction */ - _aux->client_symbols.firstKeyAction = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalActions */ - _aux->client_symbols.totalActions = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nKeyActions */ - _aux->client_symbols.nKeyActions = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstKeyBehavior */ - _aux->client_symbols.firstKeyBehavior = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nKeyBehaviors */ - _aux->client_symbols.nKeyBehaviors = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalKeyBehaviors */ - _aux->client_symbols.totalKeyBehaviors = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstKeyExplicit */ - _aux->client_symbols.firstKeyExplicit = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nKeyExplicit */ - _aux->client_symbols.nKeyExplicit = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalKeyExplicit */ - _aux->client_symbols.totalKeyExplicit = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstModMapKey */ - _aux->client_symbols.firstModMapKey = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nModMapKeys */ - _aux->client_symbols.nModMapKeys = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalModMapKeys */ - _aux->client_symbols.totalModMapKeys = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.firstVModMapKey */ - _aux->client_symbols.firstVModMapKey = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.nVModMapKeys */ - _aux->client_symbols.nVModMapKeys = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.totalVModMapKeys */ - _aux->client_symbols.totalVModMapKeys = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.pad1 */ - _aux->client_symbols.pad1 = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.client_symbols.virtualMods */ - _aux->client_symbols.virtualMods = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* map */ - xcb_block_len += xcb_xkb_get_kbd_by_name_replies_client_symbols_map_unpack(xcb_tmp, _aux->client_symbols.nTypes, _aux->client_symbols.nKeySyms, _aux->client_symbols.nKeyActions, _aux->client_symbols.totalActions, _aux->client_symbols.totalKeyBehaviors, _aux->client_symbols.nVModMapKeys, _aux->client_symbols.totalKeyExplicit, _aux->client_symbols.totalModMapKeys, _aux->client_symbols.totalVModMapKeys, _aux->client_symbols.present, &_aux->client_symbols.map); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_client_symbols_map_t); - } - if(reported & XCB_XKB_GBN_DETAIL_SERVER_SYMBOLS) { - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.serverDeviceID */ - _aux->server_symbols.serverDeviceID = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.pad0 */ - _aux->server_symbols.pad0[0] = *(uint8_t *)xcb_tmp; - _aux->server_symbols.pad0[1] = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t) * 2; - xcb_tmp += sizeof(uint8_t) * 2; - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.serverMinKeyCode */ - _aux->server_symbols.serverMinKeyCode = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.serverMaxKeyCode */ - _aux->server_symbols.serverMaxKeyCode = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.present */ - _aux->server_symbols.present = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstType */ - _aux->server_symbols.firstType = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nTypes */ - _aux->server_symbols.nTypes = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalTypes */ - _aux->server_symbols.totalTypes = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstKeySym */ - _aux->server_symbols.firstKeySym = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalSyms */ - _aux->server_symbols.totalSyms = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nKeySyms */ - _aux->server_symbols.nKeySyms = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstKeyAction */ - _aux->server_symbols.firstKeyAction = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalActions */ - _aux->server_symbols.totalActions = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nKeyActions */ - _aux->server_symbols.nKeyActions = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstKeyBehavior */ - _aux->server_symbols.firstKeyBehavior = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nKeyBehaviors */ - _aux->server_symbols.nKeyBehaviors = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalKeyBehaviors */ - _aux->server_symbols.totalKeyBehaviors = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstKeyExplicit */ - _aux->server_symbols.firstKeyExplicit = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nKeyExplicit */ - _aux->server_symbols.nKeyExplicit = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalKeyExplicit */ - _aux->server_symbols.totalKeyExplicit = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstModMapKey */ - _aux->server_symbols.firstModMapKey = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nModMapKeys */ - _aux->server_symbols.nModMapKeys = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalModMapKeys */ - _aux->server_symbols.totalModMapKeys = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.firstVModMapKey */ - _aux->server_symbols.firstVModMapKey = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.nVModMapKeys */ - _aux->server_symbols.nVModMapKeys = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.totalVModMapKeys */ - _aux->server_symbols.totalVModMapKeys = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.pad1 */ - _aux->server_symbols.pad1 = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.server_symbols.virtualMods */ - _aux->server_symbols.virtualMods = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* map */ - xcb_block_len += xcb_xkb_get_kbd_by_name_replies_server_symbols_map_unpack(xcb_tmp, _aux->server_symbols.nTypes, _aux->server_symbols.nKeySyms, _aux->server_symbols.nKeyActions, _aux->server_symbols.totalActions, _aux->server_symbols.totalKeyBehaviors, _aux->server_symbols.nVModMapKeys, _aux->server_symbols.totalKeyExplicit, _aux->server_symbols.totalModMapKeys, _aux->server_symbols.totalVModMapKeys, _aux->server_symbols.present, &_aux->server_symbols.map); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_server_symbols_map_t); - } if(reported & XCB_XKB_GBN_DETAIL_INDICATOR_MAPS) { + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_type */ + _aux->indicator_maps.indicatormap_type = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatorDeviceID */ _aux->indicator_maps.indicatorDeviceID = *(uint8_t *)xcb_tmp; xcb_block_len += sizeof(uint8_t); xcb_tmp += sizeof(uint8_t); xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_sequence */ + _aux->indicator_maps.indicatormap_sequence = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_length */ + _aux->indicator_maps.indicatormap_length = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.which */ _aux->indicator_maps.which = *(uint32_t *)xcb_tmp; xcb_block_len += sizeof(uint32_t); @@ -20765,12 +14921,28 @@ xcb_xkb_get_kbd_by_name_replies_unpack (const void *_buf xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(xcb_xkb_indicator_map_t); } - if(reported & XCB_XKB_GBN_DETAIL_KEY_NAMES) { + if((reported & XCB_XKB_GBN_DETAIL_KEY_NAMES) || + (reported & XCB_XKB_GBN_DETAIL_OTHER_NAMES)) { + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_type */ + _aux->key_names.keyname_type = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyDeviceID */ _aux->key_names.keyDeviceID = *(uint8_t *)xcb_tmp; xcb_block_len += sizeof(uint8_t); xcb_tmp += sizeof(uint8_t); xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_sequence */ + _aux->key_names.keyname_sequence = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_length */ + _aux->key_names.keyname_length = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); /* xcb_xkb_get_kbd_by_name_replies_t.key_names.which */ _aux->key_names.which = *(uint32_t *)xcb_tmp; xcb_block_len += sizeof(uint32_t); @@ -20852,99 +15024,27 @@ xcb_xkb_get_kbd_by_name_replies_unpack (const void *_buf xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t); } - if(reported & XCB_XKB_GBN_DETAIL_OTHER_NAMES) { - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.otherDeviceID */ - _aux->other_names.otherDeviceID = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.which */ - _aux->other_names.which = *(uint32_t *)xcb_tmp; - xcb_block_len += sizeof(uint32_t); - xcb_tmp += sizeof(uint32_t); - xcb_align_to = ALIGNOF(uint32_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.otherMinKeyCode */ - _aux->other_names.otherMinKeyCode = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.otherMaxKeyCode */ - _aux->other_names.otherMaxKeyCode = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nTypes */ - _aux->other_names.nTypes = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.groupNames */ - _aux->other_names.groupNames = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.virtualMods */ - _aux->other_names.virtualMods = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.firstKey */ - _aux->other_names.firstKey = *(xcb_keycode_t *)xcb_tmp; - xcb_block_len += sizeof(xcb_keycode_t); - xcb_tmp += sizeof(xcb_keycode_t); - xcb_align_to = ALIGNOF(xcb_keycode_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nKeys */ - _aux->other_names.nKeys = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.indicators */ - _aux->other_names.indicators = *(uint32_t *)xcb_tmp; - xcb_block_len += sizeof(uint32_t); - xcb_tmp += sizeof(uint32_t); - xcb_align_to = ALIGNOF(uint32_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nRadioGroups */ - _aux->other_names.nRadioGroups = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nKeyAliases */ - _aux->other_names.nKeyAliases = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t); - xcb_tmp += sizeof(uint8_t); - xcb_align_to = ALIGNOF(uint8_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.nKTLevels */ - _aux->other_names.nKTLevels = *(uint16_t *)xcb_tmp; - xcb_block_len += sizeof(uint16_t); - xcb_tmp += sizeof(uint16_t); - xcb_align_to = ALIGNOF(uint16_t); - /* xcb_xkb_get_kbd_by_name_replies_t.other_names.pad0 */ - _aux->other_names.pad0[0] = *(uint8_t *)xcb_tmp; - _aux->other_names.pad0[1] = *(uint8_t *)xcb_tmp; - _aux->other_names.pad0[2] = *(uint8_t *)xcb_tmp; - _aux->other_names.pad0[3] = *(uint8_t *)xcb_tmp; - xcb_block_len += sizeof(uint8_t) * 4; - xcb_tmp += sizeof(uint8_t) * 4; - xcb_align_to = ALIGNOF(uint8_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* valueList */ - xcb_block_len += xcb_xkb_get_kbd_by_name_replies_other_names_value_list_unpack(xcb_tmp, _aux->other_names.nTypes, _aux->other_names.nKTLevels, _aux->other_names.indicators, _aux->other_names.virtualMods, _aux->other_names.groupNames, _aux->other_names.nKeys, _aux->other_names.nKeyAliases, _aux->other_names.nRadioGroups, _aux->other_names.which, &_aux->other_names.valueList); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_get_kbd_by_name_replies_other_names_value_list_t); - } if(reported & XCB_XKB_GBN_DETAIL_GEOMETRY) { + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_type */ + _aux->geometry.geometry_type = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometryDeviceID */ _aux->geometry.geometryDeviceID = *(uint8_t *)xcb_tmp; xcb_block_len += sizeof(uint8_t); xcb_tmp += sizeof(uint8_t); xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_sequence */ + _aux->geometry.geometry_sequence = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_length */ + _aux->geometry.geometry_length = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); /* xcb_xkb_get_kbd_by_name_replies_t.geometry.name */ _aux->geometry.name = *(xcb_atom_t *)xcb_tmp; xcb_block_len += sizeof(xcb_atom_t); @@ -21023,99 +15123,6 @@ xcb_xkb_get_kbd_by_name_replies_unpack (const void *_buf xcb_block_len += xcb_xkb_counted_string_16_sizeof(xcb_tmp); xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* properties */ - _aux->geometry.properties = (xcb_xkb_property_t *)xcb_tmp; - for(i=0; i<_aux->geometry.nProperties; i++) { - xcb_tmp_len = xcb_xkb_property_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_property_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* colors */ - _aux->geometry.colors = (xcb_xkb_counted_string_16_t *)xcb_tmp; - for(i=0; i<_aux->geometry.nColors; i++) { - xcb_tmp_len = xcb_xkb_counted_string_16_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* shapes */ - _aux->geometry.shapes = (xcb_xkb_shape_t *)xcb_tmp; - for(i=0; i<_aux->geometry.nShapes; i++) { - xcb_tmp_len = xcb_xkb_shape_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_shape_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* sections */ - _aux->geometry.sections = (xcb_xkb_section_t *)xcb_tmp; - for(i=0; i<_aux->geometry.nSections; i++) { - xcb_tmp_len = xcb_xkb_section_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_section_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* doodads */ - _aux->geometry.doodads = (xcb_xkb_doodad_t *)xcb_tmp; - for(i=0; i<_aux->geometry.nDoodads; i++) { - xcb_tmp_len = xcb_xkb_doodad_sizeof(xcb_tmp); - xcb_block_len += xcb_tmp_len; - xcb_tmp += xcb_tmp_len; - } - xcb_align_to = ALIGNOF(xcb_xkb_doodad_t); - /* insert padding */ - xcb_pad = -xcb_block_len & (xcb_align_to - 1); - xcb_buffer_len += xcb_block_len + xcb_pad; - if (0 != xcb_pad) { - xcb_tmp += xcb_pad; - xcb_pad = 0; - } - xcb_block_len = 0; - /* keyAliases */ - _aux->geometry.keyAliases = (xcb_xkb_key_alias_t *)xcb_tmp; - xcb_block_len += _aux->geometry.nKeyAliases * sizeof(xcb_xkb_key_alias_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); } /* insert padding */ xcb_pad = -xcb_block_len & (xcb_align_to - 1); @@ -21142,45 +15149,21 @@ xcb_xkb_get_kbd_by_name_replies_sizeof (const void *_buffer /**< */, ** ** xcb_xkb_get_kbd_by_name_cookie_t xcb_xkb_get_kbd_by_name ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint16_t need - ** @param uint16_t want - ** @param uint8_t load - ** @param uint8_t keymapsSpecLen - ** @param const xcb_xkb_string8_t *keymapsSpec - ** @param uint8_t keycodesSpecLen - ** @param const xcb_xkb_string8_t *keycodesSpec - ** @param uint8_t typesSpecLen - ** @param const xcb_xkb_string8_t *typesSpec - ** @param uint8_t compatMapSpecLen - ** @param const xcb_xkb_string8_t *compatMapSpec - ** @param uint8_t symbolsSpecLen - ** @param const xcb_xkb_string8_t *symbolsSpec - ** @param uint8_t geometrySpecLen - ** @param const xcb_xkb_string8_t *geometrySpec + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint16_t need + ** @param uint16_t want + ** @param uint8_t load ** @returns xcb_xkb_get_kbd_by_name_cookie_t ** *****************************************************************************/ xcb_xkb_get_kbd_by_name_cookie_t -xcb_xkb_get_kbd_by_name (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint16_t need /**< */, - uint16_t want /**< */, - uint8_t load /**< */, - uint8_t keymapsSpecLen /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - uint8_t keycodesSpecLen /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - uint8_t typesSpecLen /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - uint8_t compatMapSpecLen /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - uint8_t symbolsSpecLen /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - uint8_t geometrySpecLen /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */) +xcb_xkb_get_kbd_by_name (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint16_t need /**< */, + uint16_t want /**< */, + uint8_t load /**< */) { static const xcb_protocol_request_t xcb_req = { /* count */ 2, @@ -21192,28 +15175,19 @@ xcb_xkb_get_kbd_by_name (xcb_connection_t *c /**< */, struct iovec xcb_parts[4]; xcb_xkb_get_kbd_by_name_cookie_t xcb_ret; xcb_xkb_get_kbd_by_name_request_t xcb_out; - /* in the protocol description, variable size fields are followed by fixed size fields */ - void *xcb_aux = 0; xcb_out.deviceSpec = deviceSpec; xcb_out.need = need; xcb_out.want = want; xcb_out.load = load; xcb_out.pad0 = 0; - xcb_out.keymapsSpecLen = keymapsSpecLen; - xcb_out.keycodesSpecLen = keycodesSpecLen; - xcb_out.typesSpecLen = typesSpecLen; - xcb_out.compatMapSpecLen = compatMapSpecLen; - xcb_out.symbolsSpecLen = symbolsSpecLen; - xcb_out.geometrySpecLen = geometrySpecLen; xcb_parts[2].iov_base = (char *) &xcb_out; - xcb_parts[2].iov_len = 2*sizeof(uint8_t) + sizeof(uint16_t); - xcb_parts[3].iov_len = xcb_xkb_get_kbd_by_name_serialize (&xcb_aux, &xcb_out, keymapsSpec, keycodesSpec, typesSpec, compatMapSpec, symbolsSpec, geometrySpec); - xcb_parts[3].iov_base = (char *) xcb_aux; + xcb_parts[2].iov_len = sizeof(xcb_out); + xcb_parts[3].iov_base = 0; + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); - free(xcb_aux); return xcb_ret; } @@ -21222,45 +15196,21 @@ xcb_xkb_get_kbd_by_name (xcb_connection_t *c /**< */, ** ** xcb_xkb_get_kbd_by_name_cookie_t xcb_xkb_get_kbd_by_name_unchecked ** - ** @param xcb_connection_t *c - ** @param xcb_xkb_device_spec_t deviceSpec - ** @param uint16_t need - ** @param uint16_t want - ** @param uint8_t load - ** @param uint8_t keymapsSpecLen - ** @param const xcb_xkb_string8_t *keymapsSpec - ** @param uint8_t keycodesSpecLen - ** @param const xcb_xkb_string8_t *keycodesSpec - ** @param uint8_t typesSpecLen - ** @param const xcb_xkb_string8_t *typesSpec - ** @param uint8_t compatMapSpecLen - ** @param const xcb_xkb_string8_t *compatMapSpec - ** @param uint8_t symbolsSpecLen - ** @param const xcb_xkb_string8_t *symbolsSpec - ** @param uint8_t geometrySpecLen - ** @param const xcb_xkb_string8_t *geometrySpec + ** @param xcb_connection_t *c + ** @param xcb_xkb_device_spec_t deviceSpec + ** @param uint16_t need + ** @param uint16_t want + ** @param uint8_t load ** @returns xcb_xkb_get_kbd_by_name_cookie_t ** *****************************************************************************/ xcb_xkb_get_kbd_by_name_cookie_t -xcb_xkb_get_kbd_by_name_unchecked (xcb_connection_t *c /**< */, - xcb_xkb_device_spec_t deviceSpec /**< */, - uint16_t need /**< */, - uint16_t want /**< */, - uint8_t load /**< */, - uint8_t keymapsSpecLen /**< */, - const xcb_xkb_string8_t *keymapsSpec /**< */, - uint8_t keycodesSpecLen /**< */, - const xcb_xkb_string8_t *keycodesSpec /**< */, - uint8_t typesSpecLen /**< */, - const xcb_xkb_string8_t *typesSpec /**< */, - uint8_t compatMapSpecLen /**< */, - const xcb_xkb_string8_t *compatMapSpec /**< */, - uint8_t symbolsSpecLen /**< */, - const xcb_xkb_string8_t *symbolsSpec /**< */, - uint8_t geometrySpecLen /**< */, - const xcb_xkb_string8_t *geometrySpec /**< */) +xcb_xkb_get_kbd_by_name_unchecked (xcb_connection_t *c /**< */, + xcb_xkb_device_spec_t deviceSpec /**< */, + uint16_t need /**< */, + uint16_t want /**< */, + uint8_t load /**< */) { static const xcb_protocol_request_t xcb_req = { /* count */ 2, @@ -21272,28 +15222,19 @@ xcb_xkb_get_kbd_by_name_unchecked (xcb_connection_t *c /**< */, struct iovec xcb_parts[4]; xcb_xkb_get_kbd_by_name_cookie_t xcb_ret; xcb_xkb_get_kbd_by_name_request_t xcb_out; - /* in the protocol description, variable size fields are followed by fixed size fields */ - void *xcb_aux = 0; xcb_out.deviceSpec = deviceSpec; xcb_out.need = need; xcb_out.want = want; xcb_out.load = load; xcb_out.pad0 = 0; - xcb_out.keymapsSpecLen = keymapsSpecLen; - xcb_out.keycodesSpecLen = keycodesSpecLen; - xcb_out.typesSpecLen = typesSpecLen; - xcb_out.compatMapSpecLen = compatMapSpecLen; - xcb_out.symbolsSpecLen = symbolsSpecLen; - xcb_out.geometrySpecLen = geometrySpecLen; xcb_parts[2].iov_base = (char *) &xcb_out; - xcb_parts[2].iov_len = 2*sizeof(uint8_t) + sizeof(uint16_t); - xcb_parts[3].iov_len = xcb_xkb_get_kbd_by_name_serialize (&xcb_aux, &xcb_out, keymapsSpec, keycodesSpec, typesSpec, compatMapSpec, symbolsSpec, geometrySpec); - xcb_parts[3].iov_base = (char *) xcb_aux; + xcb_parts[2].iov_len = sizeof(xcb_out); + xcb_parts[3].iov_base = 0; + xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); - free(xcb_aux); return xcb_ret; } @@ -21341,13 +15282,15 @@ xcb_xkb_get_device_info_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int i; unsigned int xcb_tmp_len; xcb_block_len += sizeof(xcb_xkb_get_device_info_reply_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* name */ xcb_block_len += _aux->nameLen * sizeof(xcb_xkb_string8_t); xcb_tmp += xcb_block_len; @@ -21674,13 +15617,15 @@ xcb_xkb_set_device_info_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; unsigned int i; unsigned int xcb_tmp_len; xcb_block_len += sizeof(xcb_xkb_set_device_info_request_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* btnActions */ xcb_block_len += _aux->nBtns * sizeof(xcb_xkb_action_t); xcb_tmp += xcb_block_len; @@ -21864,11 +15809,13 @@ xcb_xkb_set_debugging_flags_sizeof (const void *_buffer /**< */) unsigned int xcb_buffer_len = 0; unsigned int xcb_block_len = 0; unsigned int xcb_pad = 0; - unsigned int xcb_align_to; + unsigned int xcb_align_to = 0; xcb_block_len += sizeof(xcb_xkb_set_debugging_flags_request_t); xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; /* message */ xcb_block_len += _aux->msgLength * sizeof(xcb_xkb_string8_t); xcb_tmp += xcb_block_len; diff --git a/src/3rdparty/xcb/libxcb/xkb.patch b/src/3rdparty/xcb/libxcb/xkb.patch deleted file mode 100644 index 054d97467f8..00000000000 --- a/src/3rdparty/xcb/libxcb/xkb.patch +++ /dev/null @@ -1,172 +0,0 @@ -diff --git src/3rdparty/xcb/libxcb/xkb.c src/3rdparty/xcb/libxcb/xkb.c -index cd09226..3e07d6d 100644 ---- src/3rdparty/xcb/libxcb/xkb.c -+++ src/3rdparty/xcb/libxcb/xkb.c -@@ -15,6 +15,15 @@ - - xcb_extension_t xcb_xkb_id = { "XKEYBOARD", 0 }; - -+int qt_xcb_sumof(uint8_t *list, int len) -+{ -+ int i, s = 0; -+ for(i=0; inLevelsPerType, R->nTypes); -+ return qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes); - } - - -@@ -9640,7 +9649,7 @@ xcb_xkb_get_names_value_list_kt_level_names_end (const xcb_xkb_get_names_reply_t - const xcb_xkb_get_names_value_list_t *S /**< */) - { - xcb_generic_iterator_t i; -- i.data = /* valueList */ S->ktLevelNames + xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes); -+ i.data = /* valueList */ S->ktLevelNames + qt_xcb_sumof(/* valueList */ S->nLevelsPerType, R->nTypes); - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -@@ -10089,8 +10098,8 @@ xcb_xkb_get_names_value_list_serialize (void **_ - xcb_block_len = 0; - /* ktLevelNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; -- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); -- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); -+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); -+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } -@@ -10330,7 +10339,7 @@ xcb_xkb_get_names_value_list_unpack (const void *_buffer / - xcb_block_len = 0; - /* ktLevelNames */ - _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; -- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); -+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nTypes) * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } -@@ -10707,7 +10716,7 @@ int - xcb_xkb_set_names_values_kt_level_names_length (const xcb_xkb_set_names_request_t *R /**< */, - const xcb_xkb_set_names_values_t *S /**< */) - { -- return xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); -+ return qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); - } - - -@@ -10725,7 +10734,7 @@ xcb_xkb_set_names_values_kt_level_names_end (const xcb_xkb_set_names_request_t * - const xcb_xkb_set_names_values_t *S /**< */) - { - xcb_generic_iterator_t i; -- i.data = /* values */ S->ktLevelNames + xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); -+ i.data = /* values */ S->ktLevelNames + qt_xcb_sumof(/* values */ S->nLevelsPerType, R->nKTLevels); - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -@@ -11175,8 +11184,8 @@ xcb_xkb_set_names_values_serialize (void **_buffer - xcb_block_len = 0; - /* ktLevelNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; -- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } -@@ -11417,7 +11426,7 @@ xcb_xkb_set_names_values_unpack (const void *_buffer /**< */, - xcb_block_len = 0; - /* ktLevelNames */ - _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; -- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } -@@ -16654,7 +16663,7 @@ int - xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) - { -- return xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); -+ return qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); - } - - -@@ -16672,7 +16681,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (const x - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) - { - xcb_generic_iterator_t i; -- i.data = /* replies */ S->key_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); -+ i.data = /* replies */ S->key_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->key_names.valueList.nLevelsPerType, /* replies */ S->key_names.nKTLevels); - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -@@ -17122,8 +17131,8 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void - xcb_block_len = 0; - /* ktLevelNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; -- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } -@@ -17364,7 +17373,7 @@ xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void - xcb_block_len = 0; - /* ktLevelNames */ - _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; -- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } -@@ -17624,7 +17633,7 @@ int - xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R /**< */, - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) - { -- return xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels); -+ return qt_xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels); - } - - -@@ -17642,7 +17651,7 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list_kt_level_names_end (const - const xcb_xkb_get_kbd_by_name_replies_t *S /**< */) - { - xcb_generic_iterator_t i; -- i.data = /* replies */ S->other_names.valueList.ktLevelNames + xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels); -+ i.data = /* replies */ S->other_names.valueList.ktLevelNames + qt_xcb_sumof(/* replies */ S->other_names.valueList.nLevelsPerType, /* replies */ S->other_names.nKTLevels); - i.rem = 0; - i.index = (char *) i.data - (char *) S; - return i; -@@ -18092,8 +18101,8 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list_serialize (void - xcb_block_len = 0; - /* ktLevelNames */ - xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; -- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -- xcb_parts[xcb_parts_idx].iov_len = xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -+ xcb_parts[xcb_parts_idx].iov_len = qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); - xcb_parts_idx++; - xcb_align_to = ALIGNOF(xcb_atom_t); - } -@@ -18334,7 +18343,7 @@ xcb_xkb_get_kbd_by_name_replies_other_names_value_list_unpack (const void - xcb_block_len = 0; - /* ktLevelNames */ - _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; -- xcb_block_len += xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); -+ xcb_block_len += qt_xcb_sumof(_aux->nLevelsPerType, nKTLevels) * sizeof(xcb_atom_t); - xcb_tmp += xcb_block_len; - xcb_align_to = ALIGNOF(xcb_atom_t); - } diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro index 2fd5519053d..19852b74b15 100644 --- a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro +++ b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro @@ -1,6 +1,7 @@ # # Statically compile in code for -# libxcb-fixes, libxcb-randr, libxcb-shm, libxcb-sync, libxcb-image, libxcb-keysyms, libxcb-icccm, libxcb-renderutil +# libxcb-fixes, libxcb-randr, libxcb-shm, libxcb-sync, libxcb-image, +# libxcb-keysyms, libxcb-icccm, libxcb-renderutil, libxcb-xkb # TEMPLATE = lib TARGET = xcb-static From 71ae9b4b35e8460752fe463d175c468d4b27238e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 6 Mar 2014 12:28:48 +0100 Subject: [PATCH 096/172] CMake: Test with the NMake Makefiles generator on Windows. It may be much faster through the CI system that way. Change-Id: Ib5e3a438bd2ac98dd0a3806cedba152f25e219d5 Reviewed-by: Friedemann Kleint --- mkspecs/features/ctest_testcase_common.prf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mkspecs/features/ctest_testcase_common.prf b/mkspecs/features/ctest_testcase_common.prf index a2b7e8e72bb..b98a613f55b 100644 --- a/mkspecs/features/ctest_testcase_common.prf +++ b/mkspecs/features/ctest_testcase_common.prf @@ -51,11 +51,8 @@ load(cmake_functions) CMAKE_BUILD_TYPE = Debug CONFIG(release, debug|release):CMAKE_BUILD_TYPE = Release +win32: CMAKE_GENERATOR = -G \"NMake Makefiles\" mingw:isEmpty(CROSS_COMPILE):CMAKE_GENERATOR = -G \"MinGW Makefiles\" -win32:equals(QT_ARCH, x86_64) { - win32-msvc2010:CMAKE_GENERATOR = -G \"Visual Studio 10 Win64\" - win32-msvc2012:CMAKE_GENERATOR = -G \"Visual Studio 11 Win64\" -} BUILD_DIR = $$replace($$list($$OUT_PWD/build), /, $$QMAKE_DIR_SEP) From b0d8beb858491622670b3771a11b55c3872598b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Thu, 6 Mar 2014 10:50:34 +0100 Subject: [PATCH 097/172] Simplify tst_QMetaType::automaticTemplateRegistration Redundant and unused variadic macro arguments were removed. For macros with known count of arguments, named arguments are preferred. Common code was moved out from macros so it is not generated over and over. Change-Id: Ib5106555d0d3c6cadfbdbdbd614831240b6d762f Reviewed-by: Stephen Kelly --- .../kernel/qmetatype/tst_qmetatype.cpp | 115 ++++++++++-------- 1 file changed, 61 insertions(+), 54 deletions(-) diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index acff6a55ba3..fba0b87c091 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1314,6 +1314,27 @@ public: typedef MyObject* MyObjectPtr; Q_DECLARE_METATYPE(MyObjectPtr) +#if defined(Q_COMPILER_VARIADIC_MACROS) && !defined(TST_QMETATYPE_BROKEN_COMPILER) +static QByteArray createTypeName(const char *begin, const char *va) +{ + QByteArray tn(begin); + const QList args = QByteArray(va).split(','); + tn += args.first().trimmed(); + if (args.size() > 1) { + QList::const_iterator it = args.constBegin() + 1; + const QList::const_iterator end = args.constEnd(); + for (; it != end; ++it) { + tn += ","; + tn += it->trimmed(); + } + } + if (tn.endsWith('>')) + tn += ' '; + tn += ">"; + return tn; +} +#endif + void tst_QMetaType::automaticTemplateRegistration() { #define TEST_SEQUENTIAL_CONTAINER(CONTAINER, VALUE_TYPE) \ @@ -1480,58 +1501,44 @@ void tst_QMetaType::automaticTemplateRegistration() #if defined(Q_COMPILER_VARIADIC_MACROS) && !defined(TST_QMETATYPE_BROKEN_COMPILER) - #define FOR_EACH_STATIC_PRIMITIVE_TYPE(F, ...) \ - F(bool, __VA_ARGS__) \ - F(int, __VA_ARGS__) \ - F(uint, __VA_ARGS__) \ - F(qlonglong, __VA_ARGS__) \ - F(qulonglong, __VA_ARGS__) \ - F(double, __VA_ARGS__) \ - F(long, __VA_ARGS__) \ - F(short, __VA_ARGS__) \ - F(char, __VA_ARGS__) \ - F(ulong, __VA_ARGS__) \ - F(ushort, __VA_ARGS__) \ - F(uchar, __VA_ARGS__) \ - F(float, __VA_ARGS__) \ - F(QObject*, __VA_ARGS__) \ - F(QString, __VA_ARGS__) \ - F(CustomMovable, __VA_ARGS__) - - #define FOR_EACH_STATIC_PRIMITIVE_TYPE2(F, ...) \ - F(bool, __VA_ARGS__) \ - F(int, __VA_ARGS__) \ - F(uint, __VA_ARGS__) \ - F(qlonglong, __VA_ARGS__) \ - F(qulonglong, __VA_ARGS__) \ - F(long, __VA_ARGS__) \ - F(short, __VA_ARGS__) \ - F(char, __VA_ARGS__) \ - F(ulong, __VA_ARGS__) \ - F(ushort, __VA_ARGS__) \ - F(uchar, __VA_ARGS__) \ - F(QObject*, __VA_ARGS__) \ - F(QString, __VA_ARGS__) + #define FOR_EACH_STATIC_PRIMITIVE_TYPE(F) \ + F(bool) \ + F(int) \ + F(uint) \ + F(qlonglong) \ + F(qulonglong) \ + F(double) \ + F(long) \ + F(short) \ + F(char) \ + F(ulong) \ + F(ushort) \ + F(uchar) \ + F(float) \ + F(QObject*) \ + F(QString) \ + F(CustomMovable) + #define FOR_EACH_STATIC_PRIMITIVE_TYPE2(F, SecondaryRealName) \ + F(bool, SecondaryRealName) \ + F(int, SecondaryRealName) \ + F(uint, SecondaryRealName) \ + F(qlonglong, SecondaryRealName) \ + F(qulonglong, SecondaryRealName) \ + F(long, SecondaryRealName) \ + F(short, SecondaryRealName) \ + F(char, SecondaryRealName) \ + F(ulong, SecondaryRealName) \ + F(ushort, SecondaryRealName) \ + F(uchar, SecondaryRealName) \ + F(QObject*, SecondaryRealName) \ + F(QString, SecondaryRealName) #define CREATE_AND_VERIFY_CONTAINER(CONTAINER, ...) \ { \ CONTAINER< __VA_ARGS__ > t; \ const QVariant v = QVariant::fromValue(t); \ - QByteArray tn = #CONTAINER + QByteArray("<"); \ - const QList args = QByteArray(#__VA_ARGS__).split(','); \ - tn += args.first().trimmed(); \ - if (args.size() > 1) { \ - QList::const_iterator it = args.constBegin() + 1; \ - const QList::const_iterator end = args.constEnd(); \ - for (; it != end; ++it) { \ - tn += ","; \ - tn += it->trimmed(); \ - } \ - } \ - if (tn.endsWith('>')) \ - tn += ' '; \ - tn += ">"; \ + QByteArray tn = createTypeName(#CONTAINER "<", #__VA_ARGS__); \ const int type = QMetaType::type(tn); \ const int expectedType = ::qMetaTypeId >(); \ QCOMPARE(type, expectedType); \ @@ -1547,18 +1554,18 @@ void tst_QMetaType::automaticTemplateRegistration() F(QStack, TYPE) \ F(QSet, TYPE) - #define PRINT_1ARG_TEMPLATE(RealName, ...) \ + #define PRINT_1ARG_TEMPLATE(RealName) \ FOR_EACH_1ARG_TEMPLATE_TYPE(CREATE_AND_VERIFY_CONTAINER, RealName) - #define FOR_EACH_2ARG_TEMPLATE_TYPE(F, RealName, ...) \ - F(QHash, __VA_ARGS__) \ - F(QMap, __VA_ARGS__) \ - F(QPair, __VA_ARGS__) + #define FOR_EACH_2ARG_TEMPLATE_TYPE(F, RealName1, RealName2) \ + F(QHash, RealName1, RealName2) \ + F(QMap, RealName1, RealName2) \ + F(QPair, RealName1, RealName2) - #define PRINT_2ARG_TEMPLATE_INTERNAL(RealName, ...) \ - FOR_EACH_2ARG_TEMPLATE_TYPE(CREATE_AND_VERIFY_CONTAINER, 0, RealName, __VA_ARGS__) + #define PRINT_2ARG_TEMPLATE_INTERNAL(RealName1, RealName2) \ + FOR_EACH_2ARG_TEMPLATE_TYPE(CREATE_AND_VERIFY_CONTAINER, RealName1, RealName2) - #define PRINT_2ARG_TEMPLATE(RealName, ...) \ + #define PRINT_2ARG_TEMPLATE(RealName) \ FOR_EACH_STATIC_PRIMITIVE_TYPE2(PRINT_2ARG_TEMPLATE_INTERNAL, RealName) #define REGISTER_TYPEDEF(TYPE, ARG1, ARG2) \ From 1d6de20e0b901f54ac41b3195a13ed5946b983f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 28 Feb 2014 16:35:02 +0100 Subject: [PATCH 098/172] Re-enable drag-and-drop on iOS after bugfixes to QBasicDrag and friends Change-Id: I0fd4e5e8d561826841cc78b26cd524ba01a8b689 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/ios/qiosintegration.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index fdecf70725d..c655d8d3bf0 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -74,8 +74,6 @@ public: QStringList themeNames() const; QPlatformTheme *createPlatformTheme(const QString &name) const; - QPlatformDrag *drag() const Q_DECL_OVERRIDE { return 0; } - QAbstractEventDispatcher *createEventDispatcher() const; QPlatformNativeInterface *nativeInterface() const; From 564297d7c470fa8691b6d00af7b138e06b848d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Thu, 6 Mar 2014 12:40:15 +0100 Subject: [PATCH 099/172] Reduce clang compilation time of tst_qmetatype by ~50% We do not need to check all possible basic type combinations in the autoregistration test. Change-Id: Ibfb97a93d9d1862e669d843988976690bbc83c74 Reviewed-by: Stephen Kelly Reviewed-by: Olivier Goffart --- .../corelib/kernel/qmetatype/tst_qmetatype.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index fba0b87c091..0e3ea861658 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -1504,15 +1504,11 @@ void tst_QMetaType::automaticTemplateRegistration() #define FOR_EACH_STATIC_PRIMITIVE_TYPE(F) \ F(bool) \ F(int) \ - F(uint) \ - F(qlonglong) \ F(qulonglong) \ F(double) \ - F(long) \ F(short) \ F(char) \ F(ulong) \ - F(ushort) \ F(uchar) \ F(float) \ F(QObject*) \ @@ -1520,19 +1516,11 @@ void tst_QMetaType::automaticTemplateRegistration() F(CustomMovable) #define FOR_EACH_STATIC_PRIMITIVE_TYPE2(F, SecondaryRealName) \ - F(bool, SecondaryRealName) \ - F(int, SecondaryRealName) \ F(uint, SecondaryRealName) \ F(qlonglong, SecondaryRealName) \ - F(qulonglong, SecondaryRealName) \ - F(long, SecondaryRealName) \ - F(short, SecondaryRealName) \ F(char, SecondaryRealName) \ - F(ulong, SecondaryRealName) \ - F(ushort, SecondaryRealName) \ F(uchar, SecondaryRealName) \ - F(QObject*, SecondaryRealName) \ - F(QString, SecondaryRealName) + F(QObject*, SecondaryRealName) #define CREATE_AND_VERIFY_CONTAINER(CONTAINER, ...) \ { \ From 275dcd61d30a59a6144c5ba40ae853cca463b173 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 5 Mar 2014 11:58:07 +0100 Subject: [PATCH 100/172] Fix cursor blink time in Windows In Qt 4 there is a factor of 2 in qapplication_win.cpp, this got lost, so all our cursors were blinking twice as fast. Task-number: QTBUG-37200 Change-Id: I11ce61c51279d9ceb8bc9ba01c1bb9640a31ade8 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 64a842d492a..e0e8753e14e 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -382,7 +382,7 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co switch (hint) { case QPlatformIntegration::CursorFlashTime: if (const unsigned timeMS = GetCaretBlinkTime()) - return QVariant(int(timeMS)); + return QVariant(int(timeMS) * 2); break; #ifdef SPI_GETKEYBOARDSPEED case KeyboardAutoRepeatRate: From 9a08483d763dacfca6029f7a8970846e83df0e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 5 Mar 2014 17:32:24 +0100 Subject: [PATCH 101/172] Try to speedup tst_qmetatype.cpp compilation with clang. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test instantiates enormous amounts of templates in one compilation unit. All clang versions, that I tested, suffers from performance issues while compiling the test, the cost depends on the version. The most affected are shipped by Apple. Task-number: QTBUG-37237 Change-Id: I0959c1a4a6faee448ae1dae5c1e70ee06cefbd9c Reviewed-by: Simo Fält Reviewed-by: Frederik Gladhorn --- tests/auto/corelib/kernel/kernel.pro | 4 ---- tests/auto/corelib/kernel/qmetatype/qmetatype.pro | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro index 3ec783ab2cf..604a0f4fd8d 100644 --- a/tests/auto/corelib/kernel/kernel.pro +++ b/tests/auto/corelib/kernel/kernel.pro @@ -21,10 +21,6 @@ SUBDIRS=\ qvariant \ qwineventnotifier -# Building the qmetatype test with Clang on ARM takes forever (QTBUG-37237) -!clang|!contains(QT_ARCH, arm): \ - SUBDIRS += qmetatype - !qtHaveModule(gui): SUBDIRS -= \ qmimedata diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro index d19ec237605..fc262b8fc7e 100644 --- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro +++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro @@ -15,3 +15,18 @@ win32-msvc*|wince|winrt { QMAKE_CFLAGS_RELEASE -= -O2 } } + +clang { + # clang has some performance problems with the test. Especially + # with automaticTemplateRegistration which creates few thousands + # template instantiations (QTBUG-37237). Removing -O2 and -g + # improves the situation, but it is not solving the problem. + QMAKE_CXXFLAGS_RELEASE -= -O2 + QMAKE_CFLAGS_RELEASE -= -O2 + QMAKE_CXXFLAGS_RELEASE -= -g + QMAKE_CFLAGS_RELEASE -= -g + + # Building for ARM (eg iOS) is affected so much that we disable + #the template part of the test + contains(QT_ARCH, arm): DEFINES += TST_QMETATYPE_BROKEN_COMPILER +} From 6b4b3c7ef652b4f14335b65183f03718731cab75 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 4 Mar 2014 14:11:42 +0100 Subject: [PATCH 102/172] Fix building of Qt with icc on Windows Since there was no extension specified for static libraries then it would end up not being able to build Qt at all. Change-Id: Iec9040640ba399544b86df27e370fcf23cabb4de Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- mkspecs/win32-icc/qmake.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf index 1ee07c64b67..a20d7c31221 100644 --- a/mkspecs/win32-icc/qmake.conf +++ b/mkspecs/win32-icc/qmake.conf @@ -56,6 +56,7 @@ QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:console QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:windows QMAKE_LFLAGS_DLL = /DLL +QMAKE_EXTENSION_STATICLIB = lib QMAKE_LIBS = QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib From 82288308ecbe1481d82bee78ec59855b69d24391 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 6 Mar 2014 12:31:55 +0100 Subject: [PATCH 103/172] Doc fix QOpenGLContext::destroy() is private. The recommended way to free resources temporarily is simply to delete the context. Change-Id: I0d59b55afb209d56405f3584e4645bd4718790af Reviewed-by: Gunnar Sletta --- src/gui/kernel/qopenglcontext.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 005f716788f..f68915edebc 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -257,12 +257,10 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex; rendering a new frame, after calling swapBuffers(). If the context is temporarily not needed, such as when the application is - not rendering, it can be useful to call destroy() to free resources. - However, if you do so you will need to call create() again before the - context can be used, and you might need to recreate any OpenGL resources - and reinitialize the OpenGL state. You can connect to the - aboutToBeDestroyed() signal to clean up any resources that have been - allocated with different ownership from the QOpenGLContext itself. + not rendering, it can be useful to delete it in order to free resources. + You can connect to the aboutToBeDestroyed() signal to clean up any + resources that have been allocated with different ownership from the + QOpenGLContext itself. Once a QOpenGLContext has been made current, you can render to it in a platform independent way by using Qt's OpenGL enablers such as From 9ba7cc07dbef542bc73f97f1d7458699d25fbb8d Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 6 Mar 2014 11:10:44 +0100 Subject: [PATCH 104/172] Tslib plugin: also apply missing release coordinate code to non-raw mode Even if the normal mode is used the release events may have zero coordinates. Change-Id: I2eac8cf50dfcf9e62d8cec2423419a6579266849 Reviewed-by: Laszlo Agocs Reviewed-by: Friedemann Kleint --- src/plugins/generic/tslib/qtslib.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/generic/tslib/qtslib.cpp b/src/plugins/generic/tslib/qtslib.cpp index 9905d9cc9ef..0dcf5bc6ca7 100644 --- a/src/plugins/generic/tslib/qtslib.cpp +++ b/src/plugins/generic/tslib/qtslib.cpp @@ -110,12 +110,17 @@ static bool get_sample(struct tsdev *dev, struct ts_sample *sample, bool rawMode void QTsLibMouseHandler::readMouseData() { ts_sample sample; - while (get_sample(m_dev, &sample, m_rawMode)) { + while (get_sample(m_dev, &sample, m_rawMode)) { bool pressed = sample.pressure; int x = sample.x; int y = sample.y; + // work around missing coordinates on mouse release + if (sample.pressure == 0 && sample.x == 0 && sample.y == 0) { + x = m_x; + y = m_y; + } if (!m_rawMode) { //filtering: ignore movements of 2 pixels or less @@ -123,12 +128,6 @@ void QTsLibMouseHandler::readMouseData() int dy = y - m_y; if (dx*dx <= 4 && dy*dy <= 4 && pressed == m_pressed) continue; - } else { - // work around missing coordinates on mouse release in raw mode - if (sample.pressure == 0 && sample.x == 0 && sample.y == 0) { - x = m_x; - y = m_y; - } } QPoint pos(x, y); From cc278a4a78f154235eca0052cedea0bc16ec4931 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 4 Mar 2014 15:32:16 +0100 Subject: [PATCH 105/172] Window change notification QQuickWidget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QQuickWidget and QOpenGLWidget needs to know when the window changes so it can use the correct GL context. Task-number: QTBUG-37045 Change-Id: Ib98b18e721908017398518f73226cb3731886927 Reviewed-by: Laszlo Agocs Reviewed-by: Jørgen Lind --- src/corelib/kernel/qcoreevent.cpp | 1 + src/corelib/kernel/qcoreevent.h | 2 ++ src/widgets/kernel/qwidget.cpp | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index cce385352ef..62c76c1a409 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -274,6 +274,7 @@ QT_BEGIN_NAMESPACE \omitvalue NetworkReplyUpdated \omitvalue FutureCallOut \omitvalue NativeGesture + \omitvalue WindowChangeInternal */ /*! diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index e974c4d226a..3ee0eaaa61b 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -278,6 +278,8 @@ public: StyleAnimationUpdate = 213, // style animation target should be updated ApplicationStateChange = 214, + WindowChangeInternal = 215, // internal for QQuickWidget + // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index e2c766ea4c1..102e659fbf3 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9596,6 +9596,23 @@ void QWidget::setParent(QWidget *parent) setParent((QWidget*)parent, windowFlags() & ~Qt::WindowType_Mask); } +#ifndef QT_NO_OPENGL +static void sendWindowChangeToTextureChildrenRecursively(QWidget *widget) +{ + QWidgetPrivate *d = QWidgetPrivate::get(widget); + if (d->renderToTexture) { + QEvent e(QEvent::WindowChangeInternal); + QApplication::sendEvent(widget, &e); + } + + for (int i = 0; i < d->children.size(); ++i) { + QWidget *w = qobject_cast(d->children.at(i)); + if (w && !w->isWindow() && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen) + sendWindowChangeToTextureChildrenRecursively(w); + } +} +#endif + /*! \overload @@ -9720,6 +9737,12 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) QEvent e(QEvent::ParentChange); QApplication::sendEvent(this, &e); } +#ifndef QT_NO_OPENGL + //renderToTexture widgets also need to know when their top-level window changes + if (d->textureChildSeen && oldtlw != window()) { + sendWindowChangeToTextureChildrenRecursively(this); + } +#endif if (!wasCreated) { if (isWindow() || parentWidget()->isVisible()) From f116778aedacfcff131a5fb20b5439e1a617733a Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Thu, 6 Mar 2014 14:08:11 +0200 Subject: [PATCH 106/172] WinRT: Use native wait methods instead of std::thread's sleep_for sleep_for appears to be unreliable (resulting in infinite waits) when used in a thread which is also using native waiting methods. This is also a step in the direction of eliminating std::thread's usage in WinRT. Change-Id: I58bc4bf9ada25de247849333ef925964676b7239 Reviewed-by: Oliver Wolff --- src/corelib/thread/qthread_win.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index db5c13157cc..a12636778e9 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -504,22 +504,22 @@ void QThread::usleep(unsigned long usecs) void QThread::yieldCurrentThread() { - std::this_thread::yield(); + msleep(1); } void QThread::sleep(unsigned long secs) { - std::this_thread::sleep_for(std::chrono::seconds(secs)); + msleep(secs * 1000); } void QThread::msleep(unsigned long msecs) { - std::this_thread::sleep_for(std::chrono::milliseconds(msecs)); + WaitForSingleObjectEx(GetCurrentThread(), msecs, FALSE); } void QThread::usleep(unsigned long usecs) { - std::this_thread::sleep_for(std::chrono::microseconds(usecs)); + msleep((usecs / 1000) + 1); } #endif // Q_OS_WINRT From 898f7ea1ec106b5e24824d2819b53376b433c8c8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 6 Mar 2014 15:50:27 +0100 Subject: [PATCH 107/172] Sanitize tst_qftp. - Replace SRCDIR define by QFINDTESTDATA - Replace QVERIFY by QCOMPARE where applicable - Introduce QVERIFY2 with message for comparisons Change-Id: Ib5a6b0f09428587281e1b9521e4d8a8117c1afdb Reviewed-by: Peter Hartmann --- tests/auto/network/access/qftp/qftp.pro | 3 - tests/auto/network/access/qftp/tst_qftp.cpp | 202 +++++++++++--------- 2 files changed, 113 insertions(+), 92 deletions(-) diff --git a/tests/auto/network/access/qftp/qftp.pro b/tests/auto/network/access/qftp/qftp.pro index c56dfa2b6e0..44161f4e1e4 100644 --- a/tests/auto/network/access/qftp/qftp.pro +++ b/tests/auto/network/access/qftp/qftp.pro @@ -9,9 +9,6 @@ wince*: { addFiles.files = rfc3252.txt addFiles.path = . DEPLOYMENT += addFiles - DEFINES += SRCDIR=\\\"\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" } CONFIG+=insignificant_test # QTBUG-15111: uses live qt-test-server, inherently unstable diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index fffe663f0a8..a322c7ab65d 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -57,6 +57,14 @@ #include "../../../network-settings.h" +template +static QByteArray msgComparison(T1 lhs, const char *op, T2 rhs) +{ + QString result; + QTextStream(&result) << lhs << ' ' << op << ' ' << rhs; + return result.toLatin1(); +} + class tst_QFtp : public QObject { Q_OBJECT @@ -174,6 +182,7 @@ private: bool inFileDirExistsFunction; QString uniqueExtension; + QString rfc3252File; }; //#define DUMP_SIGNALS @@ -220,6 +229,8 @@ void tst_QFtp::initTestCase() networkSessionImplicit->open(); QVERIFY(networkSessionImplicit->waitForOpened(60000)); //there may be user prompt on 1st connect #endif + rfc3252File = QFINDTESTDATA("rfc3252.txt"); + QVERIFY(!rfc3252File.isEmpty()); } void tst_QFtp::cleanupTestCase() @@ -327,6 +338,16 @@ void tst_QFtp::connectToHost_data() QTest::newRow( "error02" ) << QString("foo.bar") << (uint)21 << (int)QFtp::Unconnected; } +static QByteArray msgTimedOut(const QString &host, quint16 port = 0) +{ + QByteArray result = "Network operation timed out on " + host.toLatin1(); + if (port) { + result += ':'; + result += QByteArray::number(port); + } + return result; +} + void tst_QFtp::connectToHost() { QFETCH( QString, host ); @@ -339,7 +360,7 @@ void tst_QFtp::connectToHost() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); QTEST( connectToHost_state, "state" ); @@ -347,9 +368,9 @@ void tst_QFtp::connectToHost() QVERIFY( it != resultMap.end() ); QFETCH( int, state ); if ( state == QFtp::Connected ) { - QVERIFY( it.value().success == 1 ); + QCOMPARE( it.value().success, 1 ); } else { - QVERIFY( it.value().success == 0 ); + QCOMPARE( it.value().success , 0 ); } } @@ -382,10 +403,10 @@ void tst_QFtp::connectToUnresponsiveHost() #endif QVERIFY2(! QTestEventLoop::instance().timeout(), "Network timeout longer than expected (should have been 60 seconds)"); - QVERIFY( ftp->state() == QFtp::Unconnected); + QCOMPARE( ftp->state(), QFtp::Unconnected); ResMapIt it = resultMap.find( QFtp::ConnectToHost ); QVERIFY( it != resultMap.end() ); - QVERIFY( it.value().success == 0 ); + QCOMPARE( it.value().success, 0 ); delete ftp; ftp = 0; @@ -423,16 +444,17 @@ void tst_QFtp::login() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( QFtp::Login ); QVERIFY( it != resultMap.end() ); QTEST( it.value().success, "success" ); + const QFtp::State loginState = static_cast(login_state); if ( it.value().success ) { - QVERIFY( login_state == QFtp::LoggedIn ); + QCOMPARE( loginState, QFtp::LoggedIn ); } else { - QVERIFY( login_state != QFtp::LoggedIn ); + QVERIFY2( loginState != QFtp::LoggedIn, msgComparison(loginState, "!=", QFtp::LoggedIn)); } } @@ -470,13 +492,13 @@ void tst_QFtp::close() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); QCOMPARE( close_state, (int)QFtp::Unconnected ); ResMapIt it = resultMap.find( QFtp::Close ); QVERIFY( it != resultMap.end() ); - QVERIFY( it.value().success == 1 ); + QCOMPARE( it.value().success, 1 ); } void tst_QFtp::list_data() @@ -538,7 +560,7 @@ void tst_QFtp::list() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( QFtp::List ); QVERIFY( it != resultMap.end() ); @@ -599,7 +621,7 @@ void tst_QFtp::cd() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) { - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); } ResMapIt it = resultMap.find( QFtp::Cd ); @@ -624,8 +646,8 @@ void tst_QFtp::get_data() QTest::addColumn("useIODevice"); // ### move this into external testdata - QFile file( SRCDIR "rfc3252.txt" ); - QVERIFY( file.open( QIODevice::ReadOnly ) ); + QFile file(rfc3252File); + QVERIFY2( file.open( QIODevice::ReadOnly ), qPrintable(file.errorString()) ); QByteArray rfc3252 = file.readAll(); // test the two get() overloads in one routine @@ -675,7 +697,7 @@ void tst_QFtp::get() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( QFtp::Get ); QVERIFY( it != resultMap.end() ); @@ -685,17 +707,17 @@ void tst_QFtp::get() } else { QTEST( newData_ba, "res" ); } - QVERIFY( bytesTotal != bytesTotal_init ); + QVERIFY2( bytesTotal != bytesTotal_init, msgComparison(bytesTotal, "!=", bytesTotal_init) ); if ( bytesTotal != -1 ) { - QVERIFY( bytesDone == bytesTotal ); + QCOMPARE( bytesDone, bytesTotal ); } if ( useIODevice ) { if ( bytesDone != bytesDone_init ) { - QVERIFY( (int)buf_ba.size() == bytesDone ); + QCOMPARE( qlonglong(buf_ba.size()), bytesDone ); } } else { if ( bytesDone != bytesDone_init ) { - QVERIFY( (int)newData_ba.size() == bytesDone ); + QCOMPARE( qlonglong(newData_ba.size()), bytesDone ); } } } @@ -712,8 +734,8 @@ void tst_QFtp::put_data() QTest::addColumn("success"); // ### move this into external testdata - QFile file( SRCDIR "rfc3252.txt" ); - QVERIFY( file.open( QIODevice::ReadOnly ) ); + QFile file(rfc3252File); + QVERIFY2( file.open( QIODevice::ReadOnly ), qPrintable(file.errorString()) ); QByteArray rfc3252 = file.readAll(); QByteArray bigData( 10*1024*1024, 0 ); @@ -801,7 +823,7 @@ void tst_QFtp::put() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Put ); QVERIFY( it != resultMap.end() ); @@ -810,8 +832,8 @@ void tst_QFtp::put() QVERIFY( !fileExists( host, port, user, password, file ) ); return; // the following tests are only meaningful if the file could be put } - QVERIFY( bytesTotal == (int)fileData.size() ); - QVERIFY( bytesDone == bytesTotal ); + QCOMPARE( bytesTotal, qlonglong(fileData.size()) ); + QCOMPARE( bytesDone, bytesTotal ); QVERIFY( fileExists( host, port, user, password, file ) ); @@ -834,9 +856,9 @@ void tst_QFtp::put() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); - QVERIFY( done_success == 1 ); + QCOMPARE( done_success, 1 ); QTEST( buf.buffer(), "fileData" ); ////////////////////////////////////////////////////////////////// @@ -852,7 +874,7 @@ void tst_QFtp::put() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Remove ); QVERIFY( it != resultMap.end() ); @@ -916,7 +938,7 @@ void tst_QFtp::mkdir() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( QFtp::Mkdir ); QVERIFY( it != resultMap.end() ); @@ -941,7 +963,7 @@ void tst_QFtp::mkdir() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Mkdir ); QVERIFY( it != resultMap.end() ); @@ -961,7 +983,7 @@ void tst_QFtp::mkdir() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Rmdir ); QVERIFY( it != resultMap.end() ); @@ -1074,11 +1096,11 @@ void tst_QFtp::renameInit( const QString &host, const QString &user, const QStri delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host) ); ResMapIt it = resultMap.find( QFtp::Put ); QVERIFY( it != resultMap.end() ); - QVERIFY( it.value().success == 1 ); + QCOMPARE( it.value().success, 1 ); QVERIFY( fileExists( host, 21, user, password, createFile ) ); } @@ -1099,11 +1121,11 @@ void tst_QFtp::renameCleanup( const QString &host, const QString &user, const QS delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host) ); ResMapIt it = resultMap.find( QFtp::Remove ); QVERIFY( it != resultMap.end() ); - QVERIFY( it.value().success == 1 ); + QCOMPARE( it.value().success, 1 ); QVERIFY( !fileExists( host, 21, user, password, fileToDelete ) ); } @@ -1144,7 +1166,7 @@ void tst_QFtp::rename() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host) ); ResMapIt it = resultMap.find( QFtp::Rename ); QVERIFY( it != resultMap.end() ); @@ -1300,25 +1322,27 @@ void tst_QFtp::commandSequence() QFETCH( QList, cmds ); ftp = newFtp(); + QString host; + quint16 port = 0; QList::iterator it; for ( it = cmds.begin(); it != cmds.end(); ++it ) { switch ( (*it).cmd ) { case QFtp::ConnectToHost: { - QVERIFY( (*it).args.count() == 2 ); - uint port; + QCOMPARE( (*it).args.count(), 2 ); bool portOk; - port = (*it).args[1].toUInt( &portOk ); + port = (*it).args[1].toUShort( &portOk ); QVERIFY( portOk ); - ids << ftp->connectToHost( (*it).args[0], port ); + host = (*it).args[0]; + ids << ftp->connectToHost( host, port ); } break; case QFtp::Login: - QVERIFY( (*it).args.count() == 2 ); + QCOMPARE( (*it).args.count(), 2 ); ids << ftp->login( (*it).args[0], (*it).args[1] ); break; case QFtp::Close: - QVERIFY( (*it).args.count() == 0 ); + QCOMPARE( (*it).args.count(), 0 ); ids << ftp->close(); break; default: @@ -1331,7 +1355,7 @@ void tst_QFtp::commandSequence() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host) ); QTEST( commandSequence_success, "success" ); } @@ -1389,7 +1413,7 @@ void tst_QFtp::abort() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); ResMapIt it = resultMap.find( cmd ); QVERIFY( it != resultMap.end() ); @@ -1399,18 +1423,18 @@ void tst_QFtp::abort() // the operation was aborted. So we have to use some heuristics. if ( host == QtNetworkSettings::serverName() ) { if ( cmd == QFtp::Get ) { - QVERIFY(bytesDone <= bytesTotal); + QVERIFY2(bytesDone <= bytesTotal, msgComparison(bytesDone, "<=", bytesTotal)); } else { // put commands should always be aborted, since we use really // big data - QVERIFY( bytesDone != bytesTotal ); + QVERIFY2( bytesDone != bytesTotal, msgComparison(bytesDone, "!=", bytesTotal) ); } } else { // this could be tested by verifying that no more progress signals are emitted - QVERIFY(bytesDone <= bytesTotal); + QVERIFY2(bytesDone <= bytesTotal, msgComparison(bytesDone, "<=", bytesTotal)); } } else { - QVERIFY( bytesDone != bytesTotal ); + QVERIFY2( bytesDone != bytesTotal, msgComparison(bytesDone, "!=", bytesTotal) ); } if ( cmd == QFtp::Put ) { @@ -1427,11 +1451,11 @@ void tst_QFtp::abort() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); it = resultMap.find( QFtp::Remove ); QVERIFY( it != resultMap.end() ); - QVERIFY( it.value().success == 1 ); + QCOMPARE( it.value().success, 1 ); } } @@ -1466,7 +1490,7 @@ void tst_QFtp::bytesAvailable() QTestEventLoop::instance().enterLoop( 40 ); if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host) ); ResMapIt it = resultMap.find( QFtp::Get ); QVERIFY( it != resultMap.end() ); @@ -1482,7 +1506,7 @@ void tst_QFtp::bytesAvailable() QCOMPARE(bytesAvailable_done, bytesAvailDone); ftp->readAll(); - QVERIFY( ftp->bytesAvailable() == 0 ); + QCOMPARE( ftp->bytesAvailable(), 0 ); delete ftp; ftp = 0; } @@ -1500,7 +1524,7 @@ void tst_QFtp::activeMode() connect(&ftp, SIGNAL(done(bool)), SLOT(activeModeDone(bool))); QTestEventLoop::instance().enterLoop(900); QFile::remove("tst_QFtp_activeMode_inittab"); - QVERIFY(done_success == 1); + QCOMPARE(done_success, 1); } @@ -1559,7 +1583,7 @@ void tst_QFtp::proxy() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) { - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(host, port) ); } ResMapIt it = resultMap.find( QFtp::Cd ); @@ -1594,7 +1618,7 @@ void tst_QFtp::binaryAscii() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(QtNetworkSettings::serverName()) ); ResMapIt it = resultMap.find(QFtp::Put); QVERIFY(it != resultMap.end()); @@ -1616,7 +1640,7 @@ void tst_QFtp::binaryAscii() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(QtNetworkSettings::serverName()) ); ResMapIt it2 = resultMap.find(QFtp::Get); QVERIFY(it2 != resultMap.end()); @@ -1624,7 +1648,7 @@ void tst_QFtp::binaryAscii() // most modern ftp servers leave the file as it is by default // (and do not remove the windows line ending), the -1 below could be // deleted in the future - QVERIFY(getData.size() == putData.size()-1); + QCOMPARE(getData.size(), putData.size() - 1); ////////////////////////////////////////////////////////////////// // cleanup (i.e. remove the file) -- this also tests the remove command init(); @@ -1639,7 +1663,7 @@ void tst_QFtp::binaryAscii() delete ftp; ftp = 0; if ( QTestEventLoop::instance().timeout() ) - QFAIL( "Network operation timed out" ); + QFAIL( msgTimedOut(QtNetworkSettings::serverName()) ); it = resultMap.find( QFtp::Remove ); QVERIFY( it != resultMap.end() ); @@ -1666,11 +1690,11 @@ void tst_QFtp::commandStarted( int id ) qDebug( "%d:commandStarted( %d )", ftp->currentId(), id ); #endif // make sure that the commandStarted and commandFinished are nested correctly - QVERIFY( current_id == 0 ); + QCOMPARE( current_id, 0 ); current_id = id; QVERIFY( !ids.isEmpty() ); - QVERIFY( ids.first() == id ); + QCOMPARE( ids.first(), id ); if ( ids.count() > 1 ) { QVERIFY( ftp->hasPendingCommands() ); } else { @@ -1678,10 +1702,10 @@ void tst_QFtp::commandStarted( int id ) } QVERIFY( ftp->currentId() == id ); - QVERIFY( cur_state == ftp->state() ); + QCOMPARE( cur_state, int(ftp->state()) ); CURRENTCOMMAND_TEST; - QVERIFY( ftp->error() == QFtp::NoError ); + QCOMPARE( ftp->error(), QFtp::NoError ); } void tst_QFtp::commandFinished( int id, bool error ) @@ -1696,32 +1720,32 @@ void tst_QFtp::commandFinished( int id, bool error ) bytesAvailable_finished = ftp->bytesAvailable(); // make sure that the commandStarted and commandFinished are nested correctly - QVERIFY( current_id == id ); + QCOMPARE( current_id, id ); current_id = 0; QVERIFY( !ids.isEmpty() ); - QVERIFY( ids.first() == id ); + QCOMPARE( ids.first(), id ); if ( !error && ids.count() > 1) { QVERIFY( ftp->hasPendingCommands() ); } else { QVERIFY( !ftp->hasPendingCommands() ); } if ( error ) { - QVERIFY( ftp->error() != QFtp::NoError ); + QVERIFY2( ftp->error() != QFtp::NoError, msgComparison(ftp->error(), "!=", QFtp::NoError) ); ids.clear(); } else { - QVERIFY( ftp->error() == QFtp::NoError ); + QCOMPARE( ftp->error(), QFtp::NoError ); ids.pop_front(); } - QVERIFY( ftp->currentId() == id ); - QVERIFY( cur_state == ftp->state() ); + QCOMPARE( ftp->currentId(), id ); + QCOMPARE( cur_state, int(ftp->state()) ); CURRENTCOMMAND_TEST; if ( QTest::currentTestFunction() != QLatin1String("commandSequence") ) { ResMapIt it = resultMap.find( ftp->currentCommand() ); QVERIFY( it != resultMap.end() ); - QVERIFY( it.value().success == -1 ); + QCOMPARE( it.value().success, -1 ); if ( error ) it.value().success = 0; else @@ -1736,25 +1760,25 @@ void tst_QFtp::done( bool error ) #endif bytesAvailable_done = ftp->bytesAvailable(); - QVERIFY( ftp->currentId() == 0 ); + QCOMPARE( ftp->currentId(), 0 ); QVERIFY( current_id == 0 ); QVERIFY( ids.isEmpty() ); QVERIFY( cur_state == ftp->state() ); QVERIFY( !ftp->hasPendingCommands() ); if ( QTest::currentTestFunction() == QLatin1String("commandSequence") ) { - QVERIFY( commandSequence_success == -1 ); + QCOMPARE( commandSequence_success, -1 ); if ( error ) commandSequence_success = 0; else commandSequence_success = 1; } - QVERIFY( done_success == -1 ); + QCOMPARE( done_success, -1 ); if ( error ) { - QVERIFY( ftp->error() != QFtp::NoError ); + QVERIFY2( ftp->error() != QFtp::NoError, msgComparison(ftp->error(), "!=", QFtp::NoError) ); done_success = 0; } else { - QVERIFY( ftp->error() == QFtp::NoError ); + QCOMPARE( ftp->error(), QFtp::NoError ); done_success = 1; } QTestEventLoop::instance().exitLoop(); @@ -1768,13 +1792,13 @@ void tst_QFtp::stateChanged( int state ) QCOMPARE( ftp->currentId(), current_id ); CURRENTCOMMAND_TEST; - QVERIFY( state != cur_state ); + QVERIFY2( state != cur_state, msgComparison(state, "!=", cur_state) ); QCOMPARE( state, (int)ftp->state() ); if ( state != QFtp::Unconnected ) { // make sure that the states are always emitted in the right order (for // this, we assume an ordering on the enum values, which they have at // the moment) - QVERIFY( cur_state < state ); + QVERIFY2( cur_state < state, msgComparison(cur_state, "<", state) ); // make sure that state changes are only emitted in response to certain // commands @@ -1818,10 +1842,10 @@ void tst_QFtp::stateChanged( int state ) ResMapIt it = resultMap.find( QFtp::Close ); if ( it!=resultMap.end() && ftp->currentId()==it.value().id ) { if ( state == QFtp::Closing ) { - QVERIFY( close_state == -1 ); + QCOMPARE( close_state, -1 ); close_state = state; } else if ( state == QFtp::Unconnected ) { - QVERIFY( close_state == QFtp::Closing ); + QCOMPARE(close_state, int(QFtp::Closing) ); close_state = state; } } @@ -1829,7 +1853,7 @@ void tst_QFtp::stateChanged( int state ) ResMapIt it = resultMap.find( QFtp::Login ); if ( it!=resultMap.end() && ftp->currentId()==it.value().id ) { if ( state == QFtp::LoggedIn ) { - QVERIFY( login_state == -1 ); + QCOMPARE( login_state, -1 ); login_state = state; } } @@ -1847,13 +1871,13 @@ void tst_QFtp::listInfo( const QUrlInfo &i ) } else { QVERIFY( !ftp->hasPendingCommands() ); } - QVERIFY( cur_state == ftp->state() ); + QCOMPARE( cur_state, int(ftp->state()) ); CURRENTCOMMAND_TEST; if ( QTest::currentTestFunction()==QLatin1String("list") || QTest::currentTestFunction()==QLatin1String("cd") || QTest::currentTestFunction()==QLatin1String("proxy") || inFileDirExistsFunction ) { ResMapIt it = resultMap.find( QFtp::List ); QVERIFY( it != resultMap.end() ); - QVERIFY( ftp->currentId() == it.value().id ); + QCOMPARE( ftp->currentId(), it.value().id ); listInfo_i << i; } } @@ -1876,14 +1900,14 @@ void tst_QFtp::readyRead() int oldSize = newData_ba.size(); qlonglong bytesAvail = ftp->bytesAvailable(); QByteArray ba = ftp->readAll(); - QVERIFY( ba.size() == (int) bytesAvail ); + QCOMPARE( ba.size(), (int) bytesAvail ); newData_ba.resize( oldSize + ba.size() ); memcpy( newData_ba.data()+oldSize, ba.data(), ba.size() ); if ( bytesTotal != -1 ) { - QVERIFY( (int)newData_ba.size() <= bytesTotal ); + QVERIFY2( (int)newData_ba.size() <= bytesTotal, msgComparison(newData_ba.size(), "<=", bytesTotal) ); } - QVERIFY( (int)newData_ba.size() == bytesDone ); + QCOMPARE( qlonglong(newData_ba.size()), bytesDone ); } } @@ -1898,20 +1922,20 @@ void tst_QFtp::dataTransferProgress( qint64 done, qint64 total ) } else { QVERIFY( !ftp->hasPendingCommands() ); } - QVERIFY( cur_state == ftp->state() ); + QCOMPARE( cur_state, int(ftp->state()) ); CURRENTCOMMAND_TEST; if ( bytesTotal == bytesTotal_init ) { bytesTotal = total; } else { - QVERIFY( bytesTotal == total ); + QCOMPARE( bytesTotal, total ); } - QVERIFY( bytesTotal != bytesTotal_init ); - QVERIFY( bytesDone <= done ); + QVERIFY2( bytesTotal != bytesTotal_init, msgComparison(bytesTotal, "!=", bytesTotal_init) ); + QVERIFY2( bytesDone <= done, msgComparison(bytesDone, "<=", done) ); bytesDone = done; if ( bytesTotal != -1 ) { - QVERIFY( bytesDone <= bytesTotal ); + QVERIFY2( bytesDone <= bytesTotal, msgComparison(bytesDone, "<=", bytesTotal) ); } if ( QTest::currentTestFunction() == QLatin1String("abort") ) { @@ -2044,7 +2068,7 @@ bool tst_QFtp::dirExists( const QString &host, quint16 port, const QString &user ftp = 0; if ( QTestEventLoop::instance().timeout() ) { // ### make this test work - // QFAIL( "Network operation timed out" ); + // QFAIL( msgTimedOut(host, port) ); qWarning("tst_QFtp::dirExists: Network operation timed out"); return false; } From 8302d8b5aa8bbbedeeaaf8eb380953d5d666ab5d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 5 Mar 2014 17:37:39 +0100 Subject: [PATCH 108/172] Make QGLFunctions wrap QOpenGLFunctions Remove the duplicated implementation. When moving to support also dynamic GL builds, having a standalone QGLFunctions is not feasible anymore since the changes made to QOpenGLFunctions will not be backported to QGLFunctions. Change-Id: Iaf742e496d3c92d6d915baee93283180259e27a6 Reviewed-by: Gunnar Sletta Reviewed-by: Friedemann Kleint --- src/opengl/qglfunctions.cpp | 2364 +---------------------------------- src/opengl/qglfunctions.h | 818 ++---------- 2 files changed, 115 insertions(+), 3067 deletions(-) diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp index 7dc30d53195..d82e55eba16 100644 --- a/src/opengl/qglfunctions.cpp +++ b/src/opengl/qglfunctions.cpp @@ -150,7 +150,16 @@ struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate, public QOpenGLSharedR QGLFunctionsPrivateEx(QOpenGLContext *context) : QGLFunctionsPrivate(QGLContext::fromOpenGLContext(context)) , QOpenGLSharedResource(context->shareGroup()) - , m_features(-1) {} + , m_features(-1) + { + funcs = new QOpenGLFunctions(context); + funcs->initializeOpenGLFunctions(); + } + + ~QGLFunctionsPrivateEx() + { + delete funcs; + } void invalidateResource() { @@ -1363,2360 +1372,9 @@ void QGLFunctions::initializeGLFunctions(const QGLContext *context) This convenience function will do nothing on OpenGL/ES 1.x systems. */ -#ifndef QT_OPENGL_ES_2 - -static void QGLF_APIENTRY qglfResolveActiveTexture(GLenum texture) -{ - typedef void (QGLF_APIENTRYP type_glActiveTexture)(GLenum texture); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->activeTexture = (type_glActiveTexture) - context->getProcAddress(QLatin1String("glActiveTexture")); - if (!funcs->activeTexture) { - funcs->activeTexture = (type_glActiveTexture) - context->getProcAddress(QLatin1String("glActiveTextureARB")); - } - - if (funcs->activeTexture) - funcs->activeTexture(texture); - else - funcs->activeTexture = qglfResolveActiveTexture; -} - -static void QGLF_APIENTRY qglfResolveAttachShader(GLuint program, GLuint shader) -{ - typedef void (QGLF_APIENTRYP type_glAttachShader)(GLuint program, GLuint shader); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->attachShader = (type_glAttachShader) - context->getProcAddress(QLatin1String("glAttachShader")); - if (!funcs->attachShader) { - funcs->attachShader = (type_glAttachShader) - context->getProcAddress(QLatin1String("glAttachObjectARB")); - } - - if (funcs->attachShader) - funcs->attachShader(program, shader); - else - funcs->attachShader = qglfResolveAttachShader; -} - -static void QGLF_APIENTRY qglfResolveBindAttribLocation(GLuint program, GLuint index, const char* name) -{ - typedef void (QGLF_APIENTRYP type_glBindAttribLocation)(GLuint program, GLuint index, const char* name); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->bindAttribLocation = (type_glBindAttribLocation) - context->getProcAddress(QLatin1String("glBindAttribLocation")); - if (!funcs->bindAttribLocation) { - funcs->bindAttribLocation = (type_glBindAttribLocation) - context->getProcAddress(QLatin1String("glBindAttribLocationARB")); - } - - if (funcs->bindAttribLocation) - funcs->bindAttribLocation(program, index, name); - else - funcs->bindAttribLocation = qglfResolveBindAttribLocation; -} - -static void QGLF_APIENTRY qglfResolveBindBuffer(GLenum target, GLuint buffer) -{ - typedef void (QGLF_APIENTRYP type_glBindBuffer)(GLenum target, GLuint buffer); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->bindBuffer = (type_glBindBuffer) - context->getProcAddress(QLatin1String("glBindBuffer")); -#ifdef QT_OPENGL_ES - if (!funcs->bindBuffer) { - funcs->bindBuffer = (type_glBindBuffer) - context->getProcAddress(QLatin1String("glBindBufferOES")); - } -#endif - if (!funcs->bindBuffer) { - funcs->bindBuffer = (type_glBindBuffer) - context->getProcAddress(QLatin1String("glBindBufferEXT")); - } - if (!funcs->bindBuffer) { - funcs->bindBuffer = (type_glBindBuffer) - context->getProcAddress(QLatin1String("glBindBufferARB")); - } - - if (funcs->bindBuffer) - funcs->bindBuffer(target, buffer); - else - funcs->bindBuffer = qglfResolveBindBuffer; -} - -static void QGLF_APIENTRY qglfResolveBindFramebuffer(GLenum target, GLuint framebuffer) -{ - typedef void (QGLF_APIENTRYP type_glBindFramebuffer)(GLenum target, GLuint framebuffer); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->bindFramebuffer = (type_glBindFramebuffer) - context->getProcAddress(QLatin1String("glBindFramebuffer")); -#ifdef QT_OPENGL_ES - if (!funcs->bindFramebuffer) { - funcs->bindFramebuffer = (type_glBindFramebuffer) - context->getProcAddress(QLatin1String("glBindFramebufferOES")); - } -#endif - if (!funcs->bindFramebuffer) { - funcs->bindFramebuffer = (type_glBindFramebuffer) - context->getProcAddress(QLatin1String("glBindFramebufferEXT")); - } - if (!funcs->bindFramebuffer) { - funcs->bindFramebuffer = (type_glBindFramebuffer) - context->getProcAddress(QLatin1String("glBindFramebufferARB")); - } - - if (funcs->bindFramebuffer) - funcs->bindFramebuffer(target, framebuffer); - else - funcs->bindFramebuffer = qglfResolveBindFramebuffer; -} - -static void QGLF_APIENTRY qglfResolveBindRenderbuffer(GLenum target, GLuint renderbuffer) -{ - typedef void (QGLF_APIENTRYP type_glBindRenderbuffer)(GLenum target, GLuint renderbuffer); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->bindRenderbuffer = (type_glBindRenderbuffer) - context->getProcAddress(QLatin1String("glBindRenderbuffer")); -#ifdef QT_OPENGL_ES - if (!funcs->bindRenderbuffer) { - funcs->bindRenderbuffer = (type_glBindRenderbuffer) - context->getProcAddress(QLatin1String("glBindRenderbufferOES")); - } -#endif - if (!funcs->bindRenderbuffer) { - funcs->bindRenderbuffer = (type_glBindRenderbuffer) - context->getProcAddress(QLatin1String("glBindRenderbufferEXT")); - } - if (!funcs->bindRenderbuffer) { - funcs->bindRenderbuffer = (type_glBindRenderbuffer) - context->getProcAddress(QLatin1String("glBindRenderbufferARB")); - } - - if (funcs->bindRenderbuffer) - funcs->bindRenderbuffer(target, renderbuffer); - else - funcs->bindRenderbuffer = qglfResolveBindRenderbuffer; -} - -static void QGLF_APIENTRY qglfResolveBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -{ - typedef void (QGLF_APIENTRYP type_glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->blendColor = (type_glBlendColor) - context->getProcAddress(QLatin1String("glBlendColor")); -#ifdef QT_OPENGL_ES - if (!funcs->blendColor) { - funcs->blendColor = (type_glBlendColor) - context->getProcAddress(QLatin1String("glBlendColorOES")); - } -#endif - if (!funcs->blendColor) { - funcs->blendColor = (type_glBlendColor) - context->getProcAddress(QLatin1String("glBlendColorEXT")); - } - if (!funcs->blendColor) { - funcs->blendColor = (type_glBlendColor) - context->getProcAddress(QLatin1String("glBlendColorARB")); - } - - if (funcs->blendColor) - funcs->blendColor(red, green, blue, alpha); - else - funcs->blendColor = qglfResolveBlendColor; -} - -static void QGLF_APIENTRY qglfResolveBlendEquation(GLenum mode) -{ - typedef void (QGLF_APIENTRYP type_glBlendEquation)(GLenum mode); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->blendEquation = (type_glBlendEquation) - context->getProcAddress(QLatin1String("glBlendEquation")); -#ifdef QT_OPENGL_ES - if (!funcs->blendEquation) { - funcs->blendEquation = (type_glBlendEquation) - context->getProcAddress(QLatin1String("glBlendEquationOES")); - } -#endif - if (!funcs->blendEquation) { - funcs->blendEquation = (type_glBlendEquation) - context->getProcAddress(QLatin1String("glBlendEquationEXT")); - } - if (!funcs->blendEquation) { - funcs->blendEquation = (type_glBlendEquation) - context->getProcAddress(QLatin1String("glBlendEquationARB")); - } - - if (funcs->blendEquation) - funcs->blendEquation(mode); - else - funcs->blendEquation = qglfResolveBlendEquation; -} - -static void QGLF_APIENTRY qglfResolveBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) -{ - typedef void (QGLF_APIENTRYP type_glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->blendEquationSeparate = (type_glBlendEquationSeparate) - context->getProcAddress(QLatin1String("glBlendEquationSeparate")); -#ifdef QT_OPENGL_ES - if (!funcs->blendEquationSeparate) { - funcs->blendEquationSeparate = (type_glBlendEquationSeparate) - context->getProcAddress(QLatin1String("glBlendEquationSeparateOES")); - } -#endif - if (!funcs->blendEquationSeparate) { - funcs->blendEquationSeparate = (type_glBlendEquationSeparate) - context->getProcAddress(QLatin1String("glBlendEquationSeparateEXT")); - } - if (!funcs->blendEquationSeparate) { - funcs->blendEquationSeparate = (type_glBlendEquationSeparate) - context->getProcAddress(QLatin1String("glBlendEquationSeparateARB")); - } - - if (funcs->blendEquationSeparate) - funcs->blendEquationSeparate(modeRGB, modeAlpha); - else - funcs->blendEquationSeparate = qglfResolveBlendEquationSeparate; -} - -static void QGLF_APIENTRY qglfResolveBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -{ - typedef void (QGLF_APIENTRYP type_glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->blendFuncSeparate = (type_glBlendFuncSeparate) - context->getProcAddress(QLatin1String("glBlendFuncSeparate")); -#ifdef QT_OPENGL_ES - if (!funcs->blendFuncSeparate) { - funcs->blendFuncSeparate = (type_glBlendFuncSeparate) - context->getProcAddress(QLatin1String("glBlendFuncSeparateOES")); - } -#endif - if (!funcs->blendFuncSeparate) { - funcs->blendFuncSeparate = (type_glBlendFuncSeparate) - context->getProcAddress(QLatin1String("glBlendFuncSeparateEXT")); - } - if (!funcs->blendFuncSeparate) { - funcs->blendFuncSeparate = (type_glBlendFuncSeparate) - context->getProcAddress(QLatin1String("glBlendFuncSeparateARB")); - } - - if (funcs->blendFuncSeparate) - funcs->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); - else - funcs->blendFuncSeparate = qglfResolveBlendFuncSeparate; -} - -static void QGLF_APIENTRY qglfResolveBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage) -{ - typedef void (QGLF_APIENTRYP type_glBufferData)(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->bufferData = (type_glBufferData) - context->getProcAddress(QLatin1String("glBufferData")); -#ifdef QT_OPENGL_ES - if (!funcs->bufferData) { - funcs->bufferData = (type_glBufferData) - context->getProcAddress(QLatin1String("glBufferDataOES")); - } -#endif - if (!funcs->bufferData) { - funcs->bufferData = (type_glBufferData) - context->getProcAddress(QLatin1String("glBufferDataEXT")); - } - if (!funcs->bufferData) { - funcs->bufferData = (type_glBufferData) - context->getProcAddress(QLatin1String("glBufferDataARB")); - } - - if (funcs->bufferData) - funcs->bufferData(target, size, data, usage); - else - funcs->bufferData = qglfResolveBufferData; -} - -static void QGLF_APIENTRY qglfResolveBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data) -{ - typedef void (QGLF_APIENTRYP type_glBufferSubData)(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->bufferSubData = (type_glBufferSubData) - context->getProcAddress(QLatin1String("glBufferSubData")); -#ifdef QT_OPENGL_ES - if (!funcs->bufferSubData) { - funcs->bufferSubData = (type_glBufferSubData) - context->getProcAddress(QLatin1String("glBufferSubDataOES")); - } -#endif - if (!funcs->bufferSubData) { - funcs->bufferSubData = (type_glBufferSubData) - context->getProcAddress(QLatin1String("glBufferSubDataEXT")); - } - if (!funcs->bufferSubData) { - funcs->bufferSubData = (type_glBufferSubData) - context->getProcAddress(QLatin1String("glBufferSubDataARB")); - } - - if (funcs->bufferSubData) - funcs->bufferSubData(target, offset, size, data); - else - funcs->bufferSubData = qglfResolveBufferSubData; -} - -static GLenum QGLF_APIENTRY qglfResolveCheckFramebufferStatus(GLenum target) -{ - typedef GLenum (QGLF_APIENTRYP type_glCheckFramebufferStatus)(GLenum target); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus) - context->getProcAddress(QLatin1String("glCheckFramebufferStatus")); -#ifdef QT_OPENGL_ES - if (!funcs->checkFramebufferStatus) { - funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus) - context->getProcAddress(QLatin1String("glCheckFramebufferStatusOES")); - } -#endif - if (!funcs->checkFramebufferStatus) { - funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus) - context->getProcAddress(QLatin1String("glCheckFramebufferStatusEXT")); - } - if (!funcs->checkFramebufferStatus) { - funcs->checkFramebufferStatus = (type_glCheckFramebufferStatus) - context->getProcAddress(QLatin1String("glCheckFramebufferStatusARB")); - } - - if (funcs->checkFramebufferStatus) - return funcs->checkFramebufferStatus(target); - funcs->checkFramebufferStatus = qglfResolveCheckFramebufferStatus; - return GLenum(0); -} - -static void QGLF_APIENTRY qglfResolveCompileShader(GLuint shader) -{ - typedef void (QGLF_APIENTRYP type_glCompileShader)(GLuint shader); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->compileShader = (type_glCompileShader) - context->getProcAddress(QLatin1String("glCompileShader")); - if (!funcs->compileShader) { - funcs->compileShader = (type_glCompileShader) - context->getProcAddress(QLatin1String("glCompileShader")); - } - - if (funcs->compileShader) - funcs->compileShader(shader); - else - funcs->compileShader = qglfResolveCompileShader; -} - -static void QGLF_APIENTRY qglfResolveCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) -{ - typedef void (QGLF_APIENTRYP type_glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->compressedTexImage2D = (type_glCompressedTexImage2D) - context->getProcAddress(QLatin1String("glCompressedTexImage2D")); -#ifdef QT_OPENGL_ES - if (!funcs->compressedTexImage2D) { - funcs->compressedTexImage2D = (type_glCompressedTexImage2D) - context->getProcAddress(QLatin1String("glCompressedTexImage2DOES")); - } -#endif - if (!funcs->compressedTexImage2D) { - funcs->compressedTexImage2D = (type_glCompressedTexImage2D) - context->getProcAddress(QLatin1String("glCompressedTexImage2DEXT")); - } - if (!funcs->compressedTexImage2D) { - funcs->compressedTexImage2D = (type_glCompressedTexImage2D) - context->getProcAddress(QLatin1String("glCompressedTexImage2DARB")); - } - - if (funcs->compressedTexImage2D) - funcs->compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); - else - funcs->compressedTexImage2D = qglfResolveCompressedTexImage2D; -} - -static void QGLF_APIENTRY qglfResolveCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) -{ - typedef void (QGLF_APIENTRYP type_glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D) - context->getProcAddress(QLatin1String("glCompressedTexSubImage2D")); -#ifdef QT_OPENGL_ES - if (!funcs->compressedTexSubImage2D) { - funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D) - context->getProcAddress(QLatin1String("glCompressedTexSubImage2DOES")); - } -#endif - if (!funcs->compressedTexSubImage2D) { - funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D) - context->getProcAddress(QLatin1String("glCompressedTexSubImage2DEXT")); - } - if (!funcs->compressedTexSubImage2D) { - funcs->compressedTexSubImage2D = (type_glCompressedTexSubImage2D) - context->getProcAddress(QLatin1String("glCompressedTexSubImage2DARB")); - } - - if (funcs->compressedTexSubImage2D) - funcs->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); - else - funcs->compressedTexSubImage2D = qglfResolveCompressedTexSubImage2D; -} - -static GLuint QGLF_APIENTRY qglfResolveCreateProgram() -{ - typedef GLuint (QGLF_APIENTRYP type_glCreateProgram)(); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->createProgram = (type_glCreateProgram) - context->getProcAddress(QLatin1String("glCreateProgram")); - if (!funcs->createProgram) { - funcs->createProgram = (type_glCreateProgram) - context->getProcAddress(QLatin1String("glCreateProgramObjectARB")); - } - - if (funcs->createProgram) - return funcs->createProgram(); - funcs->createProgram = qglfResolveCreateProgram; - return GLuint(0); -} - -static GLuint QGLF_APIENTRY qglfResolveCreateShader(GLenum type) -{ - typedef GLuint (QGLF_APIENTRYP type_glCreateShader)(GLenum type); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->createShader = (type_glCreateShader) - context->getProcAddress(QLatin1String("glCreateShader")); - if (!funcs->createShader) { - funcs->createShader = (type_glCreateShader) - context->getProcAddress(QLatin1String("glCreateShaderObjectARB")); - } - - if (funcs->createShader) - return funcs->createShader(type); - funcs->createShader = qglfResolveCreateShader; - return GLuint(0); -} - -static void QGLF_APIENTRY qglfResolveDeleteBuffers(GLsizei n, const GLuint* buffers) -{ - typedef void (QGLF_APIENTRYP type_glDeleteBuffers)(GLsizei n, const GLuint* buffers); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->deleteBuffers = (type_glDeleteBuffers) - context->getProcAddress(QLatin1String("glDeleteBuffers")); -#ifdef QT_OPENGL_ES - if (!funcs->deleteBuffers) { - funcs->deleteBuffers = (type_glDeleteBuffers) - context->getProcAddress(QLatin1String("glDeleteBuffersOES")); - } -#endif - if (!funcs->deleteBuffers) { - funcs->deleteBuffers = (type_glDeleteBuffers) - context->getProcAddress(QLatin1String("glDeleteBuffersEXT")); - } - if (!funcs->deleteBuffers) { - funcs->deleteBuffers = (type_glDeleteBuffers) - context->getProcAddress(QLatin1String("glDeleteBuffersARB")); - } - - if (funcs->deleteBuffers) - funcs->deleteBuffers(n, buffers); - else - funcs->deleteBuffers = qglfResolveDeleteBuffers; -} - -static void QGLF_APIENTRY qglfResolveDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) -{ - typedef void (QGLF_APIENTRYP type_glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->deleteFramebuffers = (type_glDeleteFramebuffers) - context->getProcAddress(QLatin1String("glDeleteFramebuffers")); -#ifdef QT_OPENGL_ES - if (!funcs->deleteFramebuffers) { - funcs->deleteFramebuffers = (type_glDeleteFramebuffers) - context->getProcAddress(QLatin1String("glDeleteFramebuffersOES")); - } -#endif - if (!funcs->deleteFramebuffers) { - funcs->deleteFramebuffers = (type_glDeleteFramebuffers) - context->getProcAddress(QLatin1String("glDeleteFramebuffersEXT")); - } - if (!funcs->deleteFramebuffers) { - funcs->deleteFramebuffers = (type_glDeleteFramebuffers) - context->getProcAddress(QLatin1String("glDeleteFramebuffersARB")); - } - - if (funcs->deleteFramebuffers) - funcs->deleteFramebuffers(n, framebuffers); - else - funcs->deleteFramebuffers = qglfResolveDeleteFramebuffers; -} - -static void QGLF_APIENTRY qglfResolveDeleteProgram(GLuint program) -{ - typedef void (QGLF_APIENTRYP type_glDeleteProgram)(GLuint program); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->deleteProgram = (type_glDeleteProgram) - context->getProcAddress(QLatin1String("glDeleteProgram")); - if (!funcs->deleteProgram) { - funcs->deleteProgram = (type_glDeleteProgram) - context->getProcAddress(QLatin1String("glDeleteObjectARB")); - } - - if (funcs->deleteProgram) - funcs->deleteProgram(program); - else - funcs->deleteProgram = qglfResolveDeleteProgram; -} - -static void QGLF_APIENTRY qglfResolveDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) -{ - typedef void (QGLF_APIENTRYP type_glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers) - context->getProcAddress(QLatin1String("glDeleteRenderbuffers")); -#ifdef QT_OPENGL_ES - if (!funcs->deleteRenderbuffers) { - funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers) - context->getProcAddress(QLatin1String("glDeleteRenderbuffersOES")); - } -#endif - if (!funcs->deleteRenderbuffers) { - funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers) - context->getProcAddress(QLatin1String("glDeleteRenderbuffersEXT")); - } - if (!funcs->deleteRenderbuffers) { - funcs->deleteRenderbuffers = (type_glDeleteRenderbuffers) - context->getProcAddress(QLatin1String("glDeleteRenderbuffersARB")); - } - - if (funcs->deleteRenderbuffers) - funcs->deleteRenderbuffers(n, renderbuffers); - else - funcs->deleteRenderbuffers = qglfResolveDeleteRenderbuffers; -} - -static void QGLF_APIENTRY qglfResolveDeleteShader(GLuint shader) -{ - typedef void (QGLF_APIENTRYP type_glDeleteShader)(GLuint shader); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->deleteShader = (type_glDeleteShader) - context->getProcAddress(QLatin1String("glDeleteShader")); - if (!funcs->deleteShader) { - funcs->deleteShader = (type_glDeleteShader) - context->getProcAddress(QLatin1String("glDeleteObjectARB")); - } - - if (funcs->deleteShader) - funcs->deleteShader(shader); - else - funcs->deleteShader = qglfResolveDeleteShader; -} - -static void QGLF_APIENTRY qglfResolveDetachShader(GLuint program, GLuint shader) -{ - typedef void (QGLF_APIENTRYP type_glDetachShader)(GLuint program, GLuint shader); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->detachShader = (type_glDetachShader) - context->getProcAddress(QLatin1String("glDetachShader")); - if (!funcs->detachShader) { - funcs->detachShader = (type_glDetachShader) - context->getProcAddress(QLatin1String("glDetachObjectARB")); - } - - if (funcs->detachShader) - funcs->detachShader(program, shader); - else - funcs->detachShader = qglfResolveDetachShader; -} - -static void QGLF_APIENTRY qglfResolveDisableVertexAttribArray(GLuint index) -{ - typedef void (QGLF_APIENTRYP type_glDisableVertexAttribArray)(GLuint index); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->disableVertexAttribArray = (type_glDisableVertexAttribArray) - context->getProcAddress(QLatin1String("glDisableVertexAttribArray")); - if (!funcs->disableVertexAttribArray) { - funcs->disableVertexAttribArray = (type_glDisableVertexAttribArray) - context->getProcAddress(QLatin1String("glDisableVertexAttribArrayARB")); - } - - if (funcs->disableVertexAttribArray) - funcs->disableVertexAttribArray(index); - else - funcs->disableVertexAttribArray = qglfResolveDisableVertexAttribArray; -} - -static void QGLF_APIENTRY qglfResolveEnableVertexAttribArray(GLuint index) -{ - typedef void (QGLF_APIENTRYP type_glEnableVertexAttribArray)(GLuint index); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->enableVertexAttribArray = (type_glEnableVertexAttribArray) - context->getProcAddress(QLatin1String("glEnableVertexAttribArray")); - if (!funcs->enableVertexAttribArray) { - funcs->enableVertexAttribArray = (type_glEnableVertexAttribArray) - context->getProcAddress(QLatin1String("glEnableVertexAttribArrayARB")); - } - - if (funcs->enableVertexAttribArray) - funcs->enableVertexAttribArray(index); - else - funcs->enableVertexAttribArray = qglfResolveEnableVertexAttribArray; -} - -static void QGLF_APIENTRY qglfResolveFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) -{ - typedef void (QGLF_APIENTRYP type_glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer) - context->getProcAddress(QLatin1String("glFramebufferRenderbuffer")); -#ifdef QT_OPENGL_ES - if (!funcs->framebufferRenderbuffer) { - funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer) - context->getProcAddress(QLatin1String("glFramebufferRenderbufferOES")); - } -#endif - if (!funcs->framebufferRenderbuffer) { - funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer) - context->getProcAddress(QLatin1String("glFramebufferRenderbufferEXT")); - } - if (!funcs->framebufferRenderbuffer) { - funcs->framebufferRenderbuffer = (type_glFramebufferRenderbuffer) - context->getProcAddress(QLatin1String("glFramebufferRenderbufferARB")); - } - - if (funcs->framebufferRenderbuffer) - funcs->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); - else - funcs->framebufferRenderbuffer = qglfResolveFramebufferRenderbuffer; -} - -static void QGLF_APIENTRY qglfResolveFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -{ - typedef void (QGLF_APIENTRYP type_glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->framebufferTexture2D = (type_glFramebufferTexture2D) - context->getProcAddress(QLatin1String("glFramebufferTexture2D")); -#ifdef QT_OPENGL_ES - if (!funcs->framebufferTexture2D) { - funcs->framebufferTexture2D = (type_glFramebufferTexture2D) - context->getProcAddress(QLatin1String("glFramebufferTexture2DOES")); - } -#endif - if (!funcs->framebufferTexture2D) { - funcs->framebufferTexture2D = (type_glFramebufferTexture2D) - context->getProcAddress(QLatin1String("glFramebufferTexture2DEXT")); - } - if (!funcs->framebufferTexture2D) { - funcs->framebufferTexture2D = (type_glFramebufferTexture2D) - context->getProcAddress(QLatin1String("glFramebufferTexture2DARB")); - } - - if (funcs->framebufferTexture2D) - funcs->framebufferTexture2D(target, attachment, textarget, texture, level); - else - funcs->framebufferTexture2D = qglfResolveFramebufferTexture2D; -} - -static void QGLF_APIENTRY qglfResolveGenBuffers(GLsizei n, GLuint* buffers) -{ - typedef void (QGLF_APIENTRYP type_glGenBuffers)(GLsizei n, GLuint* buffers); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->genBuffers = (type_glGenBuffers) - context->getProcAddress(QLatin1String("glGenBuffers")); -#ifdef QT_OPENGL_ES - if (!funcs->genBuffers) { - funcs->genBuffers = (type_glGenBuffers) - context->getProcAddress(QLatin1String("glGenBuffersOES")); - } -#endif - if (!funcs->genBuffers) { - funcs->genBuffers = (type_glGenBuffers) - context->getProcAddress(QLatin1String("glGenBuffersEXT")); - } - if (!funcs->genBuffers) { - funcs->genBuffers = (type_glGenBuffers) - context->getProcAddress(QLatin1String("glGenBuffersARB")); - } - - if (funcs->genBuffers) - funcs->genBuffers(n, buffers); - else - funcs->genBuffers = qglfResolveGenBuffers; -} - -static void QGLF_APIENTRY qglfResolveGenerateMipmap(GLenum target) -{ - typedef void (QGLF_APIENTRYP type_glGenerateMipmap)(GLenum target); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->generateMipmap = (type_glGenerateMipmap) - context->getProcAddress(QLatin1String("glGenerateMipmap")); -#ifdef QT_OPENGL_ES - if (!funcs->generateMipmap) { - funcs->generateMipmap = (type_glGenerateMipmap) - context->getProcAddress(QLatin1String("glGenerateMipmapOES")); - } -#endif - if (!funcs->generateMipmap) { - funcs->generateMipmap = (type_glGenerateMipmap) - context->getProcAddress(QLatin1String("glGenerateMipmapEXT")); - } - if (!funcs->generateMipmap) { - funcs->generateMipmap = (type_glGenerateMipmap) - context->getProcAddress(QLatin1String("glGenerateMipmapARB")); - } - - if (funcs->generateMipmap) - funcs->generateMipmap(target); - else - funcs->generateMipmap = qglfResolveGenerateMipmap; -} - -static void QGLF_APIENTRY qglfResolveGenFramebuffers(GLsizei n, GLuint* framebuffers) -{ - typedef void (QGLF_APIENTRYP type_glGenFramebuffers)(GLsizei n, GLuint* framebuffers); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->genFramebuffers = (type_glGenFramebuffers) - context->getProcAddress(QLatin1String("glGenFramebuffers")); -#ifdef QT_OPENGL_ES - if (!funcs->genFramebuffers) { - funcs->genFramebuffers = (type_glGenFramebuffers) - context->getProcAddress(QLatin1String("glGenFramebuffersOES")); - } -#endif - if (!funcs->genFramebuffers) { - funcs->genFramebuffers = (type_glGenFramebuffers) - context->getProcAddress(QLatin1String("glGenFramebuffersEXT")); - } - if (!funcs->genFramebuffers) { - funcs->genFramebuffers = (type_glGenFramebuffers) - context->getProcAddress(QLatin1String("glGenFramebuffersARB")); - } - - if (funcs->genFramebuffers) - funcs->genFramebuffers(n, framebuffers); - else - funcs->genFramebuffers = qglfResolveGenFramebuffers; -} - -static void QGLF_APIENTRY qglfResolveGenRenderbuffers(GLsizei n, GLuint* renderbuffers) -{ - typedef void (QGLF_APIENTRYP type_glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->genRenderbuffers = (type_glGenRenderbuffers) - context->getProcAddress(QLatin1String("glGenRenderbuffers")); -#ifdef QT_OPENGL_ES - if (!funcs->genRenderbuffers) { - funcs->genRenderbuffers = (type_glGenRenderbuffers) - context->getProcAddress(QLatin1String("glGenRenderbuffersOES")); - } -#endif - if (!funcs->genRenderbuffers) { - funcs->genRenderbuffers = (type_glGenRenderbuffers) - context->getProcAddress(QLatin1String("glGenRenderbuffersEXT")); - } - if (!funcs->genRenderbuffers) { - funcs->genRenderbuffers = (type_glGenRenderbuffers) - context->getProcAddress(QLatin1String("glGenRenderbuffersARB")); - } - - if (funcs->genRenderbuffers) - funcs->genRenderbuffers(n, renderbuffers); - else - funcs->genRenderbuffers = qglfResolveGenRenderbuffers; -} - -static void QGLF_APIENTRY qglfResolveGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) -{ - typedef void (QGLF_APIENTRYP type_glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getActiveAttrib = (type_glGetActiveAttrib) - context->getProcAddress(QLatin1String("glGetActiveAttrib")); - if (!funcs->getActiveAttrib) { - funcs->getActiveAttrib = (type_glGetActiveAttrib) - context->getProcAddress(QLatin1String("glGetActiveAttribARB")); - } - - if (funcs->getActiveAttrib) - funcs->getActiveAttrib(program, index, bufsize, length, size, type, name); - else - funcs->getActiveAttrib = qglfResolveGetActiveAttrib; -} - -static void QGLF_APIENTRY qglfResolveGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) -{ - typedef void (QGLF_APIENTRYP type_glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getActiveUniform = (type_glGetActiveUniform) - context->getProcAddress(QLatin1String("glGetActiveUniform")); - if (!funcs->getActiveUniform) { - funcs->getActiveUniform = (type_glGetActiveUniform) - context->getProcAddress(QLatin1String("glGetActiveUniformARB")); - } - - if (funcs->getActiveUniform) - funcs->getActiveUniform(program, index, bufsize, length, size, type, name); - else - funcs->getActiveUniform = qglfResolveGetActiveUniform; -} - -static void QGLF_APIENTRY qglfResolveGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) -{ - typedef void (QGLF_APIENTRYP type_glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getAttachedShaders = (type_glGetAttachedShaders) - context->getProcAddress(QLatin1String("glGetAttachedShaders")); - if (!funcs->getAttachedShaders) { - funcs->getAttachedShaders = (type_glGetAttachedShaders) - context->getProcAddress(QLatin1String("glGetAttachedObjectsARB")); - } - - if (funcs->getAttachedShaders) - funcs->getAttachedShaders(program, maxcount, count, shaders); - else - funcs->getAttachedShaders = qglfResolveGetAttachedShaders; -} - -static int QGLF_APIENTRY qglfResolveGetAttribLocation(GLuint program, const char* name) -{ - typedef int (QGLF_APIENTRYP type_glGetAttribLocation)(GLuint program, const char* name); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getAttribLocation = (type_glGetAttribLocation) - context->getProcAddress(QLatin1String("glGetAttribLocation")); - if (!funcs->getAttribLocation) { - funcs->getAttribLocation = (type_glGetAttribLocation) - context->getProcAddress(QLatin1String("glGetAttribLocationARB")); - } - - if (funcs->getAttribLocation) - return funcs->getAttribLocation(program, name); - funcs->getAttribLocation = qglfResolveGetAttribLocation; - return int(0); -} - -static void QGLF_APIENTRY qglfResolveGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) -{ - typedef void (QGLF_APIENTRYP type_glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getBufferParameteriv = (type_glGetBufferParameteriv) - context->getProcAddress(QLatin1String("glGetBufferParameteriv")); -#ifdef QT_OPENGL_ES - if (!funcs->getBufferParameteriv) { - funcs->getBufferParameteriv = (type_glGetBufferParameteriv) - context->getProcAddress(QLatin1String("glGetBufferParameterivOES")); - } -#endif - if (!funcs->getBufferParameteriv) { - funcs->getBufferParameteriv = (type_glGetBufferParameteriv) - context->getProcAddress(QLatin1String("glGetBufferParameterivEXT")); - } - if (!funcs->getBufferParameteriv) { - funcs->getBufferParameteriv = (type_glGetBufferParameteriv) - context->getProcAddress(QLatin1String("glGetBufferParameterivARB")); - } - - if (funcs->getBufferParameteriv) - funcs->getBufferParameteriv(target, pname, params); - else - funcs->getBufferParameteriv = qglfResolveGetBufferParameteriv; -} - -static void QGLF_APIENTRY qglfResolveGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) -{ - typedef void (QGLF_APIENTRYP type_glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv) - context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameteriv")); -#ifdef QT_OPENGL_ES - if (!funcs->getFramebufferAttachmentParameteriv) { - funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv) - context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivOES")); - } -#endif - if (!funcs->getFramebufferAttachmentParameteriv) { - funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv) - context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivEXT")); - } - if (!funcs->getFramebufferAttachmentParameteriv) { - funcs->getFramebufferAttachmentParameteriv = (type_glGetFramebufferAttachmentParameteriv) - context->getProcAddress(QLatin1String("glGetFramebufferAttachmentParameterivARB")); - } - - if (funcs->getFramebufferAttachmentParameteriv) - funcs->getFramebufferAttachmentParameteriv(target, attachment, pname, params); - else - funcs->getFramebufferAttachmentParameteriv = qglfResolveGetFramebufferAttachmentParameteriv; -} - -static void QGLF_APIENTRY qglfResolveGetProgramiv(GLuint program, GLenum pname, GLint* params) -{ - typedef void (QGLF_APIENTRYP type_glGetProgramiv)(GLuint program, GLenum pname, GLint* params); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getProgramiv = (type_glGetProgramiv) - context->getProcAddress(QLatin1String("glGetProgramiv")); - if (!funcs->getProgramiv) { - funcs->getProgramiv = (type_glGetProgramiv) - context->getProcAddress(QLatin1String("glGetObjectParameterivARB")); - } - - if (funcs->getProgramiv) - funcs->getProgramiv(program, pname, params); - else - funcs->getProgramiv = qglfResolveGetProgramiv; -} - -static void QGLF_APIENTRY qglfResolveGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) -{ - typedef void (QGLF_APIENTRYP type_glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getProgramInfoLog = (type_glGetProgramInfoLog) - context->getProcAddress(QLatin1String("glGetProgramInfoLog")); - if (!funcs->getProgramInfoLog) { - funcs->getProgramInfoLog = (type_glGetProgramInfoLog) - context->getProcAddress(QLatin1String("glGetInfoLogARB")); - } - - if (funcs->getProgramInfoLog) - funcs->getProgramInfoLog(program, bufsize, length, infolog); - else - funcs->getProgramInfoLog = qglfResolveGetProgramInfoLog; -} - -static void QGLF_APIENTRY qglfResolveGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) -{ - typedef void (QGLF_APIENTRYP type_glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv) - context->getProcAddress(QLatin1String("glGetRenderbufferParameteriv")); -#ifdef QT_OPENGL_ES - if (!funcs->getRenderbufferParameteriv) { - funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv) - context->getProcAddress(QLatin1String("glGetRenderbufferParameterivOES")); - } -#endif - if (!funcs->getRenderbufferParameteriv) { - funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv) - context->getProcAddress(QLatin1String("glGetRenderbufferParameterivEXT")); - } - if (!funcs->getRenderbufferParameteriv) { - funcs->getRenderbufferParameteriv = (type_glGetRenderbufferParameteriv) - context->getProcAddress(QLatin1String("glGetRenderbufferParameterivARB")); - } - - if (funcs->getRenderbufferParameteriv) - funcs->getRenderbufferParameteriv(target, pname, params); - else - funcs->getRenderbufferParameteriv = qglfResolveGetRenderbufferParameteriv; -} - -static void QGLF_APIENTRY qglfResolveGetShaderiv(GLuint shader, GLenum pname, GLint* params) -{ - typedef void (QGLF_APIENTRYP type_glGetShaderiv)(GLuint shader, GLenum pname, GLint* params); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getShaderiv = (type_glGetShaderiv) - context->getProcAddress(QLatin1String("glGetShaderiv")); - if (!funcs->getShaderiv) { - funcs->getShaderiv = (type_glGetShaderiv) - context->getProcAddress(QLatin1String("glGetObjectParameterivARB")); - } - - if (funcs->getShaderiv) - funcs->getShaderiv(shader, pname, params); - else - funcs->getShaderiv = qglfResolveGetShaderiv; -} - -static void QGLF_APIENTRY qglfResolveGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) -{ - typedef void (QGLF_APIENTRYP type_glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getShaderInfoLog = (type_glGetShaderInfoLog) - context->getProcAddress(QLatin1String("glGetShaderInfoLog")); - if (!funcs->getShaderInfoLog) { - funcs->getShaderInfoLog = (type_glGetShaderInfoLog) - context->getProcAddress(QLatin1String("glGetInfoLogARB")); - } - - if (funcs->getShaderInfoLog) - funcs->getShaderInfoLog(shader, bufsize, length, infolog); - else - funcs->getShaderInfoLog = qglfResolveGetShaderInfoLog; -} - -static void QGLF_APIENTRY qglfSpecialGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) -{ - Q_UNUSED(shadertype); - Q_UNUSED(precisiontype); - range[0] = range[1] = precision[0] = 0; -} - -static void QGLF_APIENTRY qglfResolveGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) -{ - typedef void (QGLF_APIENTRYP type_glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat) - context->getProcAddress(QLatin1String("glGetShaderPrecisionFormat")); -#ifdef QT_OPENGL_ES - if (!funcs->getShaderPrecisionFormat) { - funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat) - context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatOES")); - } -#endif - if (!funcs->getShaderPrecisionFormat) { - funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat) - context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatEXT")); - } - if (!funcs->getShaderPrecisionFormat) { - funcs->getShaderPrecisionFormat = (type_glGetShaderPrecisionFormat) - context->getProcAddress(QLatin1String("glGetShaderPrecisionFormatARB")); - } - - if (!funcs->getShaderPrecisionFormat) - funcs->getShaderPrecisionFormat = qglfSpecialGetShaderPrecisionFormat; - - funcs->getShaderPrecisionFormat(shadertype, precisiontype, range, precision); -} - -static void QGLF_APIENTRY qglfResolveGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) -{ - typedef void (QGLF_APIENTRYP type_glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, char* source); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getShaderSource = (type_glGetShaderSource) - context->getProcAddress(QLatin1String("glGetShaderSource")); - if (!funcs->getShaderSource) { - funcs->getShaderSource = (type_glGetShaderSource) - context->getProcAddress(QLatin1String("glGetShaderSourceARB")); - } - - if (funcs->getShaderSource) - funcs->getShaderSource(shader, bufsize, length, source); - else - funcs->getShaderSource = qglfResolveGetShaderSource; -} - -static void QGLF_APIENTRY qglfResolveGetUniformfv(GLuint program, GLint location, GLfloat* params) -{ - typedef void (QGLF_APIENTRYP type_glGetUniformfv)(GLuint program, GLint location, GLfloat* params); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getUniformfv = (type_glGetUniformfv) - context->getProcAddress(QLatin1String("glGetUniformfv")); - if (!funcs->getUniformfv) { - funcs->getUniformfv = (type_glGetUniformfv) - context->getProcAddress(QLatin1String("glGetUniformfvARB")); - } - - if (funcs->getUniformfv) - funcs->getUniformfv(program, location, params); - else - funcs->getUniformfv = qglfResolveGetUniformfv; -} - -static void QGLF_APIENTRY qglfResolveGetUniformiv(GLuint program, GLint location, GLint* params) -{ - typedef void (QGLF_APIENTRYP type_glGetUniformiv)(GLuint program, GLint location, GLint* params); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getUniformiv = (type_glGetUniformiv) - context->getProcAddress(QLatin1String("glGetUniformiv")); - if (!funcs->getUniformiv) { - funcs->getUniformiv = (type_glGetUniformiv) - context->getProcAddress(QLatin1String("glGetUniformivARB")); - } - - if (funcs->getUniformiv) - funcs->getUniformiv(program, location, params); - else - funcs->getUniformiv = qglfResolveGetUniformiv; -} - -static int QGLF_APIENTRY qglfResolveGetUniformLocation(GLuint program, const char* name) -{ - typedef int (QGLF_APIENTRYP type_glGetUniformLocation)(GLuint program, const char* name); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getUniformLocation = (type_glGetUniformLocation) - context->getProcAddress(QLatin1String("glGetUniformLocation")); - if (!funcs->getUniformLocation) { - funcs->getUniformLocation = (type_glGetUniformLocation) - context->getProcAddress(QLatin1String("glGetUniformLocationARB")); - } - - if (funcs->getUniformLocation) - return funcs->getUniformLocation(program, name); - funcs->getUniformLocation = qglfResolveGetUniformLocation; - return int(0); -} - -static void QGLF_APIENTRY qglfResolveGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) -{ - typedef void (QGLF_APIENTRYP type_glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getVertexAttribfv = (type_glGetVertexAttribfv) - context->getProcAddress(QLatin1String("glGetVertexAttribfv")); - if (!funcs->getVertexAttribfv) { - funcs->getVertexAttribfv = (type_glGetVertexAttribfv) - context->getProcAddress(QLatin1String("glGetVertexAttribfvARB")); - } - - if (funcs->getVertexAttribfv) - funcs->getVertexAttribfv(index, pname, params); - else - funcs->getVertexAttribfv = qglfResolveGetVertexAttribfv; -} - -static void QGLF_APIENTRY qglfResolveGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) -{ - typedef void (QGLF_APIENTRYP type_glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getVertexAttribiv = (type_glGetVertexAttribiv) - context->getProcAddress(QLatin1String("glGetVertexAttribiv")); - if (!funcs->getVertexAttribiv) { - funcs->getVertexAttribiv = (type_glGetVertexAttribiv) - context->getProcAddress(QLatin1String("glGetVertexAttribivARB")); - } - - if (funcs->getVertexAttribiv) - funcs->getVertexAttribiv(index, pname, params); - else - funcs->getVertexAttribiv = qglfResolveGetVertexAttribiv; -} - -static void QGLF_APIENTRY qglfResolveGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) -{ - typedef void (QGLF_APIENTRYP type_glGetVertexAttribPointerv)(GLuint index, GLenum pname, void** pointer); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->getVertexAttribPointerv = (type_glGetVertexAttribPointerv) - context->getProcAddress(QLatin1String("glGetVertexAttribPointerv")); - if (!funcs->getVertexAttribPointerv) { - funcs->getVertexAttribPointerv = (type_glGetVertexAttribPointerv) - context->getProcAddress(QLatin1String("glGetVertexAttribPointervARB")); - } - - if (funcs->getVertexAttribPointerv) - funcs->getVertexAttribPointerv(index, pname, pointer); - else - funcs->getVertexAttribPointerv = qglfResolveGetVertexAttribPointerv; -} - -static GLboolean QGLF_APIENTRY qglfResolveIsBuffer(GLuint buffer) -{ - typedef GLboolean (QGLF_APIENTRYP type_glIsBuffer)(GLuint buffer); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->isBuffer = (type_glIsBuffer) - context->getProcAddress(QLatin1String("glIsBuffer")); -#ifdef QT_OPENGL_ES - if (!funcs->isBuffer) { - funcs->isBuffer = (type_glIsBuffer) - context->getProcAddress(QLatin1String("glIsBufferOES")); - } -#endif - if (!funcs->isBuffer) { - funcs->isBuffer = (type_glIsBuffer) - context->getProcAddress(QLatin1String("glIsBufferEXT")); - } - if (!funcs->isBuffer) { - funcs->isBuffer = (type_glIsBuffer) - context->getProcAddress(QLatin1String("glIsBufferARB")); - } - - if (funcs->isBuffer) - return funcs->isBuffer(buffer); - funcs->isBuffer = qglfResolveIsBuffer; - return GLboolean(0); -} - -static GLboolean QGLF_APIENTRY qglfResolveIsFramebuffer(GLuint framebuffer) -{ - typedef GLboolean (QGLF_APIENTRYP type_glIsFramebuffer)(GLuint framebuffer); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->isFramebuffer = (type_glIsFramebuffer) - context->getProcAddress(QLatin1String("glIsFramebuffer")); -#ifdef QT_OPENGL_ES - if (!funcs->isFramebuffer) { - funcs->isFramebuffer = (type_glIsFramebuffer) - context->getProcAddress(QLatin1String("glIsFramebufferOES")); - } -#endif - if (!funcs->isFramebuffer) { - funcs->isFramebuffer = (type_glIsFramebuffer) - context->getProcAddress(QLatin1String("glIsFramebufferEXT")); - } - if (!funcs->isFramebuffer) { - funcs->isFramebuffer = (type_glIsFramebuffer) - context->getProcAddress(QLatin1String("glIsFramebufferARB")); - } - - if (funcs->isFramebuffer) - return funcs->isFramebuffer(framebuffer); - funcs->isFramebuffer = qglfResolveIsFramebuffer; - return GLboolean(0); -} - -static GLboolean QGLF_APIENTRY qglfSpecialIsProgram(GLuint program) -{ - return program != 0; -} - -static GLboolean QGLF_APIENTRY qglfResolveIsProgram(GLuint program) -{ - typedef GLboolean (QGLF_APIENTRYP type_glIsProgram)(GLuint program); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->isProgram = (type_glIsProgram) - context->getProcAddress(QLatin1String("glIsProgram")); - if (!funcs->isProgram) { - funcs->isProgram = (type_glIsProgram) - context->getProcAddress(QLatin1String("glIsProgramARB")); - } - - if (!funcs->isProgram) - funcs->isProgram = qglfSpecialIsProgram; - - return funcs->isProgram(program); -} - -static GLboolean QGLF_APIENTRY qglfResolveIsRenderbuffer(GLuint renderbuffer) -{ - typedef GLboolean (QGLF_APIENTRYP type_glIsRenderbuffer)(GLuint renderbuffer); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->isRenderbuffer = (type_glIsRenderbuffer) - context->getProcAddress(QLatin1String("glIsRenderbuffer")); -#ifdef QT_OPENGL_ES - if (!funcs->isRenderbuffer) { - funcs->isRenderbuffer = (type_glIsRenderbuffer) - context->getProcAddress(QLatin1String("glIsRenderbufferOES")); - } -#endif - if (!funcs->isRenderbuffer) { - funcs->isRenderbuffer = (type_glIsRenderbuffer) - context->getProcAddress(QLatin1String("glIsRenderbufferEXT")); - } - if (!funcs->isRenderbuffer) { - funcs->isRenderbuffer = (type_glIsRenderbuffer) - context->getProcAddress(QLatin1String("glIsRenderbufferARB")); - } - - if (funcs->isRenderbuffer) - return funcs->isRenderbuffer(renderbuffer); - funcs->isRenderbuffer = qglfResolveIsRenderbuffer; - return GLboolean(0); -} - -static GLboolean QGLF_APIENTRY qglfSpecialIsShader(GLuint shader) -{ - return shader != 0; -} - -static GLboolean QGLF_APIENTRY qglfResolveIsShader(GLuint shader) -{ - typedef GLboolean (QGLF_APIENTRYP type_glIsShader)(GLuint shader); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->isShader = (type_glIsShader) - context->getProcAddress(QLatin1String("glIsShader")); - if (!funcs->isShader) { - funcs->isShader = (type_glIsShader) - context->getProcAddress(QLatin1String("glIsShaderARB")); - } - - if (!funcs->isShader) - funcs->isShader = qglfSpecialIsShader; - - return funcs->isShader(shader); -} - -static void QGLF_APIENTRY qglfResolveLinkProgram(GLuint program) -{ - typedef void (QGLF_APIENTRYP type_glLinkProgram)(GLuint program); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->linkProgram = (type_glLinkProgram) - context->getProcAddress(QLatin1String("glLinkProgram")); - if (!funcs->linkProgram) { - funcs->linkProgram = (type_glLinkProgram) - context->getProcAddress(QLatin1String("glLinkProgramARB")); - } - - if (funcs->linkProgram) - funcs->linkProgram(program); - else - funcs->linkProgram = qglfResolveLinkProgram; -} - -static void QGLF_APIENTRY qglfSpecialReleaseShaderCompiler() -{ -} - -static void QGLF_APIENTRY qglfResolveReleaseShaderCompiler() -{ - typedef void (QGLF_APIENTRYP type_glReleaseShaderCompiler)(); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->releaseShaderCompiler = (type_glReleaseShaderCompiler) - context->getProcAddress(QLatin1String("glReleaseShaderCompiler")); - if (!funcs->releaseShaderCompiler) { - funcs->releaseShaderCompiler = (type_glReleaseShaderCompiler) - context->getProcAddress(QLatin1String("glReleaseShaderCompilerARB")); - } - - if (!funcs->releaseShaderCompiler) - funcs->releaseShaderCompiler = qglfSpecialReleaseShaderCompiler; - - funcs->releaseShaderCompiler(); -} - -static void QGLF_APIENTRY qglfResolveRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) -{ - typedef void (QGLF_APIENTRYP type_glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->renderbufferStorage = (type_glRenderbufferStorage) - context->getProcAddress(QLatin1String("glRenderbufferStorage")); -#ifdef QT_OPENGL_ES - if (!funcs->renderbufferStorage) { - funcs->renderbufferStorage = (type_glRenderbufferStorage) - context->getProcAddress(QLatin1String("glRenderbufferStorageOES")); - } -#endif - if (!funcs->renderbufferStorage) { - funcs->renderbufferStorage = (type_glRenderbufferStorage) - context->getProcAddress(QLatin1String("glRenderbufferStorageEXT")); - } - if (!funcs->renderbufferStorage) { - funcs->renderbufferStorage = (type_glRenderbufferStorage) - context->getProcAddress(QLatin1String("glRenderbufferStorageARB")); - } - - if (funcs->renderbufferStorage) - funcs->renderbufferStorage(target, internalformat, width, height); - else - funcs->renderbufferStorage = qglfResolveRenderbufferStorage; -} - -static void QGLF_APIENTRY qglfResolveSampleCoverage(GLclampf value, GLboolean invert) -{ - typedef void (QGLF_APIENTRYP type_glSampleCoverage)(GLclampf value, GLboolean invert); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->sampleCoverage = (type_glSampleCoverage) - context->getProcAddress(QLatin1String("glSampleCoverage")); -#ifdef QT_OPENGL_ES - if (!funcs->sampleCoverage) { - funcs->sampleCoverage = (type_glSampleCoverage) - context->getProcAddress(QLatin1String("glSampleCoverageOES")); - } -#endif - if (!funcs->sampleCoverage) { - funcs->sampleCoverage = (type_glSampleCoverage) - context->getProcAddress(QLatin1String("glSampleCoverageEXT")); - } - if (!funcs->sampleCoverage) { - funcs->sampleCoverage = (type_glSampleCoverage) - context->getProcAddress(QLatin1String("glSampleCoverageARB")); - } - - if (funcs->sampleCoverage) - funcs->sampleCoverage(value, invert); - else - funcs->sampleCoverage = qglfResolveSampleCoverage; -} - -static void QGLF_APIENTRY qglfResolveShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length) -{ - typedef void (QGLF_APIENTRYP type_glShaderBinary)(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->shaderBinary = (type_glShaderBinary) - context->getProcAddress(QLatin1String("glShaderBinary")); - if (!funcs->shaderBinary) { - funcs->shaderBinary = (type_glShaderBinary) - context->getProcAddress(QLatin1String("glShaderBinaryARB")); - } - - if (funcs->shaderBinary) - funcs->shaderBinary(n, shaders, binaryformat, binary, length); - else - funcs->shaderBinary = qglfResolveShaderBinary; -} - -static void QGLF_APIENTRY qglfResolveShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) -{ - typedef void (QGLF_APIENTRYP type_glShaderSource)(GLuint shader, GLsizei count, const char** string, const GLint* length); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->shaderSource = (type_glShaderSource) - context->getProcAddress(QLatin1String("glShaderSource")); - if (!funcs->shaderSource) { - funcs->shaderSource = (type_glShaderSource) - context->getProcAddress(QLatin1String("glShaderSourceARB")); - } - - if (funcs->shaderSource) - funcs->shaderSource(shader, count, string, length); - else - funcs->shaderSource = qglfResolveShaderSource; -} - -static void QGLF_APIENTRY qglfResolveStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) -{ - typedef void (QGLF_APIENTRYP type_glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->stencilFuncSeparate = (type_glStencilFuncSeparate) - context->getProcAddress(QLatin1String("glStencilFuncSeparate")); -#ifdef QT_OPENGL_ES - if (!funcs->stencilFuncSeparate) { - funcs->stencilFuncSeparate = (type_glStencilFuncSeparate) - context->getProcAddress(QLatin1String("glStencilFuncSeparateOES")); - } -#endif - if (!funcs->stencilFuncSeparate) { - funcs->stencilFuncSeparate = (type_glStencilFuncSeparate) - context->getProcAddress(QLatin1String("glStencilFuncSeparateEXT")); - } - if (!funcs->stencilFuncSeparate) { - funcs->stencilFuncSeparate = (type_glStencilFuncSeparate) - context->getProcAddress(QLatin1String("glStencilFuncSeparateARB")); - } - - if (funcs->stencilFuncSeparate) - funcs->stencilFuncSeparate(face, func, ref, mask); - else - funcs->stencilFuncSeparate = qglfResolveStencilFuncSeparate; -} - -static void QGLF_APIENTRY qglfResolveStencilMaskSeparate(GLenum face, GLuint mask) -{ - typedef void (QGLF_APIENTRYP type_glStencilMaskSeparate)(GLenum face, GLuint mask); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->stencilMaskSeparate = (type_glStencilMaskSeparate) - context->getProcAddress(QLatin1String("glStencilMaskSeparate")); -#ifdef QT_OPENGL_ES - if (!funcs->stencilMaskSeparate) { - funcs->stencilMaskSeparate = (type_glStencilMaskSeparate) - context->getProcAddress(QLatin1String("glStencilMaskSeparateOES")); - } -#endif - if (!funcs->stencilMaskSeparate) { - funcs->stencilMaskSeparate = (type_glStencilMaskSeparate) - context->getProcAddress(QLatin1String("glStencilMaskSeparateEXT")); - } - if (!funcs->stencilMaskSeparate) { - funcs->stencilMaskSeparate = (type_glStencilMaskSeparate) - context->getProcAddress(QLatin1String("glStencilMaskSeparateARB")); - } - - if (funcs->stencilMaskSeparate) - funcs->stencilMaskSeparate(face, mask); - else - funcs->stencilMaskSeparate = qglfResolveStencilMaskSeparate; -} - -static void QGLF_APIENTRY qglfResolveStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) -{ - typedef void (QGLF_APIENTRYP type_glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->stencilOpSeparate = (type_glStencilOpSeparate) - context->getProcAddress(QLatin1String("glStencilOpSeparate")); -#ifdef QT_OPENGL_ES - if (!funcs->stencilOpSeparate) { - funcs->stencilOpSeparate = (type_glStencilOpSeparate) - context->getProcAddress(QLatin1String("glStencilOpSeparateOES")); - } -#endif - if (!funcs->stencilOpSeparate) { - funcs->stencilOpSeparate = (type_glStencilOpSeparate) - context->getProcAddress(QLatin1String("glStencilOpSeparateEXT")); - } - if (!funcs->stencilOpSeparate) { - funcs->stencilOpSeparate = (type_glStencilOpSeparate) - context->getProcAddress(QLatin1String("glStencilOpSeparateARB")); - } - - if (funcs->stencilOpSeparate) - funcs->stencilOpSeparate(face, fail, zfail, zpass); - else - funcs->stencilOpSeparate = qglfResolveStencilOpSeparate; -} - -static void QGLF_APIENTRY qglfResolveUniform1f(GLint location, GLfloat x) -{ - typedef void (QGLF_APIENTRYP type_glUniform1f)(GLint location, GLfloat x); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform1f = (type_glUniform1f) - context->getProcAddress(QLatin1String("glUniform1f")); - if (!funcs->uniform1f) { - funcs->uniform1f = (type_glUniform1f) - context->getProcAddress(QLatin1String("glUniform1fARB")); - } - - if (funcs->uniform1f) - funcs->uniform1f(location, x); - else - funcs->uniform1f = qglfResolveUniform1f; -} - -static void QGLF_APIENTRY qglfResolveUniform1fv(GLint location, GLsizei count, const GLfloat* v) -{ - typedef void (QGLF_APIENTRYP type_glUniform1fv)(GLint location, GLsizei count, const GLfloat* v); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform1fv = (type_glUniform1fv) - context->getProcAddress(QLatin1String("glUniform1fv")); - if (!funcs->uniform1fv) { - funcs->uniform1fv = (type_glUniform1fv) - context->getProcAddress(QLatin1String("glUniform1fvARB")); - } - - if (funcs->uniform1fv) - funcs->uniform1fv(location, count, v); - else - funcs->uniform1fv = qglfResolveUniform1fv; -} - -static void QGLF_APIENTRY qglfResolveUniform1i(GLint location, GLint x) -{ - typedef void (QGLF_APIENTRYP type_glUniform1i)(GLint location, GLint x); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform1i = (type_glUniform1i) - context->getProcAddress(QLatin1String("glUniform1i")); - if (!funcs->uniform1i) { - funcs->uniform1i = (type_glUniform1i) - context->getProcAddress(QLatin1String("glUniform1iARB")); - } - - if (funcs->uniform1i) - funcs->uniform1i(location, x); - else - funcs->uniform1i = qglfResolveUniform1i; -} - -static void QGLF_APIENTRY qglfResolveUniform1iv(GLint location, GLsizei count, const GLint* v) -{ - typedef void (QGLF_APIENTRYP type_glUniform1iv)(GLint location, GLsizei count, const GLint* v); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform1iv = (type_glUniform1iv) - context->getProcAddress(QLatin1String("glUniform1iv")); - if (!funcs->uniform1iv) { - funcs->uniform1iv = (type_glUniform1iv) - context->getProcAddress(QLatin1String("glUniform1ivARB")); - } - - if (funcs->uniform1iv) - funcs->uniform1iv(location, count, v); - else - funcs->uniform1iv = qglfResolveUniform1iv; -} - -static void QGLF_APIENTRY qglfResolveUniform2f(GLint location, GLfloat x, GLfloat y) -{ - typedef void (QGLF_APIENTRYP type_glUniform2f)(GLint location, GLfloat x, GLfloat y); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform2f = (type_glUniform2f) - context->getProcAddress(QLatin1String("glUniform2f")); - if (!funcs->uniform2f) { - funcs->uniform2f = (type_glUniform2f) - context->getProcAddress(QLatin1String("glUniform2fARB")); - } - - if (funcs->uniform2f) - funcs->uniform2f(location, x, y); - else - funcs->uniform2f = qglfResolveUniform2f; -} - -static void QGLF_APIENTRY qglfResolveUniform2fv(GLint location, GLsizei count, const GLfloat* v) -{ - typedef void (QGLF_APIENTRYP type_glUniform2fv)(GLint location, GLsizei count, const GLfloat* v); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform2fv = (type_glUniform2fv) - context->getProcAddress(QLatin1String("glUniform2fv")); - if (!funcs->uniform2fv) { - funcs->uniform2fv = (type_glUniform2fv) - context->getProcAddress(QLatin1String("glUniform2fvARB")); - } - - if (funcs->uniform2fv) - funcs->uniform2fv(location, count, v); - else - funcs->uniform2fv = qglfResolveUniform2fv; -} - -static void QGLF_APIENTRY qglfResolveUniform2i(GLint location, GLint x, GLint y) -{ - typedef void (QGLF_APIENTRYP type_glUniform2i)(GLint location, GLint x, GLint y); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform2i = (type_glUniform2i) - context->getProcAddress(QLatin1String("glUniform2i")); - if (!funcs->uniform2i) { - funcs->uniform2i = (type_glUniform2i) - context->getProcAddress(QLatin1String("glUniform2iARB")); - } - - if (funcs->uniform2i) - funcs->uniform2i(location, x, y); - else - funcs->uniform2i = qglfResolveUniform2i; -} - -static void QGLF_APIENTRY qglfResolveUniform2iv(GLint location, GLsizei count, const GLint* v) -{ - typedef void (QGLF_APIENTRYP type_glUniform2iv)(GLint location, GLsizei count, const GLint* v); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform2iv = (type_glUniform2iv) - context->getProcAddress(QLatin1String("glUniform2iv")); - if (!funcs->uniform2iv) { - funcs->uniform2iv = (type_glUniform2iv) - context->getProcAddress(QLatin1String("glUniform2ivARB")); - } - - if (funcs->uniform2iv) - funcs->uniform2iv(location, count, v); - else - funcs->uniform2iv = qglfResolveUniform2iv; -} - -static void QGLF_APIENTRY qglfResolveUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) -{ - typedef void (QGLF_APIENTRYP type_glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform3f = (type_glUniform3f) - context->getProcAddress(QLatin1String("glUniform3f")); - if (!funcs->uniform3f) { - funcs->uniform3f = (type_glUniform3f) - context->getProcAddress(QLatin1String("glUniform3fARB")); - } - - if (funcs->uniform3f) - funcs->uniform3f(location, x, y, z); - else - funcs->uniform3f = qglfResolveUniform3f; -} - -static void QGLF_APIENTRY qglfResolveUniform3fv(GLint location, GLsizei count, const GLfloat* v) -{ - typedef void (QGLF_APIENTRYP type_glUniform3fv)(GLint location, GLsizei count, const GLfloat* v); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform3fv = (type_glUniform3fv) - context->getProcAddress(QLatin1String("glUniform3fv")); - if (!funcs->uniform3fv) { - funcs->uniform3fv = (type_glUniform3fv) - context->getProcAddress(QLatin1String("glUniform3fvARB")); - } - - if (funcs->uniform3fv) - funcs->uniform3fv(location, count, v); - else - funcs->uniform3fv = qglfResolveUniform3fv; -} - -static void QGLF_APIENTRY qglfResolveUniform3i(GLint location, GLint x, GLint y, GLint z) -{ - typedef void (QGLF_APIENTRYP type_glUniform3i)(GLint location, GLint x, GLint y, GLint z); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform3i = (type_glUniform3i) - context->getProcAddress(QLatin1String("glUniform3i")); - if (!funcs->uniform3i) { - funcs->uniform3i = (type_glUniform3i) - context->getProcAddress(QLatin1String("glUniform3iARB")); - } - - if (funcs->uniform3i) - funcs->uniform3i(location, x, y, z); - else - funcs->uniform3i = qglfResolveUniform3i; -} - -static void QGLF_APIENTRY qglfResolveUniform3iv(GLint location, GLsizei count, const GLint* v) -{ - typedef void (QGLF_APIENTRYP type_glUniform3iv)(GLint location, GLsizei count, const GLint* v); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform3iv = (type_glUniform3iv) - context->getProcAddress(QLatin1String("glUniform3iv")); - if (!funcs->uniform3iv) { - funcs->uniform3iv = (type_glUniform3iv) - context->getProcAddress(QLatin1String("glUniform3ivARB")); - } - - if (funcs->uniform3iv) - funcs->uniform3iv(location, count, v); - else - funcs->uniform3iv = qglfResolveUniform3iv; -} - -static void QGLF_APIENTRY qglfResolveUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - typedef void (QGLF_APIENTRYP type_glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform4f = (type_glUniform4f) - context->getProcAddress(QLatin1String("glUniform4f")); - if (!funcs->uniform4f) { - funcs->uniform4f = (type_glUniform4f) - context->getProcAddress(QLatin1String("glUniform4fARB")); - } - - if (funcs->uniform4f) - funcs->uniform4f(location, x, y, z, w); - else - funcs->uniform4f = qglfResolveUniform4f; -} - -static void QGLF_APIENTRY qglfResolveUniform4fv(GLint location, GLsizei count, const GLfloat* v) -{ - typedef void (QGLF_APIENTRYP type_glUniform4fv)(GLint location, GLsizei count, const GLfloat* v); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform4fv = (type_glUniform4fv) - context->getProcAddress(QLatin1String("glUniform4fv")); - if (!funcs->uniform4fv) { - funcs->uniform4fv = (type_glUniform4fv) - context->getProcAddress(QLatin1String("glUniform4fvARB")); - } - - if (funcs->uniform4fv) - funcs->uniform4fv(location, count, v); - else - funcs->uniform4fv = qglfResolveUniform4fv; -} - -static void QGLF_APIENTRY qglfResolveUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) -{ - typedef void (QGLF_APIENTRYP type_glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform4i = (type_glUniform4i) - context->getProcAddress(QLatin1String("glUniform4i")); - if (!funcs->uniform4i) { - funcs->uniform4i = (type_glUniform4i) - context->getProcAddress(QLatin1String("glUniform4iARB")); - } - - if (funcs->uniform4i) - funcs->uniform4i(location, x, y, z, w); - else - funcs->uniform4i = qglfResolveUniform4i; -} - -static void QGLF_APIENTRY qglfResolveUniform4iv(GLint location, GLsizei count, const GLint* v) -{ - typedef void (QGLF_APIENTRYP type_glUniform4iv)(GLint location, GLsizei count, const GLint* v); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniform4iv = (type_glUniform4iv) - context->getProcAddress(QLatin1String("glUniform4iv")); - if (!funcs->uniform4iv) { - funcs->uniform4iv = (type_glUniform4iv) - context->getProcAddress(QLatin1String("glUniform4ivARB")); - } - - if (funcs->uniform4iv) - funcs->uniform4iv(location, count, v); - else - funcs->uniform4iv = qglfResolveUniform4iv; -} - -static void QGLF_APIENTRY qglfResolveUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - typedef void (QGLF_APIENTRYP type_glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniformMatrix2fv = (type_glUniformMatrix2fv) - context->getProcAddress(QLatin1String("glUniformMatrix2fv")); - if (!funcs->uniformMatrix2fv) { - funcs->uniformMatrix2fv = (type_glUniformMatrix2fv) - context->getProcAddress(QLatin1String("glUniformMatrix2fvARB")); - } - - if (funcs->uniformMatrix2fv) - funcs->uniformMatrix2fv(location, count, transpose, value); - else - funcs->uniformMatrix2fv = qglfResolveUniformMatrix2fv; -} - -static void QGLF_APIENTRY qglfResolveUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - typedef void (QGLF_APIENTRYP type_glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniformMatrix3fv = (type_glUniformMatrix3fv) - context->getProcAddress(QLatin1String("glUniformMatrix3fv")); - if (!funcs->uniformMatrix3fv) { - funcs->uniformMatrix3fv = (type_glUniformMatrix3fv) - context->getProcAddress(QLatin1String("glUniformMatrix3fvARB")); - } - - if (funcs->uniformMatrix3fv) - funcs->uniformMatrix3fv(location, count, transpose, value); - else - funcs->uniformMatrix3fv = qglfResolveUniformMatrix3fv; -} - -static void QGLF_APIENTRY qglfResolveUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - typedef void (QGLF_APIENTRYP type_glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->uniformMatrix4fv = (type_glUniformMatrix4fv) - context->getProcAddress(QLatin1String("glUniformMatrix4fv")); - if (!funcs->uniformMatrix4fv) { - funcs->uniformMatrix4fv = (type_glUniformMatrix4fv) - context->getProcAddress(QLatin1String("glUniformMatrix4fvARB")); - } - - if (funcs->uniformMatrix4fv) - funcs->uniformMatrix4fv(location, count, transpose, value); - else - funcs->uniformMatrix4fv = qglfResolveUniformMatrix4fv; -} - -static void QGLF_APIENTRY qglfResolveUseProgram(GLuint program) -{ - typedef void (QGLF_APIENTRYP type_glUseProgram)(GLuint program); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->useProgram = (type_glUseProgram) - context->getProcAddress(QLatin1String("glUseProgram")); - if (!funcs->useProgram) { - funcs->useProgram = (type_glUseProgram) - context->getProcAddress(QLatin1String("glUseProgramObjectARB")); - } - - if (funcs->useProgram) - funcs->useProgram(program); - else - funcs->useProgram = qglfResolveUseProgram; -} - -static void QGLF_APIENTRY qglfResolveValidateProgram(GLuint program) -{ - typedef void (QGLF_APIENTRYP type_glValidateProgram)(GLuint program); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->validateProgram = (type_glValidateProgram) - context->getProcAddress(QLatin1String("glValidateProgram")); - if (!funcs->validateProgram) { - funcs->validateProgram = (type_glValidateProgram) - context->getProcAddress(QLatin1String("glValidateProgramARB")); - } - - if (funcs->validateProgram) - funcs->validateProgram(program); - else - funcs->validateProgram = qglfResolveValidateProgram; -} - -static void QGLF_APIENTRY qglfResolveVertexAttrib1f(GLuint indx, GLfloat x) -{ - typedef void (QGLF_APIENTRYP type_glVertexAttrib1f)(GLuint indx, GLfloat x); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->vertexAttrib1f = (type_glVertexAttrib1f) - context->getProcAddress(QLatin1String("glVertexAttrib1f")); - if (!funcs->vertexAttrib1f) { - funcs->vertexAttrib1f = (type_glVertexAttrib1f) - context->getProcAddress(QLatin1String("glVertexAttrib1fARB")); - } - - if (funcs->vertexAttrib1f) - funcs->vertexAttrib1f(indx, x); - else - funcs->vertexAttrib1f = qglfResolveVertexAttrib1f; -} - -static void QGLF_APIENTRY qglfResolveVertexAttrib1fv(GLuint indx, const GLfloat* values) -{ - typedef void (QGLF_APIENTRYP type_glVertexAttrib1fv)(GLuint indx, const GLfloat* values); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->vertexAttrib1fv = (type_glVertexAttrib1fv) - context->getProcAddress(QLatin1String("glVertexAttrib1fv")); - if (!funcs->vertexAttrib1fv) { - funcs->vertexAttrib1fv = (type_glVertexAttrib1fv) - context->getProcAddress(QLatin1String("glVertexAttrib1fvARB")); - } - - if (funcs->vertexAttrib1fv) - funcs->vertexAttrib1fv(indx, values); - else - funcs->vertexAttrib1fv = qglfResolveVertexAttrib1fv; -} - -static void QGLF_APIENTRY qglfResolveVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) -{ - typedef void (QGLF_APIENTRYP type_glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->vertexAttrib2f = (type_glVertexAttrib2f) - context->getProcAddress(QLatin1String("glVertexAttrib2f")); - if (!funcs->vertexAttrib2f) { - funcs->vertexAttrib2f = (type_glVertexAttrib2f) - context->getProcAddress(QLatin1String("glVertexAttrib2fARB")); - } - - if (funcs->vertexAttrib2f) - funcs->vertexAttrib2f(indx, x, y); - else - funcs->vertexAttrib2f = qglfResolveVertexAttrib2f; -} - -static void QGLF_APIENTRY qglfResolveVertexAttrib2fv(GLuint indx, const GLfloat* values) -{ - typedef void (QGLF_APIENTRYP type_glVertexAttrib2fv)(GLuint indx, const GLfloat* values); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->vertexAttrib2fv = (type_glVertexAttrib2fv) - context->getProcAddress(QLatin1String("glVertexAttrib2fv")); - if (!funcs->vertexAttrib2fv) { - funcs->vertexAttrib2fv = (type_glVertexAttrib2fv) - context->getProcAddress(QLatin1String("glVertexAttrib2fvARB")); - } - - if (funcs->vertexAttrib2fv) - funcs->vertexAttrib2fv(indx, values); - else - funcs->vertexAttrib2fv = qglfResolveVertexAttrib2fv; -} - -static void QGLF_APIENTRY qglfResolveVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) -{ - typedef void (QGLF_APIENTRYP type_glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->vertexAttrib3f = (type_glVertexAttrib3f) - context->getProcAddress(QLatin1String("glVertexAttrib3f")); - if (!funcs->vertexAttrib3f) { - funcs->vertexAttrib3f = (type_glVertexAttrib3f) - context->getProcAddress(QLatin1String("glVertexAttrib3fARB")); - } - - if (funcs->vertexAttrib3f) - funcs->vertexAttrib3f(indx, x, y, z); - else - funcs->vertexAttrib3f = qglfResolveVertexAttrib3f; -} - -static void QGLF_APIENTRY qglfResolveVertexAttrib3fv(GLuint indx, const GLfloat* values) -{ - typedef void (QGLF_APIENTRYP type_glVertexAttrib3fv)(GLuint indx, const GLfloat* values); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->vertexAttrib3fv = (type_glVertexAttrib3fv) - context->getProcAddress(QLatin1String("glVertexAttrib3fv")); - if (!funcs->vertexAttrib3fv) { - funcs->vertexAttrib3fv = (type_glVertexAttrib3fv) - context->getProcAddress(QLatin1String("glVertexAttrib3fvARB")); - } - - if (funcs->vertexAttrib3fv) - funcs->vertexAttrib3fv(indx, values); - else - funcs->vertexAttrib3fv = qglfResolveVertexAttrib3fv; -} - -static void QGLF_APIENTRY qglfResolveVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - typedef void (QGLF_APIENTRYP type_glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->vertexAttrib4f = (type_glVertexAttrib4f) - context->getProcAddress(QLatin1String("glVertexAttrib4f")); - if (!funcs->vertexAttrib4f) { - funcs->vertexAttrib4f = (type_glVertexAttrib4f) - context->getProcAddress(QLatin1String("glVertexAttrib4fARB")); - } - - if (funcs->vertexAttrib4f) - funcs->vertexAttrib4f(indx, x, y, z, w); - else - funcs->vertexAttrib4f = qglfResolveVertexAttrib4f; -} - -static void QGLF_APIENTRY qglfResolveVertexAttrib4fv(GLuint indx, const GLfloat* values) -{ - typedef void (QGLF_APIENTRYP type_glVertexAttrib4fv)(GLuint indx, const GLfloat* values); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->vertexAttrib4fv = (type_glVertexAttrib4fv) - context->getProcAddress(QLatin1String("glVertexAttrib4fv")); - if (!funcs->vertexAttrib4fv) { - funcs->vertexAttrib4fv = (type_glVertexAttrib4fv) - context->getProcAddress(QLatin1String("glVertexAttrib4fvARB")); - } - - if (funcs->vertexAttrib4fv) - funcs->vertexAttrib4fv(indx, values); - else - funcs->vertexAttrib4fv = qglfResolveVertexAttrib4fv; -} - -static void QGLF_APIENTRY qglfResolveVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) -{ - typedef void (QGLF_APIENTRYP type_glVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); - - const QGLContext *context = QGLContext::currentContext(); - QGLFunctionsPrivate *funcs = qt_gl_functions(context); - - funcs->vertexAttribPointer = (type_glVertexAttribPointer) - context->getProcAddress(QLatin1String("glVertexAttribPointer")); - if (!funcs->vertexAttribPointer) { - funcs->vertexAttribPointer = (type_glVertexAttribPointer) - context->getProcAddress(QLatin1String("glVertexAttribPointerARB")); - } - - if (funcs->vertexAttribPointer) - funcs->vertexAttribPointer(indx, size, type, normalized, stride, ptr); - else - funcs->vertexAttribPointer = qglfResolveVertexAttribPointer; -} - -#endif // !QT_OPENGL_ES_2 - QGLFunctionsPrivate::QGLFunctionsPrivate(const QGLContext *) + : funcs(0) { -#ifndef QT_OPENGL_ES_2 - activeTexture = qglfResolveActiveTexture; - attachShader = qglfResolveAttachShader; - bindAttribLocation = qglfResolveBindAttribLocation; - bindBuffer = qglfResolveBindBuffer; - bindFramebuffer = qglfResolveBindFramebuffer; - bindRenderbuffer = qglfResolveBindRenderbuffer; - blendColor = qglfResolveBlendColor; - blendEquation = qglfResolveBlendEquation; - blendEquationSeparate = qglfResolveBlendEquationSeparate; - blendFuncSeparate = qglfResolveBlendFuncSeparate; - bufferData = qglfResolveBufferData; - bufferSubData = qglfResolveBufferSubData; - checkFramebufferStatus = qglfResolveCheckFramebufferStatus; - compileShader = qglfResolveCompileShader; - compressedTexImage2D = qglfResolveCompressedTexImage2D; - compressedTexSubImage2D = qglfResolveCompressedTexSubImage2D; - createProgram = qglfResolveCreateProgram; - createShader = qglfResolveCreateShader; - deleteBuffers = qglfResolveDeleteBuffers; - deleteFramebuffers = qglfResolveDeleteFramebuffers; - deleteProgram = qglfResolveDeleteProgram; - deleteRenderbuffers = qglfResolveDeleteRenderbuffers; - deleteShader = qglfResolveDeleteShader; - detachShader = qglfResolveDetachShader; - disableVertexAttribArray = qglfResolveDisableVertexAttribArray; - enableVertexAttribArray = qglfResolveEnableVertexAttribArray; - framebufferRenderbuffer = qglfResolveFramebufferRenderbuffer; - framebufferTexture2D = qglfResolveFramebufferTexture2D; - genBuffers = qglfResolveGenBuffers; - generateMipmap = qglfResolveGenerateMipmap; - genFramebuffers = qglfResolveGenFramebuffers; - genRenderbuffers = qglfResolveGenRenderbuffers; - getActiveAttrib = qglfResolveGetActiveAttrib; - getActiveUniform = qglfResolveGetActiveUniform; - getAttachedShaders = qglfResolveGetAttachedShaders; - getAttribLocation = qglfResolveGetAttribLocation; - getBufferParameteriv = qglfResolveGetBufferParameteriv; - getFramebufferAttachmentParameteriv = qglfResolveGetFramebufferAttachmentParameteriv; - getProgramiv = qglfResolveGetProgramiv; - getProgramInfoLog = qglfResolveGetProgramInfoLog; - getRenderbufferParameteriv = qglfResolveGetRenderbufferParameteriv; - getShaderiv = qglfResolveGetShaderiv; - getShaderInfoLog = qglfResolveGetShaderInfoLog; - getShaderPrecisionFormat = qglfResolveGetShaderPrecisionFormat; - getShaderSource = qglfResolveGetShaderSource; - getUniformfv = qglfResolveGetUniformfv; - getUniformiv = qglfResolveGetUniformiv; - getUniformLocation = qglfResolveGetUniformLocation; - getVertexAttribfv = qglfResolveGetVertexAttribfv; - getVertexAttribiv = qglfResolveGetVertexAttribiv; - getVertexAttribPointerv = qglfResolveGetVertexAttribPointerv; - isBuffer = qglfResolveIsBuffer; - isFramebuffer = qglfResolveIsFramebuffer; - isProgram = qglfResolveIsProgram; - isRenderbuffer = qglfResolveIsRenderbuffer; - isShader = qglfResolveIsShader; - linkProgram = qglfResolveLinkProgram; - releaseShaderCompiler = qglfResolveReleaseShaderCompiler; - renderbufferStorage = qglfResolveRenderbufferStorage; - sampleCoverage = qglfResolveSampleCoverage; - shaderBinary = qglfResolveShaderBinary; - shaderSource = qglfResolveShaderSource; - stencilFuncSeparate = qglfResolveStencilFuncSeparate; - stencilMaskSeparate = qglfResolveStencilMaskSeparate; - stencilOpSeparate = qglfResolveStencilOpSeparate; - uniform1f = qglfResolveUniform1f; - uniform1fv = qglfResolveUniform1fv; - uniform1i = qglfResolveUniform1i; - uniform1iv = qglfResolveUniform1iv; - uniform2f = qglfResolveUniform2f; - uniform2fv = qglfResolveUniform2fv; - uniform2i = qglfResolveUniform2i; - uniform2iv = qglfResolveUniform2iv; - uniform3f = qglfResolveUniform3f; - uniform3fv = qglfResolveUniform3fv; - uniform3i = qglfResolveUniform3i; - uniform3iv = qglfResolveUniform3iv; - uniform4f = qglfResolveUniform4f; - uniform4fv = qglfResolveUniform4fv; - uniform4i = qglfResolveUniform4i; - uniform4iv = qglfResolveUniform4iv; - uniformMatrix2fv = qglfResolveUniformMatrix2fv; - uniformMatrix3fv = qglfResolveUniformMatrix3fv; - uniformMatrix4fv = qglfResolveUniformMatrix4fv; - useProgram = qglfResolveUseProgram; - validateProgram = qglfResolveValidateProgram; - vertexAttrib1f = qglfResolveVertexAttrib1f; - vertexAttrib1fv = qglfResolveVertexAttrib1fv; - vertexAttrib2f = qglfResolveVertexAttrib2f; - vertexAttrib2fv = qglfResolveVertexAttrib2fv; - vertexAttrib3f = qglfResolveVertexAttrib3f; - vertexAttrib3fv = qglfResolveVertexAttrib3fv; - vertexAttrib4f = qglfResolveVertexAttrib4f; - vertexAttrib4fv = qglfResolveVertexAttrib4fv; - vertexAttribPointer = qglfResolveVertexAttribPointer; -#endif // !QT_OPENGL_ES_2 } QT_END_NAMESPACE diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h index 7fc7966a094..f822899e474 100644 --- a/src/opengl/qglfunctions.h +++ b/src/opengl/qglfunctions.h @@ -42,141 +42,14 @@ #ifndef QGLFUNCTIONS_H #define QGLFUNCTIONS_H -#ifdef __GLEW_H__ -#if defined(Q_CC_GNU) -#warning qglfunctions.h is not compatible with GLEW, GLEW defines will be undefined -#warning To use GLEW with Qt, do not include or after glew.h -#endif -#endif - #include #include #include QT_BEGIN_NAMESPACE - -// Types that aren't defined in all system's gl.h files. -typedef ptrdiff_t qgl_GLintptr; -typedef ptrdiff_t qgl_GLsizeiptr; - -#if defined(APIENTRY) && !defined(QGLF_APIENTRY) -# define QGLF_APIENTRY APIENTRY -#elif defined(GL_APIENTRY) && !defined(QGLF_APIENTRY) -# define QGLF_APIENTRY GL_APIENTRY -#endif - -# ifndef QGLF_APIENTRYP -# ifdef QGLF_APIENTRY -# define QGLF_APIENTRYP QGLF_APIENTRY * -# else -# define QGLF_APIENTRY -# define QGLF_APIENTRYP * -# endif -# endif - struct QGLFunctionsPrivate; -// Undefine any macros from GLEW, qglextensions_p.h, etc that -// may interfere with the definition of QGLFunctions. -#undef glActiveTexture -#undef glAttachShader -#undef glBindAttribLocation -#undef glBindBuffer -#undef glBindFramebuffer -#undef glBindRenderbuffer -#undef glBlendColor -#undef glBlendEquation -#undef glBlendEquationSeparate -#undef glBlendFuncSeparate -#undef glBufferData -#undef glBufferSubData -#undef glCheckFramebufferStatus -#undef glClearDepthf -#undef glCompileShader -#undef glCompressedTexImage2D -#undef glCompressedTexSubImage2D -#undef glCreateProgram -#undef glCreateShader -#undef glDeleteBuffers -#undef glDeleteFramebuffers -#undef glDeleteProgram -#undef glDeleteRenderbuffers -#undef glDeleteShader -#undef glDepthRangef -#undef glDetachShader -#undef glDisableVertexAttribArray -#undef glEnableVertexAttribArray -#undef glFramebufferRenderbuffer -#undef glFramebufferTexture2D -#undef glGenBuffers -#undef glGenerateMipmap -#undef glGenFramebuffers -#undef glGenRenderbuffers -#undef glGetActiveAttrib -#undef glGetActiveUniform -#undef glGetAttachedShaders -#undef glGetAttribLocation -#undef glGetBufferParameteriv -#undef glGetFramebufferAttachmentParameteriv -#undef glGetProgramiv -#undef glGetProgramInfoLog -#undef glGetRenderbufferParameteriv -#undef glGetShaderiv -#undef glGetShaderInfoLog -#undef glGetShaderPrecisionFormat -#undef glGetShaderSource -#undef glGetUniformfv -#undef glGetUniformiv -#undef glGetUniformLocation -#undef glGetVertexAttribfv -#undef glGetVertexAttribiv -#undef glGetVertexAttribPointerv -#undef glIsBuffer -#undef glIsFramebuffer -#undef glIsProgram -#undef glIsRenderbuffer -#undef glIsShader -#undef glLinkProgram -#undef glReleaseShaderCompiler -#undef glRenderbufferStorage -#undef glSampleCoverage -#undef glShaderBinary -#undef glShaderSource -#undef glStencilFuncSeparate -#undef glStencilMaskSeparate -#undef glStencilOpSeparate -#undef glUniform1f -#undef glUniform1fv -#undef glUniform1i -#undef glUniform1iv -#undef glUniform2f -#undef glUniform2fv -#undef glUniform2i -#undef glUniform2iv -#undef glUniform3f -#undef glUniform3fv -#undef glUniform3i -#undef glUniform3iv -#undef glUniform4f -#undef glUniform4fv -#undef glUniform4i -#undef glUniform4iv -#undef glUniformMatrix2fv -#undef glUniformMatrix3fv -#undef glUniformMatrix4fv -#undef glUseProgram -#undef glValidateProgram -#undef glVertexAttrib1f -#undef glVertexAttrib1fv -#undef glVertexAttrib2f -#undef glVertexAttrib2fv -#undef glVertexAttrib3f -#undef glVertexAttrib3fv -#undef glVertexAttrib4f -#undef glVertexAttrib4fv -#undef glVertexAttribPointer - class Q_OPENGL_EXPORT QGLFunctions { public: @@ -217,8 +90,8 @@ public: void glBlendEquation(GLenum mode); void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); - void glBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage); - void glBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data); + void glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage); + void glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data); GLenum glCheckFramebufferStatus(GLenum target); void glClearDepthf(GLclampf depth); void glCompileShader(GLuint shader); @@ -315,1074 +188,591 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFunctions::OpenGLFeatures) struct QGLFunctionsPrivate { QGLFunctionsPrivate(const QGLContext *context = 0); - -#ifndef QT_OPENGL_ES_2 - void (QGLF_APIENTRYP activeTexture)(GLenum texture); - void (QGLF_APIENTRYP attachShader)(GLuint program, GLuint shader); - void (QGLF_APIENTRYP bindAttribLocation)(GLuint program, GLuint index, const char* name); - void (QGLF_APIENTRYP bindBuffer)(GLenum target, GLuint buffer); - void (QGLF_APIENTRYP bindFramebuffer)(GLenum target, GLuint framebuffer); - void (QGLF_APIENTRYP bindRenderbuffer)(GLenum target, GLuint renderbuffer); - void (QGLF_APIENTRYP blendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void (QGLF_APIENTRYP blendEquation)(GLenum mode); - void (QGLF_APIENTRYP blendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha); - void (QGLF_APIENTRYP blendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); - void (QGLF_APIENTRYP bufferData)(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage); - void (QGLF_APIENTRYP bufferSubData)(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data); - GLenum (QGLF_APIENTRYP checkFramebufferStatus)(GLenum target); - void (QGLF_APIENTRYP compileShader)(GLuint shader); - void (QGLF_APIENTRYP compressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); - void (QGLF_APIENTRYP compressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); - GLuint (QGLF_APIENTRYP createProgram)(); - GLuint (QGLF_APIENTRYP createShader)(GLenum type); - void (QGLF_APIENTRYP deleteBuffers)(GLsizei n, const GLuint* buffers); - void (QGLF_APIENTRYP deleteFramebuffers)(GLsizei n, const GLuint* framebuffers); - void (QGLF_APIENTRYP deleteProgram)(GLuint program); - void (QGLF_APIENTRYP deleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers); - void (QGLF_APIENTRYP deleteShader)(GLuint shader); - void (QGLF_APIENTRYP detachShader)(GLuint program, GLuint shader); - void (QGLF_APIENTRYP disableVertexAttribArray)(GLuint index); - void (QGLF_APIENTRYP enableVertexAttribArray)(GLuint index); - void (QGLF_APIENTRYP framebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); - void (QGLF_APIENTRYP framebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); - void (QGLF_APIENTRYP genBuffers)(GLsizei n, GLuint* buffers); - void (QGLF_APIENTRYP generateMipmap)(GLenum target); - void (QGLF_APIENTRYP genFramebuffers)(GLsizei n, GLuint* framebuffers); - void (QGLF_APIENTRYP genRenderbuffers)(GLsizei n, GLuint* renderbuffers); - void (QGLF_APIENTRYP getActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); - void (QGLF_APIENTRYP getActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); - void (QGLF_APIENTRYP getAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); - int (QGLF_APIENTRYP getAttribLocation)(GLuint program, const char* name); - void (QGLF_APIENTRYP getBufferParameteriv)(GLenum target, GLenum pname, GLint* params); - void (QGLF_APIENTRYP getFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params); - void (QGLF_APIENTRYP getProgramiv)(GLuint program, GLenum pname, GLint* params); - void (QGLF_APIENTRYP getProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog); - void (QGLF_APIENTRYP getRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params); - void (QGLF_APIENTRYP getShaderiv)(GLuint shader, GLenum pname, GLint* params); - void (QGLF_APIENTRYP getShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog); - void (QGLF_APIENTRYP getShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); - void (QGLF_APIENTRYP getShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, char* source); - void (QGLF_APIENTRYP getUniformfv)(GLuint program, GLint location, GLfloat* params); - void (QGLF_APIENTRYP getUniformiv)(GLuint program, GLint location, GLint* params); - int (QGLF_APIENTRYP getUniformLocation)(GLuint program, const char* name); - void (QGLF_APIENTRYP getVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params); - void (QGLF_APIENTRYP getVertexAttribiv)(GLuint index, GLenum pname, GLint* params); - void (QGLF_APIENTRYP getVertexAttribPointerv)(GLuint index, GLenum pname, void** pointer); - GLboolean (QGLF_APIENTRYP isBuffer)(GLuint buffer); - GLboolean (QGLF_APIENTRYP isFramebuffer)(GLuint framebuffer); - GLboolean (QGLF_APIENTRYP isProgram)(GLuint program); - GLboolean (QGLF_APIENTRYP isRenderbuffer)(GLuint renderbuffer); - GLboolean (QGLF_APIENTRYP isShader)(GLuint shader); - void (QGLF_APIENTRYP linkProgram)(GLuint program); - void (QGLF_APIENTRYP releaseShaderCompiler)(); - void (QGLF_APIENTRYP renderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); - void (QGLF_APIENTRYP sampleCoverage)(GLclampf value, GLboolean invert); - void (QGLF_APIENTRYP shaderBinary)(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length); - void (QGLF_APIENTRYP shaderSource)(GLuint shader, GLsizei count, const char** string, const GLint* length); - void (QGLF_APIENTRYP stencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); - void (QGLF_APIENTRYP stencilMaskSeparate)(GLenum face, GLuint mask); - void (QGLF_APIENTRYP stencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); - void (QGLF_APIENTRYP uniform1f)(GLint location, GLfloat x); - void (QGLF_APIENTRYP uniform1fv)(GLint location, GLsizei count, const GLfloat* v); - void (QGLF_APIENTRYP uniform1i)(GLint location, GLint x); - void (QGLF_APIENTRYP uniform1iv)(GLint location, GLsizei count, const GLint* v); - void (QGLF_APIENTRYP uniform2f)(GLint location, GLfloat x, GLfloat y); - void (QGLF_APIENTRYP uniform2fv)(GLint location, GLsizei count, const GLfloat* v); - void (QGLF_APIENTRYP uniform2i)(GLint location, GLint x, GLint y); - void (QGLF_APIENTRYP uniform2iv)(GLint location, GLsizei count, const GLint* v); - void (QGLF_APIENTRYP uniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z); - void (QGLF_APIENTRYP uniform3fv)(GLint location, GLsizei count, const GLfloat* v); - void (QGLF_APIENTRYP uniform3i)(GLint location, GLint x, GLint y, GLint z); - void (QGLF_APIENTRYP uniform3iv)(GLint location, GLsizei count, const GLint* v); - void (QGLF_APIENTRYP uniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (QGLF_APIENTRYP uniform4fv)(GLint location, GLsizei count, const GLfloat* v); - void (QGLF_APIENTRYP uniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w); - void (QGLF_APIENTRYP uniform4iv)(GLint location, GLsizei count, const GLint* v); - void (QGLF_APIENTRYP uniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - void (QGLF_APIENTRYP uniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - void (QGLF_APIENTRYP uniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); - void (QGLF_APIENTRYP useProgram)(GLuint program); - void (QGLF_APIENTRYP validateProgram)(GLuint program); - void (QGLF_APIENTRYP vertexAttrib1f)(GLuint indx, GLfloat x); - void (QGLF_APIENTRYP vertexAttrib1fv)(GLuint indx, const GLfloat* values); - void (QGLF_APIENTRYP vertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y); - void (QGLF_APIENTRYP vertexAttrib2fv)(GLuint indx, const GLfloat* values); - void (QGLF_APIENTRYP vertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z); - void (QGLF_APIENTRYP vertexAttrib3fv)(GLuint indx, const GLfloat* values); - void (QGLF_APIENTRYP vertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void (QGLF_APIENTRYP vertexAttrib4fv)(GLuint indx, const GLfloat* values); - void (QGLF_APIENTRYP vertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); -#endif + QOpenGLFunctions *funcs; }; inline void QGLFunctions::glActiveTexture(GLenum texture) { -#if defined(QT_OPENGL_ES_2) - ::glActiveTexture(texture); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->activeTexture(texture); -#endif + d_ptr->funcs->glActiveTexture(texture); } inline void QGLFunctions::glAttachShader(GLuint program, GLuint shader) { -#if defined(QT_OPENGL_ES_2) - ::glAttachShader(program, shader); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->attachShader(program, shader); -#endif + d_ptr->funcs->glAttachShader(program, shader); } inline void QGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name) { -#if defined(QT_OPENGL_ES_2) - ::glBindAttribLocation(program, index, name); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->bindAttribLocation(program, index, name); -#endif + d_ptr->funcs->glBindAttribLocation(program, index, name); } inline void QGLFunctions::glBindBuffer(GLenum target, GLuint buffer) { -#if defined(QT_OPENGL_ES_2) - ::glBindBuffer(target, buffer); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->bindBuffer(target, buffer); -#endif + d_ptr->funcs->glBindBuffer(target, buffer); } inline void QGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer) { if (framebuffer == 0) framebuffer = QOpenGLContext::currentContext()->defaultFramebufferObject(); -#if defined(QT_OPENGL_ES_2) - ::glBindFramebuffer(target, framebuffer); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->bindFramebuffer(target, framebuffer); -#endif + d_ptr->funcs->glBindFramebuffer(target, framebuffer); } inline void QGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer) { -#if defined(QT_OPENGL_ES_2) - ::glBindRenderbuffer(target, renderbuffer); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->bindRenderbuffer(target, renderbuffer); -#endif + d_ptr->funcs->glBindRenderbuffer(target, renderbuffer); } inline void QGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { -#if defined(QT_OPENGL_ES_2) - ::glBlendColor(red, green, blue, alpha); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->blendColor(red, green, blue, alpha); -#endif + d_ptr->funcs->glBlendColor(red, green, blue, alpha); } inline void QGLFunctions::glBlendEquation(GLenum mode) { -#if defined(QT_OPENGL_ES_2) - ::glBlendEquation(mode); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->blendEquation(mode); -#endif + d_ptr->funcs->glBlendEquation(mode); } inline void QGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { -#if defined(QT_OPENGL_ES_2) - ::glBlendEquationSeparate(modeRGB, modeAlpha); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->blendEquationSeparate(modeRGB, modeAlpha); -#endif + d_ptr->funcs->glBlendEquationSeparate(modeRGB, modeAlpha); } inline void QGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { -#if defined(QT_OPENGL_ES_2) - ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); -#endif + d_ptr->funcs->glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); } -inline void QGLFunctions::glBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage) +inline void QGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage) { -#if defined(QT_OPENGL_ES_2) - ::glBufferData(target, size, data, usage); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->bufferData(target, size, data, usage); -#endif + d_ptr->funcs->glBufferData(target, size, data, usage); } -inline void QGLFunctions::glBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data) +inline void QGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data) { -#if defined(QT_OPENGL_ES_2) - ::glBufferSubData(target, offset, size, data); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->bufferSubData(target, offset, size, data); -#endif + d_ptr->funcs->glBufferSubData(target, offset, size, data); } inline GLenum QGLFunctions::glCheckFramebufferStatus(GLenum target) { -#if defined(QT_OPENGL_ES_2) - return ::glCheckFramebufferStatus(target); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->checkFramebufferStatus(target); -#endif + return d_ptr->funcs->glCheckFramebufferStatus(target); } inline void QGLFunctions::glClearDepthf(GLclampf depth) { -#ifndef QT_OPENGL_ES - ::glClearDepth(depth); -#else - ::glClearDepthf(depth); -#endif + Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); + return d_ptr->funcs->glClearDepthf(depth); } inline void QGLFunctions::glCompileShader(GLuint shader) { -#if defined(QT_OPENGL_ES_2) - ::glCompileShader(shader); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->compileShader(shader); -#endif + d_ptr->funcs->glCompileShader(shader); } inline void QGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { -#if defined(QT_OPENGL_ES_2) - ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); -#endif + d_ptr->funcs->glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); } inline void QGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { -#if defined(QT_OPENGL_ES_2) - ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); -#endif + d_ptr->funcs->glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); } inline GLuint QGLFunctions::glCreateProgram() { -#if defined(QT_OPENGL_ES_2) - return ::glCreateProgram(); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->createProgram(); -#endif + return d_ptr->funcs->glCreateProgram(); } inline GLuint QGLFunctions::glCreateShader(GLenum type) { -#if defined(QT_OPENGL_ES_2) - return ::glCreateShader(type); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->createShader(type); -#endif + return d_ptr->funcs->glCreateShader(type); } inline void QGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers) { -#if defined(QT_OPENGL_ES_2) - ::glDeleteBuffers(n, buffers); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->deleteBuffers(n, buffers); -#endif + d_ptr->funcs->glDeleteBuffers(n, buffers); } inline void QGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { -#if defined(QT_OPENGL_ES_2) - ::glDeleteFramebuffers(n, framebuffers); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->deleteFramebuffers(n, framebuffers); -#endif + d_ptr->funcs->glDeleteFramebuffers(n, framebuffers); } inline void QGLFunctions::glDeleteProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) - ::glDeleteProgram(program); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->deleteProgram(program); -#endif + d_ptr->funcs->glDeleteProgram(program); } inline void QGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { -#if defined(QT_OPENGL_ES_2) - ::glDeleteRenderbuffers(n, renderbuffers); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->deleteRenderbuffers(n, renderbuffers); -#endif + d_ptr->funcs->glDeleteRenderbuffers(n, renderbuffers); } inline void QGLFunctions::glDeleteShader(GLuint shader) { -#if defined(QT_OPENGL_ES_2) - ::glDeleteShader(shader); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->deleteShader(shader); -#endif + d_ptr->funcs->glDeleteShader(shader); } inline void QGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar) { -#ifndef QT_OPENGL_ES - ::glDepthRange(zNear, zFar); -#else - ::glDepthRangef(zNear, zFar); -#endif + Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); + return d_ptr->funcs->glDepthRangef(zNear, zFar); } inline void QGLFunctions::glDetachShader(GLuint program, GLuint shader) { -#if defined(QT_OPENGL_ES_2) - ::glDetachShader(program, shader); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->detachShader(program, shader); -#endif + d_ptr->funcs->glDetachShader(program, shader); } inline void QGLFunctions::glDisableVertexAttribArray(GLuint index) { -#if defined(QT_OPENGL_ES_2) - ::glDisableVertexAttribArray(index); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->disableVertexAttribArray(index); -#endif + d_ptr->funcs->glDisableVertexAttribArray(index); } inline void QGLFunctions::glEnableVertexAttribArray(GLuint index) { -#if defined(QT_OPENGL_ES_2) - ::glEnableVertexAttribArray(index); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->enableVertexAttribArray(index); -#endif + d_ptr->funcs->glEnableVertexAttribArray(index); } inline void QGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { -#if defined(QT_OPENGL_ES_2) - ::glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); -#endif + d_ptr->funcs->glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); } inline void QGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { -#if defined(QT_OPENGL_ES_2) - ::glFramebufferTexture2D(target, attachment, textarget, texture, level); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->framebufferTexture2D(target, attachment, textarget, texture, level); -#endif + d_ptr->funcs->glFramebufferTexture2D(target, attachment, textarget, texture, level); } inline void QGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers) { -#if defined(QT_OPENGL_ES_2) - ::glGenBuffers(n, buffers); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->genBuffers(n, buffers); -#endif + d_ptr->funcs->glGenBuffers(n, buffers); } inline void QGLFunctions::glGenerateMipmap(GLenum target) { -#if defined(QT_OPENGL_ES_2) - ::glGenerateMipmap(target); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->generateMipmap(target); -#endif + d_ptr->funcs->glGenerateMipmap(target); } inline void QGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers) { -#if defined(QT_OPENGL_ES_2) - ::glGenFramebuffers(n, framebuffers); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->genFramebuffers(n, framebuffers); -#endif + d_ptr->funcs->glGenFramebuffers(n, framebuffers); } inline void QGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) { -#if defined(QT_OPENGL_ES_2) - ::glGenRenderbuffers(n, renderbuffers); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->genRenderbuffers(n, renderbuffers); -#endif + d_ptr->funcs->glGenRenderbuffers(n, renderbuffers); } inline void QGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { -#if defined(QT_OPENGL_ES_2) - ::glGetActiveAttrib(program, index, bufsize, length, size, type, name); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getActiveAttrib(program, index, bufsize, length, size, type, name); -#endif + d_ptr->funcs->glGetActiveAttrib(program, index, bufsize, length, size, type, name); } inline void QGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { -#if defined(QT_OPENGL_ES_2) - ::glGetActiveUniform(program, index, bufsize, length, size, type, name); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getActiveUniform(program, index, bufsize, length, size, type, name); -#endif + d_ptr->funcs->glGetActiveUniform(program, index, bufsize, length, size, type, name); } inline void QGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { -#if defined(QT_OPENGL_ES_2) - ::glGetAttachedShaders(program, maxcount, count, shaders); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getAttachedShaders(program, maxcount, count, shaders); -#endif + d_ptr->funcs->glGetAttachedShaders(program, maxcount, count, shaders); } inline int QGLFunctions::glGetAttribLocation(GLuint program, const char* name) { -#if defined(QT_OPENGL_ES_2) - return ::glGetAttribLocation(program, name); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->getAttribLocation(program, name); -#endif + return d_ptr->funcs->glGetAttribLocation(program, name); } inline void QGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) - ::glGetBufferParameteriv(target, pname, params); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getBufferParameteriv(target, pname, params); -#endif + d_ptr->funcs->glGetBufferParameteriv(target, pname, params); } inline void QGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) - ::glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getFramebufferAttachmentParameteriv(target, attachment, pname, params); -#endif + d_ptr->funcs->glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); } inline void QGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) - ::glGetProgramiv(program, pname, params); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getProgramiv(program, pname, params); -#endif + d_ptr->funcs->glGetProgramiv(program, pname, params); } inline void QGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { -#if defined(QT_OPENGL_ES_2) - ::glGetProgramInfoLog(program, bufsize, length, infolog); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getProgramInfoLog(program, bufsize, length, infolog); -#endif + d_ptr->funcs->glGetProgramInfoLog(program, bufsize, length, infolog); } inline void QGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) - ::glGetRenderbufferParameteriv(target, pname, params); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getRenderbufferParameteriv(target, pname, params); -#endif + d_ptr->funcs->glGetRenderbufferParameteriv(target, pname, params); } inline void QGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) - ::glGetShaderiv(shader, pname, params); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getShaderiv(shader, pname, params); -#endif + d_ptr->funcs->glGetShaderiv(shader, pname, params); } inline void QGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { -#if defined(QT_OPENGL_ES_2) - ::glGetShaderInfoLog(shader, bufsize, length, infolog); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getShaderInfoLog(shader, bufsize, length, infolog); -#endif + d_ptr->funcs->glGetShaderInfoLog(shader, bufsize, length, infolog); } inline void QGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { -#if defined(QT_OPENGL_ES_2) - ::glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getShaderPrecisionFormat(shadertype, precisiontype, range, precision); -#endif + d_ptr->funcs->glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); } inline void QGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { -#if defined(QT_OPENGL_ES_2) - ::glGetShaderSource(shader, bufsize, length, source); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getShaderSource(shader, bufsize, length, source); -#endif + d_ptr->funcs->glGetShaderSource(shader, bufsize, length, source); } inline void QGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params) { -#if defined(QT_OPENGL_ES_2) - ::glGetUniformfv(program, location, params); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getUniformfv(program, location, params); -#endif + d_ptr->funcs->glGetUniformfv(program, location, params); } inline void QGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params) { -#if defined(QT_OPENGL_ES_2) - ::glGetUniformiv(program, location, params); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getUniformiv(program, location, params); -#endif + d_ptr->funcs->glGetUniformiv(program, location, params); } inline int QGLFunctions::glGetUniformLocation(GLuint program, const char* name) { -#if defined(QT_OPENGL_ES_2) - return ::glGetUniformLocation(program, name); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->getUniformLocation(program, name); -#endif + return d_ptr->funcs->glGetUniformLocation(program, name); } inline void QGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { -#if defined(QT_OPENGL_ES_2) - ::glGetVertexAttribfv(index, pname, params); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getVertexAttribfv(index, pname, params); -#endif + d_ptr->funcs->glGetVertexAttribfv(index, pname, params); } inline void QGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { -#if defined(QT_OPENGL_ES_2) - ::glGetVertexAttribiv(index, pname, params); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getVertexAttribiv(index, pname, params); -#endif + d_ptr->funcs->glGetVertexAttribiv(index, pname, params); } inline void QGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) { -#if defined(QT_OPENGL_ES_2) - ::glGetVertexAttribPointerv(index, pname, pointer); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->getVertexAttribPointerv(index, pname, pointer); -#endif + d_ptr->funcs->glGetVertexAttribPointerv(index, pname, pointer); } inline GLboolean QGLFunctions::glIsBuffer(GLuint buffer) { -#if defined(QT_OPENGL_ES_2) - return ::glIsBuffer(buffer); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->isBuffer(buffer); -#endif + return d_ptr->funcs->glIsBuffer(buffer); } inline GLboolean QGLFunctions::glIsFramebuffer(GLuint framebuffer) { -#if defined(QT_OPENGL_ES_2) - return ::glIsFramebuffer(framebuffer); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->isFramebuffer(framebuffer); -#endif + return d_ptr->funcs->glIsFramebuffer(framebuffer); } inline GLboolean QGLFunctions::glIsProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) - return ::glIsProgram(program); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->isProgram(program); -#endif + return d_ptr->funcs->glIsProgram(program); } inline GLboolean QGLFunctions::glIsRenderbuffer(GLuint renderbuffer) { -#if defined(QT_OPENGL_ES_2) - return ::glIsRenderbuffer(renderbuffer); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->isRenderbuffer(renderbuffer); -#endif + return d_ptr->funcs->glIsRenderbuffer(renderbuffer); } inline GLboolean QGLFunctions::glIsShader(GLuint shader) { -#if defined(QT_OPENGL_ES_2) - return ::glIsShader(shader); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - return d_ptr->isShader(shader); -#endif + return d_ptr->funcs->glIsShader(shader); } inline void QGLFunctions::glLinkProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) - ::glLinkProgram(program); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->linkProgram(program); -#endif + d_ptr->funcs->glLinkProgram(program); } inline void QGLFunctions::glReleaseShaderCompiler() { -#if defined(QT_OPENGL_ES_2) - ::glReleaseShaderCompiler(); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->releaseShaderCompiler(); -#endif + d_ptr->funcs->glReleaseShaderCompiler(); } inline void QGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { -#if defined(QT_OPENGL_ES_2) - ::glRenderbufferStorage(target, internalformat, width, height); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->renderbufferStorage(target, internalformat, width, height); -#endif + d_ptr->funcs->glRenderbufferStorage(target, internalformat, width, height); } inline void QGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert) { -#if defined(QT_OPENGL_ES_2) - ::glSampleCoverage(value, invert); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->sampleCoverage(value, invert); -#endif + d_ptr->funcs->glSampleCoverage(value, invert); } inline void QGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length) { -#if defined(QT_OPENGL_ES_2) - ::glShaderBinary(n, shaders, binaryformat, binary, length); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->shaderBinary(n, shaders, binaryformat, binary, length); -#endif + d_ptr->funcs->glShaderBinary(n, shaders, binaryformat, binary, length); } inline void QGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) { -#if defined(QT_OPENGL_ES_2) - ::glShaderSource(shader, count, string, length); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->shaderSource(shader, count, string, length); -#endif + d_ptr->funcs->glShaderSource(shader, count, string, length); } inline void QGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { -#if defined(QT_OPENGL_ES_2) - ::glStencilFuncSeparate(face, func, ref, mask); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->stencilFuncSeparate(face, func, ref, mask); -#endif + d_ptr->funcs->glStencilFuncSeparate(face, func, ref, mask); } inline void QGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask) { -#if defined(QT_OPENGL_ES_2) - ::glStencilMaskSeparate(face, mask); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->stencilMaskSeparate(face, mask); -#endif + d_ptr->funcs->glStencilMaskSeparate(face, mask); } inline void QGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { -#if defined(QT_OPENGL_ES_2) - ::glStencilOpSeparate(face, fail, zfail, zpass); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->stencilOpSeparate(face, fail, zfail, zpass); -#endif + d_ptr->funcs->glStencilOpSeparate(face, fail, zfail, zpass); } inline void QGLFunctions::glUniform1f(GLint location, GLfloat x) { -#if defined(QT_OPENGL_ES_2) - ::glUniform1f(location, x); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform1f(location, x); -#endif + d_ptr->funcs->glUniform1f(location, x); } inline void QGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v) { -#if defined(QT_OPENGL_ES_2) - ::glUniform1fv(location, count, v); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform1fv(location, count, v); -#endif + d_ptr->funcs->glUniform1fv(location, count, v); } inline void QGLFunctions::glUniform1i(GLint location, GLint x) { -#if defined(QT_OPENGL_ES_2) - ::glUniform1i(location, x); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform1i(location, x); -#endif + d_ptr->funcs->glUniform1i(location, x); } inline void QGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v) { -#if defined(QT_OPENGL_ES_2) - ::glUniform1iv(location, count, v); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform1iv(location, count, v); -#endif + d_ptr->funcs->glUniform1iv(location, count, v); } inline void QGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y) { -#if defined(QT_OPENGL_ES_2) - ::glUniform2f(location, x, y); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform2f(location, x, y); -#endif + d_ptr->funcs->glUniform2f(location, x, y); } inline void QGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v) { -#if defined(QT_OPENGL_ES_2) - ::glUniform2fv(location, count, v); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform2fv(location, count, v); -#endif + d_ptr->funcs->glUniform2fv(location, count, v); } inline void QGLFunctions::glUniform2i(GLint location, GLint x, GLint y) { -#if defined(QT_OPENGL_ES_2) - ::glUniform2i(location, x, y); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform2i(location, x, y); -#endif + d_ptr->funcs->glUniform2i(location, x, y); } inline void QGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v) { -#if defined(QT_OPENGL_ES_2) - ::glUniform2iv(location, count, v); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform2iv(location, count, v); -#endif + d_ptr->funcs->glUniform2iv(location, count, v); } inline void QGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { -#if defined(QT_OPENGL_ES_2) - ::glUniform3f(location, x, y, z); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform3f(location, x, y, z); -#endif + d_ptr->funcs->glUniform3f(location, x, y, z); } inline void QGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v) { -#if defined(QT_OPENGL_ES_2) - ::glUniform3fv(location, count, v); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform3fv(location, count, v); -#endif + d_ptr->funcs->glUniform3fv(location, count, v); } inline void QGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z) { -#if defined(QT_OPENGL_ES_2) - ::glUniform3i(location, x, y, z); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform3i(location, x, y, z); -#endif + d_ptr->funcs->glUniform3i(location, x, y, z); } inline void QGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v) { -#if defined(QT_OPENGL_ES_2) - ::glUniform3iv(location, count, v); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform3iv(location, count, v); -#endif + d_ptr->funcs->glUniform3iv(location, count, v); } inline void QGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { -#if defined(QT_OPENGL_ES_2) - ::glUniform4f(location, x, y, z, w); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform4f(location, x, y, z, w); -#endif + d_ptr->funcs->glUniform4f(location, x, y, z, w); } inline void QGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v) { -#if defined(QT_OPENGL_ES_2) - ::glUniform4fv(location, count, v); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform4fv(location, count, v); -#endif + d_ptr->funcs->glUniform4fv(location, count, v); } inline void QGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { -#if defined(QT_OPENGL_ES_2) - ::glUniform4i(location, x, y, z, w); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform4i(location, x, y, z, w); -#endif + d_ptr->funcs->glUniform4i(location, x, y, z, w); } inline void QGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v) { -#if defined(QT_OPENGL_ES_2) - ::glUniform4iv(location, count, v); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniform4iv(location, count, v); -#endif + d_ptr->funcs->glUniform4iv(location, count, v); } inline void QGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { -#if defined(QT_OPENGL_ES_2) - ::glUniformMatrix2fv(location, count, transpose, value); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniformMatrix2fv(location, count, transpose, value); -#endif + d_ptr->funcs->glUniformMatrix2fv(location, count, transpose, value); } inline void QGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { -#if defined(QT_OPENGL_ES_2) - ::glUniformMatrix3fv(location, count, transpose, value); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniformMatrix3fv(location, count, transpose, value); -#endif + d_ptr->funcs->glUniformMatrix3fv(location, count, transpose, value); } inline void QGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { -#if defined(QT_OPENGL_ES_2) - ::glUniformMatrix4fv(location, count, transpose, value); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->uniformMatrix4fv(location, count, transpose, value); -#endif + d_ptr->funcs->glUniformMatrix4fv(location, count, transpose, value); } inline void QGLFunctions::glUseProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) - ::glUseProgram(program); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->useProgram(program); -#endif + d_ptr->funcs->glUseProgram(program); } inline void QGLFunctions::glValidateProgram(GLuint program) { -#if defined(QT_OPENGL_ES_2) - ::glValidateProgram(program); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->validateProgram(program); -#endif + d_ptr->funcs->glValidateProgram(program); } inline void QGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x) { -#if defined(QT_OPENGL_ES_2) - ::glVertexAttrib1f(indx, x); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->vertexAttrib1f(indx, x); -#endif + d_ptr->funcs->glVertexAttrib1f(indx, x); } inline void QGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values) { -#if defined(QT_OPENGL_ES_2) - ::glVertexAttrib1fv(indx, values); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->vertexAttrib1fv(indx, values); -#endif + d_ptr->funcs->glVertexAttrib1fv(indx, values); } inline void QGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { -#if defined(QT_OPENGL_ES_2) - ::glVertexAttrib2f(indx, x, y); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->vertexAttrib2f(indx, x, y); -#endif + d_ptr->funcs->glVertexAttrib2f(indx, x, y); } inline void QGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values) { -#if defined(QT_OPENGL_ES_2) - ::glVertexAttrib2fv(indx, values); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->vertexAttrib2fv(indx, values); -#endif + d_ptr->funcs->glVertexAttrib2fv(indx, values); } inline void QGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { -#if defined(QT_OPENGL_ES_2) - ::glVertexAttrib3f(indx, x, y, z); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->vertexAttrib3f(indx, x, y, z); -#endif + d_ptr->funcs->glVertexAttrib3f(indx, x, y, z); } inline void QGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values) { -#if defined(QT_OPENGL_ES_2) - ::glVertexAttrib3fv(indx, values); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->vertexAttrib3fv(indx, values); -#endif + d_ptr->funcs->glVertexAttrib3fv(indx, values); } inline void QGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { -#if defined(QT_OPENGL_ES_2) - ::glVertexAttrib4f(indx, x, y, z, w); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->vertexAttrib4f(indx, x, y, z, w); -#endif + d_ptr->funcs->glVertexAttrib4f(indx, x, y, z, w); } inline void QGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values) { -#if defined(QT_OPENGL_ES_2) - ::glVertexAttrib4fv(indx, values); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->vertexAttrib4fv(indx, values); -#endif + d_ptr->funcs->glVertexAttrib4fv(indx, values); } inline void QGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { -#if defined(QT_OPENGL_ES_2) - ::glVertexAttribPointer(indx, size, type, normalized, stride, ptr); -#else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); - d_ptr->vertexAttribPointer(indx, size, type, normalized, stride, ptr); -#endif + d_ptr->funcs->glVertexAttribPointer(indx, size, type, normalized, stride, ptr); } #ifndef GL_ACTIVE_ATTRIBUTE_MAX_LENGTH From b2216bbe06b8be2bef6d8bc2ffff1337f6d23358 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 6 Mar 2014 14:21:53 +0100 Subject: [PATCH 109/172] do not use fileno calls in forked child This fixes an issue that causes QProcess::start to silently fail on OS X 10.9. Apparently, fileno(stdout) locks the handle on OS X 10.9. It may happen that the parent process fflush()s stdout while the child has just been forked. The stdout lock of the parent is never released in the child and fileno(stdout) therefore locks forever. According to the fork documentation on opengroup.org one may only call async-signal-safe functions between fork and exec in the child. The fileno() function does not appear in the list of async-signal-safe functions. Also, fileno(stdout) and friends can be easily replaced by the standard constants STDOUT_FILENO etc. Done-with: Fawzi Mohamed Task-number: QTBUG-37306 Change-Id: I2b1f5f47cc48a1ad020fb0493a955d2bc27aeb47 Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess_unix.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 4076ec58558..0e917ef4385 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -880,18 +880,18 @@ void QProcessPrivate::execChild(const char *workingDir, char **path, char **argv // copy the stdin socket if asked to (without closing on exec) if (inputChannelMode != QProcess::ForwardedInputChannel) - qt_safe_dup2(stdinChannel.pipe[0], fileno(stdin), 0); + qt_safe_dup2(stdinChannel.pipe[0], STDIN_FILENO, 0); // copy the stdout and stderr if asked to if (processChannelMode != QProcess::ForwardedChannels) { if (processChannelMode != QProcess::ForwardedOutputChannel) - qt_safe_dup2(stdoutChannel.pipe[1], fileno(stdout), 0); + qt_safe_dup2(stdoutChannel.pipe[1], STDOUT_FILENO, 0); // merge stdout and stderr if asked to if (processChannelMode == QProcess::MergedChannels) { - qt_safe_dup2(fileno(stdout), fileno(stderr), 0); + qt_safe_dup2(STDOUT_FILENO, STDERR_FILENO, 0); } else if (processChannelMode != QProcess::ForwardedErrorChannel) { - qt_safe_dup2(stderrChannel.pipe[1], fileno(stderr), 0); + qt_safe_dup2(stderrChannel.pipe[1], STDERR_FILENO, 0); } } From 73adb7892634d8be69f475750337a3adce9cf002 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 24 Feb 2014 16:07:40 +0100 Subject: [PATCH 110/172] Cocoa: create QCocoaMimeTypes for Cocoa-only mime-types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prepare to move qmacmime out of the cocoa port and into QPlatformSupport for sharing with iOS. This patch will start by moving tiff out, since it depends too much on old carbon image manipulation code that will not compile on iOS (depends on ApplicationServices etc). Change-Id: Id7a9b919c8f51fa9beb2f4ee2f13cca96894f6a6 Reviewed-by: Tor Arne Vestbø Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/cocoa.pro | 4 +- .../platforms/cocoa/qcocoaintegration.mm | 2 + src/plugins/platforms/cocoa/qcocoamimetypes.h | 57 +++++++ .../platforms/cocoa/qcocoamimetypes.mm | 144 ++++++++++++++++++ src/plugins/platforms/cocoa/qmacmime.mm | 93 ----------- 5 files changed, 206 insertions(+), 94 deletions(-) create mode 100644 src/plugins/platforms/cocoa/qcocoamimetypes.h create mode 100644 src/plugins/platforms/cocoa/qcocoamimetypes.mm diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index a2fd8c0613c..505fde9f968 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -40,6 +40,7 @@ OBJECTIVE_SOURCES += main.mm \ qcocoasystemtrayicon.mm \ qcocoaintrospection.mm \ qcocoakeymapper.mm \ + qcocoamimetypes.mm SOURCES += messages.cpp @@ -77,7 +78,8 @@ HEADERS += qcocoaintegration.h \ qcocoasystemtrayicon.h \ qcocoaintrospection.h \ qcocoakeymapper.h \ - messages.h + messages.h \ + qcocoamimetypes.h RESOURCES += qcocoaresources.qrc diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index dff7c9bd500..9a53e660f5e 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -53,6 +53,7 @@ #include "qcocoatheme.h" #include "qcocoainputcontext.h" #include "qmacmime.h" +#include "qcocoamimetypes.h" #include "qcocoaaccessibility.h" #include @@ -274,6 +275,7 @@ QCocoaIntegration::QCocoaIntegration() updateScreens(); QMacInternalPasteboardMime::initializeMimeTypes(); + QCocoaMimeTypes::initializeMimeTypes(); } QCocoaIntegration::~QCocoaIntegration() diff --git a/src/plugins/platforms/cocoa/qcocoamimetypes.h b/src/plugins/platforms/cocoa/qcocoamimetypes.h new file mode 100644 index 00000000000..7b55e385252 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoamimetypes.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOCOAMIMETYPES_H +#define QCOCOAMIMETYPES_H + +#include + +QT_BEGIN_NAMESPACE + +class QCocoaMimeTypes +{ +public: + static void initializeMimeTypes(); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/cocoa/qcocoamimetypes.mm b/src/plugins/platforms/cocoa/qcocoamimetypes.mm new file mode 100644 index 00000000000..d3cd0e3b52b --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoamimetypes.mm @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcocoamimetypes.h" +#include "qmacmime.h" +#include "qcocoahelpers.h" + +QT_BEGIN_NAMESPACE + +class QMacPasteboardMimeTiff : public QMacInternalPasteboardMime { +public: + QMacPasteboardMimeTiff() : QMacInternalPasteboardMime(MIME_ALL) { } + QString convertorName(); + + QString flavorFor(const QString &mime); + QString mimeFor(QString flav); + bool canConvert(const QString &mime, QString flav); + QVariant convertToMime(const QString &mime, QList data, QString flav); + QList convertFromMime(const QString &mime, QVariant data, QString flav); +}; + +QString QMacPasteboardMimeTiff::convertorName() +{ + return QLatin1String("Tiff"); +} + +QString QMacPasteboardMimeTiff::flavorFor(const QString &mime) +{ + if (mime.startsWith(QLatin1String("application/x-qt-image"))) + return QLatin1String("public.tiff"); + return QString(); +} + +QString QMacPasteboardMimeTiff::mimeFor(QString flav) +{ + if (flav == QLatin1String("public.tiff")) + return QLatin1String("application/x-qt-image"); + return QString(); +} + +bool QMacPasteboardMimeTiff::canConvert(const QString &mime, QString flav) +{ + return flav == QLatin1String("public.tiff") && mime == QLatin1String("application/x-qt-image"); +} + +QVariant QMacPasteboardMimeTiff::convertToMime(const QString &mime, QList data, QString flav) +{ + if (data.count() > 1) + qWarning("QMacPasteboardMimeTiff: Cannot handle multiple member data"); + QVariant ret; + if (!canConvert(mime, flav)) + return ret; + const QByteArray &a = data.first(); + QCFType image; + QCFType tiffData = CFDataCreateWithBytesNoCopy(0, + reinterpret_cast(a.constData()), + a.size(), kCFAllocatorNull); + QCFType imageSource = CGImageSourceCreateWithData(tiffData, 0); + image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0); + if (image != 0) + ret = QVariant(qt_mac_toQImage(image)); + return ret; +} + +QList QMacPasteboardMimeTiff::convertFromMime(const QString &mime, QVariant variant, QString flav) +{ + QList ret; + if (!canConvert(mime, flav)) + return ret; + + QImage img = qvariant_cast(variant); + QCFType cgimage = qt_mac_toCGImage(img); + + QCFType data = CFDataCreateMutable(0, 0); + QCFType imageDestination = CGImageDestinationCreateWithData(data, kUTTypeTIFF, 1, 0); + if (imageDestination != 0) { + CFTypeRef keys[2]; + QCFType values[2]; + QCFType options; + keys[0] = kCGImagePropertyPixelWidth; + keys[1] = kCGImagePropertyPixelHeight; + int width = img.width(); + int height = img.height(); + values[0] = CFNumberCreate(0, kCFNumberIntType, &width); + values[1] = CFNumberCreate(0, kCFNumberIntType, &height); + options = CFDictionaryCreate(0, reinterpret_cast(keys), + reinterpret_cast(values), 2, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CGImageDestinationAddImage(imageDestination, cgimage, options); + CGImageDestinationFinalize(imageDestination); + } + QByteArray ar(CFDataGetLength(data), 0); + CFDataGetBytes(data, + CFRangeMake(0, ar.size()), + reinterpret_cast(ar.data())); + ret.append(ar); + return ret; +} + +void QCocoaMimeTypes::initializeMimeTypes() +{ + new QMacPasteboardMimeTiff; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qmacmime.mm b/src/plugins/platforms/cocoa/qmacmime.mm index 4274e178f7b..bcc4618712a 100644 --- a/src/plugins/platforms/cocoa/qmacmime.mm +++ b/src/plugins/platforms/cocoa/qmacmime.mm @@ -503,98 +503,6 @@ QList QMacPasteboardMimeHTMLText::convertFromMime(const QString &mim return ret; } -class QMacPasteboardMimeTiff : public QMacInternalPasteboardMime { -public: - QMacPasteboardMimeTiff() : QMacInternalPasteboardMime(MIME_ALL) { } - QString convertorName(); - - QString flavorFor(const QString &mime); - QString mimeFor(QString flav); - bool canConvert(const QString &mime, QString flav); - QVariant convertToMime(const QString &mime, QList data, QString flav); - QList convertFromMime(const QString &mime, QVariant data, QString flav); -}; - -QString QMacPasteboardMimeTiff::convertorName() -{ - return QLatin1String("Tiff"); -} - -QString QMacPasteboardMimeTiff::flavorFor(const QString &mime) -{ - if (mime.startsWith(QLatin1String("application/x-qt-image"))) - return QLatin1String("public.tiff"); - return QString(); -} - -QString QMacPasteboardMimeTiff::mimeFor(QString flav) -{ - if (flav == QLatin1String("public.tiff")) - return QLatin1String("application/x-qt-image"); - return QString(); -} - -bool QMacPasteboardMimeTiff::canConvert(const QString &mime, QString flav) -{ - return flav == QLatin1String("public.tiff") && mime == QLatin1String("application/x-qt-image"); -} - -QVariant QMacPasteboardMimeTiff::convertToMime(const QString &mime, QList data, QString flav) -{ - if (data.count() > 1) - qWarning("QMacPasteboardMimeTiff: Cannot handle multiple member data"); - QVariant ret; - if (!canConvert(mime, flav)) - return ret; - const QByteArray &a = data.first(); - QCFType image; - QCFType tiffData = CFDataCreateWithBytesNoCopy(0, - reinterpret_cast(a.constData()), - a.size(), kCFAllocatorNull); - QCFType imageSource = CGImageSourceCreateWithData(tiffData, 0); - image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0); - if (image != 0) - ret = QVariant(qt_mac_toQImage(image)); - return ret; -} - -QList QMacPasteboardMimeTiff::convertFromMime(const QString &mime, QVariant variant, QString flav) -{ - QList ret; - if (!canConvert(mime, flav)) - return ret; - - QImage img = qvariant_cast(variant); - QCFType cgimage = qt_mac_toCGImage(img); - - QCFType data = CFDataCreateMutable(0, 0); - QCFType imageDestination = CGImageDestinationCreateWithData(data, kUTTypeTIFF, 1, 0); - if (imageDestination != 0) { - CFTypeRef keys[2]; - QCFType values[2]; - QCFType options; - keys[0] = kCGImagePropertyPixelWidth; - keys[1] = kCGImagePropertyPixelHeight; - int width = img.width(); - int height = img.height(); - values[0] = CFNumberCreate(0, kCFNumberIntType, &width); - values[1] = CFNumberCreate(0, kCFNumberIntType, &height); - options = CFDictionaryCreate(0, reinterpret_cast(keys), - reinterpret_cast(values), 2, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - CGImageDestinationAddImage(imageDestination, cgimage, options); - CGImageDestinationFinalize(imageDestination); - } - QByteArray ar(CFDataGetLength(data), 0); - CFDataGetBytes(data, - CFRangeMake(0, ar.size()), - reinterpret_cast(ar.data())); - ret.append(ar); - return ret; -} - - class QMacPasteboardMimeFileUri : public QMacInternalPasteboardMime { public: QMacPasteboardMimeFileUri() : QMacInternalPasteboardMime(MIME_ALL) { } @@ -816,7 +724,6 @@ void QMacInternalPasteboardMime::initializeMimeTypes() new QMacPasteboardMimeAny; //standard types that we wrap - new QMacPasteboardMimeTiff; new QMacPasteboardMimeUnicodeText; new QMacPasteboardMimePlainText; new QMacPasteboardMimeHTMLText; From 35ca2b85af9691f1f9663eeb9c496d5bf59b4a11 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 26 Feb 2014 13:41:10 +0100 Subject: [PATCH 111/172] Cocoa: remove qmacmime includes where not needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id20df8b80f3064ac0d193124fb790a075a89e53c Reviewed-by: Tor Arne Vestbø Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaclipboard.mm | 1 - src/plugins/platforms/cocoa/qcocoadrag.mm | 1 - src/plugins/platforms/cocoa/qcocoaintegration.mm | 1 - src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 1 - src/plugins/platforms/cocoa/qmacclipboard.mm | 1 - src/plugins/platforms/cocoa/qnsview.mm | 1 - 6 files changed, 6 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaclipboard.mm b/src/plugins/platforms/cocoa/qcocoaclipboard.mm index a49ff902a56..f6c424d4fdb 100644 --- a/src/plugins/platforms/cocoa/qcocoaclipboard.mm +++ b/src/plugins/platforms/cocoa/qcocoaclipboard.mm @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qcocoaclipboard.h" -#include "qmacmime.h" #include "qmacclipboard.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 5d7f53ee5dd..2c8d391d2be 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qcocoadrag.h" -#include "qmacmime.h" #include "qmacclipboard.h" #include "qcocoahelpers.h" diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 9a53e660f5e..1892a5b6bf7 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -52,7 +52,6 @@ #include "qcocoafiledialoghelper.h" #include "qcocoatheme.h" #include "qcocoainputcontext.h" -#include "qmacmime.h" #include "qcocoamimetypes.h" #include "qcocoaaccessibility.h" diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index f4776342de0..5e57200ebc1 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -44,7 +44,6 @@ #include "qcocoawindow.h" #include "qcocoamenu.h" #include "qcocoamenubar.h" -#include "qmacmime.h" #include "qcocoahelpers.h" #include "qcocoaapplication.h" #include "qcocoaintegration.h" diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index 9ccf41fbf43..9368b658664 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -51,7 +51,6 @@ #include #include #include "qcocoahelpers.h" -#include "qmacmime.h" #include "qcocoaautoreleasepool.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index fcca96a8a87..90d56bc3f31 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -49,7 +49,6 @@ #include "qcocoaautoreleasepool.h" #include "qmultitouch_mac_p.h" #include "qcocoadrag.h" -#include "qmacmime.h" #include #include From 6de7a96405f3f2ae5b22a2525b9f65e22ef6e210 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 26 Feb 2014 13:43:35 +0100 Subject: [PATCH 112/172] Cocoa: remove old carbon code from qmacmime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prepare qmacmime to be moved to platform support by removing unused includes and function declarations and other dependencies on carbon or cocoa. Also remove unneeded QCFString convertions, and use UTI strings directly (fetched from apple docs) rather than querying the system. Change-Id: I8f622664c13f3fd05862720c3658cfc1b59baf28 Reviewed-by: Tor Arne Vestbø Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qmacmime.mm | 47 +++++-------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/src/plugins/platforms/cocoa/qmacmime.mm b/src/plugins/platforms/cocoa/qmacmime.mm index bcc4618712a..a9f4c57d6d7 100644 --- a/src/plugins/platforms/cocoa/qmacmime.mm +++ b/src/plugins/platforms/cocoa/qmacmime.mm @@ -40,28 +40,10 @@ ****************************************************************************/ #include "qmacmime.h" -#include "qcocoahelpers.h" -#include "qmacclipboard.h" - -#include "qdebug.h" -#include "qpixmap.h" -#include "qimagewriter.h" -#include "qimagereader.h" -#include "qdatastream.h" -#include "qbuffer.h" -#include "qdatetime.h" #include "qguiapplication.h" -#include "qtextcodec.h" -#include "qregexp.h" -#include "qurl.h" -#include "qmap.h" - -#include QT_BEGIN_NAMESPACE -extern CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imagePtr = 0); // qpaintengine_mac.cpp - typedef QList MimeList; Q_GLOBAL_STATIC(MimeList, globalMimeList) Q_GLOBAL_STATIC(QStringList, globalDraggedTypesList) @@ -108,13 +90,6 @@ const QStringList& qt_mac_enabledDraggedTypes() *****************************************************************************/ //#define DEBUG_MIME_MAPS -//functions -extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp -extern void qt_mac_from_pascal_string(QString, Str255, TextEncoding encoding=0, int len=-1); //qglobal.cpp - -ScrapFlavorType qt_mac_mime_type = 'CUTE'; -CFStringRef qt_mac_mime_typeUTI = CFSTR("com.pasteboard.trolltech.marker"); - /*! \class QMacPasteboardMime \brief The QMacPasteboardMime class converts between a MIME type and a @@ -303,7 +278,7 @@ QVariant QMacPasteboardMimeTypeName::convertToMime(const QString &, QList QMacPasteboardMimeTypeName::convertFromMime(const QString &, QVariant, QString) { QList ret; - ret.append(QString("x-qt-mime-type-name").toUtf8()); + ret.append(QString(QLatin1String("x-qt-mime-type-name")).toUtf8()); return ret; } @@ -349,11 +324,10 @@ QVariant QMacPasteboardMimePlainText::convertToMime(const QString &mimetype, QLi qWarning("QMacPasteboardMimePlainText: Cannot handle multiple member data"); const QByteArray &firstData = data.first(); QVariant ret; - if (flavor == QCFString(QLatin1String("com.apple.traditional-mac-plain-text"))) { - QCFString str(CFStringCreateWithBytes(kCFAllocatorDefault, + if (flavor == QLatin1String("com.apple.traditional-mac-plain-text")) { + return QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault, reinterpret_cast(firstData.constData()), firstData.size(), CFStringGetSystemEncoding(), false)); - ret = QString(str); } else { qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype)); } @@ -364,7 +338,7 @@ QList QMacPasteboardMimePlainText::convertFromMime(const QString &, { QList ret; QString string = data.toString(); - if (flavor == QCFString(QLatin1String("com.apple.traditional-mac-plain-text"))) + if (flavor == QLatin1String("com.apple.traditional-mac-plain-text")) ret.append(string.toLatin1()); return ret; } @@ -425,10 +399,9 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q // I can only handle two types (system and unicode) so deal with them that way QVariant ret; if (flavor == QLatin1String("public.utf8-plain-text")) { - QCFString str(CFStringCreateWithBytes(kCFAllocatorDefault, + ret = QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault, reinterpret_cast(firstData.constData()), firstData.size(), CFStringGetSystemEncoding(), false)); - ret = QString(str); } else if (flavor == QLatin1String("public.utf16-plain-text")) { ret = QString(reinterpret_cast(firstData.constData()), firstData.size() / sizeof(QChar)); @@ -524,21 +497,20 @@ QString QMacPasteboardMimeFileUri::convertorName() QString QMacPasteboardMimeFileUri::flavorFor(const QString &mime) { if (mime == QLatin1String("text/uri-list")) - return QCFString(UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, CFSTR("furl"), 0)); + return QLatin1String("public.file-url"); return QString(); } QString QMacPasteboardMimeFileUri::mimeFor(QString flav) { - if (flav == QCFString(UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, CFSTR("furl"), 0))) + if (flav == QLatin1String("public.file-url")) return QLatin1String("text/uri-list"); return QString(); } bool QMacPasteboardMimeFileUri::canConvert(const QString &mime, QString flav) { - return mime == QLatin1String("text/uri-list") - && flav == QCFString(UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, CFSTR("furl"), 0)); + return mime == QLatin1String("text/uri-list") && flav == QLatin1String("public.file-url"); } QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList data, QString flav) @@ -670,7 +642,7 @@ public: QString QMacPasteboardMimeVCard::convertorName() { - return QString("VCard"); + return QLatin1String("VCard"); } bool QMacPasteboardMimeVCard::canConvert(const QString &mime, QString flav) @@ -710,7 +682,6 @@ QList QMacPasteboardMimeVCard::convertFromMime(const QString &mime, return ret; } - /*! \internal From 15c9fb401316991f4c26ff883c078648614ce6af Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 26 Feb 2014 13:58:26 +0100 Subject: [PATCH 113/172] Cocoa/Platformsupport: move qmacmime from cocoa to platformsupport Share qmacmime with iOS Change-Id: Ied1b6ed74f2d63ef34d818554827a6165651b6a1 Reviewed-by: Richard Moe Gustavsen --- src/platformsupport/clipboard/clipboard.pri | 5 +++++ .../cocoa => platformsupport/clipboard}/qmacmime.mm | 2 +- .../qmacmime.h => platformsupport/clipboard/qmacmime_p.h} | 0 src/platformsupport/platformsupport.pro | 1 + src/plugins/platforms/cocoa/cocoa.pro | 2 -- src/plugins/platforms/cocoa/qcocoamimetypes.mm | 2 +- src/plugins/platforms/cocoa/qmacclipboard.h | 2 +- 7 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 src/platformsupport/clipboard/clipboard.pri rename src/{plugins/platforms/cocoa => platformsupport/clipboard}/qmacmime.mm (99%) rename src/{plugins/platforms/cocoa/qmacmime.h => platformsupport/clipboard/qmacmime_p.h} (100%) diff --git a/src/platformsupport/clipboard/clipboard.pri b/src/platformsupport/clipboard/clipboard.pri new file mode 100644 index 00000000000..2532430f1e1 --- /dev/null +++ b/src/platformsupport/clipboard/clipboard.pri @@ -0,0 +1,5 @@ +mac { + HEADERS += $$PWD/qmacmime_p.h + OBJECTIVE_SOURCES += $$PWD/qmacmime.mm +} + diff --git a/src/plugins/platforms/cocoa/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm similarity index 99% rename from src/plugins/platforms/cocoa/qmacmime.mm rename to src/platformsupport/clipboard/qmacmime.mm index a9f4c57d6d7..adddabb7df1 100644 --- a/src/plugins/platforms/cocoa/qmacmime.mm +++ b/src/platformsupport/clipboard/qmacmime.mm @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmacmime.h" +#include "qmacmime_p.h" #include "qguiapplication.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qmacmime.h b/src/platformsupport/clipboard/qmacmime_p.h similarity index 100% rename from src/plugins/platforms/cocoa/qmacmime.h rename to src/platformsupport/clipboard/qmacmime_p.h diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index f5291ab2161..5b4d2b1fb35 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -19,5 +19,6 @@ include(devicediscovery/devicediscovery.pri) include(services/services.pri) include(themes/themes.pri) include(linuxaccessibility/linuxaccessibility.pri) +include(clipboard/clipboard.pri) load(qt_module) diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 505fde9f968..d8cd32255ca 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -33,7 +33,6 @@ OBJECTIVE_SOURCES += main.mm \ qcocoaclipboard.mm \ qcocoadrag.mm \ qmacclipboard.mm \ - qmacmime.mm \ qcocoasystemsettings.mm \ qcocoainputcontext.mm \ qcocoaservices.mm \ @@ -71,7 +70,6 @@ HEADERS += qcocoaintegration.h \ qcocoaclipboard.h \ qcocoadrag.h \ qmacclipboard.h \ - qmacmime.h \ qcocoasystemsettings.h \ qcocoainputcontext.h \ qcocoaservices.h \ diff --git a/src/plugins/platforms/cocoa/qcocoamimetypes.mm b/src/plugins/platforms/cocoa/qcocoamimetypes.mm index d3cd0e3b52b..05d4c19112e 100644 --- a/src/plugins/platforms/cocoa/qcocoamimetypes.mm +++ b/src/plugins/platforms/cocoa/qcocoamimetypes.mm @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qcocoamimetypes.h" -#include "qmacmime.h" +#include #include "qcocoahelpers.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qmacclipboard.h b/src/plugins/platforms/cocoa/qmacclipboard.h index d8e588e36bf..ddaa61a84d6 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.h +++ b/src/plugins/platforms/cocoa/qmacclipboard.h @@ -43,7 +43,7 @@ #define QMACCLIPBOARD_H #include -#include "qmacmime.h" +#include #undef slots From 3e89183c6709f4ac73533e85a86394f3ed30c445 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 14 Feb 2014 14:24:28 +0100 Subject: [PATCH 114/172] qmacmime: bugfix unicode::canConvert The UnicodeText converter is a bit special since it can convert to both utf8 and utf16 for text/plain. But since flavorFor("text/plain") can only return one UTI, it returns utf16. And this means that canConvert will return false if given utf8 as argument. On iOS this is often the only format available on the pasteboard, which means that pasting text from another app app will fail. This patch will ensure that it returns true for both utf8 and utf16. Change-Id: I31697f1815c19113393a8ef48f2ead4d7f1078ec Reviewed-by: Richard Moe Gustavsen --- src/platformsupport/clipboard/qmacmime.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm index adddabb7df1..93d897503b6 100644 --- a/src/platformsupport/clipboard/qmacmime.mm +++ b/src/platformsupport/clipboard/qmacmime.mm @@ -388,7 +388,8 @@ QString QMacPasteboardMimeUnicodeText::mimeFor(QString flav) bool QMacPasteboardMimeUnicodeText::canConvert(const QString &mime, QString flav) { - return flavorFor(mime) == flav; + return (mime == QLatin1String("text/plain") + && (flav == QLatin1String("public.utf8-plain-text") || (flav == QLatin1String("public.utf16-plain-text")))); } QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, QList data, QString flavor) From b1bdeba086327e165ac990b9a28aaa65a9d67134 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 12 Feb 2014 13:37:37 +0100 Subject: [PATCH 115/172] iOS: implement clipboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will implement support for copy/paste operations inside, and between, applications. Change-Id: I50031b89bdb07f106950dc90fb8b1accbd1191bb Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/ios.pro | 6 +- src/plugins/platforms/ios/qiosclipboard.h | 68 ++++++ src/plugins/platforms/ios/qiosclipboard.mm | 238 +++++++++++++++++++ src/plugins/platforms/ios/qiosintegration.h | 2 + src/plugins/platforms/ios/qiosintegration.mm | 13 + 5 files changed, 325 insertions(+), 2 deletions(-) create mode 100644 src/plugins/platforms/ios/qiosclipboard.h create mode 100644 src/plugins/platforms/ios/qiosclipboard.mm diff --git a/src/plugins/platforms/ios/ios.pro b/src/plugins/platforms/ios/ios.pro index 175cc3f8bde..b7e074b95a2 100644 --- a/src/plugins/platforms/ios/ios.pro +++ b/src/plugins/platforms/ios/ios.pro @@ -21,7 +21,8 @@ OBJECTIVE_SOURCES = \ qiosinputcontext.mm \ qiostheme.mm \ qiosglobal.mm \ - qiosservices.mm + qiosservices.mm \ + qiosclipboard.mm HEADERS = \ qiosintegration.h \ @@ -37,7 +38,8 @@ HEADERS = \ qiostheme.h \ qiosglobal.h \ qiosservices.h \ - quiview.h + quiview.h \ + qiosclipboard.h OTHER_FILES = \ quiview_textinput.mm diff --git a/src/plugins/platforms/ios/qiosclipboard.h b/src/plugins/platforms/ios/qiosclipboard.h new file mode 100644 index 00000000000..da4226a40da --- /dev/null +++ b/src/plugins/platforms/ios/qiosclipboard.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIOSCLIPBOARD_H +#define QIOSCLIPBOARD_H + +#import + +#include + +@class QUIClipboard; + +QT_BEGIN_NAMESPACE + +class QIOSClipboard : public QPlatformClipboard +{ +public: + QIOSClipboard(); + QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; + void setMimeData(QMimeData *mimeData, QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE; + bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; + bool ownsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE; + +private: + QUIClipboard *m_clipboard; +}; + +QT_END_NAMESPACE + +#endif // QIOSCLIPBOARD_H diff --git a/src/plugins/platforms/ios/qiosclipboard.mm b/src/plugins/platforms/ios/qiosclipboard.mm new file mode 100644 index 00000000000..0a7b34a2166 --- /dev/null +++ b/src/plugins/platforms/ios/qiosclipboard.mm @@ -0,0 +1,238 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qiosclipboard.h" + +#include +#include +#include + +@interface UIPasteboard (QUIPasteboard) + + (UIPasteboard *)pasteboardWithQClipboardMode:(QClipboard::Mode)mode; +@end + +@implementation UIPasteboard (QUIPasteboard) ++ (UIPasteboard *)pasteboardWithQClipboardMode:(QClipboard::Mode)mode +{ + NSString *name = (mode == QClipboard::Clipboard) ? UIPasteboardNameGeneral : UIPasteboardNameFind; + return [UIPasteboard pasteboardWithName:name create:NO]; +} +@end + +// -------------------------------------------------------------------- + +@interface QUIClipboard : NSObject +{ +@public + QIOSClipboard *m_qiosClipboard; + NSInteger m_changeCountClipboard; + NSInteger m_changeCountFindBuffer; +} +@end + +@implementation QUIClipboard + +-(id)initWithQIOSClipboard:(QIOSClipboard *)qiosClipboard +{ + self = [super init]; + if (self) { + m_qiosClipboard = qiosClipboard; + m_changeCountClipboard = [UIPasteboard pasteboardWithQClipboardMode:QClipboard::Clipboard].changeCount; + m_changeCountFindBuffer = [UIPasteboard pasteboardWithQClipboardMode:QClipboard::FindBuffer].changeCount; + + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(updatePasteboardChanged:) + name:UIPasteboardChangedNotification object:nil]; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(updatePasteboardChanged:) + name:UIPasteboardRemovedNotification object:nil]; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(updatePasteboardChanged:) + name:UIApplicationDidBecomeActiveNotification + object:nil]; + } + return self; +} + +-(void)dealloc +{ + [[NSNotificationCenter defaultCenter] + removeObserver:self + name:UIPasteboardChangedNotification object:nil]; + [[NSNotificationCenter defaultCenter] + removeObserver:self + name:UIPasteboardRemovedNotification object:nil]; + [[NSNotificationCenter defaultCenter] + removeObserver:self + name:UIApplicationDidBecomeActiveNotification + object:nil]; + [super dealloc]; +} + +- (void)updatePasteboardChanged:(NSNotification *)notification +{ + Q_UNUSED(notification); + NSInteger changeCountClipboard = [UIPasteboard pasteboardWithQClipboardMode:QClipboard::Clipboard].changeCount; + NSInteger changeCountFindBuffer = [UIPasteboard pasteboardWithQClipboardMode:QClipboard::FindBuffer].changeCount; + + if (m_changeCountClipboard != changeCountClipboard) { + m_changeCountClipboard = changeCountClipboard; + m_qiosClipboard->emitChanged(QClipboard::Clipboard); + } + + if (m_changeCountFindBuffer != changeCountFindBuffer) { + m_changeCountFindBuffer = changeCountFindBuffer; + m_qiosClipboard->emitChanged(QClipboard::FindBuffer); + } +} + +@end + +// -------------------------------------------------------------------- + +QT_BEGIN_NAMESPACE + +class QIOSMimeData : public QMimeData { +public: + QIOSMimeData(QClipboard::Mode mode) : QMimeData(), m_mode(mode) { } + ~QIOSMimeData() { } + + QStringList formats() const Q_DECL_OVERRIDE; + QVariant retrieveData(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE; + +private: + const QClipboard::Mode m_mode; +}; + +QStringList QIOSMimeData::formats() const +{ + QStringList foundMimeTypes; + UIPasteboard *pb = [UIPasteboard pasteboardWithQClipboardMode:m_mode]; + NSArray *pasteboardTypes = [pb pasteboardTypes]; + + for (NSUInteger i = 0; i < [pasteboardTypes count]; ++i) { + QString uti = QString::fromNSString([pasteboardTypes objectAtIndex:i]); + QString mimeType = QMacInternalPasteboardMime::flavorToMime(QMacInternalPasteboardMime::MIME_ALL, uti); + if (!mimeType.isEmpty() && !foundMimeTypes.contains(mimeType)) + foundMimeTypes << mimeType; + } + + return foundMimeTypes; +} + +QVariant QIOSMimeData::retrieveData(const QString &mimeType, QVariant::Type) const +{ + UIPasteboard *pb = [UIPasteboard pasteboardWithQClipboardMode:m_mode]; + NSArray *pasteboardTypes = [pb pasteboardTypes]; + + foreach (QMacInternalPasteboardMime *converter, + QMacInternalPasteboardMime::all(QMacInternalPasteboardMime::MIME_ALL)) { + if (!converter->canConvert(mimeType, converter->flavorFor(mimeType))) + continue; + + for (NSUInteger i = 0; i < [pasteboardTypes count]; ++i) { + NSString *availableUtiNSString = [pasteboardTypes objectAtIndex:i]; + QString availableUti = QString::fromNSString(availableUtiNSString); + if (!converter->canConvert(mimeType, availableUti)) + continue; + + NSData *nsData = [pb dataForPasteboardType:availableUtiNSString]; + QList dataList; + dataList << QByteArray(reinterpret_cast([nsData bytes]), [nsData length]); + return converter->convertToMime(mimeType, dataList, availableUti); + } + } + + return QVariant(); +} + +// -------------------------------------------------------------------- + +QIOSClipboard::QIOSClipboard() + : m_clipboard([[QUIClipboard alloc] initWithQIOSClipboard:this]) +{ +} + +QMimeData *QIOSClipboard::mimeData(QClipboard::Mode mode) +{ + Q_ASSERT(supportsMode(mode)); + return new QIOSMimeData(mode); +} + +void QIOSClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) +{ + Q_ASSERT(supportsMode(mode)); + + UIPasteboard *pb = [UIPasteboard pasteboardWithQClipboardMode:mode]; + NSMutableDictionary *pbItem = [NSMutableDictionary dictionaryWithCapacity:mimeData->formats().size()]; + + foreach (const QString &mimeType, mimeData->formats()) { + foreach (QMacInternalPasteboardMime *converter, + QMacInternalPasteboardMime::all(QMacInternalPasteboardMime::MIME_ALL)) { + QString uti = converter->flavorFor(mimeType); + if (uti.isEmpty() || !converter->canConvert(mimeType, uti)) + continue; + + QByteArray byteArray = converter->convertFromMime(mimeType, mimeData->data(mimeType), uti).first(); + NSData *nsData = [NSData dataWithBytes:byteArray.constData() length:byteArray.size()]; + [pbItem setValue:nsData forKey:uti.toNSString()]; + break; + } + } + + pb.items = [NSArray arrayWithObject:pbItem]; +} + +bool QIOSClipboard::supportsMode(QClipboard::Mode mode) const +{ + return (mode == QClipboard::Clipboard || mode == QClipboard::FindBuffer); +} + +bool QIOSClipboard::ownsMode(QClipboard::Mode mode) const +{ + Q_UNUSED(mode); + return false; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index c655d8d3bf0..a28926ff991 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -66,6 +66,7 @@ public: QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; QPlatformFontDatabase *fontDatabase() const; + QPlatformClipboard *clipboard() const; QPlatformInputContext *inputContext() const; QPlatformServices *services() const Q_DECL_OVERRIDE; @@ -82,6 +83,7 @@ public: QTouchDevice *touchDevice(); private: QPlatformFontDatabase *m_fontDatabase; + QPlatformClipboard *m_clipboard; QPlatformInputContext *m_inputContext; QPlatformScreen *m_screen; QTouchDevice *m_touchDevice; diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 660da6397fe..7a40e349c9f 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -46,11 +46,13 @@ #include "qiosbackingstore.h" #include "qiosscreen.h" #include "qioscontext.h" +#include "qiosclipboard.h" #include "qiosinputcontext.h" #include "qiostheme.h" #include "qiosservices.h" #include +#include #include #include @@ -59,6 +61,7 @@ QT_BEGIN_NAMESPACE QIOSIntegration::QIOSIntegration() : m_fontDatabase(new QCoreTextFontDatabase) + , m_clipboard(new QIOSClipboard) , m_inputContext(new QIOSInputContext) , m_screen(new QIOSScreen(QIOSScreen::MainScreen)) , m_platformServices(new QIOSServices) @@ -81,6 +84,7 @@ QIOSIntegration::QIOSIntegration() m_touchDevice->setType(QTouchDevice::TouchScreen); m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::NormalizedPosition); QWindowSystemInterface::registerTouchDevice(m_touchDevice); + QMacInternalPasteboardMime::initializeMimeTypes(); } QIOSIntegration::~QIOSIntegration() @@ -88,6 +92,10 @@ QIOSIntegration::~QIOSIntegration() delete m_fontDatabase; m_fontDatabase = 0; + delete m_clipboard; + m_clipboard = 0; + QMacInternalPasteboardMime::destroyMimeTypes(); + delete m_inputContext; m_inputContext = 0; @@ -149,6 +157,11 @@ QPlatformFontDatabase * QIOSIntegration::fontDatabase() const return m_fontDatabase; } +QPlatformClipboard *QIOSIntegration::clipboard() const +{ + return m_clipboard; +} + QPlatformInputContext *QIOSIntegration::inputContext() const { return m_inputContext; From 63608e4e3257cf08526c19c3d7d627b5cb74db14 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Thu, 20 Feb 2014 17:31:02 +0100 Subject: [PATCH 116/172] BlackBerry: Implement the dark palette This patch only implements the dark palette and returns it by default. Change-Id: Ieab39c2d5c8f35b9479719b78843b13355c5f123 Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxtheme.cpp | 26 +++++++++++++++++++++++++ src/plugins/platforms/qnx/qqnxtheme.h | 5 +++++ 2 files changed, 31 insertions(+) diff --git a/src/plugins/platforms/qnx/qqnxtheme.cpp b/src/plugins/platforms/qnx/qqnxtheme.cpp index 37c10794419..d91dd812100 100644 --- a/src/plugins/platforms/qnx/qqnxtheme.cpp +++ b/src/plugins/platforms/qnx/qqnxtheme.cpp @@ -49,6 +49,23 @@ QT_BEGIN_NAMESPACE QQnxTheme::QQnxTheme(const QQnxIntegration *integration) : m_integration(integration) { + // Set the dark theme as default palette + QColor color = QColor(211, 211, 211); + m_defaultPalette.setBrush(QPalette::ButtonText, color); + m_defaultPalette.setBrush(QPalette::WindowText, color); + m_defaultPalette.setBrush(QPalette::Text, color); + + color.setAlpha(179); + m_defaultPalette.setBrush(QPalette::Disabled, QPalette::ButtonText, color); + m_defaultPalette.setBrush(QPalette::Disabled, QPalette::WindowText, color); + m_defaultPalette.setBrush(QPalette::Disabled, QPalette::Text, color); + + m_defaultPalette.setColor(QPalette::Window, QColor(18, 18, 18)); + m_defaultPalette.setColor(QPalette::Base, QColor(18, 18, 18)); + m_defaultPalette.setColor(QPalette::AlternateBase, QColor(50, 50, 50)); + + m_defaultPalette.setBrush(QPalette::Highlight, QColor(0, 168, 223)); + m_defaultPalette.setBrush(QPalette::HighlightedText, QColor(250, 250,250)); } QQnxTheme::~QQnxTheme() @@ -96,4 +113,13 @@ const QFont *QQnxTheme::font(Font type) const return m_fonts.value(type, 0); } +const QPalette *QQnxTheme::palette(Palette type) const +{ + // Return the default palette + if (type == SystemPalette) + return &m_defaultPalette; + + return QPlatformTheme::palette(type); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxtheme.h b/src/plugins/platforms/qnx/qqnxtheme.h index 17b2eab1422..8698ab36a13 100644 --- a/src/plugins/platforms/qnx/qqnxtheme.h +++ b/src/plugins/platforms/qnx/qqnxtheme.h @@ -49,6 +49,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE class QQnxIntegration; @@ -66,9 +68,12 @@ public: const QFont *font(Font type = SystemFont) const; + const QPalette *palette(Palette type = SystemPalette) const; + private: mutable QHash m_fonts; const QQnxIntegration *m_integration; + QPalette m_defaultPalette; }; QT_END_NAMESPACE From f0257cc1fd38af671d34384e56401069008fd68a Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Fri, 28 Feb 2014 20:57:45 +0100 Subject: [PATCH 117/172] Blackberry: Change name from QQnxTheme to QBlackberryTheme Change-Id: Ia30a18c988986f8c20bc4e4475c5e24b06493035 Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto --- .../qnx/{qqnxtheme.cpp => qblackberrytheme.cpp} | 14 +++++++------- .../qnx/{qqnxtheme.h => qblackberrytheme.h} | 12 ++++++------ src/plugins/platforms/qnx/qnx.pro | 4 ++-- src/plugins/platforms/qnx/qqnxintegration.cpp | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) rename src/plugins/platforms/qnx/{qqnxtheme.cpp => qblackberrytheme.cpp} (89%) rename src/plugins/platforms/qnx/{qqnxtheme.h => qblackberrytheme.h} (92%) diff --git a/src/plugins/platforms/qnx/qqnxtheme.cpp b/src/plugins/platforms/qnx/qblackberrytheme.cpp similarity index 89% rename from src/plugins/platforms/qnx/qqnxtheme.cpp rename to src/plugins/platforms/qnx/qblackberrytheme.cpp index d91dd812100..a0f334d9094 100644 --- a/src/plugins/platforms/qnx/qqnxtheme.cpp +++ b/src/plugins/platforms/qnx/qblackberrytheme.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qqnxtheme.h" +#include "qblackberrytheme.h" #include "qqnxfiledialoghelper.h" #include "qqnxsystemsettings.h" @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE -QQnxTheme::QQnxTheme(const QQnxIntegration *integration) : m_integration(integration) +QBlackberryTheme::QBlackberryTheme(const QQnxIntegration *integration) : m_integration(integration) { // Set the dark theme as default palette QColor color = QColor(211, 211, 211); @@ -68,12 +68,12 @@ QQnxTheme::QQnxTheme(const QQnxIntegration *integration) : m_integration(integra m_defaultPalette.setBrush(QPalette::HighlightedText, QColor(250, 250,250)); } -QQnxTheme::~QQnxTheme() +QBlackberryTheme::~QBlackberryTheme() { qDeleteAll(m_fonts); } -bool QQnxTheme::usePlatformNativeDialog(DialogType type) const +bool QBlackberryTheme::usePlatformNativeDialog(DialogType type) const { if (type == QPlatformTheme::FileDialog) return true; @@ -88,7 +88,7 @@ bool QQnxTheme::usePlatformNativeDialog(DialogType type) const return false; } -QPlatformDialogHelper *QQnxTheme::createPlatformDialogHelper(DialogType type) const +QPlatformDialogHelper *QBlackberryTheme::createPlatformDialogHelper(DialogType type) const { switch (type) { case QPlatformTheme::FileDialog: @@ -104,7 +104,7 @@ QPlatformDialogHelper *QQnxTheme::createPlatformDialogHelper(DialogType type) co } } -const QFont *QQnxTheme::font(Font type) const +const QFont *QBlackberryTheme::font(Font type) const { QPlatformFontDatabase *fontDatabase = m_integration->fontDatabase(); @@ -113,7 +113,7 @@ const QFont *QQnxTheme::font(Font type) const return m_fonts.value(type, 0); } -const QPalette *QQnxTheme::palette(Palette type) const +const QPalette *QBlackberryTheme::palette(Palette type) const { // Return the default palette if (type == SystemPalette) diff --git a/src/plugins/platforms/qnx/qqnxtheme.h b/src/plugins/platforms/qnx/qblackberrytheme.h similarity index 92% rename from src/plugins/platforms/qnx/qqnxtheme.h rename to src/plugins/platforms/qnx/qblackberrytheme.h index 8698ab36a13..29fa0b8f612 100644 --- a/src/plugins/platforms/qnx/qqnxtheme.h +++ b/src/plugins/platforms/qnx/qblackberrytheme.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QQNXTHEME_H -#define QQNXTHEME_H +#ifndef QBLACKBERRYTHEME_H +#define QBLACKBERRYTHEME_H #include @@ -55,11 +55,11 @@ QT_BEGIN_NAMESPACE class QQnxIntegration; -class QQnxTheme : public QPlatformTheme +class QBlackberryTheme : public QPlatformTheme { public: - explicit QQnxTheme(const QQnxIntegration *); - ~QQnxTheme(); + explicit QBlackberryTheme(const QQnxIntegration *); + ~QBlackberryTheme(); static QString name() { return QStringLiteral("blackberry"); } @@ -78,4 +78,4 @@ private: QT_END_NAMESPACE -#endif // QQNXTHEME_H +#endif // QBLACKBERRYTHEME_H diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro index 2399a91c122..04c6087cd11 100644 --- a/src/plugins/platforms/qnx/qnx.pro +++ b/src/plugins/platforms/qnx/qnx.pro @@ -91,14 +91,14 @@ CONFIG(blackberry) { qqnxeventdispatcher_blackberry.cpp \ qqnxbpseventfilter.cpp \ qqnxvirtualkeyboardbps.cpp \ - qqnxtheme.cpp \ + qblackberrytheme.cpp \ qqnxsystemsettings.cpp HEADERS += qqnxnavigatorbps.h \ qqnxeventdispatcher_blackberry.h \ qqnxbpseventfilter.h \ qqnxvirtualkeyboardbps.h \ - qqnxtheme.h \ + qblackberrytheme.h \ qqnxsystemsettings.h \ qqnxfiledialoghelper.h diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index dd321163602..43045f99d19 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -63,7 +63,7 @@ #if defined(Q_OS_BLACKBERRY) #include "qqnxbpseventfilter.h" #include "qqnxnavigatorbps.h" -#include "qqnxtheme.h" +#include "qblackberrytheme.h" #include "qqnxvirtualkeyboardbps.h" #elif defined(QQNX_PPS) #include "qqnxnavigatorpps.h" @@ -462,14 +462,14 @@ QPlatformServices * QQnxIntegration::services() const #if defined(Q_OS_BLACKBERRY) QStringList QQnxIntegration::themeNames() const { - return QStringList(QQnxTheme::name()); + return QStringList(QBlackberryTheme::name()); } QPlatformTheme *QQnxIntegration::createPlatformTheme(const QString &name) const { qIntegrationDebug() << Q_FUNC_INFO << "name =" << name; - if (name == QQnxTheme::name()) - return new QQnxTheme(this); + if (name == QBlackberryTheme::name()) + return new QBlackberryTheme(this); return QPlatformIntegration::createPlatformTheme(name); } #endif From e9ce4fcffa3459774e69f712f81a6a0a542dbcd8 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 6 Mar 2014 18:53:39 +0100 Subject: [PATCH 118/172] Remove usage of QT_NO_SHAPE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First of all QT_NO_SHAPE was never set in configure script, which means that !contains(DEFINES, QT_NO_SHAPE):LIBS += -lxcb-shape always was true and we were linking to -lxcb-shape no matter what. Secondly, we are providing shape.c in qtbase/src/3rdparty/xcb/libxcb, so users always have an -qt-xcb option available to get this extension. Change-Id: I7d14a0ac5ca6e36fb9c053225916cae41028b532 Reviewed-by: Uli Schlachter Reviewed-by: Jørgen Lind --- configure | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 8 +------- src/plugins/platforms/xcb/qxcbwindow.h | 3 --- src/plugins/platforms/xcb/xcb-plugin.pro | 3 +-- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 64edc1571f5..0f47ff96687 100755 --- a/configure +++ b/configure @@ -5231,7 +5231,7 @@ if [ "$CFG_XCB" != "no" ]; then CFG_XCB="system" if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then - XCB_PACKAGES="xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm" + XCB_PACKAGES="xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm xcb-shape" QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags $XCB_PACKAGES 2>/dev/null`" QMAKE_LIBS_XCB="`$PKG_CONFIG --libs $XCB_PACKAGES 2>/dev/null`" # for xcb-xkb tests diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 29f71e69729..aabcb84a080 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -64,9 +64,7 @@ #include #undef class #include -#ifndef QT_NO_SHAPE -# include -#endif // QT_NO_SHAPE +#include // xcb-icccm 3.8 support #ifdef XCB_ICCCM_NUM_WM_SIZE_HINTS_ELEMENTS @@ -2077,8 +2075,6 @@ void QXcbWindow::handleXEmbedMessage(const xcb_client_message_event_t *event) } } -#if !defined(QT_NO_SHAPE) - static inline xcb_rectangle_t qRectToXCBRectangle(const QRect &r) { xcb_rectangle_t result; @@ -2123,8 +2119,6 @@ void QXcbWindow::setMask(const QRegion ®ion) } } -#endif // !QT_NO_SHAPE - void QXcbWindow::setAlertState(bool enabled) { if (m_alertState == enabled) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 45d44b213f7..a90ad7b5edf 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -114,10 +114,7 @@ public: bool startSystemResize(const QPoint &pos, Qt::Corner corner); void setOpacity(qreal level); - -#if !defined(QT_NO_SHAPE) void setMask(const QRegion ®ion); -#endif // !QT_NO_SHAPE void setAlertState(bool enabled); bool isAlertState() const { return m_alertState; } diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index a2ae7e908cf..bfbec91e3cc 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -121,8 +121,7 @@ contains(QT_CONFIG, xcb-qt) { INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude LIBS += -lxcb -L$$OUT_PWD/xcb-static -lxcb-static } else { - LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr - !contains(DEFINES, QT_NO_SHAPE):LIBS += -lxcb-shape + LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape contains(DEFINES, QT_NO_XKB) { LIBS += -lxcb-keysyms } else { From 9b33aecb9b24bcdb02c40eb5d53e770ad6777ae3 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 6 Mar 2014 16:39:30 +0100 Subject: [PATCH 119/172] Remove unused QMakeVar QT_NO_XCB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Grepping in Qt source code for QT_NO_XCB didn't find any references to this variable. Change-Id: Iabe5679f8b066facede2ac3bfc8c14ec4c0473a2 Reviewed-by: Jørgen Lind --- configure | 3 --- 1 file changed, 3 deletions(-) diff --git a/configure b/configure index 0f47ff96687..88eaf9a3fdb 100755 --- a/configure +++ b/configure @@ -5287,9 +5287,6 @@ if [ "$CFG_XCB" != "no" ]; then CFG_XCB=no fi fi -if [ "$CFG_XCB" = "no" ]; then - QMakeVar add DEFINES QT_NO_XCB -fi if [ "$CFG_DIRECTFB" != "no" ]; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists directfb 2>/dev/null; then From 625002f7067271b8f03f7bfa13baff6128c72e68 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 10:23:03 +0100 Subject: [PATCH 120/172] Build the cube opengl example both for desktop and ES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No reason to restrict it to desktop only, the code works on ES2 too. Task-number: QTBUG-35730 Change-Id: I915a88cbf3c95a941d6bafd88ed57fef0b6a25b9 Reviewed-by: Jørgen Lind --- examples/opengl/opengl.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro index 3d12d8707f4..bcf62b65515 100644 --- a/examples/opengl/opengl.pro +++ b/examples/opengl/opengl.pro @@ -14,7 +14,6 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){ } } else { SUBDIRS = 2dpainting \ - cube \ grabber \ hellogl \ overpainting \ @@ -26,6 +25,7 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){ SUBDIRS += hellowindow \ paintedwindow \ - contextinfo + contextinfo \ + cube EXAMPLE_FILES = shared From 9152a3bf205bdba0fbff9f4d070a99d7a6460761 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 13:24:16 +0100 Subject: [PATCH 121/172] Clarify QWindow::format() docs Change-Id: I35c5f9e7a235afc75c0051b3958875371f182b29 Reviewed-by: Sean Harmer --- src/gui/kernel/qwindow.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 04a2615c81a..fd9e0ad61b1 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -642,7 +642,7 @@ void QWindow::setFormat(const QSurfaceFormat &format) } /*! - Returns the requested surfaceformat of this window. + Returns the requested surface format of this window. If the requested format was not supported by the platform implementation, the requestedFormat will differ from the actual window format. @@ -662,9 +662,17 @@ QSurfaceFormat QWindow::requestedFormat() const After the window has been created, this function will return the actual surface format of the window. It might differ from the requested format if the requested format could - not be fulfilled by the platform. + not be fulfilled by the platform. It might also be a superset, for example certain + buffer sizes may be larger than requested. - \sa create(), requestedFormat() + \note Depending on the platform, certain values in this surface format may still + contain the requested values, that is, the values that have been passed to + setFormat(). Typical examples are the OpenGL version, profile and options. These may + not get updated during create() since these are context specific and a single window + may be used together with multiple contexts over its lifetime. Use the + QOpenGLContext's format() instead to query such values. + + \sa create(), requestedFormat(), QOpenGLContext::format() */ QSurfaceFormat QWindow::format() const { From ed5e75cf5bb63ce6a7cf23242715b6716c5685e3 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 13:18:34 +0100 Subject: [PATCH 122/172] Clarify QOpenGLContext::format() docs Avoid unrealistic expectations where applications would assume that requestedFormat() == format(). Change-Id: I12dcfda3d86ce26f1cae9771b1fe2203291864db Reviewed-by: Sean Harmer --- src/gui/kernel/qopenglcontext.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index f68915edebc..74771d6826d 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -885,6 +885,20 @@ QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName) cons Returns the format of the underlying platform context, if create() has been called. Otherwise, returns the requested format. + + The requested and the actual format may differ. Requesting a given OpenGL version does + not mean the resulting context will target exactly the requested version. It is only + guaranteed that the version/profile/options combination for the created context is + compatible with the request, as long as the driver is able to provide such a context. + + For example, requesting an OpenGL version 3.x core profile context may result in an + OpenGL 4.x core profile context. Similarly, a request for OpenGL 2.1 may result in an + OpenGL 3.0 context with deprecated functions enabled. Finally, depending on the + driver, unsupported versions may result in either a context creation failure or in a + context for the highest supported version. + + Similar differences are possible in the buffer sizes, for example, the resulting + context may have a larger depth buffer than requested. This is perfectly normal. */ QSurfaceFormat QOpenGLContext::format() const { From 4c9d767f6ebe20188b56c51d1c9af5d193a29b6b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 12:07:25 +0100 Subject: [PATCH 123/172] Avoid asserting with QQuickWidget on Windows Change-Id: I8b4185a9725b27b3e3e0e049e3a001ed61bcf1d5 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/windows/qwindowsglcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 9bfe4e6e26a..c45c34ae4de 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -1050,7 +1050,7 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface) qCDebug(lcQpaGl) << __FUNCTION__ << this << m_windowContexts.size() << "contexts"; #endif // DEBUG_GL - Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface); + Q_ASSERT(surface->surface()->supportsOpenGL()); // Do we already have a DC entry for that window? QWindowsWindow *window = static_cast(surface); From 3a1c223a0a207c76ab28e5a948f00db92f8fabc5 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Fri, 7 Mar 2014 12:41:57 +0200 Subject: [PATCH 124/172] WinRT: Handle window exposure when visibility changes Expose events should be sent to application windows when the main view becomes visible (again). This fixes a blank screen which may occur when resuming an app from suspend. Change-Id: I33dc00482ef17cdc954a71626a8ad3cd24361a64 Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 5bbf73a9459..d3ede898655 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -984,6 +984,8 @@ HRESULT QWinRTScreen::onVisibilityChanged(ICoreWindow *window, IVisibilityChange boolean visible; args->get_Visible(&visible); QWindowSystemInterface::handleApplicationStateChanged(visible ? Qt::ApplicationActive : Qt::ApplicationHidden); + if (visible) + handleExpose(); return S_OK; } From 7625c51ef426b73a8bda5853a4bd2e2d9d3aeb55 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Fri, 7 Mar 2014 12:39:47 +0200 Subject: [PATCH 125/172] Windows Phone: Handle back-button press When the back button is pressed, send an immediate key event to the topmost window (or the application if there is no window). If it is accepted, mark the native event as accepted and send a key release event. This way, the application may call accept() on the KeyPress event for Qt::Key_Back in order to create backstepping behaviors within the app. This is in line with Android, which quits the app when the event is ignored. On Windows Phone, the default behavior occurs when the event is ignored, which is to back out of the application and leave it running in the background. Task-number: QTBUG-35951 Change-Id: I46d15478f441f73d3660370370689b2f9fa11f25 Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 37 ++++++++++++++++++++ src/plugins/platforms/winrt/qwinrtscreen.h | 13 +++++++ 2 files changed, 50 insertions(+) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index d3ede898655..2e38f81499c 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -63,6 +63,9 @@ #include #include #include +#ifdef Q_OS_WINPHONE +#include +#endif using namespace Microsoft::WRL; using namespace Microsoft::WRL::Wrappers; @@ -75,6 +78,9 @@ using namespace ABI::Windows::UI::Input; using namespace ABI::Windows::UI::ViewManagement; using namespace ABI::Windows::Devices::Input; using namespace ABI::Windows::Graphics::Display; +#ifdef Q_OS_WINPHONE +using namespace ABI::Windows::Phone::UI::Input; +#endif typedef IEventHandler ResumeHandler; typedef IEventHandler SuspendHandler; @@ -87,6 +93,9 @@ typedef ITypedEventHandler PointerHandler; typedef ITypedEventHandler SizeChangedHandler; typedef ITypedEventHandler VisibilityChangedHandler; typedef ITypedEventHandler AutomationProviderRequestedHandler; +#ifdef Q_OS_WINPHONE +typedef IEventHandler BackPressedHandler; +#endif QT_BEGIN_NAMESPACE @@ -465,6 +474,11 @@ QWinRTScreen::QWinRTScreen(ICoreWindow *window) m_coreWindow->add_PointerReleased(Callback(this, &QWinRTScreen::onPointerUpdated).Get(), &m_tokens[QEvent::MouseButtonRelease]); m_coreWindow->add_PointerWheelChanged(Callback(this, &QWinRTScreen::onPointerUpdated).Get(), &m_tokens[QEvent::Wheel]); m_coreWindow->add_SizeChanged(Callback(this, &QWinRTScreen::onSizeChanged).Get(), &m_tokens[QEvent::Resize]); +#ifdef Q_OS_WINPHONE + ComPtr hardwareButtons; + if (SUCCEEDED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Phone_UI_Input_HardwareButtons).Get(), &hardwareButtons))) + hardwareButtons->add_BackPressed(Callback(this, &QWinRTScreen::onBackButtonPressed).Get(), &m_tokens[QEvent::User]); +#endif // Q_OS_WINPHONE // Window event handlers m_coreWindow->add_Activated(Callback(this, &QWinRTScreen::onActivated).Get(), &m_tokens[QEvent::WindowActivate]); @@ -1002,4 +1016,27 @@ HRESULT QWinRTScreen::onOrientationChanged(IInspectable *) return S_OK; } +#ifdef Q_OS_WINPHONE +HRESULT QWinRTScreen::onBackButtonPressed(IInspectable *, IBackPressedEventArgs *args) +{ + QKeyEvent backPress(QEvent::KeyPress, Qt::Key_Back, Qt::NoModifier); + backPress.setAccepted(false); + + QObject *receiver = m_visibleWindows.isEmpty() + ? static_cast(QGuiApplication::instance()) + : static_cast(m_visibleWindows.first()); + + // If the event is ignored, the app will suspend + QGuiApplication::sendEvent(receiver, &backPress); + if (backPress.isAccepted()) { + args->put_Handled(true); + // If the app accepts the event, send the release for symmetry + QKeyEvent backRelease(QEvent::KeyRelease, Qt::Key_Back, Qt::NoModifier); + QGuiApplication::sendEvent(receiver, &backRelease); + } + + return S_OK; +} +#endif // Q_OS_WINPHONE + QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h index 3131f879b54..c6511e94465 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.h +++ b/src/plugins/platforms/winrt/qwinrtscreen.h @@ -80,6 +80,15 @@ namespace ABI { struct IDisplayPropertiesStatics; } } +#ifdef Q_OS_WINPHONE + namespace Phone { + namespace UI { + namespace Input { + struct IBackPressedEventArgs; + } + } + } +#endif } } struct IInspectable; @@ -149,6 +158,10 @@ private: HRESULT onOrientationChanged(IInspectable *); +#ifdef Q_OS_WINPHONE + HRESULT onBackButtonPressed(IInspectable *, ABI::Windows::Phone::UI::Input::IBackPressedEventArgs *args); +#endif + ABI::Windows::UI::Core::ICoreWindow *m_coreWindow; ABI::Windows::UI::ViewManagement::IApplicationViewStatics *m_applicationView; ABI::Windows::ApplicationModel::Core::ICoreApplication *m_application; From be81c5884549c3b97ade6e7b97cf75a076d70424 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Fri, 28 Feb 2014 23:48:24 +0100 Subject: [PATCH 126/172] Add Objective-C specific type converters to QByteArray This patch adds the Objective-C NSData/CDataRef converters to QByteArray This will replace the current converters offered in QMacExtras [ChangeLog][QtCore][Objective-C] Added NSData/CDataRef converters for QByteArray Change-Id: I7a0f14bee4271798db345f3c5efd26ac671a3ea4 Reviewed-by: Jake Petroules Reviewed-by: Thiago Macieira --- src/corelib/tools/qbytearray.cpp | 85 +++++++++++++ src/corelib/tools/qbytearray.h | 18 +++ src/corelib/tools/qbytearray_mac.mm | 101 ++++++++++++++++ src/corelib/tools/tools.pri | 3 +- .../corelib/tools/qbytearray/qbytearray.pro | 5 + .../tools/qbytearray/tst_qbytearray.cpp | 12 ++ .../tools/qbytearray/tst_qbytearray_mac.mm | 114 ++++++++++++++++++ 7 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 src/corelib/tools/qbytearray_mac.mm create mode 100644 tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 73fd6369a70..fb92d82f071 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -4186,6 +4186,91 @@ QByteArray QByteArray::fromPercentEncoding(const QByteArray &input, char percent return tmp; } +/*! \fn QByteArray QByteArray::fromCFData(CFDataRef data) + \since 5.3 + + Constructs a new QByteArray containing a copy of the CFData \a data. + + \sa fromRawCFData(), fromRawData(), toRawCFData(), toCFData() +*/ + +/*! \fn QByteArray QByteArray::fromRawCFData(CFDataRef data) + \since 5.3 + + Constructs a QByteArray that uses the bytes of the CFData \a data. + + The \a data's bytes are not copied. + + The caller guarantees that the CFData will not be deleted + or modified as long as this QByteArray object exists. + + \sa fromCFData(), fromRawData(), toRawCFData(), toCFData() +*/ + +/*! \fn CFDataRef QByteArray::toCFData() const + \since 5.3 + + Creates a CFData from a QByteArray. The caller owns the CFData object + and is responsible for releasing it. + + \sa toRawCFData(), fromCFData(), fromRawCFData(), fromRawData() +*/ + +/*! \fn CFDataRef QByteArray::toRawCFData() const + \since 5.3 + + Constructs a CFData that uses the bytes of the QByteArray. + + The QByteArray's bytes are not copied. + + The caller guarantees that the QByteArray will not be deleted + or modified as long as this CFData object exists. + + \sa toCFData(), fromRawCFData(), fromCFData(), fromRawData() +*/ + +/*! \fn QByteArray QByteArray::fromNSData(const NSData *data) + \since 5.3 + + Constructs a new QByteArray containing a copy of the NSData \a data. + + \sa fromRawNSData(), fromRawData(), toNSData(), toRawNSData() +*/ + +/*! \fn QByteArray QByteArray::fromRawNSData(const NSData *data) + \since 5.3 + + Constructs a QByteArray that uses the bytes of the NSData \a data. + + The \a data's bytes are not copied. + + The caller guarantees that the NSData will not be deleted + or modified as long as this QByteArray object exists. + + \sa fromNSData(), fromRawData(), toRawNSData(), toNSData() +*/ + +/*! \fn NSData QByteArray::toNSData() const + \since 5.3 + + Creates a NSData from a QByteArray. The NSData object is autoreleased. + + \sa fromNSData(), fromRawNSData(), fromRawData(), toRawNSData() +*/ + +/*! \fn NSData QByteArray::toRawNSData() const + \since 5.3 + + Constructs a NSData that uses the bytes of the QByteArray. + + The QByteArray's bytes are not copied. + + The caller guarantees that the QByteArray will not be deleted + or modified as long as this NSData object exists. + + \sa fromRawNSData(), fromNSData(), fromRawData(), toNSData() +*/ + static inline bool q_strchr(const char str[], char chr) { if (!str) return false; diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index ae8166db819..b0a6971964c 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -65,6 +65,12 @@ #endif +#ifdef Q_OS_MAC +Q_FORWARD_DECLARE_CF_TYPE(CFData); +# ifdef __OBJC__ +Q_FORWARD_DECLARE_OBJC_CLASS(NSData); +# endif +#endif QT_BEGIN_NAMESPACE @@ -354,6 +360,18 @@ public: static QByteArray fromHex(const QByteArray &hexEncoded); static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%'); +#if defined(Q_OS_MAC) || defined(Q_QDOC) + static QByteArray fromCFData(CFDataRef data); + static QByteArray fromRawCFData(CFDataRef data); + CFDataRef toCFData() const Q_DECL_CF_RETURNS_RETAINED; + CFDataRef toRawCFData() const Q_DECL_CF_RETURNS_RETAINED; +# if defined(__OBJC__) || defined(Q_QDOC) + static QByteArray fromNSData(const NSData *data); + static QByteArray fromRawNSData(const NSData *data); + NSData *toNSData() const Q_DECL_NS_RETURNS_AUTORELEASED; + NSData *toRawNSData() const Q_DECL_NS_RETURNS_AUTORELEASED; +# endif +#endif typedef char *iterator; typedef const char *const_iterator; diff --git a/src/corelib/tools/qbytearray_mac.mm b/src/corelib/tools/qbytearray_mac.mm new file mode 100644 index 00000000000..8bddf20dc65 --- /dev/null +++ b/src/corelib/tools/qbytearray_mac.mm @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Samuel Gaist +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qbytearray.h" + +#import + +QT_BEGIN_NAMESPACE + +QByteArray QByteArray::fromCFData(CFDataRef data) +{ + if (!data) + return QByteArray(); + + return QByteArray(reinterpret_cast(CFDataGetBytePtr(data)), CFDataGetLength(data)); +} + +QByteArray QByteArray::fromRawCFData(CFDataRef data) +{ + if (!data) + return QByteArray(); + + return QByteArray::fromRawData(reinterpret_cast(CFDataGetBytePtr(data)), CFDataGetLength(data)); +} + +CFDataRef QByteArray::toCFData() const +{ + return CFDataCreate(kCFAllocatorDefault, reinterpret_cast(data()), length()); +} + +CFDataRef QByteArray::toRawCFData() const +{ + return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast(data()), + length(), kCFAllocatorNull); +} + +QByteArray QByteArray::fromNSData(const NSData *data) +{ + if (!data) + return QByteArray(); + return QByteArray(reinterpret_cast([data bytes]), [data length]); +} + +QByteArray QByteArray::fromRawNSData(const NSData *data) +{ + if (!data) + return QByteArray(); + return QByteArray::fromRawData(reinterpret_cast([data bytes]), [data length]); +} + +NSData *QByteArray::toNSData() const +{ + return [NSData dataWithBytes:constData() length:size()]; +} + +NSData *QByteArray::toRawNSData() const +{ + // const_cast is fine here because NSData is immutable thus will never modify bytes we're giving it + return [NSData dataWithBytesNoCopy:const_cast(constData()) length:size() freeWhenDone:NO]; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 1e4a503778b..7a3dc9470c4 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -127,7 +127,8 @@ false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator SOURCES += tools/qelapsedtimer_mac.cpp OBJECTIVE_SOURCES += tools/qlocale_mac.mm \ tools/qtimezoneprivate_mac.mm \ - tools/qstring_mac.mm + tools/qstring_mac.mm \ + tools/qbytearray_mac.mm } else:blackberry { SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_blackberry.cpp tools/qtimezoneprivate_tz.cpp diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro index 4a5cfbf133b..8d2efce0bed 100644 --- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro @@ -5,3 +5,8 @@ SOURCES = tst_qbytearray.cpp TESTDATA += rfc3252.txt DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +mac { + OBJECTIVE_SOURCES += tst_qbytearray_mac.mm + LIBS += -framework Foundation +} diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index d7cc92e6c0a..b06741b23ec 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -151,6 +151,8 @@ private slots: #if defined(Q_COMPILER_LAMBDA) void literals(); #endif + + void macTypes(); }; static const struct StaticByteArrays { @@ -1980,6 +1982,16 @@ void tst_QByteArray::literals() } #endif +void tst_QByteArray::macTypes() +{ +#ifndef Q_OS_MAC + QSKIP("This is a Apple-only test"); +#else + extern void tst_QByteArray_macTypes(); // in qbytearray_mac.mm + tst_QByteArray_macTypes(); +#endif +} + const char globalChar = '1'; QTEST_MAIN(tst_QByteArray) diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm b/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm new file mode 100644 index 00000000000..63d3e6a2220 --- /dev/null +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray_mac.mm @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Samuel Gaist +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include +#include + +void tst_QByteArray_macTypes() +{ + // QByteArray <-> CFData + { + QByteArray qtByteArray("test bytearray"); + const CFDataRef cfData = qtByteArray.toCFData(); + QCOMPARE(QByteArray::fromCFData(cfData), qtByteArray); + CFRelease(cfData); + } + { + QByteArray qtByteArray("test bytearray"); + const CFDataRef cfData = qtByteArray.toCFData(); + QByteArray qtByteArrayCopy(qtByteArray); + qtByteArray = qtByteArray.toUpper(); // modify + QCOMPARE(QByteArray::fromCFData(cfData), qtByteArrayCopy); + } + // QByteArray <-> CFData Raw + { + QByteArray qtByteArray("test bytearray"); + const CFDataRef cfData = qtByteArray.toRawCFData(); + const UInt8 * cfDataPtr = CFDataGetBytePtr(cfData); + QCOMPARE(reinterpret_cast(qtByteArray.constData()), cfDataPtr); + CFRelease(cfData); + } + { + const UInt8 data[] = "cfdata test"; + const CFDataRef cfData = CFDataCreate(kCFAllocatorDefault, data, sizeof(data)); + const UInt8 * cfDataPtr = CFDataGetBytePtr(cfData); + QByteArray qtByteArray = QByteArray::fromRawCFData(cfData); + QCOMPARE(reinterpret_cast(qtByteArray.constData()), cfDataPtr); + CFRelease(cfData); + } + // QByteArray <-> NSData + { + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + QByteArray qtByteArray("test bytearray"); + const NSData *nsData = qtByteArray.toNSData(); + QCOMPARE(QByteArray::fromNSData(nsData), qtByteArray); + [autoreleasepool release]; + } + { + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + QByteArray qtByteArray("test bytearray"); + const NSData *nsData = qtByteArray.toNSData(); + QByteArray qtByteArrayCopy(qtByteArray); + qtByteArray = qtByteArray.toUpper(); // modify + QCOMPARE(QByteArray::fromNSData(nsData), qtByteArrayCopy); + [autoreleasepool release]; + } + // QByteArray <-> NSData Raw + { + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + QByteArray qtByteArray("test bytearray"); + const NSData *nsData = qtByteArray.toRawNSData(); + QCOMPARE([nsData bytes], qtByteArray.constData()); + [autoreleasepool release]; + } + { + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + const char data[] = "nsdata test"; + const NSData *nsData = [NSData dataWithBytes:data length:sizeof(data)]; + QByteArray qtByteArray = QByteArray::fromRawNSData(nsData); + QCOMPARE(qtByteArray.constData(), [nsData bytes]); + [autoreleasepool release]; + } +} From 8fdd11465cd17006a108a6f04b2fb1bf8fc5de2f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 7 Mar 2014 10:49:33 +0100 Subject: [PATCH 127/172] Destroy backingstore before window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The window is created before the backingstore, so the destruction should happen in the reverse order. Also, the backingstore is created based on a pointer to a QWindow, so the dependency is from backingstore to window. Thirdly, this fixes a crash when using QQuickWidget/QOpenGLWidget. Task-number: QTBUG-37045 Change-Id: I6e782c553fddfeef877be30ca2610aff75a425a0 Reviewed-by: Laszlo Agocs Reviewed-by: Jørgen Lind --- src/widgets/kernel/qwidget_qpa.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 174b7eb5d54..5885673591e 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -939,6 +939,12 @@ void QWidgetPrivate::createTLSysExtra() void QWidgetPrivate::deleteTLSysExtra() { if (extra && extra->topextra) { + //the qplatformbackingstore may hold a reference to the window, so the backingstore + //needs to be deleted first + extra->topextra->backingStoreTracker.destroy(); + delete extra->topextra->backingStore; + extra->topextra->backingStore = 0; + //the toplevel might have a context with a "qglcontext associated with it. We need to //delete the qglcontext before we delete the qplatformopenglcontext. //One unfortunate thing about this is that we potentially create a glContext just to @@ -950,10 +956,6 @@ void QWidgetPrivate::deleteTLSysExtra() delete extra->topextra->window; extra->topextra->window = 0; - extra->topextra->backingStoreTracker.destroy(); - delete extra->topextra->backingStore; - extra->topextra->backingStore = 0; - #ifndef QT_NO_OPENGL delete extra->topextra->shareContext; extra->topextra->shareContext = 0; From 7ef5a8528eea1419ef62dafa90b5174b48a04e6a Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 7 Mar 2014 01:51:21 +0200 Subject: [PATCH 128/172] Improve code readability Since we were requesting a multi font engine, the returned font engine must be a multi one or nothing at all. Change-Id: I1ee4e1b7c68f54c83a8c7292082d015ebfa0a8cb Reviewed-by: Pierre Rossi --- src/gui/text/qfontengine_qpa.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index e9252b328e0..90c9cbb1bb9 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -731,10 +731,9 @@ QFontEngine* QFontEngineMultiQPA::createMultiFontEngine(QFontEngine *fe, int scr QFontCache::EngineCache::Iterator it = fc->engineCache.find(key), end = fc->engineCache.end(); while (it != end && it.key() == key) { - QFontEngineMulti *cachedEngine = 0; - if (it.value().data->type() == QFontEngine::Multi) - cachedEngine = static_cast(it.value().data); - if (faceIsLocal || (cachedEngine && fe == cachedEngine->engine(0))) { + Q_ASSERT(it.value().data->type() == QFontEngine::Multi); + QFontEngineMulti *cachedEngine = static_cast(it.value().data); + if (faceIsLocal || fe == cachedEngine->engine(0)) { engine = cachedEngine; fc->updateHitCountAndTimeStamp(it.value()); break; From d1e2235553733876e97c2b65ef2e8d85889fa9ea Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 3 Mar 2014 13:32:52 -0800 Subject: [PATCH 129/172] Revert the QByteArrayList addition to Qt 5.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commits f12b0f9a38c792abb13f3e6ecff4542986a6f96b ("QByteArrayList: optimize op+"), f96f2fe3670bc8a32389795dc21b9839407465a1 ("Enable QByteArrayList tests"), and 4f23f0530a9c59400a7f3821cd2c9355801ed8cd ("new QByteArrayList class"). This class is coming back in Qt 5.4. [ChangeLog][CHANGELOG FIX] Remove the line about QByteArrayList being added. Change-Id: I890ab2b34a9b3e575512eb306d0f241143a867cf Reviewed-by: Jędrzej Nowacki --- .../doc/snippets/qbytearraylist/main.cpp | 51 ---- .../qbytearraylist/qbytearraylist.pro | 2 - src/corelib/tools/qbytearraylist.cpp | 258 ------------------ src/corelib/tools/qbytearraylist.h | 124 --------- src/corelib/tools/tools.pri | 2 - .../tools/qbytearraylist/qbytearraylist.pro | 4 - .../qbytearraylist/tst_qbytearraylist.cpp | 223 --------------- tests/auto/corelib/tools/tools.pro | 1 - 8 files changed, 665 deletions(-) delete mode 100644 src/corelib/doc/snippets/qbytearraylist/main.cpp delete mode 100644 src/corelib/doc/snippets/qbytearraylist/qbytearraylist.pro delete mode 100644 src/corelib/tools/qbytearraylist.cpp delete mode 100644 src/corelib/tools/qbytearraylist.h delete mode 100644 tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro delete mode 100644 tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp diff --git a/src/corelib/doc/snippets/qbytearraylist/main.cpp b/src/corelib/doc/snippets/qbytearraylist/main.cpp deleted file mode 100644 index 59f7af52e2a..00000000000 --- a/src/corelib/doc/snippets/qbytearraylist/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 by Southwest Research Institute (R) -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include - -int main(int, char **) -{ - QByteArray ba1, ba2, ba3; -//! [0] - QByteArrayList longerList = (QByteArrayList() << ba1 << ba2 << ba3); -//! [0] -} diff --git a/src/corelib/doc/snippets/qbytearraylist/qbytearraylist.pro b/src/corelib/doc/snippets/qbytearraylist/qbytearraylist.pro deleted file mode 100644 index 87397b491d0..00000000000 --- a/src/corelib/doc/snippets/qbytearraylist/qbytearraylist.pro +++ /dev/null @@ -1,2 +0,0 @@ -QT = core -SOURCES = main.cpp diff --git a/src/corelib/tools/qbytearraylist.cpp b/src/corelib/tools/qbytearraylist.cpp deleted file mode 100644 index 817342d6825..00000000000 --- a/src/corelib/tools/qbytearraylist.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 by Southwest Research Institute (R) -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -QT_BEGIN_NAMESPACE - -/*! \typedef QByteArrayListIterator - \relates QByteArrayList - - The QByteArrayListIterator type definition provides a Java-style const - iterator for QByteArrayList. - - QByteArrayList provides both \l{Java-style iterators} and - \l{STL-style iterators}. The Java-style const iterator is simply - a type definition for QListIterator. - - \sa QMutableByteArrayListIterator, QByteArrayList::const_iterator -*/ - -/*! \typedef QMutableByteArrayListIterator - \relates QByteArrayList - - The QByteArrayListIterator type definition provides a Java-style - non-const iterator for QByteArrayList. - - QByteArrayList provides both \l{Java-style iterators} and - \l{STL-style iterators}. The Java-style non-const iterator is - simply a type definition for QMutableListIterator. - - \sa QByteArrayListIterator, QByteArrayList::iterator -*/ - -/*! - \class QByteArrayList - \inmodule QtCore - \since 5.3 - \brief The QByteArrayList class provides a list of byte arrays. - - \ingroup tools - \ingroup shared - \ingroup string-processing - - \reentrant - - QByteArrayList inherits from QList. Like QList, QByteArrayList is - \l{implicitly shared}. It provides fast index-based access as well as fast - insertions and removals. Passing string lists as value parameters is both - fast and safe. - - All of QList's functionality also applies to QByteArrayList. For example, you - can use isEmpty() to test whether the list is empty, and you can call - functions like append(), prepend(), insert(), replace(), removeAll(), - removeAt(), removeFirst(), removeLast(), and removeOne() to modify a - QByteArrayList. In addition, QByteArrayList provides several join() - methods for concatenating the list into a single QByteArray. - - The purpose of QByteArrayList is quite different from that of QStringList. - Whereas QStringList has many methods for manipulation of elements within - the list, QByteArrayList does not. - Normally, QStringList should be used whenever working with a list of printable - strings. QByteArrayList should be used to handle and efficiently join large blobs - of binary data, as when sequentially receiving serialized data through a - QIODevice. - - \sa QByteArray, QStringList -*/ - -/*! - \fn QByteArrayList::QByteArrayList() - - Constructs an empty byte array list. -*/ - -/*! - \fn QByteArrayList::QByteArrayList(const QByteArray &ba) - - Constructs a byte array list that contains the given byte array, - \a ba. Longer lists are easily created like this: - - \snippet qbytearraylist/main.cpp 0 - - \sa append() -*/ - -/*! - \fn QByteArrayList::QByteArrayList(const QByteArrayList &other) - - Constructs a copy of the \a other byte array list. - - This operation takes \l{constant time} because QByteArrayList is - \l{implicitly shared}, making the process of returning a - QByteArrayList from a function very fast. If a shared instance is - modified, it will be copied (copy-on-write), and that takes - \l{linear time}. - - \sa operator=() -*/ - -/*! - \fn QByteArrayList::QByteArrayList(const QList &other) - - Constructs a copy of \a other. - - This operation takes \l{constant time}, because QByteArrayList is - \l{implicitly shared}. This makes returning a QByteArrayList from a - function very fast. If a shared instance is modified, it will be - copied (copy-on-write), and that takes \l{linear time}. - - \sa operator=() -*/ - -/*! \fn QByteArrayList::QByteArrayList(std::initializer_list args) - - Construct a list from a std::initializer_list given by \a args. - - This constructor is only enabled if the compiler supports C++11 initializer - lists. -*/ - -/*! - \fn QByteArray QByteArrayList::join() const - - Joins all the byte arrays into a single byte array. -*/ - -/*! - \fn QByteArray QByteArrayList::join(const QByteArray &separator) const - - Joins all the byte arrays into a single byte array with each - element separated by the given \a separator. -*/ - -int QByteArrayList_joinedSize(const QByteArrayList *that, int seplen) -{ - int totalLength = 0; - const int size = that->size(); - - for (int i = 0; i < size; ++i) - totalLength += that->at(i).size(); - - if (size > 0) - totalLength += seplen * (size - 1); - - return totalLength; -} - -/*! - \fn QByteArray QByteArrayList::join(char separator) const - - Joins all the byte arrays into a single byte array with each - element separated by the given \a separator. -*/ -QByteArray QtPrivate::QByteArrayList_join(const QByteArrayList *that, const char *sep, int seplen) -{ - int totalLength = QByteArrayList_joinedSize(that, seplen); - QByteArray res; - if (totalLength == 0) - return res; - res.reserve(totalLength); - for (int i = 0; i < that->size(); ++i) { - if (i) - res.append(sep, seplen); - res += that->at(i); - } - return res; -} - -/*! - \fn QByteArrayList operator+(const QByteArrayList &list1, const QByteArrayList &list2) - \relates QByteArrayList - - Returns a byte array list that is the concatenation of \a list1 and \a list2. -*/ - -/*! - \fn QByteArrayList& operator+=(QByteArrayList &list1, const QByteArrayList &list2) - \relates QByteArrayList - - Appends \a list2 to \a list1 and returns a reference to \a list1. -*/ - -/*! - \fn QByteArrayList &QByteArrayList::operator<<(const QByteArray &ba) - - Appends the given byte array, \a ba, to this byte array list and returns - a reference to the byte array list. - - \sa append() -*/ - -/*! - \fn QByteArrayList &QByteArrayList::operator<<(const QByteArrayList &other) - - \overload - - Appends the \a other byte array list to the byte array list and returns a reference to - the latter byte array list. -*/ - -/*! - \fn QDataStream &operator>>(QDataStream &in, QByteArrayList &list) - \relates QByteArrayList - - Reads a byte array list from the given \a in stream into the specified - \a list. - - \sa {Serializing Qt Data Types} -*/ - -/*! - \fn QDataStream &operator<<(QDataStream &out, const QByteArrayList &list) - \relates QByteArrayList - - Writes the given byte array \a list to the specified \a out stream. - - \sa {Serializing Qt Data Types} -*/ - -QT_END_NAMESPACE diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h deleted file mode 100644 index 882bc68f094..00000000000 --- a/src/corelib/tools/qbytearraylist.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 by Southwest Research Institute (R) -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#ifndef QBYTEARRAYLIST_H -#define QBYTEARRAYLIST_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - - -typedef QListIterator QByteArrayListIterator; -typedef QMutableListIterator QMutableByteArrayListIterator; - -class QByteArrayList : public QList -{ -public: - inline QByteArrayList() { } - inline explicit QByteArrayList(const QByteArray &i) { append(i); } - inline QByteArrayList(const QByteArrayList &l) : QList(l) { } - inline QByteArrayList(const QList &l) : QList(l) { } -#ifdef Q_COMPILER_INITIALIZER_LISTS - inline QByteArrayList(std::initializer_list args) : QList(args) { } -#endif - - inline QByteArray join() const; - inline QByteArray join(const QByteArray &sep) const; - inline QByteArray join(char sep) const; - - inline QByteArrayList &operator<<(const QByteArray &str) - { append(str); return *this; } - inline QByteArrayList &operator<<(const QByteArrayList &l) - { *this += l; return *this; } -}; - -Q_DECLARE_TYPEINFO(QByteArrayList, Q_MOVABLE_TYPE); - -namespace QtPrivate { - QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *s, int l); -} - -inline QByteArray QByteArrayList::join() const -{ - return QtPrivate::QByteArrayList_join(this, 0, 0); -} - -inline QByteArray QByteArrayList::join(const QByteArray &sep) const -{ - return QtPrivate::QByteArrayList_join(this, sep.constData(), sep.size()); -} - -inline QByteArray QByteArrayList::join(char sep) const -{ - return QtPrivate::QByteArrayList_join(this, &sep, 1); -} - -inline QByteArrayList operator+(const QByteArrayList &lhs, const QByteArrayList &rhs) -{ - QByteArrayList res = lhs; - res += rhs; - return res; -} - -inline QByteArrayList& operator+=(QByteArrayList &lhs, const QByteArrayList &rhs) -{ - lhs.append( rhs ); - return lhs; -} - -#ifndef QT_NO_DATASTREAM -inline QDataStream &operator>>(QDataStream &in, QByteArrayList &list) -{ - return operator>>(in, static_cast &>(list)); -} -inline QDataStream &operator<<(QDataStream &out, const QByteArrayList &list) -{ - return operator<<(out, static_cast &>(list)); -} -#endif // QT_NO_DATASTREAM - -QT_END_NAMESPACE - -#endif // QBYTEARRAYLIST_H diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 7a3dc9470c4..863cf034395 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -9,7 +9,6 @@ HEADERS += \ tools/qarraydatapointer.h \ tools/qbitarray.h \ tools/qbytearray.h \ - tools/qbytearraylist.h \ tools/qbytearraymatcher.h \ tools/qbytedata_p.h \ tools/qcache.h \ @@ -78,7 +77,6 @@ SOURCES += \ tools/qarraydata.cpp \ tools/qbitarray.cpp \ tools/qbytearray.cpp \ - tools/qbytearraylist.cpp \ tools/qbytearraymatcher.cpp \ tools/qcollator.cpp \ tools/qcommandlineoption.cpp \ diff --git a/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro b/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro deleted file mode 100644 index 2cd4522f671..00000000000 --- a/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG += testcase parallel_test -TARGET = tst_qbytearraylist -QT = core testlib -SOURCES = tst_qbytearraylist.cpp diff --git a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp b/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp deleted file mode 100644 index 86a56abae3d..00000000000 --- a/tests/auto/corelib/tools/qbytearraylist/tst_qbytearraylist.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 by Southwest Research Institute (R) -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include - -Q_DECLARE_METATYPE(QByteArrayList) - -class tst_QByteArrayList : public QObject -{ - Q_OBJECT -private slots: - void join() const; - void join_data() const; - void joinByteArray() const; - void joinByteArray_data() const; - void joinChar() const; - void joinChar_data() const; - void joinEmptiness() const; - - void operator_plus() const; - void operator_plus_data() const; - - void initializeList() const; -}; - -void tst_QByteArrayList::join() const -{ - QFETCH(QByteArrayList, input); - QFETCH(QByteArray, expectedResult); - - QCOMPARE(input.join(), expectedResult); -} - -void tst_QByteArrayList::join_data() const -{ - QTest::addColumn("input"); - QTest::addColumn("expectedResult"); - - QTest::newRow("data1") << QByteArrayList() - << QByteArray(); - - QTest::newRow("data2") << QByteArrayList("one") - << QByteArray("one"); - - QTest::newRow("data3") << (QByteArrayList() << "a" << "b") - << QByteArray("ab"); - - QTest::newRow("data4") << (QByteArrayList() << "a" << "b" << "c") - << QByteArray("abc"); -} - -void tst_QByteArrayList::joinByteArray() const -{ - QFETCH(QByteArrayList, input); - QFETCH(QByteArray, separator); - QFETCH(QByteArray, expectedResult); - - QCOMPARE(input.join(separator), expectedResult); -} - -void tst_QByteArrayList::joinByteArray_data() const -{ - QTest::addColumn("input"); - QTest::addColumn("separator"); - QTest::addColumn("expectedResult"); - - QTest::newRow("data1") << QByteArrayList() - << QByteArray() - << QByteArray(); - - QTest::newRow("data2") << QByteArrayList() - << QByteArray("separator") - << QByteArray(); - - QTest::newRow("data3") << QByteArrayList("one") - << QByteArray("separator") - << QByteArray("one"); - - QTest::newRow("data4") << (QByteArrayList() << "a" << "b") - << QByteArray(" ") - << QByteArray("a b"); - - QTest::newRow("data5") << (QByteArrayList() << "a" << "b" << "c") - << QByteArray(" ") - << QByteArray("a b c"); - - QTest::newRow("data6") << (QByteArrayList() << "a" << "b" << "c") - << QByteArray() - << QByteArray("abc"); - - QTest::newRow("data7") << (QByteArrayList() << "a" << "b" << "c") - << QByteArray("") //empty - << QByteArray("abc"); -} - -void tst_QByteArrayList::joinChar() const -{ - QFETCH(QByteArrayList, input); - QFETCH(char, separator); - QFETCH(QByteArray, expectedResult); - - QCOMPARE(input.join(separator), expectedResult); -} - -void tst_QByteArrayList::joinChar_data() const -{ - QTest::addColumn("input"); - QTest::addColumn("separator"); - QTest::addColumn("expectedResult"); - - QTest::newRow("data1") << QByteArrayList() - << ' ' - << QByteArray(); - - QTest::newRow("data2") << (QByteArrayList() << "a" << "b") - << ' ' - << QByteArray("a b"); - - QTest::newRow("data3") << (QByteArrayList() << "a" << "b" << "c") - << ' ' - << QByteArray("a b c"); -} - -void tst_QByteArrayList::joinEmptiness() const -{ - QByteArrayList list; - QByteArray string = list.join(QByteArray()); - - QVERIFY(string.isEmpty()); - QVERIFY(string.isNull()); -} - -void tst_QByteArrayList::operator_plus() const -{ - QFETCH(QByteArrayList, a1); - QFETCH(QByteArrayList, a2); - QFETCH(QByteArrayList, expectedResult); - - QCOMPARE(a1+a2, expectedResult); - a1 += a2; - QCOMPARE(a1, expectedResult); -} - -void tst_QByteArrayList::operator_plus_data() const -{ - QTest::addColumn("a1"); - QTest::addColumn("a2"); - QTest::addColumn("expectedResult"); - - QTest::newRow("simpl") << ( QByteArrayList() << "a" ) - << ( QByteArrayList() << "b" << "c" ) - << ( QByteArrayList() << "a" << "b" << "c" ); - - QTest::newRow("blank1") << QByteArrayList() - << QByteArrayList() - << QByteArrayList(); - - QTest::newRow("blank2") << ( QByteArrayList() ) - << ( QByteArrayList() << "b" << "c" ) - << ( QByteArrayList() << "b" << "c" ); - - QTest::newRow("empty1") << ( QByteArrayList() << "" ) - << ( QByteArrayList() << "b" << "c" ) - << ( QByteArrayList() << "" << "b" << "c" ); - - QTest::newRow("empty2") << ( QByteArrayList() << "a" ) - << ( QByteArrayList() << "" << "c" ) - << ( QByteArrayList() << "a" << "" << "c" ); -} - -void tst_QByteArrayList::initializeList() const -{ -#ifdef Q_COMPILER_INITIALIZER_LISTS - // C++11 support is required - QByteArrayList v1{QByteArray("hello"),"world",QByteArray("plop")}; - QCOMPARE(v1, (QByteArrayList() << "hello" << "world" << "plop")); - QCOMPARE(v1, (QByteArrayList{"hello","world","plop"})); -#endif -} - -QTEST_APPLESS_MAIN(tst_QByteArrayList) -#include "tst_qbytearraylist.moc" diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro index d5c9e501902..1ef8e770714 100644 --- a/tests/auto/corelib/tools/tools.pro +++ b/tests/auto/corelib/tools/tools.pro @@ -5,7 +5,6 @@ SUBDIRS=\ qarraydata_strictiterators \ qbitarray \ qbytearray \ - qbytearraylist \ qbytearraymatcher \ qbytedatabuffer \ qcache \ From 51f7ef800ee84f9cbc0e1f742c2d869f887bd5ed Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 27 Feb 2014 14:00:26 -0800 Subject: [PATCH 130/172] Make Q_NULLPTR be NULL on C++98 Some compilers actually have a C++11-like null pointer constant in C++98 mode: $ gcc -dM -E -include stddef.h -xc++ /dev/null | grep NULL #define NULL __null $ icc -dM -E -include stddef.h -xc++ /dev/null | grep NULL #define NULL __null $ clang -dM -E -include stddef.h -xc++ /dev/null | grep NULL #define NULL __null Change-Id: Ie0bcaf36fed6ad27e761a0a24332817129128571 Reviewed-by: Olivier Goffart --- src/corelib/global/qcompilerdetection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 1eb442aa5f6..6755b82f61b 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -858,7 +858,7 @@ #ifdef Q_COMPILER_NULLPTR # define Q_NULLPTR nullptr #else -# define Q_NULLPTR 0 +# define Q_NULLPTR NULL #endif #ifdef Q_COMPILER_DEFAULT_MEMBERS From 2f63d04ff1e9c28f5c5c6465306f6e19ba781287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 6 Mar 2014 14:46:46 +0100 Subject: [PATCH 131/172] Export rootWindow to the QXcbNativeInterface This change exports the root window to the native interface as there is QX11Info::appRootWindow which so far goes over the QDesktopWidget to get the window id of the root window. Which is a rather hackish way considering that the root window is known to the QXcbConnection. But even more it's a very fragile way and can result in crashes on startup of applications if the application accesses the appRootWindow too early. Change-Id: Ibb09a7fa714cb355f579298fc6df33bf80f73f58 Reviewed-by: Friedemann Kleint Reviewed-by: David Faure Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 15 ++++++++++++++- src/plugins/platforms/xcb/qxcbnativeinterface.h | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 7d69564c57e..b45bd6a82e5 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -80,7 +80,8 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("glxcontext"), QByteArrayLiteral("apptime"), QByteArrayLiteral("appusertime"), QByteArrayLiteral("hintstyle"), QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"), - QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen") + QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"), + QByteArrayLiteral("rootwindow") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -142,6 +143,9 @@ void *QXcbNativeInterface::nativeResourceForIntegration(const QByteArray &resour case X11Screen: result = x11Screen(); break; + case RootWindow: + result = rootWindow(); + break; default: break; } @@ -264,6 +268,15 @@ void *QXcbNativeInterface::x11Screen() return 0; } +void *QXcbNativeInterface::rootWindow() +{ + QXcbIntegration *integration = static_cast(QGuiApplicationPrivate::platformIntegration()); + QXcbConnection *defaultConnection = integration->defaultConnection(); + if (defaultConnection) + return reinterpret_cast(defaultConnection->rootWindow()); + return 0; +} + void QXcbNativeInterface::setAppTime(QScreen* screen, xcb_timestamp_t time) { static_cast(screen->handle())->connection()->setTime(time); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 9c4fa44d3b3..fb1a46014c4 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -70,7 +70,8 @@ public: StartupId, TrayWindow, GetTimestamp, - X11Screen + X11Screen, + RootWindow }; QXcbNativeInterface(); @@ -94,6 +95,7 @@ public: void *getTimestamp(const QXcbScreen *screen); void *startupId(); void *x11Screen(); + void *rootWindow(); static void setAppTime(QScreen *screen, xcb_timestamp_t time); static void setAppUserTime(QScreen *screen, xcb_timestamp_t time); static void *eglContextForContext(QOpenGLContext *context); From d42b8a22ff8e201166ea3c3ac0bb3e43a615a5d3 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 7 Mar 2014 12:33:32 +0100 Subject: [PATCH 132/172] Make QVector* compile on Win/static Task-number: QTBUG-37122 Change-Id: Ib2283e8c27da7af2bdc08eee3b7cc542fbe55d71 Reviewed-by: Lars Knoll --- src/gui/math3d/qvector2d.cpp | 2 ++ src/gui/math3d/qvector2d.h | 2 +- src/gui/math3d/qvector3d.cpp | 4 ++++ src/gui/math3d/qvector3d.h | 2 +- src/gui/math3d/qvector4d.cpp | 2 ++ src/gui/math3d/qvector4d.h | 2 +- 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp index a56e23eb72d..73999f1fca9 100644 --- a/src/gui/math3d/qvector2d.cpp +++ b/src/gui/math3d/qvector2d.cpp @@ -326,10 +326,12 @@ float QVector2D::distanceToLine /*! Returns the dot product of \a v1 and \a v2. */ +#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) float QVector2D::dotProduct(const QVector2D& v1, const QVector2D& v2) { return v1.xp * v2.xp + v1.yp * v2.yp; } +#endif /*! \fn bool operator==(const QVector2D &v1, const QVector2D &v2) diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h index 649d45d477c..0098c119eca 100644 --- a/src/gui/math3d/qvector2d.h +++ b/src/gui/math3d/qvector2d.h @@ -99,7 +99,7 @@ public: QVector2D &operator*=(const QVector2D &vector); QVector2D &operator/=(float divisor); -#ifdef QT_BUILD_GUI_LIB +#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) static float dotProduct(const QVector2D& v1, const QVector2D& v2); #else Q_DECL_CONSTEXPR inline static float dotProduct(const QVector2D& v1, const QVector2D& v2) diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp index 7e3ed7c61bf..1cb73a1fa20 100644 --- a/src/gui/math3d/qvector3d.cpp +++ b/src/gui/math3d/qvector3d.cpp @@ -316,10 +316,12 @@ void QVector3D::normalize() /*! Returns the dot product of \a v1 and \a v2. */ +#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) float QVector3D::dotProduct(const QVector3D& v1, const QVector3D& v2) { return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp; } +#endif /*! Returns the cross-product of vectors \a v1 and \a v2, which corresponds @@ -327,12 +329,14 @@ float QVector3D::dotProduct(const QVector3D& v1, const QVector3D& v2) \sa normal() */ +#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) QVector3D QVector3D::crossProduct(const QVector3D& v1, const QVector3D& v2) { return QVector3D(v1.yp * v2.zp - v1.zp * v2.yp, v1.zp * v2.xp - v1.xp * v2.zp, v1.xp * v2.yp - v1.yp * v2.xp); } +#endif /*! Returns the normal vector of a plane defined by vectors \a v1 and \a v2, diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h index c5506bf1ac9..64f8e347046 100644 --- a/src/gui/math3d/qvector3d.h +++ b/src/gui/math3d/qvector3d.h @@ -95,7 +95,7 @@ public: QVector3D &operator*=(const QVector3D& vector); QVector3D &operator/=(float divisor); -#ifdef QT_BUILD_GUI_LIB +#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) static float dotProduct(const QVector3D& v1, const QVector3D& v2); static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2); #else diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp index 691551367f9..b3db610d9af 100644 --- a/src/gui/math3d/qvector4d.cpp +++ b/src/gui/math3d/qvector4d.cpp @@ -369,10 +369,12 @@ void QVector4D::normalize() /*! Returns the dot product of \a v1 and \a v2. */ +#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) float QVector4D::dotProduct(const QVector4D& v1, const QVector4D& v2) { return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp + v1.wp * v2.wp; } +#endif /*! \fn bool operator==(const QVector4D &v1, const QVector4D &v2) diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h index 1256f384a0d..2bc5b79c14c 100644 --- a/src/gui/math3d/qvector4d.h +++ b/src/gui/math3d/qvector4d.h @@ -102,7 +102,7 @@ public: QVector4D &operator*=(const QVector4D &vector); QVector4D &operator/=(float divisor); -#ifdef QT_BUILD_GUI_LIB +#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) static float dotProduct(const QVector4D& v1, const QVector4D& v2); #else static float dotProduct(const QVector4D& v1, const QVector4D& v2) From 7591abbe0402d7fcb6305728c1456c1e148d1c40 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Fri, 7 Mar 2014 11:54:26 +0100 Subject: [PATCH 133/172] BlackBerry: Repair the file picker The interface for invoking the file dialog has been changed. Instead of a Json object we now passing a pps object to the invoke target. Change-Id: I3c5bc8f0e1af1a84d4afb6bc1923f23db2b43d5e Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxfilepicker.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxfilepicker.cpp b/src/plugins/platforms/qnx/qqnxfilepicker.cpp index 56c804a5b45..843b0350371 100644 --- a/src/plugins/platforms/qnx/qqnxfilepicker.cpp +++ b/src/plugins/platforms/qnx/qqnxfilepicker.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -132,11 +133,16 @@ void QQnxFilePicker::open() if (!m_filters.isEmpty()) map[QStringLiteral("Filter")] = m_filters.join(";"); + QByteArray ppsData; +#if defined(Q_OS_BLACKBERRY_TABLET) QJsonDocument document; document.setObject(QJsonObject::fromVariantMap(map)); - const QByteArray jsonData = document.toJson(QJsonDocument::Compact); + ppsData = document.toJson(QJsonDocument::Compact); +#else + ppsData = QPpsObject::encode(map); +#endif - errorCode = navigator_invoke_invocation_set_data(m_invocationHandle, jsonData.constData(), jsonData.size()); + errorCode = navigator_invoke_invocation_set_data(m_invocationHandle, ppsData.constData(), ppsData.size()); if (errorCode != BPS_SUCCESS) { cleanup(); qWarning() << "QQnxFilePicker: unable to set data:" << strerror(errno); From 43af92be45b5ea59c7db71b977faf5870a0baa24 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Fri, 7 Mar 2014 14:05:45 +0100 Subject: [PATCH 134/172] BlackBerry: Choose the appropriate file dialog type This chooses the appropriate file dialog type based on the nameFilters that were set. Change-Id: I0c674eacbaebf862ce4359e744271c0d6382c216 Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxfilepicker.cpp | 36 +++++++++++++++++++- src/plugins/platforms/qnx/qqnxfilepicker.h | 1 + 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/qnx/qqnxfilepicker.cpp b/src/plugins/platforms/qnx/qqnxfilepicker.cpp index 843b0350371..830b110f2ae 100644 --- a/src/plugins/platforms/qnx/qqnxfilepicker.cpp +++ b/src/plugins/platforms/qnx/qqnxfilepicker.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -119,7 +120,7 @@ void QQnxFilePicker::open() } QVariantMap map; - map[QStringLiteral("Type")] = QStringLiteral("Other"); + map[QStringLiteral("Type")] = filePickerType(); map[QStringLiteral("Mode")] = modeToString(m_mode); map[QStringLiteral("Title")] = m_title; map[QStringLiteral("ViewMode")] = QStringLiteral("Default"); @@ -281,6 +282,39 @@ void QQnxFilePicker::handleFilePickerResponse(const char *data) cleanup(); } +QString QQnxFilePicker::filePickerType() const +{ + bool images = false; + bool video = false; + bool music = false; + QMimeDatabase mimeDb; + for (int i = 0; i < filters().count(); i++) { + QList mimeTypes = mimeDb.mimeTypesForFileName(filters().at(i)); + if (mimeTypes.isEmpty()) + return QStringLiteral("Other"); + + if (mimeTypes.first().name().startsWith(QLatin1String("image"))) + images = true; + else if (mimeTypes.first().name().startsWith(QLatin1String("audio"))) + music = true; + else if (mimeTypes.first().name().startsWith(QLatin1String("video"))) + video = true; + else + return QStringLiteral("Other"); + } + + if (!video && !music) + return QStringLiteral("Picture"); + + if (!images && !music) + return QStringLiteral("Video"); + + if (!images && !video) + return QStringLiteral("Music"); + + return QStringLiteral("Other"); +} + QString QQnxFilePicker::modeToString(QQnxFilePicker::Mode mode) const { switch (mode) { diff --git a/src/plugins/platforms/qnx/qqnxfilepicker.h b/src/plugins/platforms/qnx/qqnxfilepicker.h index 5bb8f0969f0..e8272900b0b 100644 --- a/src/plugins/platforms/qnx/qqnxfilepicker.h +++ b/src/plugins/platforms/qnx/qqnxfilepicker.h @@ -92,6 +92,7 @@ public Q_SLOTS: private: void cleanup(); void handleFilePickerResponse(const char *data); + QString filePickerType() const; QString modeToString(Mode mode) const; From 79469565cfcd1397110be7b5c61466624a92153d Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Fri, 28 Feb 2014 21:05:15 +0100 Subject: [PATCH 135/172] Fix description of how themes are created (code comments) Change-Id: I3b8ed0af5208687a9ab75e916b477f5e24b4d1e2 Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto --- src/gui/kernel/qguiapplication.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c587e51299d..1347f309e57 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1007,16 +1007,17 @@ static void init_platform(const QString &pluginArgument, const QString &platform if (!platformThemeName.isEmpty()) themeNames.append(platformThemeName); - // 2) Ask the platform integration for a list of names and try loading them. + // 2) Ask the platform integration for a list of theme names themeNames += QGuiApplicationPrivate::platform_integration->themeNames(); + // 3) Look for a theme plugin. foreach (const QString &themeName, themeNames) { QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath); if (QGuiApplicationPrivate::platform_theme) break; } - // 3) If none found, look for a theme plugin. Theme plugins are located in the - // same directory as platform plugins. + // 4) If no theme plugin was found ask the platform integration to + // create a theme if (!QGuiApplicationPrivate::platform_theme) { foreach (const QString &themeName, themeNames) { QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName); @@ -1026,7 +1027,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform // No error message; not having a theme plugin is allowed. } - // 4) Fall back on the built-in "null" platform theme. + // 5) Fall back on the built-in "null" platform theme. if (!QGuiApplicationPrivate::platform_theme) QGuiApplicationPrivate::platform_theme = new QPlatformTheme; From 3f6a554d21efad87c8d8502aac6e3c0f85b893d1 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Wed, 26 Feb 2014 17:56:57 +0100 Subject: [PATCH 136/172] QNX: Do not create default platform theme If the theme name is not recognized we should not create a QPlatformTheme, but rather return 0. If no platform theme can be created on creation of the QGuiApplication,a default QPlatformTheme will be created automatically. Change-Id: I685fa352c87d74c225c7f91c10cb84fb5128a3f6 Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 43045f99d19..41ca2b5e186 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -470,7 +470,7 @@ QPlatformTheme *QQnxIntegration::createPlatformTheme(const QString &name) const qIntegrationDebug() << Q_FUNC_INFO << "name =" << name; if (name == QBlackberryTheme::name()) return new QBlackberryTheme(this); - return QPlatformIntegration::createPlatformTheme(name); + return 0; } #endif From 94d0f7c3d3b98b5b89bceffbf02a2114ca0f1339 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 5 Mar 2014 09:34:57 +0200 Subject: [PATCH 137/172] Make QFontEngineQPA report the TT 'cmap' table support The QPF2 CMap is identical to the TrueType CMap table format. Change-Id: I8c34d7c6a5942375538f3b8cb71d5a808b4fb400 Reviewed-by: Lars Knoll --- src/gui/text/qfontengine_qpa.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index 90c9cbb1bb9..b17a8eb2db3 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -335,10 +335,14 @@ QFontEngineQPA::~QFontEngineQPA() bool QFontEngineQPA::getSfntTableData(uint tag, uchar *buffer, uint *length) const { - Q_UNUSED(tag); - Q_UNUSED(buffer); - *length = 0; - return false; + if (tag != MAKE_TAG('c', 'm', 'a', 'p') || !cmap) + return false; + + if (buffer && int(*length) >= cmapSize) + memcpy(buffer, cmap, cmapSize); + *length = cmapSize; + Q_ASSERT(int(*length) > 0); + return true; } glyph_t QFontEngineQPA::glyphIndex(uint ucs4) const From cfb4581feef2058a3b1b31b6bd4cfeef2c01339d Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 5 Mar 2014 09:30:58 +0200 Subject: [PATCH 138/172] QFontEngineQPA: Get rid of unused externalCMap It seems to be a leftover after dropping the QPF1 font engine. Change-Id: If8d3e1447fab9d042a85195d7bdb4d9811c37c6e Reviewed-by: Lars Knoll --- src/gui/text/qfontengine_qpa.cpp | 21 +++++---------------- src/gui/text/qfontengine_qpa_p.h | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index b17a8eb2db3..5a6021fe531 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -242,7 +242,7 @@ QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data) { fontDef = def; cache_cost = 100; - externalCMap = 0; + cmap = 0; cmapOffset = 0; cmapSize = 0; glyphMapOffset = 0; @@ -293,15 +293,8 @@ QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data) // get the real cmap if (cmapOffset) { - int tableSize = cmapSize; - const uchar *cmapPtr = getCMap(fontData + cmapOffset, tableSize, &symbol, &cmapSize); - if (cmapPtr) - cmapOffset = cmapPtr - fontData; - else - cmapOffset = 0; - } else if (externalCMap) { - int tableSize = cmapSize; - externalCMap = getCMap(externalCMap, tableSize, &symbol, &cmapSize); + cmap = QFontEngine::getCMap(fontData + cmapOffset, cmapSize, &symbol, &cmapSize); + cmapOffset = cmap ? cmap - fontData : 0; } // verify all the positions in the glyphMap @@ -323,7 +316,7 @@ QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data) #if defined(DEBUG_FONTENGINE) if (!isValid()) qDebug() << "fontData" << fontData << "dataSize" << dataSize - << "externalCMap" << externalCMap << "cmapOffset" << cmapOffset + << "cmap" << cmap << "cmapOffset" << cmapOffset << "glyphMapOffset" << glyphMapOffset << "glyphDataOffset" << glyphDataOffset << "fd" << fd << "glyphDataSize" << glyphDataSize; #endif @@ -347,8 +340,6 @@ bool QFontEngineQPA::getSfntTableData(uint tag, uchar *buffer, uint *length) con glyph_t QFontEngineQPA::glyphIndex(uint ucs4) const { - const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset); - glyph_t glyph = getTrueTypeGlyphIndex(cmap, ucs4); if (glyph == 0 && symbol && ucs4 < 0x100) glyph = getTrueTypeGlyphIndex(cmap, ucs4 + 0xf000); @@ -370,8 +361,6 @@ bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph QSet seenGlyphs; #endif - const uchar *cmap = externalCMap ? externalCMap : (fontData + cmapOffset); - int glyph_pos = 0; if (symbol) { for (int i = 0; i < len; ++i) { @@ -517,7 +506,7 @@ QFixed QFontEngineQPA::lineThickness() const bool QFontEngineQPA::isValid() const { - return fontData && dataSize && (cmapOffset || externalCMap) + return fontData && dataSize && cmapOffset && glyphMapOffset && glyphDataOffset && glyphDataSize > 0; } diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h index 35bf9ad74cd..e84b067c68b 100644 --- a/src/gui/text/qfontengine_qpa_p.h +++ b/src/gui/text/qfontengine_qpa_p.h @@ -195,7 +195,7 @@ private: const uchar *fontData; int dataSize; - const uchar *externalCMap; + const uchar *cmap; quint32 cmapOffset; int cmapSize; quint32 glyphMapOffset; From d87ddcf56ff3bc46f468d8da276f1afc28b6ac26 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 4 Mar 2014 12:55:59 +0100 Subject: [PATCH 139/172] qdoc: Improve navigation bar for example files For example file pages, added a link to the parent example page into the navigation bar. Also, - Removed protectEnc() calls for strings added as Text atoms, this is done automatically when generating the navigation bar output, and doing it twice results in malformed output. - Removed the subtitle from being appended to example file title. The subtitle contains the full path of the file and it's already displayed on the page body, so removing it from the html title + navigation bar makes for a cleaner look without losing any information. Task-number: QTBUG-33022 Change-Id: I3ca942470453379e22f1a4aaec1d9b866d85bb5c Reviewed-by: Jerome Pasion --- src/tools/qdoc/htmlgenerator.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 1eef42dc2fd..641e59f018c 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -1439,11 +1439,7 @@ void HtmlGenerator::generateDocNode(DocNode* dn, CodeMarker* marker) QString fullTitle = dn->fullTitle(); QString htmlTitle = fullTitle; - if (dn->subType() == Node::File && !dn->subTitle().isEmpty()) { - subTitleSize = SmallSubTitle; - htmlTitle += " (" + dn->subTitle() + QLatin1Char(')'); - } - else if (dn->subType() == Node::QmlBasicType) { + if (dn->subType() == Node::QmlBasicType) { fullTitle = "QML Basic Type: " + fullTitle; htmlTitle = fullTitle; @@ -1668,10 +1664,11 @@ void HtmlGenerator::generateNavigationBar(const QString &title, if (!cn->name().isEmpty()) navigationbar << Atom(Atom::ListItemLeft) - << Atom(Atom::String, protectEnc(cn->name())) + << Atom(Atom::String, cn->name()) << Atom(Atom::ListItemRight); } else if (node->type() == Node::Document) { + const DocNode *dn = static_cast(node); if (node->subType() == Node::QmlClass || node->subType() == Node::QmlBasicType) { if (!qmltypespage.isEmpty()) navigationbar << Atom(Atom::ListItemLeft) @@ -1680,16 +1677,19 @@ void HtmlGenerator::generateNavigationBar(const QString &title, << Atom(Atom::String, QLatin1String("QML Types")) << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); + } + else if (dn && dn->isExampleFile()) { + navigationbar << Atom(Atom::ListItemLeft) + << Atom(Atom::Link, dn->parent()->name()) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, dn->parent()->title()) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) + << Atom(Atom::ListItemRight); - navigationbar << Atom(Atom::ListItemLeft) - << Atom(Atom::String, protectEnc(title)) - << Atom(Atom::ListItemRight); } - else { - navigationbar << Atom(Atom::ListItemLeft) - << Atom(Atom::String, protectEnc(title)) + navigationbar << Atom(Atom::ListItemLeft) + << Atom(Atom::String, title) << Atom(Atom::ListItemRight); - } } generateText(navigationbar, node, marker); From ca280bfe3bc551f814d59d25079e098798fbdad7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 27 Feb 2014 16:48:16 +0100 Subject: [PATCH 140/172] Android: Support double click event It's impossible to get the distance between two touch events down to 5 pixels on e.g. my Nexus 5. This patch makes it possible to tweak the distance through the platform theme, and sets the distance to 15% of an inch on Android. Also provides a way to override the default minimum of 5 pixels by using an environment variable. [ChangeLog][Android] Fixed double click events Task-number: QTBUG-36974 Change-Id: I23d94020c531747d6638b645133611614a2a0703 Reviewed-by: BogDan Vatra --- src/gui/kernel/qguiapplication.cpp | 4 ++- src/gui/kernel/qplatformtheme.cpp | 2 ++ src/gui/kernel/qplatformtheme.h | 3 ++- .../android/qandroidplatformtheme.cpp | 26 ++++++++++++++++++- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 1347f309e57..b2d774b40da 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -145,7 +145,7 @@ ulong QGuiApplicationPrivate::mousePressTime = 0; Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton; int QGuiApplicationPrivate::mousePressX = 0; int QGuiApplicationPrivate::mousePressY = 0; -int QGuiApplicationPrivate::mouse_double_click_distance = 5; +int QGuiApplicationPrivate::mouse_double_click_distance = -1; static Qt::LayoutDirection layout_direction = Qt::LeftToRight; static bool force_reverse = false; @@ -1255,6 +1255,8 @@ void QGuiApplicationPrivate::init() initPalette(); QFont::initialize(); + mouse_double_click_distance = platformTheme()->themeHint(QPlatformTheme::MouseDoubleClickDistance).toInt(); + #ifndef QT_NO_CURSOR QCursorData::initialize(); #endif diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index e12eb318dcf..05ab2f15ba6 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -499,6 +499,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint) return QVariant(false); case MousePressAndHoldInterval: return QVariant(800); + case MouseDoubleClickDistance: + return QVariant(5); } return QVariant(); } diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index 205a5bab690..073eda8d07a 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -108,7 +108,8 @@ public: PasswordMaskCharacter, DialogSnapToDefaultButton, ContextMenuOnMouseRelease, - MousePressAndHoldInterval + MousePressAndHoldInterval, + MouseDoubleClickDistance }; enum DialogType { diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index 039b19f8614..94e58eaeb67 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *androidPlatformNativeInterface) @@ -179,7 +180,30 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const return QStringList("android"); } return QStringList("fusion"); - break; + + case MouseDoubleClickDistance: + { + int minimumDistance = qgetenv("QT_ANDROID_MINIMUM_MOUSE_DOUBLE_CLICK_DISTANCE").toInt(); + int ret = minimumDistance; + + QAndroidPlatformIntegration *platformIntegration + = static_cast(QGuiApplicationPrivate::platformIntegration()); + QAndroidPlatformScreen *platformScreen = platformIntegration->screen(); + if (platformScreen != 0) { + QScreen *screen = platformScreen->screen(); + qreal dotsPerInch = screen->physicalDotsPerInch(); + + // Allow 15% of an inch between clicks when double clicking + int distance = qRound(dotsPerInch * 0.15); + if (distance > minimumDistance) + ret = distance; + } + + if (ret > 0) + return ret; + + // fall through + } default: return QPlatformTheme::themeHint(hint); } From 11eb9d37dc191b6e71c903e4f7f4d2da579e7df5 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 6 Mar 2014 12:02:25 +0200 Subject: [PATCH 141/172] Use QStringIterator instead of homebrew Task-number: QTBUG-15664 Change-Id: I1ed3eb04ddd822e57a4d993af656dfe283f3af1a Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 11 +++--- src/gui/text/qfontengine_ft.cpp | 21 ++++-------- src/gui/text/qfontengine_qpa.cpp | 22 ++++-------- src/gui/text/qharfbuzzng.cpp | 14 +++----- .../platforms/windows/qwindowsfontengine.cpp | 34 +++++++------------ .../windows/qwindowsfontenginedirectwrite.cpp | 20 +++-------- 6 files changed, 41 insertions(+), 81 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index c6674a1b125..a72ac234188 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1594,10 +1594,10 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, const_cast(this)->ensureFallbackFamiliesQueried(); int glyph_pos = 0; - for (int i = 0; i < len; ++i) { - bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()); - uint ucs4 = surrogate ? QChar::surrogateToUcs4(str[i], str[i+1]) : str[i].unicode(); - if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) { + QStringIterator it(str, str + len); + while (it.hasNext()) { + const uint ucs4 = it.peekNext(); + if (glyphs->glyphs[glyph_pos] == 0 && ucs4 != QChar::LineSeparator) { for (int x = 1, n = qMin(engines.size(), 256); x < n; ++x) { if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4)) continue; @@ -1625,8 +1625,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, } } - if (surrogate) - ++i; + it.advance(); ++glyph_pos; } diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index f8b7fc3d5c7..11e9ce6c027 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -45,6 +45,7 @@ #include "qvariant.h" #include "qfontengine_ft_p.h" #include "private/qimage_p.h" +#include #ifndef QT_NO_FREETYPE @@ -1447,16 +1448,6 @@ bool QFontEngineFT::supportsTransformation(const QTransform &transform) const return transform.type() <= QTransform::TxTranslate; } -static inline unsigned int getChar(const QChar *str, int &i, const int len) -{ - uint ucs4 = str[i].unicode(); - if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { - ++i; - ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); - } - return ucs4; -} - void QFontEngineFT::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) { if (!glyphs.numGlyphs) @@ -1543,8 +1534,9 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs int glyph_pos = 0; if (freetype->symbol_map) { FT_Face face = freetype->face; - for ( int i = 0; i < len; ++i ) { - unsigned int uc = getChar(str, i, len); + QStringIterator it(str, str + len); + while (it.hasNext()) { + uint uc = it.next(); glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0; if ( !glyphs->glyphs[glyph_pos] ) { // Symbol fonts can have more than one CMAPs, FreeType should take the @@ -1573,8 +1565,9 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs } } else { FT_Face face = freetype->face; - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(str, i, len); + QStringIterator it(str, str + len); + while (it.hasNext()) { + uint uc = it.next(); glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0; if (!glyphs->glyphs[glyph_pos]) { { diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index 5a6021fe531..f9ed3c38c16 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -225,17 +226,6 @@ QVariant QFontEngineQPA::extractHeaderField(const uchar *data, HeaderTag request } - -static inline unsigned int getChar(const QChar *str, int &i, const int len) -{ - uint ucs4 = str[i].unicode(); - if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { - ++i; - ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); - } - return ucs4; -} - QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data) : QFontEngine(QPF2), fontData(reinterpret_cast(data.constData())), dataSize(data.size()) @@ -363,16 +353,18 @@ bool QFontEngineQPA::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph int glyph_pos = 0; if (symbol) { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(str, i, len); + QStringIterator it(str, str + len); + while (it.hasNext()) { + const uint uc = it.next(); glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); if(!glyphs->glyphs[glyph_pos] && uc < 0x100) glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000); ++glyph_pos; } } else { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(str, i, len); + QStringIterator it(str, str + len); + while (it.hasNext()) { + const uint uc = it.next(); glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); #if 0 && defined(DEBUG_FONTENGINE) QChar c(uc); diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp index f7a1d30e6f7..1258ea9a784 100644 --- a/src/gui/text/qharfbuzzng.cpp +++ b/src/gui/text/qharfbuzzng.cpp @@ -45,6 +45,8 @@ #include #include +#include + #include "qfontengine_p.h" QT_BEGIN_NAMESPACE @@ -341,16 +343,10 @@ _hb_qt_unicode_decompose_compatibility(hb_unicode_funcs_t * /*ufuncs*/, const QString normalized = QChar::decomposition(u); uint outlen = 0; - - // ### replace with QCharIterator - const ushort *p = reinterpret_cast(normalized.unicode()); - const ushort *const e = p + normalized.size(); - for ( ; p != e; ++p) { - uint ucs4 = *p; - if (QChar::isHighSurrogate(ucs4) && p + 1 != e && QChar::isLowSurrogate(p[1])) - ucs4 = QChar::surrogateToUcs4(ucs4, *++p); + QStringIterator it(normalized); + while (it.hasNext()) { Q_ASSERT(outlen < HB_UNICODE_MAX_DECOMPOSITION_LEN); - decomposed[outlen++] = ucs4; + decomposed[outlen++] = it.next(); } return outlen; diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index e8e2978ee32..6f0a4f9ea54 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -65,6 +65,7 @@ #include #include #include +#include #include @@ -205,47 +206,37 @@ void QWindowsFontEngine::getCMap() } } -// ### Qt 5.1: replace with QStringIterator -inline unsigned int getChar(const QChar *str, int &i, const int len) -{ - uint uc = str[i].unicode(); - if (QChar::isHighSurrogate(uc) && i < len-1) { - uint low = str[i+1].unicode(); - if (QChar::isLowSurrogate(low)) { - uc = QChar::surrogateToUcs4(uc, low); - ++i; - } - } - return uc; -} - int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout *glyphs) const { - int i = 0; int glyph_pos = 0; { #if defined(Q_OS_WINCE) { #else if (symbol) { - for (; i < numChars; ++i, ++glyph_pos) { - unsigned int uc = getChar(str, i, numChars); + QStringIterator it(str, str + numChars); + while (it.hasNext()) { + const uint uc = it.next(); glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); if(!glyphs->glyphs[glyph_pos] && uc < 0x100) glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000); + ++glyph_pos; } } else if (ttf) { - for (; i < numChars; ++i, ++glyph_pos) { - unsigned int uc = getChar(str, i, numChars); + QStringIterator it(str, str + numChars); + while (it.hasNext()) { + const uint uc = it.next(); glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); + ++glyph_pos; } } else { #endif wchar_t first = tm.tmFirstChar; wchar_t last = tm.tmLastChar; - for (; i < numChars; ++i, ++glyph_pos) { - uint uc = getChar(str, i, numChars); + QStringIterator it(str, str + numChars); + while (it.hasNext()) { + const uint uc = it.next(); if ( #ifdef Q_WS_WINCE tm.tmFirstChar > 60000 || @@ -254,6 +245,7 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa glyphs->glyphs[glyph_pos] = uc; else glyphs->glyphs[glyph_pos] = 0; + ++glyph_pos; } } } diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index b6b554d4b0e..8f55e205360 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -314,20 +315,6 @@ glyph_t QWindowsFontEngineDirectWrite::glyphIndex(uint ucs4) const return glyphIndex; } -// ### Qt 5.1: replace with QStringIterator -inline unsigned int getChar(const QChar *str, int &i, const int len) -{ - uint uc = str[i].unicode(); - if (QChar::isHighSurrogate(uc) && i < len-1) { - uint low = str[i+1].unicode(); - if (QChar::isLowSurrogate(low)) { - uc = QChar::surrogateToUcs4(uc, low); - ++i; - } - } - return uc; -} - bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { @@ -339,8 +326,9 @@ bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGly QVarLengthArray codePoints(len); int actualLength = 0; - for (int i = 0; i < len; ++i) - codePoints[actualLength++] = getChar(str, i, len); + QStringIterator it(str, str + len); + while (it.hasNext()) + codePoints[actualLength++] = it.next(); QVarLengthArray glyphIndices(actualLength); HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(codePoints.data(), actualLength, From 1e8de50674f5b33a50c45224b7e07b3f974f6ab0 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 4 Mar 2014 15:06:36 +0100 Subject: [PATCH 142/172] Avoid using direct OpenGL calls in gui and widgets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5d88a2e204ca23e178a4e3044b9cb13392c3e763 Reviewed-by: Jørgen Lind --- src/gui/kernel/qopenglcontext.cpp | 15 +- src/gui/opengl/qopengl.cpp | 9 +- src/gui/opengl/qopengl.h | 20 +- src/gui/opengl/qopenglbuffer.cpp | 4 +- src/gui/opengl/qopengldebug.cpp | 21 +- src/gui/opengl/qopenglframebufferobject.cpp | 43 +-- src/gui/opengl/qopenglfunctions.cpp | 55 +++ src/gui/opengl/qopenglfunctions.h | 38 +- src/gui/opengl/qopenglgradientcache.cpp | 15 +- src/gui/opengl/qopenglpaintengine.cpp | 367 ++++++++++---------- src/gui/opengl/qopenglshaderprogram.cpp | 3 +- src/gui/opengl/qopengltexture.cpp | 6 +- src/gui/opengl/qopengltextureblitter.cpp | 9 +- src/gui/opengl/qopengltexturecache.cpp | 15 +- src/gui/opengl/qopengltextureglyphcache.cpp | 95 ++--- src/gui/opengl/qopengltextureglyphcache_p.h | 4 +- src/gui/painting/qplatformbackingstore.cpp | 45 +-- src/widgets/kernel/qopenglwidget.cpp | 17 +- 18 files changed, 444 insertions(+), 337 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 74771d6826d..d64f996b56a 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -334,17 +334,18 @@ int QOpenGLContextPrivate::maxTextureSize() if (max_texture_size != -1) return max_texture_size; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); + Q_Q(QOpenGLContext); + QOpenGLFunctions *funcs = q->functions(); + funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); #ifndef QT_OPENGL_ES - Q_Q(QOpenGLContext); if (!q->isES()) { GLenum proxy = GL_PROXY_TEXTURE_2D; GLint size; GLint next = 64; - glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); + funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &size); if (size == 0) { return max_texture_size; } @@ -354,8 +355,8 @@ int QOpenGLContextPrivate::maxTextureSize() if (next > max_texture_size) break; - glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); + funcs->glTexImage2D(proxy, 0, GL_RGBA, next, next, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + funcs->glGetTexLevelParameteriv(proxy, 0, GL_TEXTURE_WIDTH, &next); } while (next > size); max_texture_size = size; @@ -864,7 +865,7 @@ void QOpenGLContext::swapBuffers(QSurface *surface) qWarning() << "QOpenGLContext::swapBuffers() called without corresponding makeCurrent()"; #endif if (surface->format().swapBehavior() == QSurfaceFormat::SingleBuffer) - glFlush(); + functions()->glFlush(); d->platformGLContext->swapBuffers(surfaceHandle); } diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index 94270ba0c47..b452c605e36 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -53,7 +53,9 @@ typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint); QOpenGLExtensionMatcher::QOpenGLExtensionMatcher() { - const char *extensionStr = reinterpret_cast(glGetString(GL_EXTENSIONS)); + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + QOpenGLFunctions *funcs = ctx->functions(); + const char *extensionStr = reinterpret_cast(funcs->glGetString(GL_EXTENSIONS)); if (extensionStr) { QByteArray ba(extensionStr); @@ -64,9 +66,8 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher() #else } else { // clear error state - while (glGetError()) {} + while (funcs->glGetError()) {} - QOpenGLContext *ctx = QOpenGLContext::currentContext(); if (ctx) { qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi"); @@ -74,7 +75,7 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher() return; GLint numExtensions; - glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); + funcs->glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); for (int i = 0; i < numExtensions; ++i) { const char *str = reinterpret_cast(glGetStringi(GL_EXTENSIONS, i)); diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index 6eb656cd09b..190c05ba265 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -66,7 +66,7 @@ // which the system headers do not. #if defined(QT_OPENGL_ES_2) -# if defined(Q_OS_MAC) +# if defined(Q_OS_MAC) // iOS # include # include @@ -78,7 +78,7 @@ */ typedef void* GLeglImageOES; -# else // "uncontrolled" platforms +# else // "uncontrolled" ES2 platforms # include /* @@ -90,14 +90,14 @@ typedef void* GLeglImageOES; typedef char GLchar; # include -# ifndef GL_DOUBLE -# define GL_DOUBLE GL_FLOAT -# endif -# ifndef GLdouble -typedef GLfloat GLdouble; -# endif # endif // Q_OS_MAC -#else +# ifndef GL_DOUBLE +# define GL_DOUBLE GL_FLOAT +# endif +# ifndef GLdouble +typedef GLfloat GLdouble; +# endif +#else // non-ES2 platforms # if defined(Q_OS_MAC) # include # if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 @@ -110,7 +110,7 @@ typedef GLfloat GLdouble; # include # include # endif // Q_OS_MAC -#endif +#endif // QT_OPENGL_ES_2 // Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3 // and desktops apart from Mac can support OpenGL 4 diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp index fe121f126f3..2e1a4577f63 100644 --- a/src/gui/opengl/qopenglbuffer.cpp +++ b/src/gui/opengl/qopenglbuffer.cpp @@ -337,9 +337,9 @@ bool QOpenGLBuffer::read(int offset, void *data, int count) Q_D(QOpenGLBuffer); if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) return false; - while (glGetError() != GL_NO_ERROR) ; // Clear error state. + while (d->funcs->glGetError() != GL_NO_ERROR) ; // Clear error state. d->funcs->glGetBufferSubData(d->type, offset, count, data); - return glGetError() == GL_NO_ERROR; + return d->funcs->glGetError() == GL_NO_ERROR; } #else Q_UNUSED(offset); diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp index cc6e945954e..79b59a8e98e 100644 --- a/src/gui/opengl/qopengldebug.cpp +++ b/src/gui/opengl/qopengldebug.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include "qopengldebug.h" @@ -1380,7 +1381,7 @@ bool QOpenGLDebugLogger::initialize() #undef GET_DEBUG_PROC_ADDRESS - glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength); + QOpenGLContext::currentContext()->functions()->glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength); #ifndef QT_NO_DEBUG if (!d->context->format().testOption(QSurfaceFormat::DebugContext)) { @@ -1448,15 +1449,16 @@ void QOpenGLDebugLogger::startLogging(QOpenGLDebugLogger::LoggingMode loggingMod d->glDebugMessageCallback(&qt_opengl_debug_callback, d); - d->debugWasEnabled = glIsEnabled(GL_DEBUG_OUTPUT); - d->syncDebugWasEnabled = glIsEnabled(GL_DEBUG_OUTPUT_SYNCHRONOUS); + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); + d->debugWasEnabled = funcs->glIsEnabled(GL_DEBUG_OUTPUT); + d->syncDebugWasEnabled = funcs->glIsEnabled(GL_DEBUG_OUTPUT_SYNCHRONOUS); if (d->loggingMode == SynchronousLogging) - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + funcs->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); else - glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + funcs->glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - glEnable(GL_DEBUG_OUTPUT); + funcs->glEnable(GL_DEBUG_OUTPUT); } /*! @@ -1485,13 +1487,14 @@ void QOpenGLDebugLogger::stopLogging() d->glDebugMessageCallback(d->oldDebugCallbackFunction, d->oldDebugCallbackParameter); + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); if (!d->debugWasEnabled) - glDisable(GL_DEBUG_OUTPUT); + funcs->glDisable(GL_DEBUG_OUTPUT); if (d->syncDebugWasEnabled) - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + funcs->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); else - glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + funcs->glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS); } /*! diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index db1ea1b1a1f..55edaf7bafa 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -57,11 +57,11 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_DEBUG #define QT_RESET_GLERROR() \ { \ - while (glGetError() != GL_NO_ERROR) {} \ + while (QOpenGLContext::currentContext()->functions()->glGetError() != GL_NO_ERROR) {} \ } #define QT_CHECK_GLERROR() \ { \ - GLenum err = glGetError(); \ + GLenum err = QOpenGLContext::currentContext()->functions()->glGetError(); \ if (err != GL_NO_ERROR) { \ qDebug("[%s line %d] OpenGL Error: %d", \ __FILE__, __LINE__, (int)err); \ @@ -405,9 +405,9 @@ namespace funcs->glDeleteRenderbuffers(1, &id); } - void freeTextureFunc(QOpenGLFunctions *, GLuint id) + void freeTextureFunc(QOpenGLFunctions *funcs, GLuint id) { - glDeleteTextures(1, &id); + funcs->glDeleteTextures(1, &id); } } @@ -432,7 +432,7 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi #ifndef QT_OPENGL_ES_2 GLint maxSamples; - glGetIntegerv(GL_MAX_SAMPLES, &maxSamples); + funcs.glGetIntegerv(GL_MAX_SAMPLES, &maxSamples); samples = qBound(0, int(samples), int(maxSamples)); #endif @@ -497,16 +497,16 @@ void QOpenGLFramebufferObjectPrivate::initTexture(GLenum target, GLenum internal QOpenGLContext *ctx = QOpenGLContext::currentContext(); GLuint texture = 0; - glGenTextures(1, &texture); - glBindTexture(target, texture); + funcs.glGenTextures(1, &texture); + funcs.glBindTexture(target, texture); - glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + funcs.glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + funcs.glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + funcs.glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); if (mipmap) { int width = size.width(); int height = size.height(); @@ -515,20 +515,20 @@ void QOpenGLFramebufferObjectPrivate::initTexture(GLenum target, GLenum internal width = qMax(1, width >> 1); height = qMax(1, height >> 1); ++level; - glTexImage2D(target, level, internal_format, width, height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + funcs.glTexImage2D(target, level, internal_format, width, height, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); } } funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, texture, 0); QT_CHECK_GLERROR(); - glBindTexture(target, 0); + funcs.glBindTexture(target, 0); valid = checkFramebufferStatus(ctx); if (valid) texture_guard = new QOpenGLSharedResourceGuard(ctx, texture, freeTextureFunc); else - glDeleteTextures(1, &texture); + funcs.glDeleteTextures(1, &texture); } void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpenGLFramebufferObject::Attachment attachment) @@ -1084,7 +1084,8 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, int w = size.width(); int h = size.height(); - while (glGetError()); + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); + while (funcs->glGetError()); #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied @@ -1094,14 +1095,14 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, #else GLint fmt = GL_BGRA; #endif - glReadPixels(0, 0, w, h, fmt, GL_UNSIGNED_BYTE, img.bits()); - if (!glGetError()) + funcs->glReadPixels(0, 0, w, h, fmt, GL_UNSIGNED_BYTE, img.bits()); + if (!funcs->glGetError()) return img.mirrored(); #endif QImage rgbaImage(size, (alpha_format && include_alpha) ? QImage::Format_RGBA8888_Premultiplied : QImage::Format_RGBX8888); - glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits()); + funcs->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits()); return rgbaImage.mirrored(); } diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 5d30020f499..84c70606b17 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -1992,6 +1992,12 @@ void QOpenGLFunctions::initializeOpenGLFunctions() This convenience function will do nothing on OpenGL/ES 1.x systems. */ +/*! + \fn void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) + + \internal +*/ + /*! \fn bool QOpenGLFunctions::isInitialized(const QOpenGLFunctionsPrivate *d) \internal @@ -2394,6 +2400,15 @@ static void QOPENGLF_APIENTRY qopenglfResolveClearColor(GLclampf red, GLclampf g RESOLVE_FUNC_VOID(0, ClearColor)(red, green, blue, alpha); } +static void QOPENGLF_APIENTRY qopenglfResolveClearDepthf(GLclampf depth) +{ + if (QOpenGLContext::currentContext()->isES()) { + RESOLVE_FUNC_VOID(0, ClearDepthf)(depth); + } else { + RESOLVE_FUNC_VOID(0, ClearDepth)((GLdouble) depth); + } +} + static void QOPENGLF_APIENTRY qopenglfResolveClearStencil(GLint s) { RESOLVE_FUNC_VOID(0, ClearStencil)(s); @@ -2434,6 +2449,15 @@ static void QOPENGLF_APIENTRY qopenglfResolveDepthMask(GLboolean flag) RESOLVE_FUNC_VOID(0, DepthMask)(flag); } +static void QOPENGLF_APIENTRY qopenglfResolveDepthRangef(GLclampf zNear, GLclampf zFar) +{ + if (QOpenGLContext::currentContext()->isES()) { + RESOLVE_FUNC_VOID(0, DepthRangef)(zNear, zFar); + } else { + RESOLVE_FUNC_VOID(0, DepthRange)((GLdouble) zNear, (GLdouble) zFar); + } +} + static void QOPENGLF_APIENTRY qopenglfResolveDisable(GLenum cap) { RESOLVE_FUNC_VOID(0, Disable)(cap); @@ -3131,6 +3155,29 @@ static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qop (target, offset, size, data); } +#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC) + +// Desktop only + +static void QOPENGLF_APIENTRY qopenglfResolveGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) +{ + RESOLVE_FUNC_VOID(0, GetTexLevelParameteriv)(target, level, pname, params); +} + +// Special translation functions for ES-specific calls on desktop GL + +static void QOPENGLF_APIENTRY qopenglfTranslateClearDepthf(GLclampf depth) +{ + ::glClearDepth(depth); +} + +static void QOPENGLF_APIENTRY qopenglfTranslateDepthRangef(GLclampf zNear, GLclampf zFar) +{ + ::glDepthRange(zNear, zFar); +} + +#endif // !ES2 && !DYNAMIC + QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) { /* Assign a pointer to an above defined static function @@ -3145,6 +3192,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) BlendFunc = qopenglfResolveBlendFunc; Clear = qopenglfResolveClear; ClearColor = qopenglfResolveClearColor; + ClearDepthf = qopenglfResolveClearDepthf; ClearStencil = qopenglfResolveClearStencil; ColorMask = qopenglfResolveColorMask; CopyTexImage2D = qopenglfResolveCopyTexImage2D; @@ -3153,6 +3201,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) DeleteTextures = qopenglfResolveDeleteTextures; DepthFunc = qopenglfResolveDepthFunc; DepthMask = qopenglfResolveDepthMask; + DepthRangef = qopenglfResolveDepthRangef; Disable = qopenglfResolveDisable; DrawArrays = qopenglfResolveDrawArrays; DrawElements = qopenglfResolveDrawElements; @@ -3186,6 +3235,8 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) TexParameteriv = qopenglfResolveTexParameteriv; TexSubImage2D = qopenglfResolveTexSubImage2D; Viewport = qopenglfResolveViewport; + + GetTexLevelParameteriv = qopenglfResolveGetTexLevelParameteriv; } else { #ifndef QT_OPENGL_DYNAMIC // Use the functions directly. This requires linking QtGui to an OpenGL implementation. @@ -3193,6 +3244,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) BlendFunc = ::glBlendFunc; Clear = ::glClear; ClearColor = ::glClearColor; + ClearDepthf = qopenglfTranslateClearDepthf; ClearStencil = ::glClearStencil; ColorMask = ::glColorMask; CopyTexImage2D = ::glCopyTexImage2D; @@ -3201,6 +3253,7 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) DeleteTextures = ::glDeleteTextures; DepthFunc = ::glDepthFunc; DepthMask = ::glDepthMask; + DepthRangef = qopenglfTranslateDepthRangef; Disable = ::glDisable; DrawArrays = ::glDrawArrays; DrawElements = ::glDrawElements; @@ -3234,6 +3287,8 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) TexParameteriv = ::glTexParameteriv; TexSubImage2D = ::glTexSubImage2D; Viewport = ::glViewport; + + GetTexLevelParameteriv = ::glGetTexLevelParameteriv; #else // QT_OPENGL_DYNAMIC // This should not happen. qFatal("QOpenGLFunctions: Dynamic OpenGL builds do not support platforms with insufficient function resolving capabilities"); diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index ac490372603..03c12200d54 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -223,6 +223,8 @@ struct QOpenGLFunctionsPrivate; #undef glVertexAttrib4fv #undef glVertexAttribPointer +#undef glTexLevelParameteriv + class Q_GUI_EXPORT QOpenGLFunctions { public: @@ -405,6 +407,9 @@ public: void glVertexAttrib4fv(GLuint indx, const GLfloat* values); void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); + // OpenGL1, not GLES2 + void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params); + protected: QOpenGLFunctionsPrivate *d_ptr; static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; } @@ -420,6 +425,7 @@ struct QOpenGLFunctionsPrivate void (QOPENGLF_APIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor); void (QOPENGLF_APIENTRYP Clear)(GLbitfield mask); void (QOPENGLF_APIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void (QOPENGLF_APIENTRYP ClearDepthf)(GLclampf depth); void (QOPENGLF_APIENTRYP ClearStencil)(GLint s); void (QOPENGLF_APIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); void (QOPENGLF_APIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); @@ -428,6 +434,7 @@ struct QOpenGLFunctionsPrivate void (QOPENGLF_APIENTRYP DeleteTextures)(GLsizei n, const GLuint* textures); void (QOPENGLF_APIENTRYP DepthFunc)(GLenum func); void (QOPENGLF_APIENTRYP DepthMask)(GLboolean flag); + void (QOPENGLF_APIENTRYP DepthRangef)(GLclampf nearVal, GLclampf farVal); void (QOPENGLF_APIENTRYP Disable)(GLenum cap); void (QOPENGLF_APIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count); void (QOPENGLF_APIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); @@ -557,6 +564,13 @@ struct QOpenGLFunctionsPrivate void (QOPENGLF_APIENTRYP VertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); void (QOPENGLF_APIENTRYP VertexAttrib4fv)(GLuint indx, const GLfloat* values); void (QOPENGLF_APIENTRYP VertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); + + // OpenGL1 only, not GLES2 + void (QOPENGLF_APIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params); + + // Special non-ES OpenGL variants, not to be called directly + void (QOPENGLF_APIENTRYP ClearDepth)(GLdouble depth); + void (QOPENGLF_APIENTRYP DepthRange)(GLdouble zNear, GLdouble zFar); }; // GLES2 + OpenGL1 common subset @@ -1210,7 +1224,8 @@ inline GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target) inline void QOpenGLFunctions::glClearDepthf(GLclampf depth) { #ifndef QT_OPENGL_ES - ::glClearDepth(depth); + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ClearDepthf(depth); #else ::glClearDepthf(depth); #endif @@ -1332,7 +1347,8 @@ inline void QOpenGLFunctions::glDeleteShader(GLuint shader) inline void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar) { #ifndef QT_OPENGL_ES - ::glDepthRange(zNear, zFar); + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DepthRangef(zNear, zFar); #else ::glDepthRangef(zNear, zFar); #endif @@ -2138,6 +2154,24 @@ inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLe Q_OPENGL_FUNCTIONS_DEBUG } +// OpenGL1, not GLES2 + +inline void QOpenGLFunctions::glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) +{ +#ifdef QT_OPENGL_ES_2 + Q_UNUSED(target); + Q_UNUSED(level); + Q_UNUSED(pname); + Q_UNUSED(params); + // Cannot get here. + qFatal("QOpenGLFunctions: glGetTexLevelParameteriv not available with OpenGL ES"); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetTexLevelParameteriv(target, level, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + QT_END_NAMESPACE #endif // QT_NO_OPENGL diff --git a/src/gui/opengl/qopenglgradientcache.cpp b/src/gui/opengl/qopenglgradientcache.cpp index 9c312808a25..91b4d084749 100644 --- a/src/gui/opengl/qopenglgradientcache.cpp +++ b/src/gui/opengl/qopenglgradientcache.cpp @@ -43,6 +43,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -91,9 +92,10 @@ void QOpenGL2GradientCache::cleanCache() { QMutexLocker lock(&m_mutex); QOpenGLGradientColorTableHash::const_iterator it = cache.constBegin(); + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); for (; it != cache.constEnd(); ++it) { const CacheInfo &cache_info = it.value(); - glDeleteTextures(1, &cache_info.texId); + funcs->glDeleteTextures(1, &cache_info.texId); } cache.clear(); } @@ -129,6 +131,7 @@ GLuint QOpenGL2GradientCache::getBuffer(const QGradient &gradient, qreal opacity GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity) { + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); if (cache.size() == maxCacheSize()) { int elem_to_remove = qrand() % maxCacheSize(); quint64 key = cache.keys()[elem_to_remove]; @@ -136,7 +139,7 @@ GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient // need to call glDeleteTextures on each removed cache entry: QOpenGLGradientColorTableHash::const_iterator it = cache.constFind(key); do { - glDeleteTextures(1, &it.value().texId); + funcs->glDeleteTextures(1, &it.value().texId); } while (++it != cache.constEnd() && it.key() == key); cache.remove(key); // may remove more than 1, but OK } @@ -144,10 +147,10 @@ GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode()); uint buffer[1024]; generateGradientColorTable(gradient, buffer, paletteSize(), opacity); - glGenTextures(1, &cache_entry.texId); - glBindTexture(GL_TEXTURE_2D, cache_entry.texId); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, paletteSize(), 1, - 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + funcs->glGenTextures(1, &cache_entry.texId); + funcs->glBindTexture(GL_TEXTURE_2D, cache_entry.texId); + funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, paletteSize(), 1, + 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); return cache.insert(hash_val, cache_entry).value().texId; } diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 7fa80c5343c..f160b340e0a 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -123,14 +123,14 @@ void QOpenGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wra lastTextureUsed = id; if (smoothPixmapTransform) { - glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } else { - glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + funcs.glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + funcs.glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } - glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapMode); - glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapMode); + funcs.glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapMode); + funcs.glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapMode); } @@ -204,7 +204,7 @@ void QOpenGL2PaintEngineExPrivate::updateBrushTexture() GLuint texId = QOpenGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0); funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - glBindTexture(GL_TEXTURE_2D, texId); + funcs.glBindTexture(GL_TEXTURE_2D, texId); if (g->spread() == QGradient::RepeatSpread || g->type() == QGradient::ConicalGradient) updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); @@ -439,43 +439,43 @@ void QOpenGL2PaintEngineExPrivate::updateCompositionMode() // qDebug() << "QOpenGL2PaintEngineExPrivate::updateCompositionMode() - Setting GL composition mode for " << q->state()->composition_mode; switch(q->state()->composition_mode) { case QPainter::CompositionMode_SourceOver: - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + funcs.glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); break; case QPainter::CompositionMode_DestinationOver: - glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); + funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); break; case QPainter::CompositionMode_Clear: - glBlendFunc(GL_ZERO, GL_ZERO); + funcs.glBlendFunc(GL_ZERO, GL_ZERO); break; case QPainter::CompositionMode_Source: - glBlendFunc(GL_ONE, GL_ZERO); + funcs.glBlendFunc(GL_ONE, GL_ZERO); break; case QPainter::CompositionMode_Destination: - glBlendFunc(GL_ZERO, GL_ONE); + funcs.glBlendFunc(GL_ZERO, GL_ONE); break; case QPainter::CompositionMode_SourceIn: - glBlendFunc(GL_DST_ALPHA, GL_ZERO); + funcs.glBlendFunc(GL_DST_ALPHA, GL_ZERO); break; case QPainter::CompositionMode_DestinationIn: - glBlendFunc(GL_ZERO, GL_SRC_ALPHA); + funcs.glBlendFunc(GL_ZERO, GL_SRC_ALPHA); break; case QPainter::CompositionMode_SourceOut: - glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO); + funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO); break; case QPainter::CompositionMode_DestinationOut: - glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); + funcs.glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); break; case QPainter::CompositionMode_SourceAtop: - glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + funcs.glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break; case QPainter::CompositionMode_DestinationAtop: - glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA); + funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA); break; case QPainter::CompositionMode_Xor: - glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + funcs.glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break; case QPainter::CompositionMode_Plus: - glBlendFunc(GL_ONE, GL_ONE); + funcs.glBlendFunc(GL_ONE, GL_ONE); break; default: qWarning("Unsupported composition mode"); @@ -524,7 +524,7 @@ void QOpenGL2PaintEngineExPrivate::drawTexture(const QOpenGLRect& dest, const QO setCoords(staticVertexCoordinateArray, dest); setCoords(staticTextureCoordinateArray, srcTextureRect); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + funcs.glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } void QOpenGL2PaintEngineEx::beginNativePainting() @@ -541,37 +541,35 @@ void QOpenGL2PaintEngineEx::beginNativePainting() for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) d->funcs.glDisableVertexAttribArray(i); -#ifndef QT_OPENGL_ES_2 - if (!QOpenGLContext::currentContext()->isES()) { - Q_ASSERT(QOpenGLContext::currentContext()); - const QOpenGLContext *ctx = d->ctx; - const QSurfaceFormat &fmt = d->device->context()->format(); - if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1) - || (fmt.majorVersion() == 3 && fmt.minorVersion() == 1 && ctx->hasExtension(QByteArrayLiteral("GL_ARB_compatibility"))) - || fmt.profile() == QSurfaceFormat::CompatibilityProfile) - { - // be nice to people who mix OpenGL 1.x code with QPainter commands - // by setting modelview and projection matrices to mirror the GL 1 - // paint engine - const QTransform& mtx = state()->matrix; +#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC) + Q_ASSERT(QOpenGLContext::currentContext()); + const QOpenGLContext *ctx = d->ctx; + const QSurfaceFormat &fmt = d->device->context()->format(); + if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1) + || (fmt.majorVersion() == 3 && fmt.minorVersion() == 1 && ctx->hasExtension(QByteArrayLiteral("GL_ARB_compatibility"))) + || fmt.profile() == QSurfaceFormat::CompatibilityProfile) + { + // be nice to people who mix OpenGL 1.x code with QPainter commands + // by setting modelview and projection matrices to mirror the GL 1 + // paint engine + const QTransform& mtx = state()->matrix; - float mv_matrix[4][4] = - { - { float(mtx.m11()), float(mtx.m12()), 0, float(mtx.m13()) }, - { float(mtx.m21()), float(mtx.m22()), 0, float(mtx.m23()) }, - { 0, 0, 1, 0 }, - { float(mtx.dx()), float(mtx.dy()), 0, float(mtx.m33()) } - }; + float mv_matrix[4][4] = + { + { float(mtx.m11()), float(mtx.m12()), 0, float(mtx.m13()) }, + { float(mtx.m21()), float(mtx.m22()), 0, float(mtx.m23()) }, + { 0, 0, 1, 0 }, + { float(mtx.dx()), float(mtx.dy()), 0, float(mtx.m33()) } + }; - const QSize sz = d->device->size(); + const QSize sz = d->device->size(); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999); - glMatrixMode(GL_MODELVIEW); - glLoadMatrixf(&mv_matrix[0][0]); - } + glMatrixMode(GL_MODELVIEW); + glLoadMatrixf(&mv_matrix[0][0]); } #endif // QT_OPENGL_ES_2 @@ -586,17 +584,17 @@ void QOpenGL2PaintEngineEx::beginNativePainting() void QOpenGL2PaintEngineExPrivate::resetGLState() { - glDisable(GL_BLEND); + funcs.glDisable(GL_BLEND); funcs.glActiveTexture(GL_TEXTURE0); - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); - glDepthMask(true); - glDepthFunc(GL_LESS); + funcs.glDisable(GL_STENCIL_TEST); + funcs.glDisable(GL_DEPTH_TEST); + funcs.glDisable(GL_SCISSOR_TEST); + funcs.glDepthMask(true); + funcs.glDepthFunc(GL_LESS); funcs.glClearDepthf(1); - glStencilMask(0xff); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glStencilFunc(GL_ALWAYS, 0, 0xff); + funcs.glStencilMask(0xff); + funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + funcs.glStencilFunc(GL_ALWAYS, 0, 0xff); setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false); setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false); setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); @@ -755,9 +753,9 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path) cache->primitiveType = GL_TRIANGLE_FAN; cache->iscale = inverseScale; #ifdef QT_OPENGL_CACHE_AS_VBOS - glGenBuffers(1, &cache->vbo); - glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); - glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW); + funcs.glGenBuffers(1, &cache->vbo); + funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); + funcs.glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW); cache->ibo = 0; #else cache->vertices = (float *) malloc(floatSizeInBytes); @@ -768,12 +766,12 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path) prepareForDraw(currentBrush.isOpaque()); #ifdef QT_OPENGL_CACHE_AS_VBOS - glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); + funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); #else setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); #endif - glDrawArrays(cache->primitiveType, 0, cache->vertexCount); + funcs.glDrawArrays(cache->primitiveType, 0, cache->vertexCount); } else { // printf(" - Marking path as cachable...\n"); @@ -833,10 +831,10 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path) cache->iscale = inverseScale; cache->indexType = polys.indices.type(); #ifdef QT_OPENGL_CACHE_AS_VBOS - glGenBuffers(1, &cache->vbo); - glGenBuffers(1, &cache->ibo); - glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); + funcs.glGenBuffers(1, &cache->vbo); + funcs.glGenBuffers(1, &cache->ibo); + funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); + funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); if (polys.indices.type() == QVertexIndexVector::UnsignedInt) funcs.glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); @@ -863,21 +861,21 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path) prepareForDraw(currentBrush.isOpaque()); #ifdef QT_OPENGL_CACHE_AS_VBOS - glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); + funcs.glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); + funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); if (cache->indexType == QVertexIndexVector::UnsignedInt) - glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0); + funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0); else - glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - glBindBuffer(GL_ARRAY_BUFFER, 0); + funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0); + funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + funcs.glBindBuffer(GL_ARRAY_BUFFER, 0); #else setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); if (cache->indexType == QVertexIndexVector::UnsignedInt) - glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices); + funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices); else - glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices); + funcs.glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices); #endif } else { @@ -904,9 +902,9 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path) prepareForDraw(currentBrush.isOpaque()); setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData()); if (funcs.hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint)) - glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.data()); + funcs.glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.data()); else - glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_SHORT, polys.indices.data()); + funcs.glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_SHORT, polys.indices.data()); } else { // We can't handle big, concave painter paths with OpenGL without stencil buffer. qWarning("Painter path exceeds +/-32767 pixels."); @@ -920,24 +918,24 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path) fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); - glStencilMask(0xff); - glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + funcs.glStencilMask(0xff); + funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); if (q->state()->clipTestEnabled) { // Pass when high bit is set, replace stencil value with current clip - glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT); } else if (path.hasWindingFill()) { // Pass when any bit is set, replace stencil value with 0 - glStencilFunc(GL_NOTEQUAL, 0, 0xff); + funcs.glStencilFunc(GL_NOTEQUAL, 0, 0xff); } else { // Pass when high bit is set, replace stencil value with 0 - glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); } prepareForDraw(currentBrush.isOpaque()); // Stencil the brush onto the dest buffer composite(vertexCoordinateArray.boundingRect()); - glStencilMask(0); + funcs.glStencilMask(0); updateClipScissorTest(); } } @@ -954,16 +952,16 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, Q_ASSERT(count || stops); // qDebug("QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray()"); - glStencilMask(0xff); // Enable stencil writes + funcs.glStencilMask(0xff); // Enable stencil writes if (dirtyStencilRegion.intersects(currentScissorBounds)) { QVector clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); - glClearStencil(0); // Clear to zero + funcs.glClearStencil(0); // Clear to zero for (int i = 0; i < clearRegion.size(); ++i) { #ifndef QT_GL_NO_SCISSOR_TEST setScissor(clearRegion.at(i)); #endif - glClear(GL_STENCIL_BUFFER_BIT); + funcs.glClear(GL_STENCIL_BUFFER_BIT); } dirtyStencilRegion -= currentScissorBounds; @@ -973,23 +971,23 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, #endif } - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes + funcs.glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes useSimpleShader(); - glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d + funcs.glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d if (mode == WindingFillMode) { Q_ASSERT(stops && !count); if (q->state()->clipTestEnabled) { // Flatten clip values higher than current clip, and set high bit to match current clip - glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); - glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + funcs.glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); composite(bounds); - glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); } else if (!stencilClean) { // Clear stencil buffer within bounding rect - glStencilFunc(GL_ALWAYS, 0, 0xff); - glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); + funcs.glStencilFunc(GL_ALWAYS, 0, 0xff); + funcs.glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); composite(bounds); } @@ -997,44 +995,44 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, funcs.glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_INCR_WRAP); // Dec. for back-facing "holes" funcs.glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_DECR_WRAP); - glStencilMask(~GL_STENCIL_HIGH_BIT); + funcs.glStencilMask(~GL_STENCIL_HIGH_BIT); drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN); if (q->state()->clipTestEnabled) { // Clear high bit of stencil outside of path - glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); - glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); - glStencilMask(GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + funcs.glStencilMask(GL_STENCIL_HIGH_BIT); composite(bounds); } } else if (mode == OddEvenFillMode) { - glStencilMask(GL_STENCIL_HIGH_BIT); - glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit + funcs.glStencilMask(GL_STENCIL_HIGH_BIT); + funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN); } else { // TriStripStrokeFillMode Q_ASSERT(count && !stops); // tristrips generated directly, so no vertexArray or stops - glStencilMask(GL_STENCIL_HIGH_BIT); + funcs.glStencilMask(GL_STENCIL_HIGH_BIT); #if 0 - glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit + funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); - glDrawArrays(GL_TRIANGLE_STRIP, 0, count); + funcs.glDrawArrays(GL_TRIANGLE_STRIP, 0, count); #else - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + funcs.glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); if (q->state()->clipTestEnabled) { - glStencilFunc(GL_LEQUAL, q->state()->currentClip | GL_STENCIL_HIGH_BIT, - ~GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip | GL_STENCIL_HIGH_BIT, + ~GL_STENCIL_HIGH_BIT); } else { - glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff); + funcs.glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff); } setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); - glDrawArrays(GL_TRIANGLE_STRIP, 0, count); + funcs.glDrawArrays(GL_TRIANGLE_STRIP, 0, count); #endif } // Enable color writes & disable stencil writes - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + funcs.glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } /* @@ -1050,22 +1048,22 @@ void QOpenGL2PaintEngineExPrivate::resetClipIfNeeded() Q_Q(QOpenGL2PaintEngineEx); useSimpleShader(); - glEnable(GL_STENCIL_TEST); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + funcs.glEnable(GL_STENCIL_TEST); + funcs.glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); QRectF bounds = q->state()->matrix.inverted().mapRect(QRectF(0, 0, width, height)); QOpenGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom()); // Set high bit on clip region - glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff); - glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); - glStencilMask(GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff); + funcs.glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); + funcs.glStencilMask(GL_STENCIL_HIGH_BIT); composite(rect); // Reset clipping to 1 and everything else to zero - glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT); - glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE); - glStencilMask(0xff); + funcs.glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT); + funcs.glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE); + funcs.glStencilMask(0xff); composite(rect); q->state()->currentClip = 1; @@ -1073,8 +1071,8 @@ void QOpenGL2PaintEngineExPrivate::resetClipIfNeeded() maxClip = 1; - glStencilMask(0x0); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + funcs.glStencilMask(0x0); + funcs.glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } bool QOpenGL2PaintEngineExPrivate::prepareForCachedGlyphDraw(const QFontEngineGlyphCache &cache) @@ -1107,9 +1105,9 @@ bool QOpenGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) || (q->state()->composition_mode == QPainter::CompositionMode_SourceOver && srcPixelsAreOpaque && !stateHasOpacity)) { - glDisable(GL_BLEND); + funcs.glDisable(GL_BLEND); } else { - glEnable(GL_BLEND); + funcs.glEnable(GL_BLEND); } QOpenGLEngineShaderManager::OpacityMode opacityMode; @@ -1159,7 +1157,7 @@ void QOpenGL2PaintEngineExPrivate::composite(const QOpenGLRect& boundingRect) { setCoords(staticVertexCoordinateArray, boundingRect); setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + funcs.glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } // Draws the vertex array as a set of triangle fans. @@ -1177,7 +1175,7 @@ void QOpenGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stop for (int i=previousStop; isetBrush(&b); @@ -1292,16 +1290,16 @@ void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &p fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2, 0, 0, bounds, QOpenGL2PaintEngineExPrivate::TriStripStrokeFillMode); - glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); // Pass when any bit is set, replace stencil value with 0 - glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); prepareForDraw(false); // Stencil the brush onto the dest buffer composite(bounds); - glStencilMask(0); + funcs.glStencilMask(0); updateClipScissorTest(); } @@ -1336,11 +1334,12 @@ void QOpenGL2PaintEngineEx::renderHintsChanged() #ifndef QT_OPENGL_ES_2 if (!QOpenGLContext::currentContext()->isES()) { + Q_D(QOpenGL2PaintEngineEx); if ((state()->renderHints & QPainter::Antialiasing) || (state()->renderHints & QPainter::HighQualityAntialiasing)) - glEnable(GL_MULTISAMPLE); + d->funcs.glEnable(GL_MULTISAMPLE); else - glDisable(GL_MULTISAMPLE); + d->funcs.glDisable(GL_MULTISAMPLE); } #endif // QT_OPENGL_ES_2 @@ -1461,7 +1460,7 @@ bool QOpenGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, co d->transferMode(ImageDrawingMode); d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); - glBindTexture(GL_TEXTURE_2D, textureId); + d->funcs.glBindTexture(GL_TEXTURE_2D, textureId); QOpenGLRect srcRect(src.left(), src.bottom(), src.right(), src.top()); @@ -1720,15 +1719,15 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) if (elementIndicesVBOId == 0) - glGenBuffers(1, &elementIndicesVBOId); + funcs.glGenBuffers(1, &elementIndicesVBOId); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementIndices.size() * sizeof(GLushort), - elementIndices.constData(), GL_STATIC_DRAW); + funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId); + funcs.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementIndices.size() * sizeof(GLushort), + elementIndices.constData(), GL_STATIC_DRAW); #endif } else { #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId); + funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId); #endif } @@ -1774,8 +1773,8 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly opacityUniformDirty = true; } - glEnable(GL_BLEND); - glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR); + funcs.glEnable(GL_BLEND); + funcs.glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR); funcs.glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); } else { // Other brush styles need two passes. @@ -1790,17 +1789,17 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly compositionModeDirty = false; // I can handle this myself, thank you very much prepareForCachedGlyphDraw(*cache); - glEnable(GL_BLEND); - glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); + funcs.glEnable(GL_BLEND); + funcs.glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT); - glBindTexture(GL_TEXTURE_2D, cache->texture()); + funcs.glBindTexture(GL_TEXTURE_2D, cache->texture()); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false); #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) - glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); + funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); #else - glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); + funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); #endif shaderManager->setMaskType(QOpenGLEngineShaderManager::SubPixelMaskPass2); @@ -1814,8 +1813,8 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly compositionModeDirty = false; prepareForCachedGlyphDraw(*cache); - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE); + funcs.glEnable(GL_BLEND); + funcs.glBlendFunc(GL_ONE, GL_ONE); } compositionModeDirty = true; } else if (glyphFormat == QFontEngine::Format_ARGB) { @@ -1839,27 +1838,27 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT); if (lastMaskTextureUsed != cache->texture()) { - glBindTexture(GL_TEXTURE_2D, cache->texture()); + funcs.glBindTexture(GL_TEXTURE_2D, cache->texture()); lastMaskTextureUsed = cache->texture(); } if (cache->filterMode() != filterMode) { if (filterMode == QOpenGLTextureGlyphCache::Linear) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + funcs.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } cache->setFilterMode(filterMode); } } #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) - glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); + funcs.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #else - glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); + funcs.glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); #endif } @@ -1960,7 +1959,7 @@ void QOpenGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFra shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col); } - glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount); + funcs.glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount); } bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev) @@ -2005,15 +2004,15 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev) d->shaderManager = new QOpenGLEngineShaderManager(d->ctx); - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); + d->funcs.glDisable(GL_STENCIL_TEST); + d->funcs.glDisable(GL_DEPTH_TEST); + d->funcs.glDisable(GL_SCISSOR_TEST); d->glyphCacheFormat = QFontEngine::Format_A8; #ifndef QT_OPENGL_ES_2 if (!QOpenGLContext::currentContext()->isES()) { - glDisable(GL_MULTISAMPLE); + d->funcs.glDisable(GL_MULTISAMPLE); d->glyphCacheFormat = QFontEngine::Format_A32; d->multisamplingAlwaysEnabled = false; } else @@ -2071,7 +2070,7 @@ void QOpenGL2PaintEngineEx::ensureActive() d->device->ensureActiveTarget(); d->transferMode(BrushDrawingMode); - glViewport(0, 0, d->width, d->height); + d->funcs.glViewport(0, 0, d->width, d->height); d->needsSync = false; d->lastMaskTextureUsed = 0; d->shaderManager->setDirty(); @@ -2086,11 +2085,11 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest() { Q_Q(QOpenGL2PaintEngineEx); if (q->state()->clipTestEnabled) { - glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + funcs.glEnable(GL_STENCIL_TEST); + funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); } else { - glDisable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 0, 0xff); + funcs.glDisable(GL_STENCIL_TEST); + funcs.glStencilFunc(GL_ALWAYS, 0, 0xff); } #ifdef QT_GL_NO_SCISSOR_TEST @@ -2112,9 +2111,9 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest() currentScissorBounds = bounds; if (bounds == QRect(0, 0, width, height)) { - glDisable(GL_SCISSOR_TEST); + funcs.glDisable(GL_SCISSOR_TEST); } else { - glEnable(GL_SCISSOR_TEST); + funcs.glEnable(GL_SCISSOR_TEST); setScissor(bounds); } #endif @@ -2130,7 +2129,7 @@ void QOpenGL2PaintEngineExPrivate::setScissor(const QRect &rect) } const int height = rect.height(); - glScissor(left, bottom, width, height); + funcs.glScissor(left, bottom, width, height); } void QOpenGL2PaintEngineEx::clipEnabledChanged() @@ -2149,10 +2148,10 @@ void QOpenGL2PaintEngineExPrivate::clearClip(uint value) { dirtyStencilRegion -= currentScissorBounds; - glStencilMask(0xff); - glClearStencil(value); - glClear(GL_STENCIL_BUFFER_BIT); - glStencilMask(0x0); + funcs.glStencilMask(0xff); + funcs.glClearStencil(value); + funcs.glClear(GL_STENCIL_BUFFER_BIT); + funcs.glStencilMask(0x0); q->state()->needsClipBufferClear = false; } @@ -2180,15 +2179,15 @@ void QOpenGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value clearClip(1); if (path.isEmpty()) { - glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); + funcs.glEnable(GL_STENCIL_TEST); + funcs.glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); return; } if (q->state()->clipTestEnabled) - glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); else - glStencilFunc(GL_ALWAYS, 0, 0xff); + funcs.glStencilFunc(GL_ALWAYS, 0, 0xff); vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale, false); @@ -2196,39 +2195,39 @@ void QOpenGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value if (!singlePass) fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); - glColorMask(false, false, false, false); - glEnable(GL_STENCIL_TEST); + funcs.glColorMask(false, false, false, false); + funcs.glEnable(GL_STENCIL_TEST); useSimpleShader(); if (singlePass) { // Under these conditions we can set the new stencil value in a single // pass, by using the current value and the "new value" as the toggles - glStencilFunc(GL_LEQUAL, referenceClipValue, ~GL_STENCIL_HIGH_BIT); - glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); - glStencilMask(value ^ referenceClipValue); + funcs.glStencilFunc(GL_LEQUAL, referenceClipValue, ~GL_STENCIL_HIGH_BIT); + funcs.glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); + funcs.glStencilMask(value ^ referenceClipValue); drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); } else { - glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); - glStencilMask(0xff); + funcs.glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + funcs.glStencilMask(0xff); if (!q->state()->clipTestEnabled && path.hasWindingFill()) { // Pass when any clip bit is set, set high bit - glStencilFunc(GL_NOTEQUAL, GL_STENCIL_HIGH_BIT, ~GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_NOTEQUAL, GL_STENCIL_HIGH_BIT, ~GL_STENCIL_HIGH_BIT); composite(vertexCoordinateArray.boundingRect()); } // Pass when high bit is set, replace stencil value with new clip value - glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT); + funcs.glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT); composite(vertexCoordinateArray.boundingRect()); } - glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); - glStencilMask(0); + funcs.glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); + funcs.glStencilMask(0); - glColorMask(true, true, true, true); + funcs.glColorMask(true, true, true, true); } void QOpenGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) @@ -2384,7 +2383,7 @@ void QOpenGL2PaintEngineEx::setState(QPainterState *new_state) if (old_state == s || old_state->clipChanged) { if (old_state && old_state != s && old_state->canRestoreClip) { d->updateClipScissorTest(); - glDepthFunc(GL_LEQUAL); + d->funcs.glDepthFunc(GL_LEQUAL); } else { d->regenerateClip(); } diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index 08930b558eb..d2429cdd231 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -3035,7 +3035,8 @@ int QOpenGLShaderProgram::maxGeometryOutputVertices() const { GLint n = 0; #if defined(QT_OPENGL_3_2) - glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, &n); + Q_D(const QOpenGLShaderProgram); + d->glfuncs->glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES, &n); #endif return n; } diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 901c564a8bf..0266656c1b0 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -1633,7 +1633,7 @@ GLuint QOpenGLTexture::boundTextureId(BindingTarget target) } GLint textureId = 0; - glGetIntegerv(target, &textureId); + ctx->functions()->glGetIntegerv(target, &textureId); return static_cast(textureId); } @@ -1653,11 +1653,11 @@ GLuint QOpenGLTexture::boundTextureId(uint unit, BindingTarget target) funcs->initializeOpenGLFunctions(); GLint oldTextureUnit = 0; - glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); + funcs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); funcs->glActiveTexture(unit); GLint textureId = 0; - glGetIntegerv(target, &textureId); + funcs->glGetIntegerv(target, &textureId); funcs->glActiveTexture(oldTextureUnit); return static_cast(textureId); diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp index b776444347f..d52517add2c 100644 --- a/src/gui/opengl/qopengltextureblitter.cpp +++ b/src/gui/opengl/qopengltextureblitter.cpp @@ -45,6 +45,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -120,11 +121,11 @@ class TextureBinder public: TextureBinder(GLuint textureId) { - glBindTexture(GL_TEXTURE_2D, textureId); + QOpenGLContext::currentContext()->functions()->glBindTexture(GL_TEXTURE_2D, textureId); } ~TextureBinder() { - glBindTexture(GL_TEXTURE_2D, 0); + QOpenGLContext::currentContext()->functions()->glBindTexture(GL_TEXTURE_2D, 0); } }; @@ -196,7 +197,7 @@ void QOpenGLTextureBlitterPrivate::blit(GLuint texture, program->setUniformValue(textureTransformUniformPos, textureTransform); textureMatrixUniformState = User; - glDrawArrays(GL_TRIANGLES, 0, 6); + QOpenGLContext::currentContext()->functions()->glDrawArrays(GL_TRIANGLES, 0, 6); } void QOpenGLTextureBlitterPrivate::blit(GLuint texture, @@ -219,7 +220,7 @@ void QOpenGLTextureBlitterPrivate::blit(GLuint texture, textureMatrixUniformState = Identity; } - glDrawArrays(GL_TRIANGLES, 0, 6); + QOpenGLContext::currentContext()->functions()->glDrawArrays(GL_TRIANGLES, 0, 6); } QOpenGLTextureBlitter::QOpenGLTextureBlitter() diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp index 750264935b2..f4aa29ac0f7 100644 --- a/src/gui/opengl/qopengltexturecache.cpp +++ b/src/gui/opengl/qopengltexturecache.cpp @@ -117,7 +117,7 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap & if (!pixmap.paintingActive()) { QOpenGLCachedTexture *entry = m_cache.object(key); if (entry) { - glBindTexture(GL_TEXTURE_2D, entry->id()); + context->functions()->glBindTexture(GL_TEXTURE_2D, entry->id()); return entry->id(); } } @@ -154,7 +154,7 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &i if (!image.paintingActive()) { QOpenGLCachedTexture *entry = m_cache.object(key); if (entry) { - glBindTexture(GL_TEXTURE_2D, entry->id()); + context->functions()->glBindTexture(GL_TEXTURE_2D, entry->id()); return entry->id(); } } @@ -181,12 +181,13 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &i GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, const QImage &image) { GLuint id; - glGenTextures(1, &id); - glBindTexture(GL_TEXTURE_2D, id); + QOpenGLFunctions *funcs = context->functions(); + funcs->glGenTextures(1, &id); + funcs->glBindTexture(GL_TEXTURE_2D, id); QImage tx = image.convertToFormat(QImage::Format_RGBA8888_Premultiplied); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx.width(), tx.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, const_cast(tx).bits()); + funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx.width(), tx.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, const_cast(tx).bits()); int cost = tx.width() * tx.height() * 4 / 1024; m_cache.insert(key, new QOpenGLCachedTexture(id, context), cost); @@ -210,9 +211,9 @@ void QOpenGLTextureCache::freeResource(QOpenGLContext *) Q_ASSERT(false); // the texture cache lives until the context group disappears } -static void freeTexture(QOpenGLFunctions *, GLuint id) +static void freeTexture(QOpenGLFunctions *funcs, GLuint id) { - glDeleteTextures(1, &id); + funcs->glDeleteTextures(1, &id); } QOpenGLCachedTexture::QOpenGLCachedTexture(GLuint id, QOpenGLContext *context) diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 92eb9be80c0..5844bf639c8 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -122,8 +122,9 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height) if (!m_textureResource) m_textureResource = new QOpenGLGlyphTexture(ctx); - glGenTextures(1, &m_textureResource->m_texture); - glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); + QOpenGLFunctions *funcs = ctx->functions(); + funcs->glGenTextures(1, &m_textureResource->m_texture); + funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); m_textureResource->m_width = width; m_textureResource->m_height = height; @@ -132,7 +133,7 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height) QVarLengthArray data(width * height * 4); for (int i = 0; i < data.size(); ++i) data[i] = 0; - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); + funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); } else { QVarLengthArray data(width * height); for (int i = 0; i < data.size(); ++i) @@ -144,13 +145,13 @@ void QOpenGLTextureGlyphCache::createTextureData(int width, int height) const GLint internalFormat = GL_ALPHA; const GLenum format = GL_ALPHA; #endif - glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_UNSIGNED_BYTE, &data[0]); + funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_UNSIGNED_BYTE, &data[0]); } - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); m_filterMode = Nearest; if (!m_buffer.isCreated()) { @@ -187,8 +188,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) return; } + QOpenGLFunctions *funcs = ctx->functions(); GLint oldFbo; - glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFbo); + funcs->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFbo); int oldWidth = m_textureResource->m_width; int oldHeight = m_textureResource->m_height; @@ -205,44 +207,42 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) if (ctx->d_func()->workaround_brokenFBOReadBack) { QImageTextureGlyphCache::resizeTextureData(width, height); Q_ASSERT(image().depth() == 8); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, image().constBits()); - glDeleteTextures(1, &oldTexture); + funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, image().constBits()); + funcs->glDeleteTextures(1, &oldTexture); return; } // ### the QTextureGlyphCache API needs to be reworked to allow // ### resizeTextureData to fail - QOpenGLFunctions funcs(ctx); - - funcs.glBindFramebuffer(GL_FRAMEBUFFER, m_textureResource->m_fbo); + funcs->glBindFramebuffer(GL_FRAMEBUFFER, m_textureResource->m_fbo); GLuint tmp_texture; - glGenTextures(1, &tmp_texture); - glBindTexture(GL_TEXTURE_2D, tmp_texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + funcs->glGenTextures(1, &tmp_texture); + funcs->glBindTexture(GL_TEXTURE_2D, tmp_texture); + funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); m_filterMode = Nearest; - glBindTexture(GL_TEXTURE_2D, 0); - funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, tmp_texture, 0); + funcs->glBindTexture(GL_TEXTURE_2D, 0); + funcs->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, tmp_texture, 0); - funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); - glBindTexture(GL_TEXTURE_2D, oldTexture); + funcs->glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); + funcs->glBindTexture(GL_TEXTURE_2D, oldTexture); if (pex != 0) pex->transferMode(BrushDrawingMode); - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); - glDisable(GL_BLEND); + funcs->glDisable(GL_STENCIL_TEST); + funcs->glDisable(GL_DEPTH_TEST); + funcs->glDisable(GL_SCISSOR_TEST); + funcs->glDisable(GL_BLEND); - glViewport(0, 0, oldWidth, oldHeight); + funcs->glViewport(0, 0, oldWidth, oldHeight); QOpenGLShaderProgram *blitProgram = 0; if (pex == 0) { @@ -301,21 +301,21 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) blitProgram->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + funcs->glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); + funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight); + funcs->glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight); - funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, 0); - glDeleteTextures(1, &tmp_texture); - glDeleteTextures(1, &oldTexture); + funcs->glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, 0); + funcs->glDeleteTextures(1, &tmp_texture); + funcs->glDeleteTextures(1, &oldTexture); - funcs.glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo); + funcs->glBindFramebuffer(GL_FRAMEBUFFER, (GLuint)oldFbo); if (pex != 0) { - glViewport(0, 0, pex->width, pex->height); + funcs->glViewport(0, 0, pex->width, pex->height); pex->updateClipScissorTest(); } else { if (m_vao.isCreated()) { @@ -335,15 +335,16 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed return; } + QOpenGLFunctions *funcs = ctx->functions(); if (ctx->d_func()->workaround_brokenFBOReadBack) { QImageTextureGlyphCache::fillTexture(c, glyph, subPixelPosition); - glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); + funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); const QImage &texture = image(); const uchar *bits = texture.constBits(); bits += c.y * texture.bytesPerLine() + c.x; for (int i=0; iglTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, c.w, 1, GL_ALPHA, GL_UNSIGNED_BYTE, bits); bits += texture.bytesPerLine(); } return; @@ -404,7 +405,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed } } - glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); + funcs->glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); if (mask.depth() == 32) { #ifdef QT_OPENGL_ES_2 GLenum fmt = GL_RGBA; @@ -415,7 +416,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed #if Q_BYTE_ORDER == Q_BIG_ENDIAN fmt = GL_RGBA; #endif - glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, fmt, GL_UNSIGNED_BYTE, mask.bits()); + funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, fmt, GL_UNSIGNED_BYTE, mask.bits()); } else { // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is // not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista @@ -438,7 +439,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed #if 0 if (ctx->d_func()->workaround_brokenAlphaTexSubImage) { for (int i = 0; i < maskHeight; ++i) - glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i)); + funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i)); } else { #endif @@ -447,7 +448,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed #else const GLenum format = GL_ALPHA; #endif - glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits()); + funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, format, GL_UNSIGNED_BYTE, mask.bits()); #if 0 } diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h index 1e2c0310184..5a4a4e4c929 100644 --- a/src/gui/opengl/qopengltextureglyphcache_p.h +++ b/src/gui/opengl/qopengltextureglyphcache_p.h @@ -89,9 +89,9 @@ public: qDebug("~QOpenGLGlyphTexture() %p for context %p.", this, ctx); #endif if (!ctx->d_func()->workaround_brokenFBOReadBack) - QOpenGLFunctions(ctx).glDeleteFramebuffers(1, &m_fbo); + ctx->functions()->glDeleteFramebuffers(1, &m_fbo); if (m_width || m_height) - glDeleteTextures(1, &m_texture); + ctx->functions()->glDeleteTextures(1, &m_texture); } void invalidateResource() diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index b4ea8e48424..4843e938580 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -204,7 +204,8 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i Q_UNUSED(offset); context->makeCurrent(window); - glViewport(0, 0, window->width(), window->height()); + QOpenGLFunctions *funcs = context->functions(); + funcs->glViewport(0, 0, window->width(), window->height()); if (!d_ptr->blitter) { d_ptr->blitter = new QOpenGLTextureBlitter; @@ -216,7 +217,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i QRect windowRect(QPoint(), window->size()); for (int i = 0; i < textures->count(); ++i) { GLuint textureId = textures->textureId(i); - glBindTexture(GL_TEXTURE_2D, textureId); + funcs->glBindTexture(GL_TEXTURE_2D, textureId); QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), windowRect); d_ptr->blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginBottomLeft); @@ -226,15 +227,15 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i if (!textureId) return; - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + funcs->glEnable(GL_BLEND); + funcs->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(windowRect, windowRect); d_ptr->blitter->setSwizzleRB(true); d_ptr->blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft); d_ptr->blitter->setSwizzleRB(false); - glDisable(GL_BLEND); + funcs->glDisable(GL_BLEND); d_ptr->blitter->release(); context->swapBuffers(window); } @@ -280,27 +281,29 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion) const if (image.format() != QImage::Format_RGB32 && image.format() != QImage::Format_RGBA8888) image = image.convertToFormat(QImage::Format_RGBA8888); + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); + if (resized) { if (d_ptr->textureId) - glDeleteTextures(1, &d_ptr->textureId); - glGenTextures(1, &d_ptr->textureId); - glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); + funcs->glDeleteTextures(1, &d_ptr->textureId); + funcs->glGenTextures(1, &d_ptr->textureId); + funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); #ifndef QT_OPENGL_ES_2 if (!QOpenGLContext::currentContext()->isES()) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); } #endif - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imageSize.width(), imageSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, - const_cast(image.constBits())); + funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imageSize.width(), imageSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, + const_cast(image.constBits())); d_ptr->textureSize = imageSize; } else { - glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); + funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId); QRect imageRect = image.rect(); QRect rect = dirtyRegion.boundingRect() & imageRect; // if the rect is wide enough it's cheaper to just @@ -314,11 +317,11 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion) const // OpenGL instead of copying, since there's no gap between scanlines if (rect.width() == imageRect.width()) { - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE, - image.constScanLine(rect.y())); + funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE, + image.constScanLine(rect.y())); } else { - glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE, - image.copy(rect).constBits()); + funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE, + image.copy(rect).constBits()); } } diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index a5f81a9df85..e05c03d9525 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -144,9 +145,10 @@ void QOpenGLWidget::paintGL() void QOpenGLWidget::updateGL() { + Q_D(QOpenGLWidget); makeCurrent(); paintGL(); - glFlush(); + d->context.functions()->glFlush(); doneCurrent(); update(); } @@ -163,15 +165,16 @@ void QOpenGLWidget::resizeEvent(QResizeEvent *) delete d->fbo; // recreate when resized d->fbo = new QOpenGLFramebufferObject(size()); d->fbo->bind(); - glBindTexture(GL_TEXTURE_2D, d->fbo->texture()); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + QOpenGLFunctions *funcs = d->context.functions(); + funcs->glBindTexture(GL_TEXTURE_2D, d->fbo->texture()); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + funcs->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); resizeGL(width(), height()); paintGL(); - glFlush(); + funcs->glFlush(); } void QOpenGLWidget::paintEvent(QPaintEvent *) From 267eab3f398646b59f5773173cd22a97b8e9540a Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 27 Jan 2014 15:20:25 +0100 Subject: [PATCH 143/172] Doc: correction link, example and parameter issues qtbase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moved codecs folder to qtbase/examples Corrected quote in dropsite.qdoc Replaced snippet statement by include statement Added doc for undocumented parameters Task-number: QTBUG-34749 Change-Id: If4de95b8d39e5680fd0f63f8d2b6685a4b0a8052 Reviewed-by: Jędrzej Nowacki Reviewed-by: Sean Harmer --- examples/widgets/doc/dropsite.qdoc | 2 +- .../codecs/doc}/images/codecs-example.png | Bin src/corelib/global/qglobal.cpp | 16 ++- src/corelib/tools/qeasingcurve.cpp | 16 ++- src/corelib/tools/qstring.cpp | 134 ++++++++++-------- src/corelib/tools/qvarlengtharray.qdoc | 8 +- src/corelib/tools/qvector.cpp | 5 +- src/dbus/qdbusvirtualobject.cpp | 3 +- src/gui/kernel/qguiapplication.cpp | 12 +- src/gui/kernel/qopenglcontext.cpp | 15 +- src/gui/opengl/qopengltexture.cpp | 72 ++++++---- .../code/doc_src_examples_dropsite.qdoc | 2 + .../widgets/qmaccocoaviewcontainer_mac.mm | 2 +- 13 files changed, 172 insertions(+), 115 deletions(-) rename {doc/src => examples/widgets/tools/codecs/doc}/images/codecs-example.png (100%) diff --git a/examples/widgets/doc/dropsite.qdoc b/examples/widgets/doc/dropsite.qdoc index aaa5f7b3eb7..785d044a15c 100644 --- a/examples/widgets/doc/dropsite.qdoc +++ b/examples/widgets/doc/dropsite.qdoc @@ -205,7 +205,7 @@ supported formats using the \l{The foreach Keyword}{foreach keyword}. This keyword has the following format: - \snippet code/doc_src_examples_dropsite.qdoc 0 + \include code/doc_src_examples_dropsite.qdoc 0 In our example, \c format is the \a variable and the \a container is a QStringList, obtained from \c mimeData->formats(). diff --git a/doc/src/images/codecs-example.png b/examples/widgets/tools/codecs/doc/images/codecs-example.png similarity index 100% rename from doc/src/images/codecs-example.png rename to examples/widgets/tools/codecs/doc/images/codecs-example.png diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 710f7e8ba12..c15305322bf 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -394,7 +394,7 @@ Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits"); \fn bool QFlags::testFlag(Enum flag) const \since 4.2 - Returns \c true if the \a flag is set, otherwise false. + Returns \c true if the \a flag is set, otherwise \c false. */ /*! @@ -1937,7 +1937,7 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() \relates Prints a warning message containing the source code file name and - line number if \a test is false. + line number if \a test is \c false. Q_ASSERT() is useful for testing pre- and post-conditions during development. It does nothing if \c QT_NO_DEBUG was defined @@ -1960,7 +1960,7 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() \relates Prints the message \a what together with the location \a where, - the source file name and line number if \a test is false. + the source file name and line number if \a test is \c false. Q_ASSERT_X is useful for testing pre- and post-conditions during development. It does nothing if \c QT_NO_DEBUG was defined during @@ -1983,18 +1983,18 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() \relates \since 5.0 - Causes the compiler to assume that \a expr is true. This macro is useful + Causes the compiler to assume that \a expr is \c true. This macro is useful for improving code generation, by providing the compiler with hints about conditions that it would not otherwise know about. However, there is no guarantee that the compiler will actually use those hints. This macro could be considered a "lighter" version of \l{Q_ASSERT()}. While - Q_ASSERT will abort the program's execution if the condition is false, + Q_ASSERT will abort the program's execution if the condition is \c false, Q_ASSUME will tell the compiler not to generate code for those conditions. Therefore, it is important that the assumptions always hold, otherwise undefined behaviour may occur. - If \a expr is a constantly false condition, Q_ASSUME will tell the compiler + If \a expr is a constantly \c false condition, Q_ASSUME will tell the compiler that the current code execution cannot be reached. That is, Q_ASSUME(false) is equivalent to Q_UNREACHABLE(). @@ -3346,6 +3346,8 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) It expands to "std::move" if your compiler supports that C++11 function, or to nothing otherwise. + + qMove takes an rvalue reference to its parameter \a x, and converts it to an xvalue. */ /*! @@ -3426,7 +3428,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) \relates \since 5.0 - This macro marks a function as non-throwing if \a x is true. If + This macro marks a function as non-throwing if \a x is \c true. If the function does nevertheless throw, the behaviour is defined: std::terminate() is called. diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 27089018664..409ebd1de53 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1232,6 +1232,8 @@ void QEasingCurve::setOvershoot(qreal overshoot) It is only applicable if type() is QEasingCurve::BezierSpline. Note that the spline implicitly starts at (0.0, 0.0) and has to end at (1.0, 1.0) to be a valid easing curve. + \a c1 and \a c2 are the control points used for drawing the curve. + \a endPoint is the endpoint of the curve. */ void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint) { @@ -1290,8 +1292,12 @@ QVector static inline tcbToBezier(const TCBPoints &tcbPoints) It is only applicable if type() is QEasingCurve::TCBSpline. The spline has to start explitly at (0.0, 0.0) and has to end at (1.0, 1.0) to be a valid easing curve. - The three parameters are called tension, continuity and bias. All three parameters are - valid between -1 and 1 and define the tangent of the control point. + The tension \a t changes the length of the tangent vector. + The continuity \a c changes the sharpness in change between the tangents. + The bias \a b changes the direction of the tangent vector. + \a nextPoint is the sample position. + All three parameters are valid between -1 and 1 and define the + tangent of the control point. If all three parameters are 0 the resulting spline is a Catmull-Rom spline. The begin and endpoint always have a bias of -1 and 1, since the outer tangent is not defined. */ @@ -1390,7 +1396,7 @@ void QEasingCurve::setType(Type type) /*! Sets a custom easing curve that is defined by the user in the function \a func. The signature of the function is qreal myEasingFunction(qreal progress), - where \e progress and the return value is considered to be normalized between 0 and 1. + where \e progress and the return value are considered to be normalized between 0 and 1. (In some cases the return value can be outside that range) After calling this function type() will return QEasingCurve::Custom. \a func cannot be zero. @@ -1420,8 +1426,8 @@ QEasingCurve::EasingFunction QEasingCurve::customType() const /*! Return the effective progress for the easing curve at \a progress. - While \a progress must be between 0 and 1, the returned effective progress - can be outside those bounds. For instance, QEasingCurve::InBack will + Whereas \a progress must be between 0 and 1, the returned effective progress + can be outside those bounds. For example, QEasingCurve::InBack will return negative values in the beginning of the function. */ qreal QEasingCurve::valueForProgress(qreal progress) const diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 116da9e383a..7547ba8c19c 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1617,7 +1617,7 @@ void QString::resize(int size) This function is useful for code that needs to build up a long string and wants to avoid repeated reallocation. In this example, - we want to add to the string until some condition is true, and + we want to add to the string until some condition is \c true, and we're fairly sure that size is large enough to make a call to reserve() worthwhile: @@ -2534,6 +2534,9 @@ bool QString::operator==(QLatin1String other) const QT_NO_CAST_FROM_ASCII when you compile your applications. This can be useful if you want to ensure that all user-visible strings go through QObject::tr(), for example. + + Returns \c true if this string is lexically equal to the parameter + string \a other. Otherwise returns \c false. */ /*! \fn bool QString::operator==(const char *other) const @@ -2563,9 +2566,11 @@ bool operator<(const QString &s1, const QString &s2) { return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0; } - /*! - \overload operator<() + \overload operator<() + \relates QString + Returns \c true if this string is lexically less than the parameter + string called \a other; otherwise returns \c false. */ bool QString::operator<(QLatin1String other) const { @@ -2592,6 +2597,9 @@ bool QString::operator<(QLatin1String other) const /*! \fn bool QString::operator<(const char *other) const + Returns \c true if this string is lexically less than string \a other. + Otherwise returns \c false. + \overload operator<() The \a other const char pointer is converted to a QString using @@ -2616,6 +2624,9 @@ bool QString::operator<(QLatin1String other) const /*! \fn bool QString::operator<=(QLatin1String other) const + Returns \c true if this string is lexically less than or equal to + parameter string \a other. Otherwise returns \c false. + \overload operator<=() */ @@ -2658,7 +2669,10 @@ bool QString::operator<(QLatin1String other) const */ /*! - \overload operator>() + \overload operator>() + \relates QString + Returns \c true if this string is lexically greater than the parameter + string \a other; otherwise returns \c false. */ bool QString::operator>(QLatin1String other) const { @@ -2710,6 +2724,9 @@ bool QString::operator>(QLatin1String other) const /*! \fn bool QString::operator>=(QLatin1String other) const + Returns \c true if this string is lexically greater than or equal to parameter + string \a other. Otherwise returns \c false. + \overload operator>=() */ @@ -2754,6 +2771,9 @@ bool QString::operator>(QLatin1String other) const /*! \fn bool QString::operator!=(QLatin1String other) const + Returns \c true if this string is not equal to parameter string \a other. + Otherwise returns \c false. + \overload operator!=() */ @@ -4082,7 +4102,7 @@ QString QString::mid(int position, int n) const /*! Returns \c true if the string starts with \a s; otherwise returns - false. + \c false. If \a cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive. @@ -4109,7 +4129,7 @@ bool QString::startsWith(QLatin1String s, Qt::CaseSensitivity cs) const \overload startsWith() Returns \c true if the string starts with \a c; otherwise returns - false. + \c false. */ bool QString::startsWith(QChar c, Qt::CaseSensitivity cs) const { @@ -4138,7 +4158,7 @@ bool QString::startsWith(const QStringRef &s, Qt::CaseSensitivity cs) const /*! Returns \c true if the string ends with \a s; otherwise returns - false. + \c false. If \a cs is Qt::CaseSensitive (default), the search is case sensitive; otherwise the search is case insensitive. @@ -4181,7 +4201,7 @@ bool QString::endsWith(QLatin1String s, Qt::CaseSensitivity cs) const /*! Returns \c true if the string ends with \a c; otherwise returns - false. + \c false. \overload endsWith() */ @@ -4581,7 +4601,7 @@ QString& QString::setUnicode(const QChar *unicode, int size) replaced with a single space. Whitespace means any character for which QChar::isSpace() returns - true. This includes the ASCII characters '\\t', '\\n', '\\v', + \c true. This includes the ASCII characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '. Example: @@ -4671,7 +4691,7 @@ QString QString::simplified() const the end. Whitespace means any character for which QChar::isSpace() returns - true. This includes the ASCII characters '\\t', '\\n', '\\v', + \c true. This includes the ASCII characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '. Example: @@ -4866,7 +4886,7 @@ QString& QString::fill(QChar ch, int size) /*! \fn bool QString::isEmpty() const Returns \c true if the string has no characters; otherwise returns - false. + \c false. Example: @@ -4981,7 +5001,7 @@ QString& QString::fill(QChar ch, int size) \relates QString Returns \c true if \a s1 is not equal to \a s2; otherwise returns - false. + \c false. For \a s1 != 0, this is equivalent to \c {compare(} \a s1, \a s2 \c {) != 0}. Note that no string is equal to \a s1 being 0. @@ -5389,12 +5409,12 @@ const ushort *QString::utf16() const Returns a string of size \a width that contains this string padded by the \a fill character. - If \a truncate is false and the size() of the string is more than + If \a truncate is \c false and the size() of the string is more than \a width, then the returned string is a copy of the string. \snippet qstring/main.cpp 32 - If \a truncate is true and the size() of the string is more than + If \a truncate is \c true and the size() of the string is more than \a width, then any characters in a copy of the string after position \a width are removed, and the copy is returned. @@ -5430,7 +5450,7 @@ QString QString::leftJustified(int width, QChar fill, bool truncate) const \snippet qstring/main.cpp 49 - If \a truncate is false and the size() of the string is more than + If \a truncate is \c false and the size() of the string is more than \a width, then the returned string is a copy of the string. If \a truncate is true and the size() of the string is more than @@ -6053,8 +6073,8 @@ QString &QString::vsprintf(const char* cformat, va_list ap) base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -6093,8 +6113,8 @@ qlonglong QString::toIntegral_helper(const QChar *data, int len, bool *ok, int b base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -6134,8 +6154,8 @@ qulonglong QString::toIntegral_helper(const QChar *data, uint len, bool *ok, int base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -6163,8 +6183,8 @@ long QString::toLong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -6191,8 +6211,8 @@ ulong QString::toULong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -6218,8 +6238,8 @@ int QString::toInt(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -6245,8 +6265,8 @@ uint QString::toUInt(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -6272,8 +6292,8 @@ short QString::toShort(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -6300,8 +6320,8 @@ ushort QString::toUShort(bool *ok, int base) const Returns 0.0 if the conversion fails. - If a conversion error occurs, \c{*}\a{ok} is set to false; - otherwise \c{*}\a{ok} is set to true. + If a conversion error occurs, \c{*}\a{ok} is set to \c false; + otherwise \c{*}\a{ok} is set to \c true. \snippet qstring/main.cpp 66 @@ -6332,8 +6352,8 @@ double QString::toDouble(bool *ok) const /*! Returns the string converted to a \c float value. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. Returns 0.0 if the conversion fails. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. Returns 0.0 if the conversion fails. The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toFloat() @@ -8276,7 +8296,7 @@ ownership of it, no memory is freed when instances are destroyed. \fn bool QStringRef::isEmpty() const Returns \c true if the string reference has no characters; otherwise returns - false. + \c false. A string reference is empty if its size is zero. @@ -9523,7 +9543,7 @@ QVector QStringRef::toUcs4() const the end. Whitespace means any character for which QChar::isSpace() returns - true. This includes the ASCII characters '\\t', '\\n', '\\v', + \c true. This includes the ASCII characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' '. Unlike QString::simplified(), trimmed() leaves internal whitespace alone. @@ -9555,8 +9575,8 @@ QStringRef QStringRef::trimmed() const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -9580,8 +9600,8 @@ qint64 QStringRef::toLongLong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -9607,8 +9627,8 @@ quint64 QStringRef::toULongLong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -9634,8 +9654,8 @@ long QStringRef::toLong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -9660,8 +9680,8 @@ ulong QStringRef::toULong(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -9685,8 +9705,8 @@ int QStringRef::toInt(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -9710,8 +9730,8 @@ uint QStringRef::toUInt(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -9735,8 +9755,8 @@ short QStringRef::toShort(bool *ok, int base) const base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. If \a base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", @@ -9761,8 +9781,8 @@ ushort QStringRef::toUShort(bool *ok, int base) const Returns 0.0 if the conversion fails. - If a conversion error occurs, \c{*}\a{ok} is set to false; - otherwise \c{*}\a{ok} is set to true. + If a conversion error occurs, \c{*}\a{ok} is set to \c false; + otherwise \c{*}\a{ok} is set to \c true. The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toDouble() @@ -9784,8 +9804,8 @@ double QStringRef::toDouble(bool *ok) const /*! Returns the string converted to a \c float value. - If a conversion error occurs, *\a{ok} is set to false; otherwise - *\a{ok} is set to true. Returns 0.0 if the conversion fails. + If a conversion error occurs, *\a{ok} is set to \c false; otherwise + *\a{ok} is set to \c true. Returns 0.0 if the conversion fails. The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toFloat() diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 05d9258c867..73036ceaed2 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -189,6 +189,8 @@ /*! \fn bool QVarLengthArray::empty() const \since 5.0 + Returns \c true if the array has size 0; otherwise returns \c false. + Same as isEmpty(). Provided for STL-compatibility. */ @@ -285,7 +287,8 @@ \fn void QVarLengthArray::push_back(const T &t) \since 5.0 - Same as append(). Provided for STL-compatibility. + Appends item \a t to the array, extending the array if necessary. + Provided for STL-compatibility. */ /*! @@ -665,8 +668,7 @@ /*! \fn QVarLengthArray &QVarLengthArray::operator+=(const T &value) \since 4.8 - Appends \a value to the array and returns a reference to this - vector. + Appends \a value to the array and returns a reference to this vector. \sa append(), operator<<() */ diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 4beb0f939cf..89396540e0f 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -565,6 +565,7 @@ /*! \fn void QVector::removeAt(int i) \since 5.2 + Removes the element at index position \a i. Equivalent to \code remove(i); @@ -588,6 +589,8 @@ /*! \fn T QVector::takeAt(int i) \since 5.2 + Removes the element at index position \a i and returns it. + Equivalent to \code T t = at(i); @@ -907,7 +910,7 @@ /*! \fn bool QVector::empty() const This function is provided for STL compatibility. It is equivalent - to isEmpty(), returning true if the vector is empty; otherwise + to isEmpty(), returning \c true if the vector is empty; otherwise returns \c false. */ diff --git a/src/dbus/qdbusvirtualobject.cpp b/src/dbus/qdbusvirtualobject.cpp index 15e01c2f20a..fb9599f1939 100644 --- a/src/dbus/qdbusvirtualobject.cpp +++ b/src/dbus/qdbusvirtualobject.cpp @@ -71,7 +71,8 @@ QT_END_NAMESPACE This function needs to handle all messages to the path of the virtual object, when the SubPath option is specified. The service, path, interface and methos are all part of the \a message. - Must return true when the message is handled, otherwise false (will generate dbus error message). + Parameter \a connection is the connection handle. + Must return \c true when the message is handled, otherwise \c false (will generate dbus error message). */ diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index b2d774b40da..c6376b26478 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -910,7 +910,7 @@ qreal QGuiApplication::devicePixelRatio() const } /*! - Returns the top level window at the given position, if any. + Returns the top level window at the given position \a pos, if any. */ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) { @@ -2711,7 +2711,7 @@ void QGuiApplicationPrivate::notifyWindowIconChanged() \brief whether the application implicitly quits when the last window is closed. - The default is true. + The default is \c true. If this property is \c true, the applications quits when the last visible primary window (i.e. window with no parent) is closed. @@ -2739,7 +2739,7 @@ bool QGuiApplication::quitOnLastWindowClosed() primary window (i.e. window with no parent) is closed. By default, QGuiApplication quits after this signal is emitted. This feature - can be turned off by setting \l quitOnLastWindowClosed to false. + can be turned off by setting \l quitOnLastWindowClosed to \c false. \sa QWindow::close(), QWindow::isTopLevel() */ @@ -2915,7 +2915,7 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state) Returns \c true if the application is currently saving the \l{Session Management}{session}; otherwise returns \c false. - This is true when commitDataRequest() and saveStateRequest() are emitted, + This is \c true when commitDataRequest() and saveStateRequest() are emitted, but also when the windows are closed afterwards by session management. \sa sessionId(), commitDataRequest(), saveStateRequest() @@ -3186,7 +3186,7 @@ QStyleHints *QGuiApplication::styleHints() /*! Sets whether Qt should use the system's standard colors, fonts, etc., to - \a on. By default, this is true. + \a on. By default, this is \c true. This function must be called before creating the QGuiApplication object, like this: @@ -3202,7 +3202,7 @@ void QGuiApplication::setDesktopSettingsAware(bool on) /*! Returns \c true if Qt is set to use the system's standard colors, fonts, etc.; - otherwise returns \c false. The default is true. + otherwise returns \c false. The default is \c true. \sa setDesktopSettingsAware() */ diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index d64f996b56a..fb7d15c1603 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -163,7 +163,7 @@ void QOpenGLVersionProfile::setVersion(int majorVersion, int minorVersion) } /*! - Returns the OpenGL profile. Only make sense if profiles are supported by this version. + Returns the OpenGL profile. Only makes sense if profiles are supported by this version. \sa setProfile(), supportsProfiles() */ @@ -173,7 +173,8 @@ QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const } /*! - Sets the profile. Only make sense if profiles are supported by this version. + Sets the OpenGL profile \a profile. Only makes sense if profiles are supported by + this version. \sa profile(), supportsProfiles() */ @@ -205,7 +206,7 @@ bool QOpenGLVersionProfile::isLegacyVersion() const /*! Returns \c true if the version number is valid. Note that for a default constructed - QOpenGLVersionProfile object this function will return false. + QOpenGLVersionProfile object this function will return \c false. \sa setVersion(), version() */ @@ -634,9 +635,9 @@ QOpenGLFunctions *QOpenGLContext::functions() const */ /*! - Returns a pointer to an object that provides access to all functions for - the version of the current context. Before using any of the functions - they must be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions(). + Returns a pointer to an object that provides access to all functions for the + \a versionProfile of the current context. Before using any of the functions they must + be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions(). Usually one would use the template version of this function to automatically have the result cast to the correct type. @@ -704,7 +705,7 @@ QSet QOpenGLContext::extensions() const /*! Returns \c true if this OpenGL context supports the specified OpenGL - \a extension, false otherwise. + \a extension, \c false otherwise. The context or a sharing context must be current. diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 0266656c1b0..983496230df 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -1461,7 +1461,7 @@ QOpenGLTexture::QOpenGLTexture(Target target) /*! Creates a QOpenGLTexture object that can later be bound to the 2D texture target and contains the pixel data contained in \a image. If you wish - to have a chain of mipmaps generated then set \a useMipMaps to true (this + to have a chain of mipmaps generated then set \a genMipMaps to \c true (this is the default). This does create the underlying OpenGL texture object. Therefore, @@ -1491,6 +1491,8 @@ QOpenGLTexture::~QOpenGLTexture() functions that set properties of the texture object implicitly call create() on your behalf. + Returns \c true if the creation succeeded, otherwise returns \c false. + \sa destroy(), isCreated(), textureId() */ bool QOpenGLTexture::create() @@ -1557,9 +1559,8 @@ void QOpenGLTexture::bind() EXT_direct_state_access extension where available and simulates it where it is not. - If \a restoreTextureUnit is true then this function - will restore the active unit to the texture unit that was active - upon entry. + If parameter \a reset is \c true then this function will restore + the active unit to the texture unit that was active upon entry. \sa release() */ @@ -1584,7 +1585,7 @@ void QOpenGLTexture::release() /*! Unbinds this texture from texture unit \a unit. - If \a restoreTextureUnit is true then this function + If parameter \a reset is \c true then this function will restore the active unit to the texture unit that was active upon entry. */ @@ -1838,11 +1839,11 @@ QOpenGLTexture::TextureFormat QOpenGLTexture::format() const } /*! - Sets the dimensions of this texture object. The default - for each dimension is 1. The maximum allowable texture size - is dependent upon your OpenGL implementation. Allocating - storage for a texture less than the maximum size can still - fail if your system is low on resources. + Sets the dimensions of this texture object to \a width, + \a height, and \a depth. The default for each dimension is 1. + The maximum allowable texture size is dependent upon your OpenGL + implementation. Allocating storage for a texture less than the + maximum size can still fail if your system is low on resources. \sa width(), height(), depth() */ @@ -1925,8 +1926,8 @@ int QOpenGLTexture::depth() const } /*! - For texture targets that support mipmaps this function - sets the requested number of mipmap levels to allocate storage + For texture targets that support mipmaps, this function + sets the requested number of mipmap \a levels to allocate storage for. This function should be called before storage is allocated for the texture. @@ -1991,11 +1992,10 @@ int QOpenGLTexture::maximumMipLevels() const } /*! - For those texture targets that support array layers this function - sets the number of array layers to allocate storage for. This - function should be called before storage is allocated for the tecture. + Sets the number of array \a layers to allocate storage for. This + function should be called before storage is allocated for the texture. - For tarets that do not support array layers this function has + For targets that do not support array layers this function has no effect. \sa layers(), isStorageAllocated() @@ -2116,13 +2116,13 @@ bool QOpenGLTexture::isStorageAllocated() const Simpliar constraints apply for the \a viewFormat. See the above link and the specification for more details. - The \a minimumMipmapLevel, \a maximumMipmapLevel, \a mimimumLayer, + The \a minimumMipmapLevel, \a maximumMipmapLevel, \a minimumLayer, and \a maximumLayer arguments serve to restrict the parts of the texture accessible by the texture view. If creation of the texture view fails this function will return 0. If the function succeeds it will return a pointer to a new - QOpenGLTexture object that will return true from its isTextureView() + QOpenGLTexture object that will return \c true from its isTextureView() function. \sa isTextureView() @@ -2158,7 +2158,7 @@ bool QOpenGLTexture::isTextureView() const } /*! - Uploads pixel \a data for this texture object \a mipLevel, array \a layer and \acubeFace. + Uploads pixel \a data for this texture object \a mipLevel, array \a layer, and \a cubeFace. Storage must have been allocated before uploading pixel data. Some overloads of setData() will set appropriate dimensions, mipmap levels, and array layers and then allocate storage for you if they have enough information to do so. This will be noted in the function @@ -2285,6 +2285,8 @@ void QOpenGLTexture::setData(PixelFormat sourceFormat, PixelType sourceType, /*! This overload of setData() will allocate storage for you. + The pixel data is contained in \a image. Mipmaps are generated by default. + Set \a genMipMaps to \l DontGenerateMipMaps to turn off mipmap generation. \overload */ @@ -2303,7 +2305,7 @@ void QOpenGLTexture::setData(const QImage& image, MipMapGeneration genMipMaps) } /*! - Uploads compressed pixel \a data to \a mipLevel, array \a layer and \a cubeFace. + Uploads compressed pixel \a data to \a mipLevel, array \a layer, and \a cubeFace. The pixel transfer can optionally be controlled with \a options. The \a dataSize argument should specify the size of the data pointed to by \a data. @@ -2625,7 +2627,7 @@ QPair QOpenGLTexture::mipLevelRange() const } /*! - If \a enabled is true, enables automatic mipmap generation for this texture object + If \a enabled is \c true, enables automatic mipmap generation for this texture object to occur whenever the level 0 mipmap data is set via setData(). The automatic mipmap generation is enabled by default. @@ -2673,7 +2675,7 @@ void QOpenGLTexture::generateMipMaps() The generation of mipmaps to above \baseLevel is achieved by setting the mipmap base level to \a baseLevel and then generating the mipmap chain. If \a resetBaseLevel - is true, then the baseLevel of the texture will be reset to its previous value. + is \c true, then the baseLevel of the texture will be reset to its previous value. \sa setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels() */ @@ -2727,6 +2729,8 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val } /*! + Parameters \a {r}, \a {g}, \a {b}, and \a {a} are values used for setting + the colors red, green, blue, and the alpha value. \overload */ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g, @@ -2941,6 +2945,7 @@ void QOpenGLTexture::setWrapMode(QOpenGLTexture::WrapMode mode) } /*! + Holds the texture dimension \a direction. \overload */ void QOpenGLTexture::setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode) @@ -2995,6 +3000,8 @@ void QOpenGLTexture::setBorderColor(QColor color) } /*! + Sets the color red to \a {r}, green to \a {g}, blue to \{b}, and \a {a} to the + alpha value. \overload */ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) @@ -3026,6 +3033,8 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) } /*! + Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a the alpha + value to {a}. \overload */ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) @@ -3059,6 +3068,8 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) } /*! + Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a the alpha + value to {a}. \overload */ void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a) @@ -3110,7 +3121,7 @@ QColor QOpenGLTexture::borderColor() const } /*! - Writes the texture border color into the first 4 elements + Writes the texture border color into the first four elements of the array pointed to by \a border. \sa setBorderColor() @@ -3129,6 +3140,9 @@ void QOpenGLTexture::borderColor(float *border) const } /*! + Writes the texture border color into the first four elements + of the array pointed to by \a border. + \overload */ void QOpenGLTexture::borderColor(int *border) const @@ -3145,6 +3159,9 @@ void QOpenGLTexture::borderColor(int *border) const } /*! + Writes the texture border color into the first four elements + of the array pointed to by \a border. + \overload */ void QOpenGLTexture::borderColor(unsigned int *border) const @@ -3235,8 +3252,8 @@ float QOpenGLTexture::maximumLevelOfDetail() const } /*! - Sets the minimum and maximum level of detail parameters. - + Sets the minimum level of detail parameters to \a min and the maximum level + to \a max. \note This function has no effect on Qt built for OpenGL ES 2. \sa levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail() */ @@ -3274,7 +3291,10 @@ QPair QOpenGLTexture::levelOfDetailRange() const } /*! - Sets the level of detail bias parameter. + Sets the level of detail bias to \a bias. + Level of detail bias affects the point at which mipmapping levels change. + Increasing values for level of detail bias makes the overall images blurrier + or smoother. Decreasing values make the overall images sharper. \note This function has no effect on Qt built for OpenGL ES 2. \sa levelofDetailBias() diff --git a/src/widgets/doc/snippets/code/doc_src_examples_dropsite.qdoc b/src/widgets/doc/snippets/code/doc_src_examples_dropsite.qdoc index 923362e9099..e9d2a94a594 100644 --- a/src/widgets/doc/snippets/code/doc_src_examples_dropsite.qdoc +++ b/src/widgets/doc/snippets/code/doc_src_examples_dropsite.qdoc @@ -39,5 +39,7 @@ ****************************************************************************/ //! [0] +\code foreach(variable, container) +\endcode //! [0] diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index a94273c5747..965e9301e91 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -164,7 +164,7 @@ NSView *QMacCocoaViewContainer::cocoaView() const } /*! - Sets the NSView to contain to be \a cocoaViewToWrap and retains it. If this + Sets \a view as the NSView to contain and retains it. If this container already had a view set, it will release the previously set view. */ void QMacCocoaViewContainer::setCocoaView(NSView *view) From 4c9885a0f580c8273a211a92b6fc55af1d4f03c0 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Mon, 10 Mar 2014 11:26:42 +0100 Subject: [PATCH 144/172] Revert some previously added constexpr in QVector?d classes This commit partly reverts cd91d8ad0281c984a01b8091696a6fdfdfa69514. The revert is required as the used ifdef relied on undefined compiler behavior. Especially Windows has had trouble. The revert reduces the risk of breaks by future compilers. The proper inline and constexpr has to wait until Qt 6. Task-number: QTBUG-37122 Change-Id: I881fffb95fa46d9c170c9420a578f15640e18aea Reviewed-by: Lars Knoll --- src/gui/math3d/qvector2d.cpp | 2 -- src/gui/math3d/qvector2d.h | 14 ++------------ src/gui/math3d/qvector3d.cpp | 4 ---- src/gui/math3d/qvector3d.h | 14 +++----------- src/gui/math3d/qvector4d.cpp | 2 -- src/gui/math3d/qvector4d.h | 14 ++------------ 6 files changed, 7 insertions(+), 43 deletions(-) diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp index 73999f1fca9..a56e23eb72d 100644 --- a/src/gui/math3d/qvector2d.cpp +++ b/src/gui/math3d/qvector2d.cpp @@ -326,12 +326,10 @@ float QVector2D::distanceToLine /*! Returns the dot product of \a v1 and \a v2. */ -#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) float QVector2D::dotProduct(const QVector2D& v1, const QVector2D& v2) { return v1.xp * v2.xp + v1.yp * v2.yp; } -#endif /*! \fn bool operator==(const QVector2D &v1, const QVector2D &v2) diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h index 0098c119eca..bd1d28274cc 100644 --- a/src/gui/math3d/qvector2d.h +++ b/src/gui/math3d/qvector2d.h @@ -80,12 +80,7 @@ public: float operator[](int i) const; float length() const; -#ifdef QT_BUILD_GUI_LIB - float lengthSquared() const; -#else - Q_DECL_CONSTEXPR inline float lengthSquared() const - { return xp * xp + yp * yp; } -#endif + float lengthSquared() const; //In Qt 6 convert to inline and constexpr QVector2D normalized() const; void normalize(); @@ -99,12 +94,7 @@ public: QVector2D &operator*=(const QVector2D &vector); QVector2D &operator/=(float divisor); -#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) - static float dotProduct(const QVector2D& v1, const QVector2D& v2); -#else - Q_DECL_CONSTEXPR inline static float dotProduct(const QVector2D& v1, const QVector2D& v2) - { return v1.xp * v2.xp + v1.yp * v2.yp; } -#endif + static float dotProduct(const QVector2D& v1, const QVector2D& v2); //In Qt 6 convert to inline and constexpr Q_DECL_CONSTEXPR friend inline bool operator==(const QVector2D &v1, const QVector2D &v2); Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector2D &v1, const QVector2D &v2); diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp index 1cb73a1fa20..7e3ed7c61bf 100644 --- a/src/gui/math3d/qvector3d.cpp +++ b/src/gui/math3d/qvector3d.cpp @@ -316,12 +316,10 @@ void QVector3D::normalize() /*! Returns the dot product of \a v1 and \a v2. */ -#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) float QVector3D::dotProduct(const QVector3D& v1, const QVector3D& v2) { return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp; } -#endif /*! Returns the cross-product of vectors \a v1 and \a v2, which corresponds @@ -329,14 +327,12 @@ float QVector3D::dotProduct(const QVector3D& v1, const QVector3D& v2) \sa normal() */ -#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) QVector3D QVector3D::crossProduct(const QVector3D& v1, const QVector3D& v2) { return QVector3D(v1.yp * v2.zp - v1.zp * v2.yp, v1.zp * v2.xp - v1.xp * v2.zp, v1.xp * v2.yp - v1.yp * v2.xp); } -#endif /*! Returns the normal vector of a plane defined by vectors \a v1 and \a v2, diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h index 64f8e347046..51412a940ab 100644 --- a/src/gui/math3d/qvector3d.h +++ b/src/gui/math3d/qvector3d.h @@ -95,17 +95,9 @@ public: QVector3D &operator*=(const QVector3D& vector); QVector3D &operator/=(float divisor); -#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) - static float dotProduct(const QVector3D& v1, const QVector3D& v2); - static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2); -#else - Q_DECL_CONSTEXPR inline static float dotProduct(const QVector3D& v1, const QVector3D& v2) - { return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp; } - Q_DECL_CONSTEXPR inline static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2) - { return QVector3D(v1.yp * v2.zp - v1.zp * v2.yp, - v1.zp * v2.xp - v1.xp * v2.zp, - v1.xp * v2.yp - v1.yp * v2.xp); } -#endif + static float dotProduct(const QVector3D& v1, const QVector3D& v2); //In Qt 6 convert to inline and constexpr + static QVector3D crossProduct(const QVector3D& v1, const QVector3D& v2); //in Qt 6 convert to inline and constexpr + static QVector3D normal(const QVector3D& v1, const QVector3D& v2); static QVector3D normal (const QVector3D& v1, const QVector3D& v2, const QVector3D& v3); diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp index b3db610d9af..691551367f9 100644 --- a/src/gui/math3d/qvector4d.cpp +++ b/src/gui/math3d/qvector4d.cpp @@ -369,12 +369,10 @@ void QVector4D::normalize() /*! Returns the dot product of \a v1 and \a v2. */ -#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) float QVector4D::dotProduct(const QVector4D& v1, const QVector4D& v2) { return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp + v1.wp * v2.wp; } -#endif /*! \fn bool operator==(const QVector4D &v1, const QVector4D &v2) diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h index 2bc5b79c14c..9ab0eba09f9 100644 --- a/src/gui/math3d/qvector4d.h +++ b/src/gui/math3d/qvector4d.h @@ -86,12 +86,7 @@ public: float operator[](int i) const; float length() const; -#ifdef QT_BUILD_GUI_LIB - float lengthSquared() const; -#else - Q_DECL_CONSTEXPR inline float lengthSquared() const - { return xp * xp + yp * yp + zp * zp + wp * wp; } -#endif + float lengthSquared() const; //In Qt 6 convert to inline and constexpr QVector4D normalized() const; void normalize(); @@ -102,12 +97,7 @@ public: QVector4D &operator*=(const QVector4D &vector); QVector4D &operator/=(float divisor); -#if defined(QT_BUILD_GUI_LIB) && !defined(QT_STATIC) - static float dotProduct(const QVector4D& v1, const QVector4D& v2); -#else - static float dotProduct(const QVector4D& v1, const QVector4D& v2) - { return v1.xp * v2.xp + v1.yp * v2.yp + v1.zp * v2.zp + v1.wp * v2.wp; } -#endif + static float dotProduct(const QVector4D& v1, const QVector4D& v2); //In Qt 6 convert to inline and constexpr Q_DECL_CONSTEXPR friend inline bool operator==(const QVector4D &v1, const QVector4D &v2); Q_DECL_CONSTEXPR friend inline bool operator!=(const QVector4D &v1, const QVector4D &v2); From b7f013bf1919486dab56a4436a17a3878341a1d5 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 10 Mar 2014 17:25:10 +0200 Subject: [PATCH 145/172] Fix CJK languages support with HarfBuzz-NG By some reason, mapping to Han script doesn't work for some (most?) fonts. Until the issue is really fixed, pretend the HB-old behavior and simply map to Common script. Change-Id: I4c146f5ff2a42f64b971b2f5ebd7f65e2513fdf0 Reviewed-by: Lars Knoll --- src/gui/text/qtextengine.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 2d7611774ba..0298adde7a0 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1506,18 +1506,8 @@ void QTextEngine::itemize() const { QVarLengthArray scripts(length); QUnicodeTools::initScripts(string, length, scripts.data()); - for (int i = 0; i < length; ++i) { - ushort script = scripts.at(i); - switch (script) { - case QChar::Script_Hiragana: - case QChar::Script_Katakana: - script = QChar::Script_Han; - break; - default: - break; - } - analysis[i].script = script; - } + for (int i = 0; i < length; ++i) + analysis[i].script = scripts.at(i); } const ushort *uc = string; @@ -1564,8 +1554,21 @@ void QTextEngine::itemize() const (analysis-1)->flags = QScriptAnalysis::LineOrParagraphSeparator; // to exclude it from width } #ifdef QT_ENABLE_HARFBUZZ_NG - if (!useHarfbuzzNG) { - analysis = scriptAnalysis.data(); + analysis = scriptAnalysis.data(); + if (useHarfbuzzNG) { + for (int i = 0; i < length; ++i) { + switch (analysis[i].script) { + case QChar::Script_Han: + case QChar::Script_Hiragana: + case QChar::Script_Katakana: + case QChar::Script_Bopomofo: + analysis[i].script = QChar::Script_Common; + break; + default: + break; + } + } + } else { for (int i = 0; i < length; ++i) analysis[i].script = hbscript_to_script(script_to_hbscript(analysis[i].script)); } From e9a93e888da7a5cdabc2d5027d0f0532f41f25e7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 6 Mar 2014 16:15:29 +0100 Subject: [PATCH 146/172] Increase timeout in tst_NetworkSelfTest. Try to fix frequently failing test: FAIL! : tst_NetworkSelfTest::ftpProxyServer() Failed to receive data in step 32: timeout tst_networkselftest.cpp(230) : failure location on Windows. Introduce timeout constant, add message. Change-Id: I709f0b34cd1cfe5d3c64cf61ccb7907bd616bc54 Reviewed-by: Peter Hartmann Reviewed-by: Richard J. Moore --- .../networkselftest/tst_networkselftest.cpp | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp index 108ec466c91..11f726dcd93 100644 --- a/tests/auto/other/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp @@ -170,7 +170,9 @@ static QString prettyByteArray(const QByteArray &array) return result; } -static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout = 4000) +enum { defaultReadTimeoutMS = 4000 }; + +static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout = defaultReadTimeoutMS) { QElapsedTimer timer; timer.start(); @@ -185,6 +187,15 @@ static bool doSocketRead(QTcpSocket *socket, int minBytesAvailable, int timeout } } +static QByteArray msgDoSocketReadFailed(const QString &host, quint16 port, + int step, int minBytesAvailable) +{ + return "Failed to receive " + + QByteArray::number(minBytesAvailable) + " bytes from " + + host.toLatin1() + ':' + QByteArray::number(port) + + " in step " + QByteArray::number(step) + ": timeout"; +} + static bool doSocketFlush(QTcpSocket *socket, int timeout = 4000) { #ifndef QT_NO_SSL @@ -226,8 +237,8 @@ static void netChat(int port, const QList &chat) switch (it->type) { case Chat::Expect: { qDebug() << i << "Expecting" << prettyByteArray(it->data); - if (!doSocketRead(&socket, it->data.length())) - QFAIL(QString("Failed to receive data in step %1: timeout").arg(i).toLocal8Bit()); + if (!doSocketRead(&socket, it->data.length(), 3 * defaultReadTimeoutMS)) + QFAIL(msgDoSocketReadFailed(QtNetworkSettings::serverName(), port, i, it->data.length())); // pop that many bytes off the socket QByteArray received = socket.read(it->data.length()); @@ -245,7 +256,7 @@ static void netChat(int port, const QList &chat) while (true) { // scan the buffer until we have our string if (!doSocketRead(&socket, it->data.length())) - QFAIL(QString("Failed to receive data in step %1: timeout").arg(i).toLocal8Bit()); + QFAIL(msgDoSocketReadFailed(QtNetworkSettings::serverName(), port, i, it->data.length())); QByteArray buffer; buffer.resize(socket.bytesAvailable()); @@ -266,7 +277,7 @@ static void netChat(int port, const QList &chat) case Chat::SkipBytes: { qDebug() << i << "Skipping" << it->value << "bytes"; if (!doSocketRead(&socket, it->value)) - QFAIL(QString("Failed to receive data in step %1: timeout").arg(i).toLocal8Bit()); + QFAIL(msgDoSocketReadFailed(QtNetworkSettings::serverName(), port, i, it->value)); // now discard the bytes QByteArray buffer = socket.read(it->value); From 9c5e44139486de81a8ed0334f441d028770930fd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 10 Mar 2014 12:12:28 +0100 Subject: [PATCH 147/172] Skip the test 'abort' of tst_qftp. The test takes too long and fails: FAIL! : tst_QFtp::abort(WithoutProxy:get_fluke01) '(int)newData_ba.size() == bytesDone' returned FALSE. () tst_qftp.cpp(1886) : failure location FAIL! : tst_QFtp::abort(WithoutProxy:get_fluke01) Network operation timed out tst_qftp.cpp(1392) : failure location FAIL! : tst_QFtp::abort(WithoutProxy:put_fluke01) 'bytesDone != bytesTotal' returned FALSE. () tst_qftp.cpp(1406) : failure location FAIL! : tst_QFtp::abort(WithSocks5Proxy:get_fluke01) '(int)newData_ba.size() == bytesDone' returned FALSE. () tst_qftp.cpp(1886) : failure location FAIL! : tst_QFtp::abort(WithSocks5Proxy:get_fluke01) Network operation timed out tst_qftp.cpp(1392) : failure location FAIL! : tst_QFtp::abort(WithoutProxyWithSession:get_fluke01) '(int)newData_ba.size() == bytesDone' returned FALSE. () tst_qftp.cpp(1886) : failure location FAIL! : tst_QFtp::abort(WithoutProxyWithSession:get_fluke01) Network operation timed out tst_qftp.cpp(1392) : failure location FAIL! : tst_QFtp::abort(WithoutProxyWithSession:put_fluke01) 'bytesDone != bytesTotal' returned FALSE. () tst_qftp.cpp(1406) : failure location FAIL! : tst_QFtp::abort(WithSocks5ProxyAndSession:get_fluke01) '(int)newData_ba.size() == bytesDone' returned FALSE. () tst_qftp.cpp(1886) : failure location FAIL! : tst_QFtp::abort(WithSocks5ProxyAndSession:get_fluke01) Network operation timed out tst_qftp.cpp(1392) : failure location Totals: 327 passed, 10 failed, 4 skipped QtQA::App::TestRunner: warning: test duration (398 seconds) is dangerously close to maximum permitted time (450 seconds) QtQA::App::TestRunner: warning: Either modify the test to reduce its runtime, or use a higher timeout. QtQA::App::TestRunner: test failed, running again to see if it is flaky... Change-Id: I122641f174927c6b3668df05c79f88e38b88042f Reviewed-by: Peter Hartmann --- tests/auto/network/access/qftp/tst_qftp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index a322c7ab65d..5c6f48c59ba 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -1382,6 +1382,7 @@ void tst_QFtp::abort_data() void tst_QFtp::abort() { + QSKIP("This test takes too long."); // In case you wonder where the abort() actually happens, look into // tst_QFtp::dataTransferProgress // From 4084e7dc19a4140efa4cb7956d10a5c738c455b5 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Wed, 5 Mar 2014 18:37:41 +0100 Subject: [PATCH 148/172] QNX: Change the way one requests child windows The use of Qt::Dialog as a way to signal that a parentless window be created as a child proved problematic as some applications use dialogs as their sole window. Instead, rely on the existence of a dynamic property called 'qnxWindowGroup'. If found, the window will be created as a child window and that window group will be joined. Also added the ability to set the id string window property via another dynamic property 'qnxWindowId'. While strictly related to the original issue, one typically needs the ability to set the window id if one is joining a group. Added extensive documentation on the mysterious rules of the QNX QPA as regards windows, at least covering the areas affected by this patch. This patch was originally implemented by Roger McLean. Change-Id: I0ef88d654b794ddcb54d4c4d9804bef750da5a33 Reviewed-by: Kevin Krammer Reviewed-by: Rafael Roquetto --- .../platforms/qnx/qqnxnativeinterface.cpp | 4 +- src/plugins/platforms/qnx/qqnxwindow.cpp | 103 +++++++++++++++++- 2 files changed, 105 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp index b89c103a066..a245a0c43a0 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp @@ -109,7 +109,7 @@ void QQnxNativeInterface::setWindowProperty(QPlatformWindow *window, const QStri if (name == QStringLiteral("mmRendererWindowName")) { qnxWindow->setMMRendererWindowName(value.toString()); - } else if (name == QStringLiteral("windowGroup")) { + } else if (name == QStringLiteral("qnxWindowGroup")) { if (value.isNull()) qnxWindow->joinWindowGroup(QByteArray()); else if (value.canConvert()) @@ -124,6 +124,8 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QQnxNativeInterfa return reinterpret_cast(QQnxInputContext::setHighlightColor); if (resource == "blackberryIMFCheckSpelling") return reinterpret_cast(QQnxInputContext::checkSpelling); +#else + Q_UNUSED(resource) #endif return 0; } diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index f2b57aec9aa..9ae2d01ab4f 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -73,6 +73,88 @@ QT_BEGIN_NAMESPACE +/*! + \class QQnxWindow + \brief The QQnxWindow is the base class of the various classes used as instances of + QPlatformWindow in the QNX QPA plugin. + + The standard properties and methods available in Qt are not a perfect match for the + features provided by the QNX screen service. While for the majority of applications + the default behavior suffices, some circumstances require greater control over the + interaction with screen. + + \section1 Window types + + The QNX QPA plugin can operate in two modes, with or without a root window. The + selection of mode is made via the \e rootwindow and \e no-rootwindow options to the + plugin. The default mode is rootwindow for BlackBerry builds and no-rootwindow for + non-BlackBerry builds. + + Windows with parents are always created as child windows, the difference in the modes + is in the treatment of parentless windows. In no-rootwindow mode, these windows are + created as application windows while in rootwindow mode, the first window on a screen + is created as an application window while subsequent windows are created as child + windows. The only exception to this is any window of type Qt::Desktop or Qt::CoverWindow; + these are created as application windows, but will never become the root window, + even if they are the first window created. + + It is also possible to create a parentless child window. These may be useful to + create windows that are parented by windows from other processes. To do this, you + attach a dynamic property \e qnxInitialWindowGroup to the QWindow though this must be done + prior to the platform window class (this class) being created which typically happens + when the window is made visible. When the window is created in QML, it is acceptable + to have the \e visible property hardcoded to true so long as the qnxInitialWindowGroup + is also set. + + \section1 Joining Window Groups + + Window groups may be joined in a number of ways, some are automatic based on + predefined rules though an application is also able to provide explicit control. + + A QWindow that has a parent will join its parent's window group. When rootwindow mode + is in effect, all but the first parentless window on a screen will be child windows + and join the window group of the first parentless window, the root window. + + If a QWindow has a valid dynamic property called \e qnxInitialWindowGroup at the time the + QQnxWindow is created, the window will be created as a child window and, if the + qnxInitialWindowGroup property is a non-empty string, an attempt will be made to join that + window group. This has an effect only when the QQnxWindow is created, subsequent + changes to this property are ignored. Setting the property to an empty string + provides a means to create 'top level' child windows without automatically joining + any group. Typically when this property is used \e qnxWindowId should be used as well + so that the process that owns the window group being joined has some means to + identify the window. + + At any point following the creation of the QQnxWindow object, an application can + change the window group it has joined. This is done by using the \e + setWindowProperty function of the native interface to set the \e qnxWindowGroup property + to the desired value, for example: + + \code + QQuickView *view = new QQuickView(parent); + view->create(); + QGuiApplication::platformNativeInterface()->setWindowProperty(view->handle(), "qnxWindowGroup", + group); + \endcode + + To leave the current window group, one passes a null value for the property value, + for example: + + \code + QQuickView *view = new QQuickView(parent); + view->create(); + QGuiApplication::platformNativeInterface()->setWindowProperty(view->handle(), "qnxWindowGroup", + QVariant()); + \endcode + + \section1 Window Id + + The screen window id string property can be set on a window by assigning the desired + value to a dynamic property \e qnxWindowId on the QWindow prior to the QQnxWindow having + been created. This is often wanted when one joins a window group belonging to a + different process. + +*/ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootWindow) : QPlatformWindow(window), m_screenContext(context), @@ -88,12 +170,16 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW QQnxScreen *platformScreen = static_cast(window->screen()->handle()); + // If a qnxInitialWindowGroup property is set on the window we'll take this as an + // indication that we want to create a child window and join that window group. + const QVariant windowGroup = window->property("qnxInitialWindowGroup"); + if (window->type() == Qt::CoverWindow || window->type() == Qt::Desktop) { // Cover windows have to be top level to be accessible to window delegate (i.e. navigator) // Desktop windows also need to be toplevel because they are not // supposed to be part of the window hierarchy tree m_isTopLevel = true; - } else if (parent() || (window->type() & Qt::Dialog) == Qt::Dialog) { + } else if (parent() || windowGroup.isValid()) { // If we have a parent we are a child window. Sometimes we have to be a child even if we // don't have a parent e.g. our parent might be in a different process. m_isTopLevel = false; @@ -117,6 +203,21 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context, bool needRootW } createWindowGroup(); + + // If the window has a qnxWindowId property, set this as the string id property. This generally + // needs to be done prior to joining any group as it might be used by the owner of the + // group to identify the window. + const QVariant windowId = window->property("qnxWindowId"); + if (windowId.isValid() && windowId.canConvert()) { + QByteArray id = windowId.toByteArray(); + Q_SCREEN_CHECKERROR(screen_set_window_property_cv(m_window, SCREEN_PROPERTY_ID_STRING, + id.size(), id), "Failed to set id"); + } + + // If a window group has been provided join it now. If it's an empty string that's OK too, + // it'll cause us not to join a group (the app will presumably join at some future time). + if (windowGroup.isValid() && windowGroup.canConvert()) + joinWindowGroup(windowGroup.toByteArray()); } QQnxWindow::~QQnxWindow() From 5aaec4800066801f069dfb4606c5d9551a9b8110 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 13:11:20 +0100 Subject: [PATCH 149/172] Remove unused parameter from QEGLPlatformContext constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API is chosen via QSurfaceFormat, the constructor argument is ignored. Remove this historical artifact. Change-Id: I4a5c1e12cb297de22f239ad0a6747c1c36168eed Reviewed-by: Jørgen Lind --- src/platformsupport/eglconvenience/qeglplatformcontext.cpp | 7 ++----- src/platformsupport/eglconvenience/qeglplatformcontext_p.h | 5 ++--- .../eglconvenience/qeglplatformintegration.cpp | 3 --- .../platforms/android/qandroidplatformopenglcontext.cpp | 2 +- src/plugins/platforms/directfb/qdirectfb_egl.cpp | 3 +-- src/plugins/platforms/eglfs/qeglfscontext.cpp | 5 ++--- src/plugins/platforms/eglfs/qeglfscontext.h | 3 +-- src/plugins/platforms/minimalegl/qminimaleglscreen.cpp | 5 ++--- src/plugins/platforms/windows/qwindowseglcontext.cpp | 2 +- src/plugins/platforms/winrt/qwinrteglcontext.cpp | 2 +- 10 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 630c77fba0b..e1c53196e69 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -89,8 +89,7 @@ static inline void bindApi(const QSurfaceFormat &format) } } -QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, - EGLenum eglApi) +QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) : m_eglDisplay(display) , m_eglConfig(q_configFromGLFormat(display, format)) , m_swapInterval(-1) @@ -98,11 +97,10 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform , m_swapIntervalFromEnv(-1) { init(format, share); - Q_UNUSED(eglApi); } QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, - EGLConfig config, EGLenum eglApi) + EGLConfig config) : m_eglDisplay(display) , m_eglConfig(config) , m_swapInterval(-1) @@ -110,7 +108,6 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform , m_swapIntervalFromEnv(-1) { init(format, share); - Q_UNUSED(eglApi); } void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLContext *share) diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index d62082faa26..b4734fb22ab 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -51,10 +51,9 @@ QT_BEGIN_NAMESPACE class QEGLPlatformContext : public QPlatformOpenGLContext { public: + QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display); QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, - EGLenum eglApi = EGL_OPENGL_ES_API); - QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, - EGLConfig config, EGLenum eglApi = EGL_OPENGL_ES_API); + EGLConfig config); ~QEGLPlatformContext(); bool makeCurrent(QPlatformSurface *surface); diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp index a961035e220..b48f9934366 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp @@ -106,9 +106,6 @@ QEGLPlatformIntegration::~QEGLPlatformIntegration() void QEGLPlatformIntegration::initialize() { - if (!eglBindAPI(EGL_OPENGL_ES_API)) - qFatal("Could not bind GL_ES API"); - m_display = eglGetDisplay(nativeDisplay()); if (m_display == EGL_NO_DISPLAY) qFatal("Could not open egl display"); diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index 59ca69c004c..a0b3ae066cc 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) - :QEGLPlatformContext(format, share, display, EGL_OPENGL_ES_API) + :QEGLPlatformContext(format, share, display) { } diff --git a/src/plugins/platforms/directfb/qdirectfb_egl.cpp b/src/plugins/platforms/directfb/qdirectfb_egl.cpp index c71f71c6a8b..c738c3d0275 100644 --- a/src/plugins/platforms/directfb/qdirectfb_egl.cpp +++ b/src/plugins/platforms/directfb/qdirectfb_egl.cpp @@ -223,8 +223,7 @@ QSurfaceFormat QDirectFbWindowEGL::format() const QDirectFbEGLContext::QDirectFbEGLContext(QDirectFbScreenEGL *screen, QOpenGLContext *context) - : QEGLPlatformContext(context->format(), context->shareHandle(), - screen->eglDisplay(), EGL_OPENGL_ES_API) + : QEGLPlatformContext(context->format(), context->shareHandle(), screen->eglDisplay()) , m_screen(screen) {} diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp index 86ceb0721bd..9083abc5627 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp @@ -52,10 +52,9 @@ QT_BEGIN_NAMESPACE -QEglFSContext::QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, - EGLDisplay display, EGLenum eglApi) +QEglFSContext::QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) : QEGLPlatformContext(QEglFSHooks::hooks()->surfaceFormatFor(format), share, display, - QEglFSIntegration::chooseConfig(display, QEglFSHooks::hooks()->surfaceFormatFor(format)), eglApi) + QEglFSIntegration::chooseConfig(display, QEglFSHooks::hooks()->surfaceFormatFor(format))) { } diff --git a/src/plugins/platforms/eglfs/qeglfscontext.h b/src/plugins/platforms/eglfs/qeglfscontext.h index 22a7c67e466..5d406f09f1e 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.h +++ b/src/plugins/platforms/eglfs/qeglfscontext.h @@ -49,8 +49,7 @@ QT_BEGIN_NAMESPACE class QEglFSContext : public QEGLPlatformContext { public: - QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, - EGLenum eglApi = EGL_OPENGL_ES_API); + QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display); EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) Q_DECL_OVERRIDE; void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE; }; diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp b/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp index d26b20d364d..578031807c8 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp @@ -57,9 +57,8 @@ QT_BEGIN_NAMESPACE class QMinimalEglContext : public QEGLPlatformContext { public: - QMinimalEglContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, - EGLenum eglApi = EGL_OPENGL_ES_API) - : QEGLPlatformContext(format, share, display, eglApi) + QMinimalEglContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) + : QEGLPlatformContext(format, share, display) { } diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index e025d7e5135..d5ca06bb3f8 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -124,7 +124,7 @@ QWindowsEGLStaticContext::~QWindowsEGLStaticContext() QWindowsEGLContext::QWindowsEGLContext(const QWindowsEGLStaticContextPtr &staticContext, const QSurfaceFormat &format, QPlatformOpenGLContext *share) - : QEGLPlatformContext(format, share, staticContext->display(), EGL_OPENGL_ES_API) + : QEGLPlatformContext(format, share, staticContext->display()) , m_staticContext(staticContext) { } diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp index 014378f8965..3a1958a20e6 100644 --- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrteglcontext.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE QWinRTEGLContext::QWinRTEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLSurface surface) - : QEGLPlatformContext(format, share, display, EGL_OPENGL_ES_API), m_eglSurface(surface) + : QEGLPlatformContext(format, share, display), m_eglSurface(surface) { } From a4f421d4311e5c0d3ebf9154856d5ecb56af292e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 13:37:58 +0100 Subject: [PATCH 150/172] egl: Update the OpenGL version in the context's QSurfaceFormat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GLX and WGL support code does this already. Do it for EGL too since requesting OpenGLES with majorVersion 3 results in GLES3 (where supported) and in this case the expected majorVersion in QOpenGLContext::format() is 3. Change-Id: I73d61d7569e6ebaa91aef57fb1b0051a77a73355 Reviewed-by: Sean Harmer Reviewed-by: Jørgen Lind --- .../eglconvenience/qeglplatformcontext.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index e1c53196e69..ace83289c99 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -41,6 +41,7 @@ #include "qeglplatformcontext_p.h" #include "qeglconvenience_p.h" +#include "qeglpbuffer_p.h" #include #include @@ -126,6 +127,36 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont m_shareContext = 0; m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, 0, contextAttrs.constData()); } + + if (m_eglContext == EGL_NO_CONTEXT) { + qWarning("QEGLPlatformContext::init: eglError: %x, this: %p \n", eglGetError(), this); + return; + } + + // Make the context current to ensure the GL version query works. This needs a surface too. + const EGLint pbufferAttributes[] = { + EGL_WIDTH, 1, + EGL_HEIGHT, 1, + EGL_LARGEST_PBUFFER, EGL_FALSE, + EGL_NONE + }; + EGLSurface pbuffer = eglCreatePbufferSurface(m_eglDisplay, m_eglConfig, pbufferAttributes); + if (pbuffer == EGL_NO_SURFACE) + return; + + if (eglMakeCurrent(m_eglDisplay, pbuffer, pbuffer, m_eglContext)) { + const GLubyte *s = glGetString(GL_VERSION); + if (s) { + QByteArray version = QByteArray(reinterpret_cast(s)); + int major, minor; + if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) { + m_format.setMajorVersion(major); + m_format.setMinorVersion(minor); + } + } + eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + } + eglDestroySurface(m_eglDisplay, pbuffer); } bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface) From 08b9e51c47ecdf6c687b3aed8bee7d7711219d25 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 16:05:13 +0100 Subject: [PATCH 151/172] egl: Choose GLES3 capable configs when needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passing OpenGLES and majorVersion 3 in a QSurfaceFormat selects GLES3 in case it is supported. This works fine already now, but is not safe since the config choosing logic does not request a GLES3-capable configuration and so it may end up with a non-GLES3 compatible one. This is now corrected by passing the EGL_OPENGL_ES3_BIT_KHR bit when EGL_KHR_create_context is available. Change-Id: Iacee1e1819b944c0f7c1062666106abddf59272b Reviewed-by: Sean Harmer Reviewed-by: Jørgen Lind --- .../eglconvenience/qeglconvenience.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index 790467150fa..7cf1f88b02d 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -50,6 +50,10 @@ #include "qeglconvenience_p.h" +#ifndef EGL_OPENGL_ES3_BIT_KHR +#define EGL_OPENGL_ES3_BIT_KHR 0x0040 +#endif + QT_BEGIN_NAMESPACE QVector q_createConfigAttributesFromFormat(const QSurfaceFormat &format) @@ -239,6 +243,7 @@ EGLConfig QEglConfigChooser::chooseConfig() configureAttributes.append(surfaceType()); configureAttributes.append(EGL_RENDERABLE_TYPE); + bool needsES2Plus = false; switch (m_format.renderableType()) { case QSurfaceFormat::OpenVG: configureAttributes.append(EGL_OPENVG_BIT); @@ -250,7 +255,7 @@ EGLConfig QEglConfigChooser::chooseConfig() configureAttributes.append(EGL_OPENGL_BIT); else #endif // QT_NO_OPENGL - configureAttributes.append(EGL_OPENGL_ES2_BIT); + needsES2Plus = true; break; case QSurfaceFormat::OpenGL: configureAttributes.append(EGL_OPENGL_BIT); @@ -263,9 +268,15 @@ EGLConfig QEglConfigChooser::chooseConfig() } // fall through default: - configureAttributes.append(EGL_OPENGL_ES2_BIT); + needsES2Plus = true; break; } + if (needsES2Plus) { + if (m_format.majorVersion() >= 3 && q_hasEglExtension(display(), "EGL_KHR_create_context")) + configureAttributes.append(EGL_OPENGL_ES3_BIT_KHR); + else + configureAttributes.append(EGL_OPENGL_ES2_BIT); + } configureAttributes.append(EGL_NONE); EGLConfig cfg = 0; From 4b3d11efc04c9fb2bf8bb43d841a9f05b34a8c84 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 16:50:22 +0100 Subject: [PATCH 152/172] Add EGL_KHR_create_context support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ChangeLog] GLES3 and desktop OpenGL are now fully supported with EGL Task-number: QTBUG-37332 Change-Id: Ic695db573d90b3a204941d105a370f5c63182b63 Reviewed-by: Jørgen Lind --- .../eglconvenience/qeglplatformcontext.cpp | 158 ++++++++++++++---- .../eglconvenience/qeglplatformcontext_p.h | 1 + 2 files changed, 123 insertions(+), 36 deletions(-) diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index ace83289c99..9c3b9b539c3 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -64,31 +64,48 @@ QT_BEGIN_NAMESPACE surface). Other than that, no further customization is necessary. */ -static inline void bindApi(const QSurfaceFormat &format) -{ - switch (format.renderableType()) { - case QSurfaceFormat::OpenVG: - eglBindAPI(EGL_OPENVG_API); - break; -#ifdef EGL_VERSION_1_4 - case QSurfaceFormat::DefaultRenderableType: -#ifndef QT_NO_OPENGL - if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) - eglBindAPI(EGL_OPENGL_API); - else -#endif // QT_NO_OPENGL - eglBindAPI(EGL_OPENGL_ES_API); - break; - case QSurfaceFormat::OpenGL: - eglBindAPI(EGL_OPENGL_API); - break; +// Constants from EGL_KHR_create_context +#ifndef EGL_CONTEXT_MINOR_VERSION_KHR +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB +#endif +#ifndef EGL_CONTEXT_FLAGS_KHR +#define EGL_CONTEXT_FLAGS_KHR 0x30FC +#endif +#ifndef EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#endif +#ifndef EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 +#endif +#ifndef EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 +#endif +#ifndef EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 +#endif +#ifndef EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 +#endif + +// Constants for OpenGL which are not available in the ES headers. +#ifndef GL_CONTEXT_FLAGS +#define GL_CONTEXT_FLAGS 0x821E +#endif +#ifndef GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#endif +#ifndef GL_CONTEXT_FLAG_DEBUG_BIT +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#endif +#ifndef GL_CONTEXT_PROFILE_MASK +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#endif +#ifndef GL_CONTEXT_CORE_PROFILE_BIT +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#endif +#ifndef GL_CONTEXT_COMPATIBILITY_PROFILE_BIT +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 #endif - case QSurfaceFormat::OpenGLES: - default: - eglBindAPI(EGL_OPENGL_ES_API); - break; - } -} QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) : m_eglDisplay(display) @@ -114,14 +131,55 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLContext *share) { m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig); + // m_format now has the renderableType() resolved (it cannot be Default anymore) + // but does not yet contain version, profile, options. m_shareContext = share ? static_cast(share)->m_eglContext : 0; QVector contextAttrs; contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); contextAttrs.append(format.majorVersion()); + const bool hasKHRCreateContext = q_hasEglExtension(m_eglDisplay, "EGL_KHR_create_context"); + if (hasKHRCreateContext) { + contextAttrs.append(EGL_CONTEXT_MINOR_VERSION_KHR); + contextAttrs.append(format.minorVersion()); + int flags = 0; + // The debug bit is supported both for OpenGL and OpenGL ES. + if (format.testOption(QSurfaceFormat::DebugContext)) + flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; + // The fwdcompat bit is only for OpenGL 3.0+. + if (m_format.renderableType() == QSurfaceFormat::OpenGL + && format.majorVersion() >= 3 + && !format.testOption(QSurfaceFormat::DeprecatedFunctions)) + flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; + if (flags) { + contextAttrs.append(EGL_CONTEXT_FLAGS_KHR); + contextAttrs.append(flags); + } + // Profiles are OpenGL only and mandatory in 3.2+. The value is silently ignored for < 3.2. + if (m_format.renderableType() == QSurfaceFormat::OpenGL) { + contextAttrs.append(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR); + contextAttrs.append(format.profile() == QSurfaceFormat::CoreProfile + ? EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR + : EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR); + } + } contextAttrs.append(EGL_NONE); - bindApi(m_format); + switch (m_format.renderableType()) { + case QSurfaceFormat::OpenVG: + m_api = EGL_OPENVG_API; + break; +#ifdef EGL_VERSION_1_4 + case QSurfaceFormat::OpenGL: + m_api = EGL_OPENGL_API; + break; +#endif // EGL_VERSION_1_4 + default: + m_api = EGL_OPENGL_ES_API; + break; + } + + eglBindAPI(m_api); m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, m_shareContext, contextAttrs.constData()); if (m_eglContext == EGL_NO_CONTEXT && m_shareContext != EGL_NO_CONTEXT) { m_shareContext = 0; @@ -133,6 +191,7 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont return; } +#ifndef QT_NO_OPENGL // Make the context current to ensure the GL version query works. This needs a surface too. const EGLint pbufferAttributes[] = { EGL_WIDTH, 1, @@ -145,25 +204,52 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont return; if (eglMakeCurrent(m_eglDisplay, pbuffer, pbuffer, m_eglContext)) { - const GLubyte *s = glGetString(GL_VERSION); - if (s) { - QByteArray version = QByteArray(reinterpret_cast(s)); - int major, minor; - if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) { - m_format.setMajorVersion(major); - m_format.setMinorVersion(minor); + if (m_format.renderableType() == QSurfaceFormat::OpenGL + || m_format.renderableType() == QSurfaceFormat::OpenGLES) { + const GLubyte *s = glGetString(GL_VERSION); + if (s) { + QByteArray version = QByteArray(reinterpret_cast(s)); + int major, minor; + if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor)) { + m_format.setMajorVersion(major); + m_format.setMinorVersion(minor); + } + } + m_format.setProfile(QSurfaceFormat::NoProfile); + m_format.setOptions(QSurfaceFormat::FormatOptions()); + if (m_format.renderableType() == QSurfaceFormat::OpenGL) { + // Check profile and options. + if (m_format.majorVersion() < 3) { + m_format.setOption(QSurfaceFormat::DeprecatedFunctions); + } else { + GLint value = 0; + glGetIntegerv(GL_CONTEXT_FLAGS, &value); + if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)) + m_format.setOption(QSurfaceFormat::DeprecatedFunctions); + if (value & GL_CONTEXT_FLAG_DEBUG_BIT) + m_format.setOption(QSurfaceFormat::DebugContext); + if (m_format.version() >= qMakePair(3, 2)) { + value = 0; + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); + if (value & GL_CONTEXT_CORE_PROFILE_BIT) + m_format.setProfile(QSurfaceFormat::CoreProfile); + else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) + m_format.setProfile(QSurfaceFormat::CompatibilityProfile); + } + } } } eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); } eglDestroySurface(m_eglDisplay, pbuffer); +#endif // QT_NO_OPENGL } bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface) { Q_ASSERT(surface->surface()->supportsOpenGL()); - bindApi(m_format); + eglBindAPI(m_api); EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface); @@ -231,7 +317,7 @@ QEGLPlatformContext::~QEGLPlatformContext() void QEGLPlatformContext::doneCurrent() { - bindApi(m_format); + eglBindAPI(m_api); bool ok = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (!ok) qWarning("QEGLPlatformContext::doneCurrent(): eglError: %d, this: %p \n", eglGetError(), this); @@ -239,7 +325,7 @@ void QEGLPlatformContext::doneCurrent() void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface) { - bindApi(m_format); + eglBindAPI(m_api); EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface); bool ok = eglSwapBuffers(m_eglDisplay, eglSurface); if (!ok) @@ -248,7 +334,7 @@ void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface) void (*QEGLPlatformContext::getProcAddress(const QByteArray &procName)) () { - bindApi(m_format); + eglBindAPI(m_api); return eglGetProcAddress(procName.constData()); } diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index b4734fb22ab..714633c3bcf 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -80,6 +80,7 @@ private: EGLDisplay m_eglDisplay; EGLConfig m_eglConfig; QSurfaceFormat m_format; + EGLenum m_api; int m_swapInterval; bool m_swapIntervalEnvChecked; int m_swapIntervalFromEnv; From c3b2425791ec1e17a8b1e2f5b35b8e79176fc9c4 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 7 Mar 2014 02:46:45 +0200 Subject: [PATCH 153/172] Guarantee QPFDB::fontEngine() always return non-multi font engine After QPA refactoring, QWindowsFontDatabase::fontEngine() was returning a multi font engine w/o any particular reason. This makes the code more obvious and opens the road to further improvements. Change-Id: I4858026ddf774d3159c89357b1c905f5112b1c51 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/gui/text/qfontdatabase.cpp | 9 +++-- .../windows/qwindowsfontdatabase.cpp | 34 ++++++++----------- .../platforms/windows/qwindowsfontdatabase.h | 4 +-- .../platforms/windows/qwindowsfontengine.cpp | 30 +++++++++------- .../platforms/windows/qwindowsfontengine.h | 5 +-- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index fbb7fe02d6c..1dfccca57c7 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -790,6 +790,7 @@ QFontEngine *loadSingleEngine(int script, if (!engine) { engine = pfdb->fontEngine(def, size->handle); if (engine) { + Q_ASSERT(engine->type() != QFontEngine::Multi); // Also check for OpenType tables when using complex scripts if (!engine->supportsScript(QChar::Script(script))) { qWarning(" OpenType support missing for script %d", script); @@ -809,12 +810,10 @@ QFontEngine *loadEngine(int script, const QFontDef &request, QtFontFamily *family, QtFontFoundry *foundry, QtFontStyle *style, QtFontSize *size) { - QFontEngine *engine = loadSingleEngine(script, request, foundry, style, size); - //make sure that the db has all fallback families - if (engine && engine->type() != QFontEngine::Multi - && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol ) { - + Q_ASSERT(!engine || engine->type() != QFontEngine::Multi); + if (engine && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) { + // make sure that the db has all fallback families if (family && !family->askedForFallback) { QFont::Style fontStyle = QFont::Style(style->key.style); QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint); diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 854444b254b..8f9ddc2168e 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1038,11 +1038,17 @@ QWindowsFontDatabase::~QWindowsFontDatabase() removeApplicationFonts(); } +QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) +{ + Q_UNUSED(script) + return new QWindowsMultiFontEngine(fontEngine, QStringList()); +} + QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) { - QFontEngine *fe = QWindowsFontDatabase::createEngine(QChar::Script_Common, fontDef, - 0, QWindowsContext::instance()->defaultDPI(), false, - QStringList(), sharedFontData()); + QFontEngine *fe = QWindowsFontDatabase::createEngine(fontDef, 0, + QWindowsContext::instance()->defaultDPI(), + false, sharedFontData()); qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << fe << handle; return fe; } @@ -1087,12 +1093,12 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal QFontDef request; request.family = uniqueFamilyName; request.pixelSize = pixelSize; - request.styleStrategy = QFont::NoFontMerging | QFont::PreferMatch; + request.styleStrategy = QFont::PreferMatch; request.hintingPreference = hintingPreference; - fontEngine = QWindowsFontDatabase::createEngine(QChar::Script_Common, request, 0, - QWindowsContext::instance()->defaultDPI(), false, QStringList(), - sharedFontData()); + fontEngine = QWindowsFontDatabase::createEngine(request, 0, + QWindowsContext::instance()->defaultDPI(), + false, sharedFontData()); if (fontEngine) { if (request.family != fontEngine->fontDef.family) { @@ -1623,9 +1629,8 @@ QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFon } -QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &request, +QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, HDC fontHdc, int dpi, bool rawMode, - const QStringList &family_list, const QSharedPointer &data) { LOGFONT lf; @@ -1769,17 +1774,6 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ directWriteFont->Release(); #endif - if ((script == QChar::Script_Common || script == QChar::Script_Han) - && !(request.styleStrategy & QFont::NoFontMerging)) { - const QStringList extraFonts = QWindowsFontDatabase::extraTryFontsForFamily(request.family); - if (extraFonts.size()) { - QStringList list = family_list; - list.append(extraFonts); - QFontEngine *mfe = new QWindowsMultiFontEngine(fe, list); - mfe->fontDef = fe->fontDef; - fe = mfe; - } - } return fe; } diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h index 1e13fc25592..a2324544d23 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.h +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h @@ -78,6 +78,7 @@ public: ~QWindowsFontDatabase(); virtual void populateFontDatabase(); + virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script); virtual QFontEngine *fontEngine(const QFontDef &fontDef, void *handle); virtual QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); virtual QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; @@ -92,9 +93,8 @@ public: static QFont systemDefaultFont(); - static QFontEngine *createEngine(int script, const QFontDef &request, + static QFontEngine *createEngine(const QFontDef &request, HDC fontHdc, int dpi, bool rawMode, - const QStringList &family_list, const QSharedPointer &data); static HFONT systemFont(); diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 6f0a4f9ea54..c3774064e31 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1233,15 +1233,11 @@ QFontEngine *QWindowsFontEngine::cloneWithSize(qreal pixelSize) const if (!uniqueFamilyName.isEmpty()) request.family = uniqueFamilyName; request.pixelSize = pixelSize; - // Disable font merging, as otherwise createEngine will return a multi-engine - // instance instead of the specific engine we wish to clone. - request.styleStrategy |= QFont::NoFontMerging; QFontEngine *fontEngine = - QWindowsFontDatabase::createEngine(QChar::Script_Common, request, 0, + QWindowsFontDatabase::createEngine(request, 0, QWindowsContext::instance()->defaultDPI(), - false, - QStringList(), m_fontEngineData); + false, m_fontEngineData); if (fontEngine) { fontEngine->fontDef.family = actualFontName; if (!uniqueFamilyName.isEmpty()) { @@ -1284,19 +1280,29 @@ void QWindowsFontEngine::initFontInfo(const QFontDef &request, */ QWindowsMultiFontEngine::QWindowsMultiFontEngine(QFontEngine *first, const QStringList &fallbacks) - : QFontEngineMulti(fallbacks.size()+1), - fallbacks(fallbacks) + : QFontEngineMulti(fallbacks.size() + 1), + fallbackFamilies(fallbacks) { - qCDebug(lcQpaFonts) << __FUNCTION__ << engines.size() << first << first->fontDef.family << fallbacks; engines[0] = first; first->ref.ref(); fontDef = engines[0]->fontDef; cache_cost = first->cache_cost; } -QWindowsMultiFontEngine::~QWindowsMultiFontEngine() +void QWindowsMultiFontEngine::setFallbackFamiliesList(const QStringList &fallbacks) { - qCDebug(lcQpaFonts) << __FUNCTION__; + // Original FontEngine to restore after the fill. + QFontEngine *fe = engines[0]; + fallbackFamilies = fallbacks; + if (!fallbackFamilies.isEmpty()) { + engines.fill(0, fallbackFamilies.size() + 1); + engines[0] = fe; + } else { + // Turns out we lied about having any fallback at all. + fallbackFamilies << fe->fontDef.family; + engines[1] = fe; + fe->ref.ref(); + } } void QWindowsMultiFontEngine::loadEngine(int at) @@ -1323,7 +1329,7 @@ void QWindowsMultiFontEngine::loadEngine(int at) data = fe->fontEngineData(); } - const QString fam = fallbacks.at(at-1); + const QString fam = fallbackFamilies.at(at-1); memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded #ifndef QT_NO_DIRECTWRITE diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index 0a40082ad26..7d934842204 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -170,10 +170,11 @@ class QWindowsMultiFontEngine : public QFontEngineMulti { public: QWindowsMultiFontEngine(QFontEngine *first, const QStringList &fallbacks); - virtual ~QWindowsMultiFontEngine(); + + void setFallbackFamiliesList(const QStringList &fallbacks); void loadEngine(int at); - QStringList fallbacks; + QStringList fallbackFamilies; }; QT_END_NAMESPACE From 800232e1d3ebfbac28d07014a3c646ea00fcf6ad Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 7 Mar 2014 01:46:47 +0200 Subject: [PATCH 154/172] Fix custom font substitution list support During the QPA refactoring, the custom font substitution list support was lost by ignoring the font request's fallbackFamilies member when the multi font engine gets created/initialized. If fallbackFamilies is not empty, it should be prepended to the font database default fallback families list. Also respect the custom fallback families list in the cache key to avoid picking a multi font engine with wrong fallbacks list. Task-number: QTBUG-36628 Change-Id: Ie2b84b3a397bee4816f421cddf76a5375829f13a Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/gui/text/qfont_p.h | 22 ++++++++++++++++------ src/gui/text/qfontdatabase.cpp | 6 ++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 61655543882..b78d6692b43 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -228,22 +228,32 @@ public: void clear(); struct Key { - Key() : script(0), screen(0) { } - Key(const QFontDef &d, int c, int s = 0) - : def(d), script(c), screen(s) { } + Key() : script(0), multi(0), screen(0) { } + Key(const QFontDef &d, uchar c, bool m = 0, uchar s = 0) + : def(d), script(c), multi(m), screen(s) { } QFontDef def; - int script; - int screen; + uchar script; + uchar multi: 1; + uchar screen: 7; inline bool operator<(const Key &other) const { if (script != other.script) return script < other.script; if (screen != other.screen) return screen < other.screen; + if (multi != other.multi) return multi < other.multi; + if (multi && def.fallBackFamilies.size() != other.def.fallBackFamilies.size()) + return def.fallBackFamilies.size() < other.def.fallBackFamilies.size(); return def < other.def; } inline bool operator==(const Key &other) const - { return def == other.def && script == other.script && screen == other.screen; } + { + return script == other.script + && screen == other.screen + && multi == other.multi + && (!multi || def.fallBackFamilies.size() == other.def.fallBackFamilies.size()) + && def == other.def; + } }; // QFontEngineData cache diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 1dfccca57c7..3c2cf4fdcf8 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -824,9 +824,11 @@ QFontEngine *loadEngine(int script, const QFontDef &request, family->askedForFallback = true; } - QStringList fallbacks = privateDb()->fallbackFamilies; + QStringList fallbacks = request.fallBackFamilies; if (family && !family->fallbackFamilies.isEmpty()) - fallbacks = family->fallbackFamilies; + fallbacks += family->fallbackFamilies; + else + fallbacks += privateDb()->fallbackFamilies; QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script)); From c466f2ed464a06ac6427df6135d3e905011aa50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 6 Mar 2014 14:58:18 +0100 Subject: [PATCH 155/172] Remove need to populate font database on OS X to get fallback families Populating the whole database takes a while, and it's very easy to trigger the fallback family code path through eg. matching or getting the default font family from QFont. Instead of relying on populate to resolve family name to a PostScript name (which was required when using CTFontCreateWithName), we instead use the CTFontDescriptorCreateWithAttributes() function to create a descriptor based on the family name, and then use CTFontCreateWithFontDescriptor(). The other way around, we use CTFontDescriptorCreateWithNameAndSize, and then pull out the family name from the descriptor. The need for creating a CTFont for private fonts (eg '.Apple Symbols Fallback') does not seem necessary anymore, as tested on 10.7-10.9. The disadvantage of creating font descriptors instead of re-using the data computed by population is that we're doing the same work twice, but the end result is making the font database more lazy, and the 80% use-case is assumed to be that you're only interested in the fallback of a small number of fonts, which means you don't want to populate all of the fonts in the system (taking about 1100ms on the test system). Looking up the fallback of a single family or style now takes about 15-25ms. Task-number: QTBUG-37165 Change-Id: I6b904dbe796a3f236919d778d0168fdef9a20e69 Reviewed-by: Konstantin Ritt Reviewed-by: Erik Verbruggen Reviewed-by: Simon Hausmann Reviewed-by: Shawn Rutledge --- .../mac/qcoretextfontdatabase.mm | 56 +++++-------------- .../mac/qcoretextfontdatabase_p.h | 3 - 2 files changed, 14 insertions(+), 45 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index f37e7a1db2b..102109e33ce 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -199,12 +199,6 @@ void QCoreTextFontDatabase::populateFontDatabase() [pool release]; } -void QCoreTextFontDatabase::invalidate() -{ - psNameToFamily.clear(); - familyNameToPsName.clear(); -} - void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) { QString foundryName = QStringLiteral("CoreText"); @@ -271,12 +265,6 @@ void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) QPlatformFontDatabase::registerFont(familyName, styleName, foundryName, weight, style, stretch, true /* antialiased */, true /* scalable */, pixelSize, fixedPitch, writingSystems, (void *) font); - - // We need to map back and forth between PostScript-names and family-names for fallback list construction - CFStringRef psName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontNameAttribute); - psNameToFamily[QCFString::toQString((NSString *) psName)] = familyName; - familyNameToPsName[familyName] = QCFString::toQString((NSString *) psName); - CFRelease(psName); } void QCoreTextFontDatabase::releaseHandle(void *handle) @@ -356,25 +344,15 @@ QFont::StyleHint styleHintFromNSString(NSString *style) return QFont::AnyStyle; } -static QString familyNameFromPostScriptName(QHash &psNameToFamily, - NSString *psName) +static QString familyNameFromPostScriptName(NSString *psName) { - QString name = QCFString::toQString(psName); - if (psNameToFamily.contains(name)) - return psNameToFamily[name]; - else { - // Some of the font name in DefaultFontFallbacks.plist are hidden fonts like AquaHiraKaku, - // their family name begins with a dot, like ".AquaHiraKaku" or ".Apple Symbols Fallback", - // the only way (I've found) to get it are actually creating a CTFont with them. We only - // need to do it once though. - QCFType font = CTFontCreateWithName((CFStringRef) psName, 12.0, NULL); - if (font) { - QCFString family = CTFontCopyFamilyName(font); - psNameToFamily[name] = family; - return family; - } - return name; - } + QCFType fontDescriptor = (CTFontDescriptorRef) CTFontDescriptorCreateWithNameAndSize((CFStringRef)psName, 12.0); + QCFString familyName = (CFStringRef) CTFontDescriptorCopyLocalizedAttribute(fontDescriptor, kCTFontFamilyNameAttribute, 0); + QString name = QCFString::toQString(familyName); + if (name.isEmpty()) + qWarning() << "QCoreTextFontDatabase: Failed to resolve family name for PostScript name " << QCFString::toQString((CFStringRef)psName); + + return name; } QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const @@ -395,12 +373,10 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo if (fallbackLists.contains(family)) return fallbackLists.value(family); - if (familyNameToPsName.isEmpty()) - const_cast(this)->populateFontDatabase(); - - if (familyNameToPsName.contains(family)) { - QCFType font = CTFontCreateWithName(QCFString(familyNameToPsName[family]), 12.0, NULL); - if (font) { + QCFType attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, QCFString(family)); + if (QCFType fontDescriptor = CTFontDescriptorCreateWithAttributes(attributes)) { + if (QCFType font = CTFontCreateWithFontDescriptor(fontDescriptor, 12.0, 0)) { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"]; @@ -432,10 +408,6 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo static bool didPopulateStyleFallbacks = false; if (!didPopulateStyleFallbacks) { #if defined(Q_OS_MACX) - // Ensure we have the psNameToFamily mapping set up - if (psNameToFamily.isEmpty()) - const_cast(this)->populateFontDatabase(); - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"]; @@ -451,10 +423,10 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo NSArray *langs = [(NSArray *) item sortedArrayUsingFunction: languageMapSort context: languages]; for (NSArray *map in langs) - fallbackList.append(familyNameFromPostScriptName(psNameToFamily, [map objectAtIndex: 1])); + fallbackList.append(familyNameFromPostScriptName([map objectAtIndex: 1])); } else if ([item isKindOfClass: [NSString class]]) - fallbackList.append(familyNameFromPostScriptName(psNameToFamily, item)); + fallbackList.append(familyNameFromPostScriptName(item)); } if (QCoreTextFontEngine::supportsColorGlyphs()) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 5b2fc2ed7ed..c6fc791503c 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -72,7 +72,6 @@ public: QCoreTextFontDatabase(); ~QCoreTextFontDatabase(); void populateFontDatabase(); - void invalidate() Q_DECL_OVERRIDE; QFontEngine *fontEngine(const QFontDef &fontDef, void *handle); QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); @@ -86,8 +85,6 @@ private: void populateFromDescriptor(CTFontDescriptorRef font); mutable QString defaultFontName; - mutable QHash psNameToFamily; - mutable QHash familyNameToPsName; void removeApplicationFonts(); From e5785d6322051ba96b1a4a97963a64c1aabbc027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Tue, 11 Mar 2014 15:17:37 +0200 Subject: [PATCH 156/172] Fix network tests relying on troll.no Replacing old troll.no domain with qt-project.org domain. Using troll.no doesn't work anymore. Change-Id: Ic6fa71b044d1adbdc66c875b47bfdc256a2afc8e Reviewed-by: Oswald Buddenhagen --- .../qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp | 2 +- .../auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 6 +++--- tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index 8e0090e4868..b793df674bd 100644 --- a/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -303,7 +303,7 @@ void tst_QHttpNetworkConnection::put_data() QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/dav/file1.txt" << ushort(80) << false << "Hello World\nEnd of file\n"< Date: Wed, 12 Mar 2014 12:38:32 +0100 Subject: [PATCH 157/172] Stabilize tst_qnetworkreply on Windows. Do not close connection in slot bytesWritten() since that can cause clients to fail with "Connection Closed". Instead, use deleteLater() to close properly and prevent leaking the sockets. FAIL! : tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() 'waitForFinish(reply) == Success' returned FALSE. ( QUrl( "http://localhost:58240" ) failed: # 2 "Connection closed" ) ..\tst_qnetworkreply.cpp(7067) : failure location Task-number: QTBUG-37449 Change-Id: Ib92cb62fae523370b2fb45e1ccfa217559732bc8 Reviewed-by: Peter Hartmann Reviewed-by: Joerg Bornemann --- .../qnetworkreply/tst_qnetworkreply.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index c883b77ea86..c448e893754 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -530,7 +530,7 @@ class MiniHttpServer: public QTcpServer { Q_OBJECT public: - QTcpSocket *client; // always the last one that was received + QPointer client; // always the last one that was received QByteArray dataToTransmit; QByteArray receivedData; QSemaphore ready; @@ -541,7 +541,7 @@ public: int totalConnections; MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0, bool useipv6 = false) - : client(0), dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6), + : dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6), multiple(false), totalConnections(0) { if (useipv6) { @@ -591,6 +591,7 @@ protected: } virtual void reply() { + Q_ASSERT(!client.isNull()); // we need to emulate the bytesWrittenSlot call if the data is empty. if (dataToTransmit.size() == 0) QMetaObject::invokeMethod(this, "bytesWrittenSlot", Qt::QueuedConnection); @@ -600,10 +601,11 @@ protected: private: void connectSocketSignals() { + Q_ASSERT(!client.isNull()); //qDebug() << "connectSocketSignals" << client; - connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); - connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot())); - connect(client, SIGNAL(error(QAbstractSocket::SocketError)), + connect(client.data(), SIGNAL(readyRead()), this, SLOT(readyReadSlot())); + connect(client.data(), SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot())); + connect(client.data(), SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotError(QAbstractSocket::SocketError))); } @@ -611,17 +613,20 @@ private slots: #ifndef QT_NO_SSL void slotSslErrors(const QList& errors) { + Q_ASSERT(!client.isNull()); qDebug() << "slotSslErrors" << client->errorString() << errors; } #endif void slotError(QAbstractSocket::SocketError err) { + Q_ASSERT(!client.isNull()); qDebug() << "slotError" << err << client->errorString(); } public slots: void readyReadSlot() { + Q_ASSERT(!client.isNull()); receivedData += client->readAll(); int doubleEndlPos = receivedData.indexOf("\r\n\r\n"); @@ -635,9 +640,11 @@ public slots: } void bytesWrittenSlot() { + Q_ASSERT(!client.isNull()); + // Disconnect and delete in next cycle (else Windows clients will fail with RemoteHostClosedError). if (doClose && client->bytesToWrite() == 0) { - client->disconnectFromHost(); disconnect(client, 0, this, 0); + client->deleteLater(); } } From 9f87c3663d49a0a4c5affe6119ce399a6d0f5e7a Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 12 Mar 2014 20:32:40 +0100 Subject: [PATCH 158/172] tests: Mark tst_qdbus* tests as insignificant on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit D-Bus libraries were recently added to OS X 10.7 making these tests to be executed for first time. Task-number: QTBUG-37469 Change-Id: Ia7a74a45b18d4a645307f7fb7666236c5e009e5f Reviewed-by: Simo Fält --- tests/auto/dbus/qdbusabstractadaptor/test/test.pro | 2 ++ tests/auto/dbus/qdbusabstractinterface/test/test.pro | 2 ++ tests/auto/dbus/qdbusconnection/qdbusconnection.pro | 2 ++ tests/auto/dbus/qdbuscontext/qdbuscontext.pro | 2 ++ tests/auto/dbus/qdbusinterface/test/test.pro | 2 ++ tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro | 2 ++ tests/auto/dbus/qdbusmarshall/test/test.pro | 2 ++ tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro | 2 ++ tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro | 2 ++ tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro | 2 ++ tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro | 2 ++ tests/auto/dbus/qdbusreply/qdbusreply.pro | 2 ++ tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro | 2 ++ tests/auto/dbus/qdbusthreading/qdbusthreading.pro | 2 ++ 14 files changed, 28 insertions(+) diff --git a/tests/auto/dbus/qdbusabstractadaptor/test/test.pro b/tests/auto/dbus/qdbusabstractadaptor/test/test.pro index 5a65abe2389..0e4dc911287 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/test/test.pro +++ b/tests/auto/dbus/qdbusabstractadaptor/test/test.pro @@ -5,3 +5,5 @@ TARGET = ../tst_qdbusabstractadaptor QT = core core-private dbus testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusabstractinterface/test/test.pro b/tests/auto/dbus/qdbusabstractinterface/test/test.pro index 66744b9252f..223c94866c3 100644 --- a/tests/auto/dbus/qdbusabstractinterface/test/test.pro +++ b/tests/auto/dbus/qdbusabstractinterface/test/test.pro @@ -10,3 +10,5 @@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DBUS_INTERFACES = ../org.qtproject.QtDBus.Pinger.xml QDBUSXML2CPP_INTERFACE_HEADER_FLAGS += -i ../interface.h + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusconnection/qdbusconnection.pro b/tests/auto/dbus/qdbusconnection/qdbusconnection.pro index 2fd62a234b5..9616607fd93 100644 --- a/tests/auto/dbus/qdbusconnection/qdbusconnection.pro +++ b/tests/auto/dbus/qdbusconnection/qdbusconnection.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbusconnection QT = core dbus testlib SOURCES += tst_qdbusconnection.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbuscontext/qdbuscontext.pro b/tests/auto/dbus/qdbuscontext/qdbuscontext.pro index b7d72236137..3477f8a41f9 100644 --- a/tests/auto/dbus/qdbuscontext/qdbuscontext.pro +++ b/tests/auto/dbus/qdbuscontext/qdbuscontext.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbuscontext QT = core dbus testlib SOURCES += tst_qdbuscontext.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusinterface/test/test.pro b/tests/auto/dbus/qdbusinterface/test/test.pro index 6fc51d2f31f..ba70273aab8 100644 --- a/tests/auto/dbus/qdbusinterface/test/test.pro +++ b/tests/auto/dbus/qdbusinterface/test/test.pro @@ -5,3 +5,5 @@ TARGET = ../tst_qdbusinterface QT = core core-private dbus testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro b/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro index cbe3e89a16b..79ad5763e09 100644 --- a/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro +++ b/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbuslocalcalls QT = core dbus testlib SOURCES += tst_qdbuslocalcalls.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusmarshall/test/test.pro b/tests/auto/dbus/qdbusmarshall/test/test.pro index 40bea4509bf..5c67bfc6247 100644 --- a/tests/auto/dbus/qdbusmarshall/test/test.pro +++ b/tests/auto/dbus/qdbusmarshall/test/test.pro @@ -7,3 +7,5 @@ QT = core-private dbus-private testlib LIBS += $$QT_LIBS_DBUS QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro b/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro index c0b38cf4789..ca567605ddd 100644 --- a/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro +++ b/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbusmetaobject QT = core dbus-private testlib SOURCES += tst_qdbusmetaobject.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro b/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro index aef9bc73cbe..47b9c40aeaf 100644 --- a/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro +++ b/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbusmetatype QT = core dbus testlib SOURCES += tst_qdbusmetatype.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro b/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro index 7b5f8677984..7f11422e1a0 100644 --- a/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro +++ b/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbuspendingcall QT = core dbus testlib SOURCES += tst_qdbuspendingcall.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro b/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro index d6b9e710844..b0ba53fb8ed 100644 --- a/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro +++ b/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbuspendingreply QT = core dbus testlib SOURCES += tst_qdbuspendingreply.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusreply/qdbusreply.pro b/tests/auto/dbus/qdbusreply/qdbusreply.pro index 0ffb35e4614..decf8462ad1 100644 --- a/tests/auto/dbus/qdbusreply/qdbusreply.pro +++ b/tests/auto/dbus/qdbusreply/qdbusreply.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbusreply QT = core dbus testlib SOURCES += tst_qdbusreply.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro b/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro index 82a0f3bb7e9..0b3bcbb3386 100644 --- a/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro +++ b/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbusservicewatcher QT = core dbus testlib SOURCES += tst_qdbusservicewatcher.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 diff --git a/tests/auto/dbus/qdbusthreading/qdbusthreading.pro b/tests/auto/dbus/qdbusthreading/qdbusthreading.pro index e50804336bc..639cf4df31f 100644 --- a/tests/auto/dbus/qdbusthreading/qdbusthreading.pro +++ b/tests/auto/dbus/qdbusthreading/qdbusthreading.pro @@ -3,3 +3,5 @@ TARGET = tst_qdbusthreading QT = core dbus testlib SOURCES += tst_qdbusthreading.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +macx:CONFIG += insignificant_test # QTBUG-37469 From 1f4cda9a70dd8b1fbabe716de26cace85f3aef41 Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Sun, 9 Mar 2014 14:39:20 +0100 Subject: [PATCH 159/172] Replace Note: with \note in documentation Change-Id: I213ac1fb2733e675f3641441fe6c621bab06c1f0 Reviewed-by: Peter Hartmann Reviewed-by: Richard J. Moore --- src/network/access/qhttpmultipart.cpp | 2 +- src/network/access/qnetworkdiskcache.cpp | 2 +- src/network/access/qnetworkreply.cpp | 4 ++-- src/network/access/qnetworkrequest.cpp | 4 ++-- src/network/kernel/qhostinfo.cpp | 2 +- src/network/kernel/qnetworkproxy.cpp | 2 +- src/network/socket/qabstractsocket.cpp | 2 +- src/network/socket/qlocalserver.cpp | 3 +-- src/network/socket/qlocalsocket.cpp | 2 +- src/network/socket/qtcpsocket.cpp | 2 +- src/network/ssl/qssl.cpp | 4 ++-- src/network/ssl/qsslconfiguration.cpp | 2 +- src/network/ssl/qsslsocket.cpp | 6 +++--- 13 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp index 20860b0fc94..e8dfa636cd7 100644 --- a/src/network/access/qhttpmultipart.cpp +++ b/src/network/access/qhttpmultipart.cpp @@ -169,7 +169,7 @@ void QHttpPart::setHeader(QNetworkRequest::KnownHeaders header, const QVariant & QNetworkRequest::KnownHeaders), the raw format will be parsed and the corresponding "cooked" header will be set as well. - Note: setting the same header twice overrides the previous + \note Setting the same header twice overrides the previous setting. To accomplish the behaviour of multiple HTTP headers of the same name, you should concatenate the two values, separating them with a comma (",") and set one single raw header. diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 2f2d1ab9a91..a1cbd9364e3 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -518,7 +518,7 @@ void QNetworkDiskCache::setMaximumCacheSize(qint64 size) knows about that QNetworkDiskCache does not, for example the number of times a cache is accessed. - Note: cacheSize() calls expire if the current cache size is unknown. + \note cacheSize() calls expire if the current cache size is unknown. \sa maximumCacheSize(), fileMetaData() */ diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index faa8464463e..bfe870c7837 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -753,7 +753,7 @@ qint64 QNetworkReply::writeData(const char *, qint64) Sets the associated operation for this object to be \a operation. This value will be returned by operation(). - Note: the operation should be set when this object is created and + \note The operation should be set when this object is created and not changed again. \sa operation(), setRequest() @@ -768,7 +768,7 @@ void QNetworkReply::setOperation(QNetworkAccessManager::Operation operation) Sets the associated request for this object to be \a request. This value will be returned by request(). - Note: the request should be set when this object is created and + \note The request should be set when this object is created and not changed again. \sa request(), setOperation() diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index aa1102f9bf5..850f5bc7e70 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -512,7 +512,7 @@ QList QNetworkRequest::rawHeaderList() const will also set the known header LastModifiedHeader to be the QDateTime object of the parsed date. - Note: setting the same header twice overrides the previous + \note Setting the same header twice overrides the previous setting. To accomplish the behaviour of multiple HTTP headers of the same name, you should concatenate the two values, separating them with a comma (",") and set one single raw header. @@ -528,7 +528,7 @@ void QNetworkRequest::setRawHeader(const QByteArray &headerName, const QByteArra Returns the attribute associated with the code \a code. If the attribute has not been set, it returns \a defaultValue. - Note: this function does not apply the defaults listed in + \note This function does not apply the defaults listed in QNetworkRequest::Attribute. \sa setAttribute(), QNetworkRequest::Attribute diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 025e3f3e00d..cafb09b1812 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -433,7 +433,7 @@ void QHostInfo::setErrorString(const QString &str) Returns the DNS domain of this machine. - Note: DNS domains are not related to domain names found in + \note DNS domains are not related to domain names found in Windows networks. \sa hostName() diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 5cc41392b54..e797eaaed4e 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -841,7 +841,7 @@ QList QNetworkProxy::rawHeaderList() const will also set the known header LastModifiedHeader to be the QDateTime object of the parsed date. - Note: setting the same header twice overrides the previous + \note Setting the same header twice overrides the previous setting. To accomplish the behaviour of multiple HTTP headers of the same name, you should concatenate the two values, separating them with a comma (",") and set one single raw header. diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 0345537d1cc..1ceec717c6e 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1552,7 +1552,7 @@ bool QAbstractSocket::bind(quint16 port, BindMode mode) Returns \c true if the socket is valid and ready for use; otherwise returns \c false. - \b{Note:} The socket's state must be ConnectedState before reading and + \note The socket's state must be ConnectedState before reading and writing can occur. \sa state() diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp index 791227002dd..d268a238e02 100644 --- a/src/network/socket/qlocalserver.cpp +++ b/src/network/socket/qlocalserver.cpp @@ -278,8 +278,7 @@ bool QLocalServer::isListening() const could also be a path such as "/tmp/foo" and on Windows this could be a pipe path such as "\\\\.\\pipe\\foo" - Note: - On Unix if the server crashes without closing listen will fail + \note On Unix if the server crashes without closing listen will fail with AddressInUseError. To create a new server the file should be removed. On Windows two local servers can listen to the same pipe at the same time, but any connections will go to one of the server. diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index d4251672db1..f7033893bc6 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected() which blocks until the operation is complete or the timeout expires. - Note that this feature is not supported on versions of Windows earlier than + \note This feature is not supported on versions of Windows earlier than Windows XP. \sa QLocalServer diff --git a/src/network/socket/qtcpsocket.cpp b/src/network/socket/qtcpsocket.cpp index ce37401a89e..e6f5887095a 100644 --- a/src/network/socket/qtcpsocket.cpp +++ b/src/network/socket/qtcpsocket.cpp @@ -58,7 +58,7 @@ allows you to establish a TCP connection and transfer streams of data. See the QAbstractSocket documentation for details. - \b{Note:} TCP sockets cannot be opened in QIODevice::Unbuffered mode. + \note TCP sockets cannot be opened in QIODevice::Unbuffered mode. \sa QTcpServer, QUdpSocket, QNetworkAccessManager, {Fortune Server Example}, {Fortune Client Example}, diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp index 5b7274e3e69..b555c885b1e 100644 --- a/src/network/ssl/qssl.cpp +++ b/src/network/ssl/qssl.cpp @@ -129,7 +129,7 @@ QT_BEGIN_NAMESPACE \value SecureProtocols The default option, using protocols known to be secure; currently behaves like TlsV1SslV3. - Note: most servers using SSL understand both versions (2 and 3), + \note most servers using SSL understand both versions (2 and 3), but it is recommended to use the latest version only for security reasons. However, SSL and TLS are not compatible with each other: if you get unexpected handshake failures, verify that you chose @@ -176,7 +176,7 @@ QT_BEGIN_NAMESPACE SslOptionDisableSessionPersistence is turned on to optimize memory usage. The other options are turned off. - Note: Availability of above options depends on the version of the SSL + \note Availability of above options depends on the version of the SSL backend in use. */ diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index 1e859ae6e61..14881931af0 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -644,7 +644,7 @@ bool QSslConfiguration::testSslOption(QSsl::SslOption option) const used or QSsl::SslOptionDisableSessionPersistence was not turned off, this function returns an empty QByteArray. - \b{Note:} When persisting the session ticket to disk or similar, be + \note When persisting the session ticket to disk or similar, be careful not to expose the session to a potential attacker, as knowledge of the session allows for eavesdropping on data encrypted with the session parameters. diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 6edf4efae06..c5ae517fb06 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -283,7 +283,7 @@ \a errors contains one or more errors that prevent QSslSocket from verifying the identity of the peer. - Note: You cannot use Qt::QueuedConnection when connecting to this signal, + \note You cannot use Qt::QueuedConnection when connecting to this signal, or calling QSslSocket::ignoreSslErrors() will have no effect. \sa peerVerifyError() @@ -400,7 +400,7 @@ void QSslSocket::resume() \snippet code/src_network_ssl_qsslsocket.cpp 3 - \b{Note:} The example above shows that text can be written to + \note The example above shows that text can be written to the socket immediately after requesting the encrypted connection, before the encrypted() signal has been emitted. In such cases, the text is queued in the object and written to the socket \e after @@ -470,7 +470,7 @@ void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, The socket is opened in the mode specified by \a openMode, and enters the socket state specified by \a state. - \b{Note:} It is not possible to initialize two sockets with the same + \note It is not possible to initialize two sockets with the same native socket descriptor. \sa socketDescriptor() From f6d0c67d30ef1c22b086641e8d1288e1baaa1663 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 13 Feb 2014 14:44:38 +0100 Subject: [PATCH 160/172] QDebug: Allow text stream formatting for 64 bit numbers Use the QTextStream stream operator for formatting 64 bit numbers, just like we do for other numbers, too. This ensures all numbers in a QDebug stream e.g. respect the hex and showbase modifiers. The original reason for formatting qin64, quint64 with QString::number is unclear (pre-dates the original qt4 git import). Maybe QTextStream did lack proper support for 64 bit numbers back then. Task-number: QTBUG-36841 Change-Id: I049516c2a8394c9c1a708f86c3d950418a20a957 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.h | 6 ++---- tests/auto/corelib/io/qdebug/tst_qdebug.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 00177b659e8..bdaaa05768c 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -110,10 +110,8 @@ public: inline QDebug &operator<<(unsigned int t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(signed long t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(unsigned long t) { stream->ts << t; return maybeSpace(); } - inline QDebug &operator<<(qint64 t) - { stream->ts << QString::number(t); return maybeSpace(); } - inline QDebug &operator<<(quint64 t) - { stream->ts << QString::number(t); return maybeSpace(); } + inline QDebug &operator<<(qint64 t) { stream->ts << t; return maybeSpace(); } + inline QDebug &operator<<(quint64 t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(float t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(const char* t) { stream->ts << QString::fromUtf8(t); return maybeSpace(); } diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 29c7e6a81eb..80144dba202 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -57,6 +57,7 @@ private slots: void veryLongWarningMessage() const; void qDebugQStringRef() const; void qDebugQLatin1String() const; + void textStreamModifiers() const; void defaultMessagehandler() const; }; @@ -280,6 +281,18 @@ void tst_QDebug::qDebugQLatin1String() const QCOMPARE(QString::fromLatin1(s_function), function); } +void tst_QDebug::textStreamModifiers() const +{ + MessageHandlerSetter mhs(myMessageHandler); + { qDebug() << hex << short(0xf) << int(0xf) << unsigned(0xf) << long(0xf) << qint64(0xf) << quint64(0xf); } + QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; + QCOMPARE(s_msgType, QtDebugMsg); + QCOMPARE(s_msg, QString::fromLatin1("f f f f f f")); + QCOMPARE(QString::fromLatin1(s_file), file); + QCOMPARE(s_line, line); + QCOMPARE(QString::fromLatin1(s_function), function); +} + void tst_QDebug::defaultMessagehandler() const { MessageHandlerSetter mhs(0); From b3871dc8049819ae3e095555f451457567eb4ee3 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 21 Feb 2014 11:39:12 +0100 Subject: [PATCH 161/172] Make parsing of categories in logging rules consistent. The documentation says that the left side of a logging rule has the syntax [.] with optional wildcard '*' as the first or the last character (or at both positions. However, so far we didn't allow qt.*.debug But what we did allow is implicit dropping of trailing '.', e.g. qt.* matched also 'qt' Fix these by splitting up the '.type' in advance, and then do string matching only on the 'real' category names. Change-Id: Iab50ad0fc673464e870f5ab8dfb3245d829b3107 Reviewed-by: Thiago Macieira --- src/corelib/io/qloggingregistry.cpp | 90 +++++++------- src/corelib/io/qloggingregistry_p.h | 7 +- .../qloggingregistry/tst_qloggingregistry.cpp | 114 ++++++++++++++++++ 3 files changed, 162 insertions(+), 49 deletions(-) diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 2619743ff4b..20eb2e13f52 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -65,11 +65,11 @@ QLoggingRule::QLoggingRule() : Constructs a logging rule. */ QLoggingRule::QLoggingRule(const QString &pattern, bool enabled) : - pattern(pattern), + messageType(-1), flags(Invalid), enabled(enabled) { - parse(); + parse(pattern); } /*! @@ -77,48 +77,33 @@ QLoggingRule::QLoggingRule(const QString &pattern, bool enabled) : Return value 1 means filter passed, 0 means filter doesn't influence this category, -1 means category doesn't pass this filter. */ -int QLoggingRule::pass(const QString &categoryName, QtMsgType msgType) const +int QLoggingRule::pass(const QString &cat, QtMsgType msgType) const { - QString fullCategory = categoryName; - switch (msgType) { - case QtDebugMsg: - fullCategory += QLatin1String(".debug"); - break; - case QtWarningMsg: - fullCategory += QLatin1String(".warning"); - break; - case QtCriticalMsg: - fullCategory += QLatin1String(".critical"); - break; - default: - break; - } + // check message type + if (messageType > -1 && messageType != msgType) + return 0; if (flags == FullText) { - // can be - // qtproject.org.debug = true - // or - // qtproject.org = true - if (pattern == categoryName - || pattern == fullCategory) + // full match + if (category == cat) return (enabled ? 1 : -1); + else + return 0; } - int idx = 0; - if (flags == MidFilter) { - // e.g. *.qtproject* - idx = fullCategory.indexOf(pattern); - if (idx >= 0) - return (enabled ? 1 : -1); - } else { - idx = fullCategory.indexOf(pattern); - if (flags == LeftFilter) { - // e.g. org.qtproject.* + const int idx = cat.indexOf(category); + if (idx >= 0) { + if (flags == MidFilter) { + // matches somewhere + if (idx >= 0) + return (enabled ? 1 : -1); + } else if (flags == LeftFilter) { + // matches left if (idx == 0) return (enabled ? 1 : -1); } else if (flags == RightFilter) { - // e.g. *.qtproject - if (idx == (fullCategory.count() - pattern.count())) + // matches right + if (idx == (cat.count() - category.count())) return (enabled ? 1 : -1); } } @@ -127,28 +112,41 @@ int QLoggingRule::pass(const QString &categoryName, QtMsgType msgType) const /*! \internal - Parses the category and checks which kind of wildcard the filter can contain. + Parses \a pattern. Allowed is f.ex.: - org.qtproject.logging FullText - org.qtproject.* LeftFilter - *.qtproject RightFilter - *.qtproject* MidFilter + qt.core.io.debug FullText, QtDebugMsg + qt.core.* LeftFilter, all types + *.io.warning RightFilter, QtWarningMsg + *.core.* MidFilter */ -void QLoggingRule::parse() +void QLoggingRule::parse(const QString &pattern) { - int index = pattern.indexOf(QLatin1Char('*')); + category = pattern; + // strip trailing ".messagetype" + if (pattern.endsWith(QLatin1String(".debug"))) { + category.chop(strlen(".debug")); + messageType = QtDebugMsg; + } else if (pattern.endsWith(QLatin1String(".warning"))) { + category.chop(strlen(".warning")); + messageType = QtWarningMsg; + } else if (pattern.endsWith(QLatin1String(".critical"))) { + category.chop(strlen(".critical")); + messageType = QtCriticalMsg; + } + + int index = category.indexOf(QLatin1Char('*')); if (index < 0) { flags = FullText; } else { flags = Invalid; if (index == 0) { flags |= RightFilter; - pattern = pattern.remove(0, 1); - index = pattern.indexOf(QLatin1Char('*')); + category.remove(0, 1); + index = category.indexOf(QLatin1Char('*')); } - if (index == (pattern.length() - 1)) { + if (index == (category.length() - 1)) { flags |= LeftFilter; - pattern = pattern.remove(pattern.length() - 1, 1); + category.chop(1); } } } diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h index d4b97d42b84..70d728228ce 100644 --- a/src/corelib/io/qloggingregistry_p.h +++ b/src/corelib/io/qloggingregistry_p.h @@ -64,7 +64,7 @@ class tst_QLoggingRegistry; QT_BEGIN_NAMESPACE -class QLoggingRule +class Q_AUTOTEST_EXPORT QLoggingRule { public: QLoggingRule(); @@ -80,12 +80,13 @@ public: }; Q_DECLARE_FLAGS(PatternFlags, PatternFlag) - QString pattern; + QString category; + int messageType; PatternFlags flags; bool enabled; private: - void parse(); + void parse(const QString &pattern); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QLoggingRule::PatternFlags) diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index dc6f16828bd..56545bb909d 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -45,6 +45,13 @@ #include QT_USE_NAMESPACE +enum LoggingRuleState { + Invalid, + Match, + NoMatch +}; +Q_DECLARE_METATYPE(LoggingRuleState); +Q_DECLARE_METATYPE(QtMsgType); class tst_QLoggingRegistry : public QObject { @@ -59,6 +66,113 @@ private slots: qunsetenv("QT_LOGGING_CONF"); } + void QLoggingRule_parse_data() + { + QTest::addColumn("pattern"); + QTest::addColumn("category"); + QTest::addColumn("msgType"); + QTest::addColumn("result"); + + // _empty_ should match (only) _empty_ + QTest::newRow("_empty_-_empty_") + << QString("") << QString("") << QtDebugMsg << Match; + QTest::newRow("_empty_-default") + << QString("") << QString("default") << QtDebugMsg << NoMatch; + QTest::newRow(".debug-_empty_") + << QString(".debug") << QString("") << QtDebugMsg << Match; + QTest::newRow(".warning-default") + << QString(".warning") << QString("default") << QtDebugMsg << NoMatch; + + // literal should match only literal + QTest::newRow("qt-qt") + << QString("qt") << QString("qt") << QtDebugMsg << Match; + QTest::newRow("qt-_empty_") + << QString("qt") << QString("") << QtDebugMsg << NoMatch; + QTest::newRow("qt-qtx") + << QString("qt") << QString("qtx") << QtDebugMsg << NoMatch; + QTest::newRow("qt-qt.io") + << QString("qt") << QString("qt.io") << QtDebugMsg << NoMatch; + QTest::newRow("qt.debug-qt") + << QString("qt.debug") << QString("qt") << QtDebugMsg << Match; + QTest::newRow("qt.critical-qt") + << QString("qt.critical") << QString("qt") << QtDebugMsg << NoMatch; + + // * should match everything + QTest::newRow("_star_-qt.io.debug") + << QString("*") << QString("qt.io") << QtDebugMsg << Match; + QTest::newRow("_star_-qt.io.warning") + << QString("*") << QString("qt.io") << QtWarningMsg << Match; + QTest::newRow("_star_-qt.io.critical") + << QString("*") << QString("qt.io") << QtCriticalMsg << Match; + QTest::newRow("_star_-_empty_") + << QString("*") << QString("") << QtDebugMsg << Match; + QTest::newRow("_star_.debug-qt.io") + << QString("*.debug") << QString("qt.io") << QtDebugMsg << Match; + QTest::newRow("_star_.warning-qt.io") + << QString("*.warning") << QString("qt.io") << QtDebugMsg << NoMatch; + + // qt.* should match everything starting with 'qt.' + QTest::newRow("qt._star_-qt.io") + << QString("qt.*") << QString("qt.io") << QtDebugMsg << Match; + QTest::newRow("qt._star_-qt") + << QString("qt.*") << QString("qt") << QtDebugMsg << NoMatch; + QTest::newRow("qt__star_-qt") + << QString("qt*") << QString("qt") << QtDebugMsg << Match; + QTest::newRow("qt._star_-qt.io.fs") + << QString("qt.*") << QString("qt.io.fs") << QtDebugMsg << Match; + QTest::newRow("qt._star_.debug-qt.io.fs") + << QString("qt.*.debug") << QString("qt.io.fs") << QtDebugMsg << Match; + QTest::newRow("qt._star_.warning-qt.io.fs") + << QString("qt.*.warning") << QString("qt.io.fs") << QtDebugMsg << NoMatch; + + // *.io should match everything ending with .io + QTest::newRow("_star_.io-qt.io") + << QString("*.io") << QString("qt.io") << QtDebugMsg << Match; + QTest::newRow("_star_io-qt.io") + << QString("*io") << QString("qt.io") << QtDebugMsg << Match; + QTest::newRow("_star_.io-io") + << QString("*.io") << QString("io") << QtDebugMsg << NoMatch; + QTest::newRow("_star_io-io") + << QString("*io") << QString("io") << QtDebugMsg << Match; + QTest::newRow("_star_.io-qt.ios") + << QString("*.io") << QString("qt.ios") << QtDebugMsg << NoMatch; + QTest::newRow("_star_.io-qt.io.x") + << QString("*.io") << QString("qt.io.x") << QtDebugMsg << NoMatch; + QTest::newRow("_star_.io.debug-qt.io") + << QString("*.io.debug") << QString("qt.io") << QtDebugMsg << Match; + QTest::newRow("_star_.io.warning-qt.io") + << QString("*.io.warning") << QString("qt.io") << QtDebugMsg << NoMatch; + + // *qt* should match everything that contains 'qt' + QTest::newRow("_star_qt_star_-qt.core.io") + << QString("*qt*") << QString("qt.core.io") << QtDebugMsg << Match; + QTest::newRow("_star_qt_star_-default") + << QString("*qt*") << QString("default") << QtDebugMsg << NoMatch; + QTest::newRow("_star_qt._star_.debug-qt.io") + << QString("*qt.*.debug") << QString("qt.io") << QtDebugMsg << Match; + QTest::newRow("_star_.qt._star_.warning-qt.io") + << QString("*.qt.*.warning") << QString("qt.io") << QtDebugMsg << NoMatch; + } + + void QLoggingRule_parse() + { + QFETCH(QString, pattern); + QFETCH(QString, category); + QFETCH(QtMsgType, msgType); + QFETCH(LoggingRuleState, result); + + QLoggingRule rule(pattern, true); + LoggingRuleState state = Invalid; + if (rule.flags != QLoggingRule::Invalid) { + switch (rule.pass(category, msgType)) { + case -1: QFAIL("Shoudn't happen, we set pattern to true"); break; + case 0: state = NoMatch; break; + case 1: state = Match; break; + } + } + QCOMPARE(state, result); + } + void QLoggingSettingsParser_iniStyle() { // From 2350c7e35c7b21ab86e54e43d1e1bfddb1746922 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 25 Feb 2014 15:16:17 +0100 Subject: [PATCH 162/172] Make parsing of categories in logging rules more strict Do not accept rules with wildcards in the middle. Change-Id: If6fa71629c46bc4127aa8bd475643bc0e8a9f57c Reviewed-by: Thiago Macieira --- src/corelib/io/qloggingregistry.cpp | 18 +++++++++--------- .../qloggingregistry/tst_qloggingregistry.cpp | 8 ++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 20eb2e13f52..ab29c423253 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -134,20 +134,20 @@ void QLoggingRule::parse(const QString &pattern) messageType = QtCriticalMsg; } - int index = category.indexOf(QLatin1Char('*')); - if (index < 0) { + flags = Invalid; + if (!category.contains(QLatin1Char('*'))) { flags = FullText; } else { - flags = Invalid; - if (index == 0) { - flags |= RightFilter; - category.remove(0, 1); - index = category.indexOf(QLatin1Char('*')); - } - if (index == (category.length() - 1)) { + if (category.endsWith(QLatin1Char('*'))) { flags |= LeftFilter; category.chop(1); } + if (category.startsWith(QLatin1Char('*'))) { + flags |= RightFilter; + category.remove(0, 1); + } + if (category.contains(QLatin1Char('*'))) // '*' only supported at start/end + flags = Invalid; } } diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index 56545bb909d..5796b2f221c 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -152,6 +152,14 @@ private slots: << QString("*qt.*.debug") << QString("qt.io") << QtDebugMsg << Match; QTest::newRow("_star_.qt._star_.warning-qt.io") << QString("*.qt.*.warning") << QString("qt.io") << QtDebugMsg << NoMatch; + QTest::newRow("**") + << QString("**") << QString("qt.core.io") << QtDebugMsg << Match; + + // * outside of start/end + QTest::newRow("qt.*.io") + << QString("qt.*.io") << QString("qt.core.io") << QtDebugMsg << Invalid; + QTest::newRow("***") + << QString("***") << QString("qt.core.io") << QtDebugMsg << Invalid; } void QLoggingRule_parse() From 19693362e7b345d417554c6497e5117f2b189be5 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 25 Feb 2014 15:44:54 +0100 Subject: [PATCH 163/172] Use QStringRef for parsing of logging rules Use QStringRef to speed up the parsing of the left side of logging rules. Change-Id: Idd4d75496e3865d092f2802c45928a414c14c615 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qloggingregistry.cpp | 34 ++++++++++++------- src/corelib/io/qloggingregistry_p.h | 4 +-- .../qloggingregistry/tst_qloggingregistry.cpp | 2 +- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index ab29c423253..c5405d698c4 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -64,7 +64,7 @@ QLoggingRule::QLoggingRule() : \internal Constructs a logging rule. */ -QLoggingRule::QLoggingRule(const QString &pattern, bool enabled) : +QLoggingRule::QLoggingRule(const QStringRef &pattern, bool enabled) : messageType(-1), flags(Invalid), enabled(enabled) @@ -119,36 +119,44 @@ int QLoggingRule::pass(const QString &cat, QtMsgType msgType) const *.io.warning RightFilter, QtWarningMsg *.core.* MidFilter */ -void QLoggingRule::parse(const QString &pattern) +void QLoggingRule::parse(const QStringRef &pattern) { - category = pattern; + QStringRef p; + // strip trailing ".messagetype" if (pattern.endsWith(QLatin1String(".debug"))) { - category.chop(strlen(".debug")); + p = QStringRef(pattern.string(), pattern.position(), + pattern.length() - strlen(".debug")); messageType = QtDebugMsg; } else if (pattern.endsWith(QLatin1String(".warning"))) { - category.chop(strlen(".warning")); + p = QStringRef(pattern.string(), pattern.position(), + pattern.length() - strlen(".warning")); messageType = QtWarningMsg; } else if (pattern.endsWith(QLatin1String(".critical"))) { - category.chop(strlen(".critical")); + p = QStringRef(pattern.string(), pattern.position(), + pattern.length() - strlen(".critical")); messageType = QtCriticalMsg; + } else { + p = pattern; } flags = Invalid; - if (!category.contains(QLatin1Char('*'))) { + if (!p.contains(QLatin1Char('*'))) { flags = FullText; } else { - if (category.endsWith(QLatin1Char('*'))) { + if (p.endsWith(QLatin1Char('*'))) { flags |= LeftFilter; - category.chop(1); + p = QStringRef(p.string(), p.position(), p.length() - 1); } - if (category.startsWith(QLatin1Char('*'))) { + if (p.startsWith(QLatin1Char('*'))) { flags |= RightFilter; - category.remove(0, 1); + p = QStringRef(p.string(), p.position() + 1, p.length() - 1); } - if (category.contains(QLatin1Char('*'))) // '*' only supported at start/end + if (p.contains(QLatin1Char('*'))) // '*' only supported at start/end flags = Invalid; } + + category = p.toString(); } /*! @@ -205,7 +213,7 @@ void QLoggingSettingsParser::setContent(QTextStream &stream) int equalPos = line.indexOf(QLatin1Char('=')); if ((equalPos != -1) && (line.lastIndexOf(QLatin1Char('=')) == equalPos)) { - const QString pattern = line.left(equalPos); + const QStringRef pattern = line.leftRef(equalPos); const QStringRef value = line.midRef(equalPos + 1); bool enabled = (value.compare(QLatin1String("true"), Qt::CaseInsensitive) == 0); diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h index 70d728228ce..21896bb2686 100644 --- a/src/corelib/io/qloggingregistry_p.h +++ b/src/corelib/io/qloggingregistry_p.h @@ -68,7 +68,7 @@ class Q_AUTOTEST_EXPORT QLoggingRule { public: QLoggingRule(); - QLoggingRule(const QString &pattern, bool enabled); + QLoggingRule(const QStringRef &pattern, bool enabled); int pass(const QString &categoryName, QtMsgType type) const; enum PatternFlag { @@ -86,7 +86,7 @@ public: bool enabled; private: - void parse(const QString &pattern); + void parse(const QStringRef &pattern); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QLoggingRule::PatternFlags) diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index 5796b2f221c..ba53df03b67 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -169,7 +169,7 @@ private slots: QFETCH(QtMsgType, msgType); QFETCH(LoggingRuleState, result); - QLoggingRule rule(pattern, true); + QLoggingRule rule(QStringRef(&pattern), true); LoggingRuleState state = Invalid; if (rule.flags != QLoggingRule::Invalid) { switch (rule.pass(category, msgType)) { From 490298e93901eac0eba8c1156e9f9d6f2ccb6b11 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 28 Feb 2014 17:14:17 +0100 Subject: [PATCH 164/172] Optionally print from where logging rules are loaded Tell the user from where logging configurations are loaded from if the QT_LOGGING_DEBUG environment variable is set. This allows 'debugging' of the logging rules database, because it's very simple to e.g. silence all debug messages by adding a logging configuration file somewhere, and forget about it. Change-Id: Iee34031d531462060b5603e2210e01fd40952c63 Reviewed-by: Friedemann Kleint Reviewed-by: Jerome Pasion Reviewed-by: Alex Blasche Reviewed-by: Thiago Macieira --- src/corelib/io/qloggingcategory.cpp | 3 +++ src/corelib/io/qloggingregistry.cpp | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index eb8aeaca50e..7104dcdc935 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -137,6 +137,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, QCoreApplication::applicationDirPath() + \c "/data" \endlist + Set the \c QT_LOGGING_DEBUG environment variable to see from where + logging rules are loaded. + \section2 Installing a Custom Filter As a lower-level alternative to the text rules you can also implement a diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index c5405d698c4..6e195d29cb8 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -45,6 +45,13 @@ #include #include #include +#include + +// We can't use the default macros because this would lead to recursion. +// Instead let's define our own one that unconditionally logs... +#define debugMsg QMessageLogger(__FILE__, __LINE__, __FUNCTION__, "qt.core.logging").debug +#define warnMsg QMessageLogger(__FILE__, __LINE__, __FUNCTION__, "qt.core.logging").warning + QT_BEGIN_NAMESPACE @@ -232,6 +239,12 @@ QLoggingRegistry::QLoggingRegistry() { } +static bool qtLoggingDebug() +{ + static const bool debugEnv = qEnvironmentVariableIsSet("QT_LOGGING_DEBUG"); + return debugEnv; +} + /*! \internal Initializes the rules database by loading @@ -247,6 +260,9 @@ void QLoggingRegistry::init() QTextStream stream(&file); QLoggingSettingsParser parser; parser.setContent(stream); + if (qtLoggingDebug()) + debugMsg("Loading \"%s\" ...", + QDir::toNativeSeparators(file.fileName()).toUtf8().constData()); envRules = parser.rules(); } } @@ -260,6 +276,9 @@ void QLoggingRegistry::init() QTextStream stream(&file); QLoggingSettingsParser parser; parser.setContent(stream); + if (qtLoggingDebug()) + debugMsg("Loading \"%s\" ...", + QDir::toNativeSeparators(envPath).toUtf8().constData()); configRules = parser.rules(); } } @@ -308,6 +327,10 @@ void QLoggingRegistry::setApiRules(const QString &content) parser.setContent(content); QMutexLocker locker(®istryMutex); + + if (qtLoggingDebug()) + debugMsg("Loading logging rules set by Qt API ..."); + apiRules = parser.rules(); updateRules(); From ef43967fcd7a0d8f9cf176dcc3f09a2970fd570d Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 11 Mar 2014 17:04:28 +0100 Subject: [PATCH 165/172] Logging: Let user configure rules via QT_LOGGING_RULES Check also for rules set in an environment variable QT_LOGGING_RULES. This makes it even more convenient to set rules e.g. for just one run of an application, without having to create a logging configuration file. It is also more in place with the current way we enable/disable debugging of parts of Qt via environment variables. Change-Id: I4d05976f2b6c12bca472552ffa22345475cd01de Reviewed-by: Laszlo Agocs Reviewed-by: Tomasz Olszak --- src/corelib/io/qloggingcategory.cpp | 14 ++++++++------ src/corelib/io/qloggingregistry.cpp | 10 +++++++++- .../io/qloggingregistry/tst_qloggingregistry.cpp | 8 ++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 7104dcdc935..08ecd67dc88 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -108,8 +108,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, Rules are evaluated in text order, from first to last. That is, if two rules apply to a category/type, the rule that comes later is applied. - Rules can be set via \l setFilterRules(). Since Qt 5.3 logging rules - are also automatically loaded from the \c [Rules] section of a logging + Rules can be set via \l setFilterRules(). Since Qt 5.3 logging rules can also + be set in the \c QT_LOGGING_RULES environment variable, and + are automatically loaded from the \c [Rules] section of a logging configuration file. Such configuration files are looked up in the QtProject configuration directory, or explicitly set in a \c QT_LOGGING_CONF environment variable. @@ -117,13 +118,15 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, Rules set by \l setFilterRules() take precedence over rules specified in the QtProject configuration directory, and can, in turn, be overwritten by rules from the configuration file specified by - \c QT_LOGGING_CONF. + \c QT_LOGGING_CONF, and rules set by \c QT_LOGGING_RULES. + Order of evaluation: \list \li Rules from QtProject/qlogging.ini \li Rules set by \l setFilterRules() \li Rules from file in \c QT_LOGGING_CONF + \li Rules from environment variable QT_LOGGING_RULES \endlist The \c QtProject/qlogging.ini file is looked up in all directories returned @@ -344,9 +347,8 @@ QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter) \snippet qloggingcategory/main.cpp 2 \note The rules might be ignored if a custom category filter is installed - with \l installFilter(), or if the user defined a custom logging - configuration file in the \c QT_LOGGING_CONF environment variable. - + with \l installFilter(), or if the user defined \c QT_LOGGING_CONF or \c QT_LOGGING_RULES + environment variable. */ void QLoggingCategory::setFilterRules(const QString &rules) { diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 6e195d29cb8..23f1ffbd168 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -248,7 +248,7 @@ static bool qtLoggingDebug() /*! \internal Initializes the rules database by loading - .config/QtProject/qtlogging.ini and $QT_LOGGING_CONF. + $QT_LOGGING_CONF, $QT_LOGGING_RULES, and .config/QtProject/qtlogging.ini. */ void QLoggingRegistry::init() { @@ -266,6 +266,14 @@ void QLoggingRegistry::init() envRules = parser.rules(); } } + const QByteArray rulesSrc = qgetenv("QT_LOGGING_RULES"); + if (!rulesSrc.isEmpty()) { + QTextStream stream(rulesSrc); + QLoggingSettingsParser parser; + parser.setSection(QStringLiteral("Rules")); + parser.setContent(stream); + envRules += parser.rules(); + } // get rules from qt configuration QString envPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp index ba53df03b67..4318396bd41 100644 --- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp +++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp @@ -64,6 +64,7 @@ private slots: // ensure a clean environment QStandardPaths::setTestModeEnabled(true); qunsetenv("QT_LOGGING_CONF"); + qunsetenv("QT_LOGGING_RULES"); } void QLoggingRule_parse_data() @@ -219,6 +220,13 @@ private slots: QCOMPARE(registry.envRules.size(), 1); QCOMPARE(registry.rules.size(), 1); + + // check that QT_LOGGING_RULES take precedence + qputenv("QT_LOGGING_RULES", "Digia.*=true"); + registry.init(); + QCOMPARE(registry.envRules.size(), 2); + QCOMPARE(registry.envRules.at(1).enabled, true); + QCOMPARE(registry.rules.size(), 2); } void QLoggingRegistry_config() From a9d4aea49401f6c138940f42012070daddd04855 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 11 Mar 2014 14:46:42 +0100 Subject: [PATCH 166/172] Doc: Add links to new Qt Creator Manual topics Beautifier and Windows Runtime plugins were added for 3.1. Change-Id: I6ad16aa004e4ea2c468d2dc07e3d6142e63ff396 Reviewed-by: Jerome Pasion --- doc/global/externalsites/qtcreator.qdoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc index 15a41252505..2edb3769fd2 100644 --- a/doc/global/externalsites/qtcreator.qdoc +++ b/doc/global/externalsites/qtcreator.qdoc @@ -475,3 +475,11 @@ \externalpage http://qt-project.org/doc/qtcreator/creator-diff-editor.html \title Qt Creator: Comparing Files */ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-beautifier.html + \title Qt Creator: Beautifying Source Code +*/ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-winrt.html + \title Qt Creator: Connecting Windows Runtime Devices +*/ From afbad00a4d9ff28967ca15e0f9029925e86f2cf4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 10 Mar 2014 13:21:06 +0100 Subject: [PATCH 167/172] QQuickWidget move/resize fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure the alphamask in the backingstore is updated whenever the geometry of a QQuickWidget/QOpenGLWidget child changes. Task-number: QTBUG-37372 Change-Id: I70e94664bd7da774694645f604e1a7277fe563c7 Reviewed-by: Jørgen Lind Reviewed-by: Ulf Hermann --- src/widgets/kernel/qwidget_qpa.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 5885673591e..3f0b0936c32 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -762,10 +762,15 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) } if (!q->isWindow()) { - if (isMove && !isResize) + if (renderToTexture) { + QRegion updateRegion(q->geometry()); + updateRegion += QRect(oldPos, olds); + q->parentWidget()->d_func()->invalidateBuffer(updateRegion); + } else if (isMove && !isResize) { moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y()); - else + } else { invalidateBuffer_resizeHelper(oldPos, olds); + } } } From daff5656e2ffbec65db73cad3c0f997e6a1e7667 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 11 Mar 2014 12:23:29 +0100 Subject: [PATCH 168/172] QQuickWidget: fix crash on exit Make sure that the correct context is current when freeing GL resources. Otherwise, on shutdown, QOpenGLVertexArrayObject would try to use the previously current context, which mmay already have been deleted. Task-number: QTBUG-37385 Change-Id: Ib2332f54636738a1a4b1041a7dcbffd0af00261d Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidget_qpa.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 3f0b0936c32..88a08060c19 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -945,10 +945,21 @@ void QWidgetPrivate::deleteTLSysExtra() { if (extra && extra->topextra) { //the qplatformbackingstore may hold a reference to the window, so the backingstore - //needs to be deleted first + //needs to be deleted first. If the backingstore holds GL resources, we need to + // make the context current here, since the platform bs does not have a reference + // to the widget. + +#ifndef QT_NO_OPENGL + if (textureChildSeen && extra->topextra->shareContext) + extra->topextra->shareContext->makeCurrent(extra->topextra->window); +#endif extra->topextra->backingStoreTracker.destroy(); delete extra->topextra->backingStore; extra->topextra->backingStore = 0; +#ifndef QT_NO_OPENGL + if (textureChildSeen && extra->topextra->shareContext) + extra->topextra->shareContext->doneCurrent(); +#endif //the toplevel might have a context with a "qglcontext associated with it. We need to //delete the qglcontext before we delete the qplatformopenglcontext. From b9ec3e895f0af70bc78d8df64d3628d9b85fbec1 Mon Sep 17 00:00:00 2001 From: Kalle Viironen Date: Wed, 26 Feb 2014 15:32:35 +0200 Subject: [PATCH 169/172] Remove definition QT_EDITION Remove definition QT_EDITION which was set in configure since it is not used anywhere anymore. Change-Id: I5c30ab47c6244fcb07707fd05e11decf2068f6d1 Reviewed-by: Oswald Buddenhagen --- configure | 21 +-------------------- qmake/qmake.pri | 4 ---- tools/configure/configureapp.cpp | 16 ---------------- tools/configure/tools.cpp | 9 +-------- 4 files changed, 2 insertions(+), 48 deletions(-) diff --git a/configure b/configure index 88eaf9a3fdb..1c1af57451e 100755 --- a/configure +++ b/configure @@ -2776,7 +2776,6 @@ if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; # Commercial preview release Licensee="Preview" Edition="Preview" - QT_EDITION="QT_EDITION_DESKTOP" LicenseType="Technology Preview" elif [ $COMMERCIAL_USER = "yes" ]; then # one of commercial editions @@ -2832,17 +2831,14 @@ elif [ $COMMERCIAL_USER = "yes" ]; then case $ProductCode in F) Edition="Universal" - QT_EDITION="QT_EDITION_UNIVERSAL" ;; B) Edition="FullFramework" EditionString="Full Framework" - QT_EDITION="QT_EDITION_DESKTOP" ;; L) Edition="GUIFramework" EditionString="GUI Framework" - QT_EDITION="QT_EDITION_DESKTOPLIGHT" ;; esac ;; @@ -2852,12 +2848,11 @@ elif [ $COMMERCIAL_USER = "yes" ]; then case $ProductCode in B) Edition="Evaluation" - QT_EDITION="QT_EDITION_EVALUATION" ;; esac ;; esac - if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then + if [ -z "$LicenseType" -o -z "$Edition" ]; then echo echo "Invalid license key. Please check the license key." exit 1 @@ -2927,7 +2922,6 @@ elif [ $COMMERCIAL_USER = "yes" ]; then esac Licensee="$Edition" EditionString="$Edition" - QT_EDITION="QT_EDITION_DESKTOP" fi case "$LicenseFeatureCode" in @@ -2981,7 +2975,6 @@ elif [ $COMMERCIAL_USER = "no" ]; then Licensee="Open Source" Edition="OpenSource" EditionString="Open Source" - QT_EDITION="QT_EDITION_OPENSOURCE" fi echo echo "This is the Qt ${EditionString} Edition." @@ -4034,9 +4027,6 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; echo "EXEEXT = $EXEEXT" >> "$mkfile" echo "RM_F = rm -f" >> "$mkfile" echo "RM_RF = rm -rf" >> "$mkfile" - if [ $QT_EDITION = "QT_EDITION_OPENSOURCE" ]; then - echo "EXTRA_CPPFLAGS = -DQMAKE_OPENSOURCE_EDITION" >> "$mkfile" - fi if [ "$BUILD_ON_MAC" = "yes" ]; then echo "EXTRA_CXXFLAGS += -MMD" >> "$mkfile" @@ -6247,10 +6237,6 @@ esac cat >>"$outpath/src/corelib/global/qconfig.h.new" <>"$outpath/src/corelib/global/qconfig.h.new" @@ -6505,7 +6491,6 @@ host_build { QMAKE_DEFAULT_LIBDIRS = `shellQuoteLines "$DEFAULT_LIBDIRS"` QMAKE_DEFAULT_INCDIRS = `shellQuoteLines "$DEFAULT_INCDIRS"` } -QT_EDITION = $Edition QT_CONFIG += $QT_CONFIG #versioning @@ -6632,10 +6617,6 @@ if [ -n "$QT_LFLAGS_TDS" ]; then echo "QT_LFLAGS_TDS = $QT_LFLAGS_TDS" >> "$QTMODULE.tmp" fi -if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then - echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$QTMODULE.tmp" -fi - #dump in the OPENSSL_LIBS info if [ '!' -z "$OPENSSL_LIBS" ]; then echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$QTMODULE.tmp" diff --git a/qmake/qmake.pri b/qmake/qmake.pri index acc99758439..73757ee086b 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -29,10 +29,6 @@ HEADERS += project.h property.h \ generators/integrity/gbuild.h \ generators/win32/cesdkhandler.h -contains(QT_EDITION, OpenSource) { - DEFINES += QMAKE_OPENSOURCE_EDITION -} - bootstrap { #Qt code SOURCES+= \ qbitarray.cpp \ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index f71d0cf9a89..fddf99d2da2 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2950,9 +2950,6 @@ void Configure::generateCachefile() moduleStream << "}" << endl; moduleStream << "QT_COORD_TYPE += " << dictionary["QREAL"] << endl; - if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE") - moduleStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl; - if (dictionary["QT_XKBCOMMON"] == "no") moduleStream << "DEFINES += QT_NO_XKBCOMMON" << endl; @@ -3296,10 +3293,6 @@ void Configure::generateQConfigPri() configStream << " QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include" << endl; } configStream << "}" << endl; - if (dictionary["QT_EDITION"].contains("OPENSOURCE")) - configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl; - else - configStream << "QT_EDITION = " << dictionary["EDITION"] << endl; configStream << "QT_CONFIG += " << qtConfig.join(' ') << endl; configStream << "#versioning " << endl @@ -3398,11 +3391,6 @@ void Configure::generateConfigfiles() tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl; tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl; tmpStream << endl; - tmpStream << "// Qt Edition" << endl; - tmpStream << "#ifndef QT_EDITION" << endl; - tmpStream << "# define QT_EDITION " << dictionary["QT_EDITION"] << endl; - tmpStream << "#endif" << endl; - tmpStream << endl; if (dictionary["BUILDDEV"] == "yes") { dictionary["QMAKE_INTERNAL"] = "yes"; tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl; @@ -4038,9 +4026,6 @@ void Configure::buildQmake() } else { stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl; } - if (dictionary["EDITION"] == "OpenSource" || - dictionary["QT_EDITION"].contains("OPENSOURCE")) - stream << "EXTRA_CPPFLAGS = -DQMAKE_OPENSOURCE_EDITION" << endl; stream << "\n\n"; @@ -4319,7 +4304,6 @@ void Configure::readLicense() cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl; licenseInfo["LICENSEE"] = "Open Source"; dictionary["EDITION"] = "OpenSource"; - dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE"; cout << endl; if (!showLicense(dictionary["LICENSE FILE"])) { cout << "Configuration aborted since license was not accepted"; diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp index e9174bf1028..07c3c82a0b9 100644 --- a/tools/configure/tools.cpp +++ b/tools/configure/tools.cpp @@ -62,14 +62,12 @@ void Tools::checkLicense(QMap &dictionary, QMap &dictionary, QMap &dictionary, QMap Date: Tue, 11 Mar 2014 15:02:55 +0100 Subject: [PATCH 170/172] Ensure that QGuiApplication is inited before using QFontDatabase Change-Id: I494c4fdfa49139316efac0f68f8d463c02056372 Reviewed-by: Konstantin Ritt Reviewed-by: Simon Hausmann --- src/gui/text/qfontdatabase.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 3c2cf4fdcf8..02b9e6d25c6 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -1227,6 +1227,9 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo) */ QFontDatabase::QFontDatabase() { + if (!qApp || !QGuiApplicationPrivate::platformIntegration()) + qFatal("QFontDatabase: Must construct a QGuiApplication before accessing QFontDatabase"); + QMutexLocker locker(fontDatabaseMutex()); createDatabase(); d = privateDb(); From b3ac505e21d1df7d417cc33464124da7b854efc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 10 Mar 2014 15:06:06 +0100 Subject: [PATCH 171/172] Fix a few build warnings on iOS due to unused functions Change-Id: If345a4137986a7d5032a2b48d92c08bc58e02144 Reviewed-by: Simon Hausmann --- .../fontdatabases/mac/qcoretextfontdatabase.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 102109e33ce..0301c2e5a1a 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -93,6 +93,7 @@ static const char *languageForWritingSystem[] = { }; enum { LanguageCount = sizeof(languageForWritingSystem) / sizeof(const char *) }; +#ifdef Q_OS_OSX static NSInteger languageMapSort(id obj1, id obj2, void *context) { NSArray *map1 = (NSArray *) obj1; @@ -104,6 +105,7 @@ static NSInteger languageMapSort(id obj1, id obj2, void *context) return [languages indexOfObject: lang1] - [languages indexOfObject: lang2]; } +#endif QCoreTextFontDatabase::QCoreTextFontDatabase() { @@ -344,6 +346,7 @@ QFont::StyleHint styleHintFromNSString(NSString *style) return QFont::AnyStyle; } +#ifdef Q_OS_OSX static QString familyNameFromPostScriptName(NSString *psName) { QCFType fontDescriptor = (CTFontDescriptorRef) CTFontDescriptorCreateWithNameAndSize((CFStringRef)psName, 12.0); @@ -354,6 +357,7 @@ static QString familyNameFromPostScriptName(NSString *psName) return name; } +#endif QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { From fbaa6d3ca6fc2693c5c8a1cd8e565803adc97730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 10 Mar 2014 15:03:36 +0100 Subject: [PATCH 172/172] Don't populate font families using localized family names on OS X/iOS The font database and QFont should have normalized font family names, so using CTFontDescriptorCopyLocalizedAttribute is not a good idea. If the feature of reporting the localized name of a font family or style is needed in for example the font selection dropdown or dialog, it should be exposed as an explicit property of the font. Change-Id: Iaa15ad861043f4c78a38080608b6fe4d99efee18 Reviewed-by: Simon Hausmann --- .../fontdatabases/mac/qcoretextfontdatabase.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 0301c2e5a1a..afee68ebed2 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -204,8 +204,8 @@ void QCoreTextFontDatabase::populateFontDatabase() void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) { QString foundryName = QStringLiteral("CoreText"); - QCFString familyName = (CFStringRef) CTFontDescriptorCopyLocalizedAttribute(font, kCTFontFamilyNameAttribute, NULL); - QCFString styleName = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute(font, kCTFontStyleNameAttribute, NULL); + QCFString familyName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); + QCFString styleName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute); QCFType styles = (CFDictionaryRef) CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute); QFont::Weight weight = QFont::Normal; QFont::Style style = QFont::StyleNormal; @@ -350,7 +350,7 @@ QFont::StyleHint styleHintFromNSString(NSString *style) static QString familyNameFromPostScriptName(NSString *psName) { QCFType fontDescriptor = (CTFontDescriptorRef) CTFontDescriptorCreateWithNameAndSize((CFStringRef)psName, 12.0); - QCFString familyName = (CFStringRef) CTFontDescriptorCopyLocalizedAttribute(fontDescriptor, kCTFontFamilyNameAttribute, 0); + QCFString familyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute); QString name = QCFString::toQString(familyName); if (name.isEmpty()) qWarning() << "QCoreTextFontDatabase: Failed to resolve family name for PostScript name " << QCFString::toQString((CFStringRef)psName); @@ -390,7 +390,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo const int numCascades = CFArrayGetCount(cascadeList); for (int i = 0; i < numCascades; ++i) { CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i); - QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyLocalizedAttribute(fontFallback, kCTFontFamilyNameAttribute, NULL); + QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute); fallbackList.append(QCFString::toQString(fallbackFamilyName)); } fallbackLists[family] = fallbackList; @@ -564,7 +564,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData for (int i = 0; i < numFonts; ++i) { CTFontDescriptorRef fontDescriptor = CTFontDescriptorRef(CFArrayGetValueAtIndex(fonts, i)); populateFromDescriptor(fontDescriptor); - QCFType familyName = CFStringRef(CTFontDescriptorCopyLocalizedAttribute(fontDescriptor, kCTFontFamilyNameAttribute, NULL)); + QCFType familyName = CFStringRef(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute)); families.append(QCFString(familyName)); } }