summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qxpmhandler.cpp2
-rw-r--r--src/gui/text/qcssparser.cpp2
-rw-r--r--src/gui/text/qtexthtmlparser.cpp3
-rw-r--r--src/gui/text/qtexthtmlparser_p.h2
-rw-r--r--src/platformheaders/xcbfunctions/qxcbwindowfunctions.h8
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp14
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtwindow.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp21
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h2
-rw-r--r--src/testlib/qtestcase.cpp6
-rw-r--r--src/testlib/qtestutil_macos.mm53
-rw-r--r--src/testlib/qtestutil_macos_p.h59
-rw-r--r--src/testlib/testlib.pro7
-rw-r--r--src/widgets/kernel/qwidget.cpp11
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp4
19 files changed, 186 insertions, 23 deletions
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index c8dd589673..c8c8f993d3 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -80,7 +80,7 @@ static const int xpmRgbTblSize = 657;
static const struct XPMRGBData {
uint value;
- const char *name;
+ const char name[21];
} xpmRgbTbl[] = {
{ QRGB(240,248,255), "aliceblue" },
{ QRGB(250,235,215), "antiquewhite" },
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index c237d80d34..966ab3fcdb 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -60,7 +60,7 @@ using namespace QCss;
struct QCssKnownValue
{
- const char *name;
+ const char name[28];
quint64 id;
};
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 7bca50325c..d18d432f46 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
// see also tst_qtextdocumentfragment.cpp
#define MAX_ENTITY 258
-static const struct QTextHtmlEntity { const char *name; quint16 code; } entities[MAX_ENTITY]= {
+static const struct QTextHtmlEntity { const char name[9]; quint16 code; } entities[]= {
{ "AElig", 0x00c6 },
{ "AMP", 38 },
{ "Aacute", 0x00c1 },
@@ -320,6 +320,7 @@ static const struct QTextHtmlEntity { const char *name; quint16 code; } entities
{ "zwj", 0x200d },
{ "zwnj", 0x200c }
};
+Q_STATIC_ASSERT(MAX_ENTITY == sizeof entities / sizeof *entities);
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
bool operator<(const QTextHtmlEntity &entity1, const QTextHtmlEntity &entity2)
diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h
index 4c0dd967f9..38c9108f75 100644
--- a/src/gui/text/qtexthtmlparser_p.h
+++ b/src/gui/text/qtexthtmlparser_p.h
@@ -144,7 +144,7 @@ enum QTextHTMLElements {
struct QTextHtmlElement
{
- const char *name;
+ const char name[11];
QTextHTMLElements id;
enum DisplayMode { DisplayBlock, DisplayInline, DisplayTable, DisplayNone } displayMode;
};
diff --git a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
index 149faadfda..b6c3b1db73 100644
--- a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
+++ b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
@@ -75,6 +75,14 @@ public:
return QPlatformHeaderHelper::callPlatformFunction<void, SetWmWindowType, QWindow *, WmWindowType>(setWmWindowTypeIdentifier(), window, type);
}
+ typedef void (*SetWmWindowRole)(QWindow *window, const QByteArray &role);
+ static const QByteArray setWmWindowRoleIdentifier() { return QByteArrayLiteral("XcbSetWmWindowRole"); }
+
+ static void setWmWindowRole(QWindow *window, const QByteArray &role)
+ {
+ return QPlatformHeaderHelper::callPlatformFunction<void, SetWmWindowRole, QWindow *, const QByteArray &>(setWmWindowRoleIdentifier(), window, role);
+ }
+
typedef void (*SetWmWindowIconText)(QWindow *window, const QString &text);
static const QByteArray setWmWindowIconTextIdentifier() { return QByteArrayLiteral("XcbSetWmWindowIconText"); }
static void setWmWindowIconText(QWindow *window, const QString &text)
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index f6d911d646..49eb7cfdec 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -447,7 +447,7 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g)
width,
height,
advanceWidth,
- advanceHeight);
+ 0);
} else {
qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
}
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index ad32e63cad..ad32c046df 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -763,10 +763,11 @@ void QWinRTScreen::addWindow(QWindow *window)
{
Q_D(QWinRTScreen);
qCDebug(lcQpaWindows) << __FUNCTION__ << window;
- if (window == topWindow())
+ if (window == topWindow() || window->surfaceClass() == QSurface::Offscreen)
return;
d->visibleWindows.prepend(window);
+ updateWindowTitle(window->title());
QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason);
handleExpose();
QWindowSystemInterface::flushWindowSystemEvents();
@@ -785,7 +786,7 @@ void QWinRTScreen::removeWindow(QWindow *window)
if (!d->visibleWindows.removeAll(window))
return;
if (wasTopWindow)
- QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason);
+ QWindowSystemInterface::handleWindowActivated(Q_NULLPTR, Qt::OtherFocusReason);
handleExpose();
QWindowSystemInterface::flushWindowSystemEvents();
#if _MSC_VER >= 1900 && !defined(QT_NO_DRAGANDDROP)
@@ -807,6 +808,8 @@ void QWinRTScreen::lower(QWindow *window)
const bool wasTopWindow = window == topWindow();
if (wasTopWindow && d->visibleWindows.size() == 1)
return;
+ if (window->surfaceClass() == QSurface::Offscreen)
+ return;
d->visibleWindows.removeAll(window);
d->visibleWindows.append(window);
if (wasTopWindow)
@@ -814,15 +817,10 @@ void QWinRTScreen::lower(QWindow *window)
handleExpose();
}
-void QWinRTScreen::updateWindowTitle()
+void QWinRTScreen::updateWindowTitle(const QString &title)
{
Q_D(QWinRTScreen);
- QWindow *window = topWindow();
- if (!window)
- return;
-
- const QString title = window->title();
HStringReference titleRef(reinterpret_cast<LPCWSTR>(title.utf16()), title.length());
HRESULT hr = d->view->put_Title(titleRef.Get());
RETURN_VOID_IF_FAILED("Unable to set window title");
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h
index 5cada9726d..0e753b748b 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.h
+++ b/src/plugins/platforms/winrt/qwinrtscreen.h
@@ -109,7 +109,7 @@ public:
void raise(QWindow *window);
void lower(QWindow *window);
- void updateWindowTitle();
+ void updateWindowTitle(const QString &title);
ABI::Windows::UI::Core::ICoreWindow *coreWindow() const;
ABI::Windows::UI::Xaml::IDependencyObject *canvas() const;
diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp
index 606ca22bcd..5b82183d40 100644
--- a/src/plugins/platforms/winrt/qwinrtwindow.cpp
+++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp
@@ -191,6 +191,8 @@ QWinRTWindow::~QWinRTWindow()
});
RETURN_VOID_IF_FAILED("Failed to completely destroy window resources, likely because the application is shutting down");
+ d->screen->removeWindow(window());
+
if (!d->surface)
return;
@@ -282,7 +284,9 @@ void QWinRTWindow::setWindowTitle(const QString &title)
{
Q_D(QWinRTWindow);
d->windowTitle = title;
- d->screen->updateWindowTitle();
+
+ if (d->screen->topWindow() == window())
+ d->screen->updateWindowTitle(title);
}
void QWinRTWindow::raise()
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index a8d401e15b..a3e8da7df8 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -364,6 +364,9 @@ QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &functio
if (function == QXcbWindowFunctions::setWmWindowTypeIdentifier())
return QFunctionPointer(QXcbWindowFunctions::SetWmWindowType(QXcbWindow::setWmWindowTypeStatic));
+ if (function == QXcbWindowFunctions::setWmWindowRoleIdentifier())
+ return QFunctionPointer(QXcbWindowFunctions::SetWmWindowRole(QXcbWindow::setWmWindowRoleStatic));
+
if (function == QXcbWindowFunctions::setWmWindowIconTextIdentifier())
return QFunctionPointer(QXcbWindowFunctions::SetWmWindowIconText(QXcbWindow::setWindowIconTextStatic));
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index a39ff01afd..6dda005bd9 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -304,6 +304,7 @@ static QWindow *childWindowAt(QWindow *win, const QPoint &p)
}
static const char *wm_window_type_property_id = "_q_xcb_wm_window_type";
+static const char *wm_window_role_property_id = "_q_xcb_wm_window_role";
QXcbWindow::QXcbWindow(QWindow *window)
: QPlatformWindow(window)
@@ -586,6 +587,11 @@ void QXcbWindow::create()
setOpacity(opacity);
if (window()->isTopLevel())
setWindowIcon(window()->icon());
+
+ if (window()->dynamicPropertyNames().contains(wm_window_role_property_id)) {
+ QByteArray wmWindowRole = window()->property(wm_window_role_property_id).toByteArray();
+ setWmWindowRole(wmWindowRole);
+ }
}
QXcbWindow::~QXcbWindow()
@@ -1720,6 +1726,14 @@ void QXcbWindow::setWindowIconTextStatic(QWindow *window, const QString &text)
static_cast<QXcbWindow *>(window->handle())->setWindowIconText(text);
}
+void QXcbWindow::setWmWindowRoleStatic(QWindow *window, const QByteArray &role)
+{
+ if (window->handle())
+ static_cast<QXcbWindow *>(window->handle())->setWmWindowRole(role);
+ else
+ window->setProperty(wm_window_role_property_id, role);
+}
+
uint QXcbWindow::visualIdStatic(QWindow *window)
{
if (window && window->handle())
@@ -1885,6 +1899,13 @@ void QXcbWindow::setWmWindowType(QXcbWindowFunctions::WmWindowTypes types, Qt::W
xcb_flush(xcb_connection());
}
+void QXcbWindow::setWmWindowRole(const QByteArray &role)
+{
+ Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
+ atom(QXcbAtom::WM_WINDOW_ROLE), XCB_ATOM_STRING, 8,
+ role.size(), role.constData()));
+}
+
void QXcbWindow::setParentRelativeBackPixmapStatic(QWindow *window)
{
if (window->handle())
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index e7190b1733..f62938ba8a 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -151,10 +151,12 @@ public:
void updateNetWmUserTime(xcb_timestamp_t timestamp);
static void setWmWindowTypeStatic(QWindow *window, QXcbWindowFunctions::WmWindowTypes windowTypes);
+ static void setWmWindowRoleStatic(QWindow *window, const QByteArray &role);
static uint visualIdStatic(QWindow *window);
QXcbWindowFunctions::WmWindowTypes wmWindowTypes() const;
void setWmWindowType(QXcbWindowFunctions::WmWindowTypes types, Qt::WindowFlags flags);
+ void setWmWindowRole(const QByteArray &role);
static void setWindowIconTextStatic(QWindow *window, const QString &text);
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 703af6b677..f3aaa7c89d 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -72,6 +72,9 @@
#if defined(HAVE_XCTEST)
#include <QtTest/private/qxctestlogger_p.h>
#endif
+#if defined Q_OS_MACOS
+#include <QtTest/private/qtestutil_macos_p.h>
+#endif
#include <numeric>
#include <algorithm>
@@ -1648,6 +1651,9 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
#if defined(Q_OS_MACX)
bool macNeedsActivate = qApp && (qstrcmp(qApp->metaObject()->className(), "QApplication") == 0);
IOPMAssertionID powerID;
+
+ // Don't restore saved window state for auto tests.
+ QTestPrivate::disableWindowRestore();
#endif
#ifndef QT_NO_EXCEPTIONS
try {
diff --git a/src/testlib/qtestutil_macos.mm b/src/testlib/qtestutil_macos.mm
new file mode 100644
index 0000000000..852c9f75f2
--- /dev/null
+++ b/src/testlib/qtestutil_macos.mm
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtTest module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtestutil_macos_p.h"
+
+#import <AppKit/AppKit.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QTestPrivate {
+
+ /*! \internal
+
+ Disables restoration of previously saved window state. This causes tests
+ to start with a clean slate and prevents the "previous restore failed"
+ dialog from showing if there was a test crash.
+ */
+ void disableWindowRestore() {
+ [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"ApplePersistenceIgnoreState"];
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/testlib/qtestutil_macos_p.h b/src/testlib/qtestutil_macos_p.h
new file mode 100644
index 0000000000..85f9ace82f
--- /dev/null
+++ b/src/testlib/qtestutil_macos_p.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtTest module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTESTUTIL_MACOS_H
+#define QTESTUTIL_MACOS_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qglobal.h>
+#import <objc/objc.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QTestPrivate {
+ void disableWindowRestore();
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 372a69c3ed..b4ac077e86 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -77,7 +77,12 @@ wince: LIBS += \
mac {
LIBS += -framework Security
- osx: LIBS += -framework ApplicationServices -framework IOKit
+
+ macos {
+ HEADERS += qtestutil_macos_p.h
+ OBJECTIVE_SOURCES += qtestutil_macos.mm
+ LIBS += -framework Foundation -framework ApplicationServices -framework IOKit
+ }
# XCTest support (disabled for now)
false:!lessThan(QMAKE_XCODE_VERSION, "6.0") {
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 5f8676697d..ba02728d7c 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1482,6 +1482,9 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
data.window_flags = win->flags();
+ if (!topData()->role.isNull())
+ QXcbWindowFunctions::setWmWindowRole(win, topData()->role.toLatin1());
+
QBackingStore *store = q->backingStore();
if (!store) {
@@ -6359,13 +6362,11 @@ QString QWidget::windowRole() const
*/
void QWidget::setWindowRole(const QString &role)
{
-#if defined(Q_DEAD_CODE_FROM_QT4_X11)
Q_D(QWidget);
+ d->createTLExtra();
d->topData()->role = role;
- d->setWindowRole();
-#else
- Q_UNUSED(role)
-#endif
+ if (windowHandle())
+ QXcbWindowFunctions::setWmWindowRole(windowHandle(), role.toLatin1());
}
/*!
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 4d37c7f682..ac8902c9e6 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -67,7 +67,9 @@ QT_BEGIN_NAMESPACE
extern QRegion qt_dirtyRegion(QWidget *);
+#ifndef QT_NO_OPENGL
Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList)
+#endif
/**
* Flushes the contents of the \a backingStore into the screen area of \a widget.
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 44555c3058..5c046d0130 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -210,7 +210,7 @@ enum PseudoElement {
struct PseudoElementInfo {
QStyle::SubControl subControl;
- const char *name;
+ const char name[19];
};
static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = {
@@ -595,7 +595,7 @@ public:
Q_DECLARE_TYPEINFO(QRenderRule, Q_MOVABLE_TYPE);
///////////////////////////////////////////////////////////////////////////////////////////
-static const char *const knownStyleHints[] = {
+static const char knownStyleHints[][45] = {
"activate-on-singleclick",
"alignment",
"arrow-keys-navigate-into-children",