From 960a1e3bf3414a59e7bd436b3a2d63a595b34dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 3 May 2016 11:49:49 +0200 Subject: QTestLib: Disable window state restore on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For test runs we want to start with a clean slate and ignore previously saved window state. This also prevents the “previous restore failed” dialog from from showing and blocking the test run. Change-Id: I8e5b87a903cf1d937d628c2b062f917c4c37f176 Reviewed-by: Morten Johan Sørvig --- src/testlib/qtestcase.cpp | 6 +++++ src/testlib/qtestutil_macos.mm | 53 ++++++++++++++++++++++++++++++++++++ src/testlib/qtestutil_macos_p.h | 59 +++++++++++++++++++++++++++++++++++++++++ src/testlib/testlib.pro | 7 ++++- 4 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 src/testlib/qtestutil_macos.mm create mode 100644 src/testlib/qtestutil_macos_p.h (limited to 'src') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index fe680e19aa..876c573196 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -65,6 +65,9 @@ #if defined(HAVE_XCTEST) #include #endif +#if defined Q_OS_MACOS +#include +#endif #include #include @@ -2915,6 +2918,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 + +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 +#import + +QT_BEGIN_NAMESPACE + +namespace QTestPrivate { + void disableWindowRestore(); +} + +QT_END_NAMESPACE + +#endif diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index ff4379f85d..3f16a0ec46 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -75,7 +75,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 !lessThan(QMAKE_XCODE_VERSION, "6.0") { -- cgit v1.2.3 From 0f6ace8118c72781e6c4c68c3dc98a2937fedf35 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Wed, 17 Aug 2016 14:22:46 +0200 Subject: winrt: Fix crash when managing multiple top-level windows When a window gets removed, the active focus window needs to be set to 0 instead of the the current window. Otherwise QGuiApplicationPrivate::focus_window is set to an invalid pointer and crashes when dereferenced. Change-Id: I258b95e447de4cbfb7f19955079c2545a738e03f Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index c1118cd0b8..703627a6c5 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -782,7 +782,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) -- cgit v1.2.3 From a75cfa60d7f15513218f7719410b09f708a2940e Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Wed, 17 Aug 2016 15:43:11 +0200 Subject: winrt: Fix crashes for visible window management First, offscreen windows/surfaces should not be tracked in the visible window list. Secondly when destroying a window, it is not guaranteed that it had been removed first, hence enforce it to guarantee that the visibleWindows list stays correct and does not hold invalid weak pointers to non existing windows. Change-Id: I7027ecd010b8bcb3d05e3f5d460662e883e42e50 Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 4 +++- src/plugins/platforms/winrt/qwinrtwindow.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 703627a6c5..77185f1bb9 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -760,7 +760,7 @@ 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); @@ -804,6 +804,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) diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp index 3bd0cd3ad7..cc50aaa8d1 100644 --- a/src/plugins/platforms/winrt/qwinrtwindow.cpp +++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp @@ -189,6 +189,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; -- cgit v1.2.3 From 4531ae8d699d06197d8485702fc48214c5e4dda8 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Wed, 17 Aug 2016 15:40:59 +0200 Subject: winrt: only update window title for top level widgets Previously we always updated the window title, independently whether the window was visible / the toplevel one. This can also cause troubles when setting the title during initialization. Change-Id: I02ec0f0e385fa490f641ce83a6cb27717a31620f Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 8 ++------ src/plugins/platforms/winrt/qwinrtscreen.h | 2 +- src/plugins/platforms/winrt/qwinrtwindow.cpp | 4 +++- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 77185f1bb9..dd2ebee3d5 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -764,6 +764,7 @@ void QWinRTScreen::addWindow(QWindow *window) return; d->visibleWindows.prepend(window); + updateWindowTitle(window->title()); QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason); handleExpose(); QWindowSystemInterface::flushWindowSystemEvents(); @@ -813,15 +814,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(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 a5c1d24d51..ff1ff32ce9 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.h +++ b/src/plugins/platforms/winrt/qwinrtscreen.h @@ -106,7 +106,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 cc50aaa8d1..be55ded7cd 100644 --- a/src/plugins/platforms/winrt/qwinrtwindow.cpp +++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp @@ -282,7 +282,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() -- cgit v1.2.3 From b8c1efcb887a2aa313fd843aa16a5be84d4189e6 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 17 Aug 2016 13:03:59 +0200 Subject: DirectWrite: Fix calculating bounding box of glyphs We don't support vertical text layouts in Qt, so the vertical advance should always be 0 (like it is in other engines). Since we were setting this, we would calculate the bounding box of strings in the DirectWrite engine as if the layouts were diagonal, adding up both the horizontal and vertical advances. [ChangeLog][QtGui][Windows] Fixed height of text bounding box when using no or vertical hinting preference, or when the device pixel ratio is different from 1. Task-number: QTBUG-51024 Change-Id: I329917eb8da71fdfdffe9651ca8f0f48d26b6a60 Reviewed-by: Lars Knoll Reviewed-by: Friedemann Kleint Reviewed-by: Konstantin Ritt --- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 04a08d892a..f2758f6d90 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -436,7 +436,7 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g) width, height, advanceWidth, - advanceHeight); + 0); } else { qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__); } -- cgit v1.2.3 From 9e85986fd09f0b46dea1ad6e4626a426b5cc469d Mon Sep 17 00:00:00 2001 From: Peter Seiderer Date: Thu, 11 Aug 2016 22:10:32 +0200 Subject: qwidgetbackingstore: fix QT_NO_OPENGL compile Readd QT_NO_OPENGL protection for qt_dummy_platformTextureList declaration (lost by commit 2a7cee47e5e84c73e32a6953e145771196645f1a). Task-number: QTBUG-55269 Change-Id: I7ec613387af81d018dbbe99d2dfd3a6f36242a4c Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidgetbackingstore.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 3f62e7913f..557e71014e 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -61,7 +61,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. -- cgit v1.2.3 From d13d81eb01a84bb8fd599ceac5ffcf19fca2f91e Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 8 Jun 2015 14:35:22 +0300 Subject: Fix QWidget::setWindowRole() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce QXcbWindowFunctions::setWmWindowRole() and call it either from the implementation of QWidget::setWindowRole() or after the creation of the corresponding QWidgetWindow. Change-Id: I143450f4673dd707bb491c1d0f0e8b61d564283d Task-number: QTBUG-45484 Reviewed-by: Laszlo Agocs Reviewed-by: Ivan Čukić --- .../xcbfunctions/qxcbwindowfunctions.h | 8 ++++++++ src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 3 +++ src/plugins/platforms/xcb/qxcbwindow.cpp | 21 +++++++++++++++++++++ src/plugins/platforms/xcb/qxcbwindow.h | 2 ++ src/widgets/kernel/qwidget.cpp | 11 ++++++----- 5 files changed, 40 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h index 0db2e2a09d..97e0e1cafa 100644 --- a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h +++ b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h @@ -69,6 +69,14 @@ public: return QPlatformHeaderHelper::callPlatformFunction(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(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/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 96239a0f20..09e7ecf3a3 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -350,6 +350,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 247e420f5d..da5020168f 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -284,6 +284,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) @@ -610,6 +611,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() @@ -1733,6 +1739,14 @@ void QXcbWindow::setWindowIconTextStatic(QWindow *window, const QString &text) static_cast(window->handle())->setWindowIconText(text); } +void QXcbWindow::setWmWindowRoleStatic(QWindow *window, const QByteArray &role) +{ + if (window->handle()) + static_cast(window->handle())->setWmWindowRole(role); + else + window->setProperty(wm_window_role_property_id, role); +} + uint QXcbWindow::visualIdStatic(QWindow *window) { if (window && window->handle()) @@ -1898,6 +1912,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 4673f3dd33..b8bcf4428a 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -145,10 +145,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/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 1926611442..6729969024 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1473,6 +1473,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) { @@ -6329,13 +6332,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()); } /*! -- cgit v1.2.3 From 3b3780748ba76ddee447d06bc6e7a5f753ee6f42 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 19 Aug 2016 12:59:09 +0200 Subject: QXpmHandler: remove 657 unneeded relocations Same change as in QColor (d38f86e50b01c6dd60f5a97355031e08d6a47d18), but much more dramatic effect, due to 5x more elements in the array: relocs: -657 text: -3416B data: -10528B (optimized GCC 6.1 Linux AMD64 build) Change-Id: Ia266ab68f2d309743374ac2034a69f58bf556adf Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/image/qxpmhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index fbce78eb74..b673ae5b33 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -74,7 +74,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" }, -- cgit v1.2.3 From 477aab08d387287a7fbcad70df0c210a6a91d257 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 19 Aug 2016 12:59:09 +0200 Subject: QCssParser: remove 239 unneeded relocations Same change as in QColor (d38f86e50b01c6dd60f5a97355031e08d6a47d18). relocs: -239 text: +2248B data: -3872B (optimized GCC 6.1 Linux AMD64 build). The text size increase means we pushed the data into an immutable section. Change-Id: Iad10c877d4a4877878dded56a7ef1e14ff92c996 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/text/qcssparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index adbb3df3bf..65b468ece4 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -54,7 +54,7 @@ using namespace QCss; struct QCssKnownValue { - const char *name; + const char name[28]; quint64 id; }; -- cgit v1.2.3 From 661b10649a56ca5c5b88164de85de29d45d8dda9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 19 Aug 2016 12:59:09 +0200 Subject: QStyleSheetStyle: remove 167 unneeded relocations Same change as in QColor (d38f86e50b01c6dd60f5a97355031e08d6a47d18). relocs: -167 text: +1296B data: -1984B (optimized GCC 6.1 Linux AMD64 build). The text size increase means we pushed the data into an immutable section. Change-Id: I0ff433714dc23350d1e19893a2e27ff4a0d2ec25 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/styles/qstylesheetstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index d3f667748e..cb3c2a410b 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -204,7 +204,7 @@ enum PseudoElement { struct PseudoElementInfo { QStyle::SubControl subControl; - const char *name; + const char name[19]; }; static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = { @@ -589,7 +589,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", -- cgit v1.2.3 From 881bda9e6ecdd8729edf7df68f94f72f5d7c9042 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 19 Aug 2016 12:59:09 +0200 Subject: QTextHtmlParser: remove 317 unneeded relocations Same change as in QColor (d38f86e50b01c6dd60f5a97355031e08d6a47d18). relocs: -317 text: -6480B data: -5088B (optimized GCC 6.1 Linux AMD64 build) Change-Id: I647cd327b421caad45a19a14955de9e3aefaefab Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/text/qtexthtmlparser.cpp | 3 ++- src/gui/text/qtexthtmlparser_p.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 77da01be3f..9c758bee60 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -54,7 +54,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 }, @@ -314,6 +314,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 460e32d5bb..85769c3779 100644 --- a/src/gui/text/qtexthtmlparser_p.h +++ b/src/gui/text/qtexthtmlparser_p.h @@ -138,7 +138,7 @@ enum QTextHTMLElements { struct QTextHtmlElement { - const char *name; + const char name[11]; QTextHTMLElements id; enum DisplayMode { DisplayBlock, DisplayInline, DisplayTable, DisplayNone } displayMode; }; -- cgit v1.2.3