From 1f0c22844811d71fae69ee6b103bbfc5e750ca90 Mon Sep 17 00:00:00 2001 From: Dominik Haumann Date: Mon, 29 Jan 2018 19:38:49 +0100 Subject: [PATCH 01/11] Fix window activation in QWindowsWindow::setCustomMargins() Currently, code paths that call QWindowsWindow:setCustomMargins() automatically also activate the window (=give the window focus). The reason for this is the call of SetWindowPos (Windows API) without the flag SWP_NOACTIVATE. From the Windows API documentation about SetWindowPos() about the flag SWP_NOACTIVATE: Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter). It seems the flag SWP_NOACTIVATE is accidentally missing in the call of SetWindowPos() in setCustomMargins(), especially since the flag is present in pretty much all other calls of SetWindowPos(). The obvious fix is to add the flag SWP_NOACTIVATE to the call of SetWindowPos() in setCustomMargins(). So far, this issue exists for a long time, an was possibly introduced with commit f5fd5346038, where setCustomMargins() was initially added. Change-Id: Id3f058f8762df17eb3f033ab0b3e1791283937fc Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 402009c70d..c1aeecf0ab 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2401,7 +2401,7 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins) newFrame.moveTo(topLeft); qCDebug(lcQpaWindows) << __FUNCTION__ << oldCustomMargins << "->" << newCustomMargins << currentFrameGeometry << "->" << newFrame; - SetWindowPos(m_data.hwnd, 0, newFrame.x(), newFrame.y(), newFrame.width(), newFrame.height(), SWP_NOZORDER | SWP_FRAMECHANGED); + SetWindowPos(m_data.hwnd, 0, newFrame.x(), newFrame.y(), newFrame.width(), newFrame.height(), SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE); } } From b7e436738756b1d5d7a45201b7a7204d7fe128a1 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Mon, 22 Jan 2018 18:51:57 +0200 Subject: [PATCH 02/11] Fix some cases of scaled text disappearing with freetype Commit a56ee60791538e5442b3d97b75270b25dc4986db changed type of advance to short, restoring this fixes at least some cases where glyphs were disappearing. Task-number: QTBUG-65838 Change-Id: I33b252d91fb7541eaea3275b1950a048941869a6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp | 4 +--- src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 2c5850b6ad..3f543755b6 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -994,9 +994,7 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, static inline bool areMetricsTooLarge(const QFontEngineFT::GlyphInfo &info) { // false if exceeds QFontEngineFT::Glyph metrics - return (short)(info.linearAdvance) != info.linearAdvance - || (uchar)(info.width) != info.width - || (uchar)(info.height) != info.height; + return info.width > 0xFF || info.height > 0xFF; } static inline void transformBoundingBox(int *left, int *top, int *right, int *bottom, FT_Matrix *matrix) diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h index c063f5df30..e98268ae4b 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h @@ -133,7 +133,7 @@ public: /* we don't cache glyphs that are too large anyway, so we can make this struct rather small */ struct Glyph { ~Glyph(); - short linearAdvance; + int linearAdvance : 22; unsigned char width; unsigned char height; short x; From 1514b4e85336245ef130deca5839267dba7b2e32 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jan 2018 21:46:40 -0800 Subject: [PATCH 03/11] Silence GCC 8 warning on memcpy of class Value to to class offset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From GCC 8: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of type ‘QJsonPrivate::offset’ {aka ‘class QSpecialInteger >’} with ‘private’ member ‘QSpecialInteger >::val’ from an array of ‘const value_type’ {aka ‘const class QJsonPrivate::Value’}; use assignment or copy-initialization instead [-Werror=class-memaccess] Both types are standard layout and have the same initial sequence (one uint member), so this is a valid copy. The only difference between the two is that QSpecialInteger has a private member, whereas in the bitfield it's public. Change-Id: I41d006aac5bc48529845fffd150e80585fd24db7 Reviewed-by: Ville Voutilainen Reviewed-by: Thiago Macieira --- src/corelib/json/qjsonarray.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp index d4cc4b81df..255dc2ee4e 100644 --- a/src/corelib/json/qjsonarray.cpp +++ b/src/corelib/json/qjsonarray.cpp @@ -297,7 +297,8 @@ QJsonArray QJsonArray::fromVariantList(const QVariantList &list) array.a->tableOffset = currentOffset; if (!array.detach2(sizeof(QJsonPrivate::offset)*values.size())) return QJsonArray(); - memcpy(array.a->table(), values.constData(), values.size()*sizeof(uint)); + memcpy(static_cast(array.a->table()), + static_cast(values.constData()), values.size()*sizeof(uint)); array.a->length = values.size(); array.a->size = currentOffset + sizeof(QJsonPrivate::offset)*values.size(); From c26c5b7d0dc4607b7cdd5569c5180b94b4563b73 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jan 2018 21:46:40 -0800 Subject: [PATCH 04/11] Silence GCC 8 warning on memcpy of movable types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is similar to commit 342bb5b03a76d1428fafb8e1532d66e172bd1c0b. From GCC 8: qarraydataops.h:84:17: error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class QStringRef’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] [etc.] Change-Id: I41d006aac5bc48529845fffd150e817e64973bec Reviewed-by: Ville Voutilainen Reviewed-by: Thiago Macieira --- src/corelib/tools/qarraydataops.h | 3 ++- src/corelib/tools/qvarlengtharray.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index b7c3bc1287..d0f83d2b6a 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -76,7 +76,8 @@ struct QPodArrayOps Q_ASSERT(b < e); Q_ASSERT(size_t(e - b) <= this->alloc - uint(this->size)); - ::memcpy(this->end(), b, (e - b) * sizeof(T)); + ::memcpy(static_cast(this->end()), static_cast(b), + (e - b) * sizeof(T)); this->size += e - b; } diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index d99eebd4b9..58bb5e75c4 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -344,7 +344,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray::append(const T *abuf, in while (s < asize) new (ptr+(s++)) T(*abuf++); } else { - memcpy(&ptr[s], abuf, increment * sizeof(T)); + memcpy(static_cast(&ptr[s]), static_cast(abuf), increment * sizeof(T)); s = asize; } } @@ -392,7 +392,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray::realloc(int asize, int a QT_RETHROW; } } else { - memcpy(ptr, oldPtr, copySize * sizeof(T)); + memcpy(static_cast(ptr), static_cast(oldPtr), copySize * sizeof(T)); } } s = copySize; From 403343039d07812c0beee9260b291f86e14d8ac4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 29 Jan 2018 22:00:46 -0800 Subject: [PATCH 05/11] Suppress GCC 8 warning about realloc() non-trivially-copyable types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit But they are movable. qxmlstream_p.h:654:32: error: ‘void* realloc(void*, size_t)’ moving an object of non-trivially copyable type ‘struct QXmlStreamPrivateTagStack::Tag’; use ‘new’ and ‘delete’ instead [-Werror=class-memaccess] Change-Id: I41d006aac5bc48529845fffd150e8115eb852034 Reviewed-by: Ville Voutilainen Reviewed-by: Thiago Macieira --- src/corelib/xml/qxmlstream_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 9ef95c1fbe..e6c89e40cd 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -651,7 +651,8 @@ public: inline void reserve(int extraCapacity) { if (tos + extraCapacity + 1 > cap) { cap = qMax(tos + extraCapacity + 1, cap << 1 ); - data = reinterpret_cast(realloc(data, cap * sizeof(T))); + void *ptr = realloc(static_cast(data), cap * sizeof(T)); + data = reinterpret_cast(ptr); Q_CHECK_PTR(data); } } From 756ebcd93a028bd9c731acddbea09de67c2410e3 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Feb 2018 14:37:32 +0100 Subject: [PATCH 06/11] QGtk3Menu::showPopup(): fix off by one error in the y-coordinate QRect::bottom() != QRect::y() + QRect::height() Change-Id: I83ae19ab588fb9651354999679f5d3c9e294a97e Reviewed-by: Friedemann Kleint --- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index f48e00ab8e..99407a21de 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -448,7 +448,8 @@ void QGtk3Menu::showPopup(const QWindow *parentWindow, const QRect &targetRect, if (index != -1) gtk_menu_set_active(GTK_MENU(m_menu), index); - m_targetPos = targetRect.bottomLeft(); + m_targetPos = QPoint(targetRect.x(), targetRect.y() + targetRect.height()); + if (parentWindow) m_targetPos = parentWindow->mapToGlobal(m_targetPos); From 57f4521c99df1e4e2c1fd321a41019ae4e0c17b1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 2 Feb 2018 08:06:04 +0100 Subject: [PATCH 07/11] Fix QXcbWindow::mapFrom/ToGlobal() Call the base class implementations to avoid returning an unmapped values for non-embedded windows. Task-number: QTBUG-55251 Change-Id: Ib05fd530498dd4d72d3d4ef37caf4e2f0ebcd2e4 Reviewed-by: Friedemann Kleint Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c4649ac818..37d6336a72 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2157,7 +2157,7 @@ bool QXcbWindow::isEmbedded() const QPoint QXcbWindow::mapToGlobal(const QPoint &pos) const { if (!m_embedded) - return pos; + return QPlatformWindow::mapToGlobal(pos); QPoint ret; xcb_translate_coordinates_cookie_t cookie = @@ -2177,7 +2177,7 @@ QPoint QXcbWindow::mapToGlobal(const QPoint &pos) const QPoint QXcbWindow::mapFromGlobal(const QPoint &pos) const { if (!m_embedded) - return pos; + return QPlatformWindow::mapFromGlobal(pos); QPoint ret; xcb_translate_coordinates_cookie_t cookie = From 1ffc6ba402114a3443df5309dec186fd337e5b66 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 2 Feb 2018 08:50:15 +0100 Subject: [PATCH 08/11] macOS: fix menu positioning on high-DPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The target position is passed in physical native pixels, so call QPlatformScreen::availableGeometry() and QPlatformWindow::mapToGlobal() instead of QScreen::availableSize() and QWindow::mapToGlobal(). The latter two operate on logical pixels. Task-number: QTBUG-55251 Change-Id: I281f47baee727bc0f4738fd6d6cdf12c9f462b0f Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoamenu.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 8bdd0512de..e41c70b8ca 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -46,6 +46,7 @@ #include #include #include "qcocoaapplication.h" +#include "qcocoaintegration.h" #include "qcocoamenuloader.h" #include "qcocoamenubar.h" #include "qcocoawindow.h" @@ -573,8 +574,9 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, [popupCell setMenu:m_nativeMenu]; [popupCell selectItem:nsItem]; - int availableHeight = screen->availableSize().height(); - const QPoint &globalPos = parentWindow->mapToGlobal(pos); + QCocoaScreen *cocoaScreen = static_cast(screen->handle()); + int availableHeight = cocoaScreen->availableGeometry().height(); + const QPoint &globalPos = cocoaWindow->mapToGlobal(pos); int menuHeight = m_nativeMenu.size.height; if (globalPos.y() + menuHeight > availableHeight) { // Maybe we need to fix the vertical popup position but we don't know the From 1cc15c4b6d65a22ab4018226a96baf843feb1f00 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 2 Feb 2018 10:00:27 +0100 Subject: [PATCH 09/11] QComboBoxPrivate::showNativePopup(): Scale target rectangle The QPlatform* classes operate in native pixels. Task-number: QTBUG-55251 Change-Id: I80490fa802fbc77a1e02c176528cc047630f9a7d Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qcombobox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index e0bc198d2e..7ab3565a00 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -2550,7 +2551,8 @@ bool QComboBoxPrivate::showNativePopup() else if (q->testAttribute(Qt::WA_MacMiniSize)) offset = QPoint(-2, 6); - m_platformMenu->showPopup(tlw, QRect(tlw->mapFromGlobal(q->mapToGlobal(offset)), QSize()), currentItem); + const QRect targetRect = QRect(tlw->mapFromGlobal(q->mapToGlobal(offset)), QSize()); + m_platformMenu->showPopup(tlw, QHighDpi::toNativePixels(targetRect, tlw), currentItem); #ifdef Q_OS_OSX // The Cocoa popup will swallow any mouse release event. From 0307bfea31782512939aa4f97425b57cf35c080c Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Mon, 29 Jan 2018 14:54:19 +0100 Subject: [PATCH 10/11] ANGLE: Remove workaround for files having the same name (Debug.h/.cpp) With object_parallel_to_source the workaround of making copies of the files and using these is no longer needed. Debug2.h and .cpp were added to the repository by mistake and should not have been there in the first place. Task-number: QTBUG-66059 Change-Id: Ib9dbd15be1dee1cb5190762fe06bad56dd40dd47 Reviewed-by: Joerg Bornemann --- src/3rdparty/angle/src/libANGLE/Debug2.cpp | 303 --------------------- src/3rdparty/angle/src/libANGLE/Debug2.h | 120 -------- src/angle/src/common/gles_common.pri | 12 +- 3 files changed, 3 insertions(+), 432 deletions(-) delete mode 100644 src/3rdparty/angle/src/libANGLE/Debug2.cpp delete mode 100644 src/3rdparty/angle/src/libANGLE/Debug2.h diff --git a/src/3rdparty/angle/src/libANGLE/Debug2.cpp b/src/3rdparty/angle/src/libANGLE/Debug2.cpp deleted file mode 100644 index 30321f4160..0000000000 --- a/src/3rdparty/angle/src/libANGLE/Debug2.cpp +++ /dev/null @@ -1,303 +0,0 @@ -// -// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// - -// Debug.cpp: Defines debug state used for GL_KHR_debug - -#include "libANGLE/Debug.h" - -#include "common/debug.h" - -#include -#include - -namespace gl -{ - -Debug::Debug() - : mOutputEnabled(false), - mCallbackFunction(nullptr), - mCallbackUserParam(nullptr), - mMessages(), - mMaxLoggedMessages(0), - mOutputSynchronous(false), - mGroups() -{ - pushDefaultGroup(); -} - -void Debug::setMaxLoggedMessages(GLuint maxLoggedMessages) -{ - mMaxLoggedMessages = maxLoggedMessages; -} - -void Debug::setOutputEnabled(bool enabled) -{ - mOutputEnabled = enabled; -} - -bool Debug::isOutputEnabled() const -{ - return mOutputEnabled; -} - -void Debug::setOutputSynchronous(bool synchronous) -{ - mOutputSynchronous = synchronous; -} - -bool Debug::isOutputSynchronous() const -{ - return mOutputSynchronous; -} - -void Debug::setCallback(GLDEBUGPROCKHR callback, const void *userParam) -{ - mCallbackFunction = callback; - mCallbackUserParam = userParam; -} - -GLDEBUGPROCKHR Debug::getCallback() const -{ - return mCallbackFunction; -} - -const void *Debug::getUserParam() const -{ - return mCallbackUserParam; -} - -void Debug::insertMessage(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - const std::string &message) -{ - std::string messageCopy(message); - insertMessage(source, type, id, severity, std::move(messageCopy)); -} - -void Debug::insertMessage(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - std::string &&message) -{ - if (!isMessageEnabled(source, type, id, severity)) - { - return; - } - - if (mCallbackFunction != nullptr) - { - // TODO(geofflang) Check the synchronous flag and potentially flush messages from another - // thread. - mCallbackFunction(source, type, id, severity, static_cast(message.length()), - message.c_str(), mCallbackUserParam); - } - else - { - if (mMessages.size() >= mMaxLoggedMessages) - { - // Drop messages over the limit - return; - } - - Message m; - m.source = source; - m.type = type; - m.id = id; - m.severity = severity; - m.message = std::move(message); - - mMessages.push_back(std::move(m)); - } -} - -size_t Debug::getMessages(GLuint count, - GLsizei bufSize, - GLenum *sources, - GLenum *types, - GLuint *ids, - GLenum *severities, - GLsizei *lengths, - GLchar *messageLog) -{ - size_t messageCount = 0; - size_t messageStringIndex = 0; - while (messageCount <= count && !mMessages.empty()) - { - const Message &m = mMessages.front(); - - if (messageLog != nullptr) - { - // Check that this message can fit in the message buffer - if (messageStringIndex + m.message.length() + 1 > static_cast(bufSize)) - { - break; - } - - std::copy(m.message.begin(), m.message.end(), messageLog + messageStringIndex); - messageStringIndex += m.message.length(); - - messageLog[messageStringIndex] = '\0'; - messageStringIndex += 1; - } - - if (sources != nullptr) - { - sources[messageCount] = m.source; - } - - if (types != nullptr) - { - types[messageCount] = m.type; - } - - if (ids != nullptr) - { - ids[messageCount] = m.id; - } - - if (severities != nullptr) - { - severities[messageCount] = m.severity; - } - - if (lengths != nullptr) - { - lengths[messageCount] = static_cast(m.message.length()); - } - - mMessages.pop_front(); - - messageCount++; - } - - return messageCount; -} - -size_t Debug::getNextMessageLength() const -{ - return mMessages.empty() ? 0 : mMessages.front().message.length(); -} - -size_t Debug::getMessageCount() const -{ - return mMessages.size(); -} - -void Debug::setMessageControl(GLenum source, - GLenum type, - GLenum severity, - std::vector &&ids, - bool enabled) -{ - Control c; - c.source = source; - c.type = type; - c.severity = severity; - c.ids = std::move(ids); - c.enabled = enabled; - - auto &controls = mGroups.back().controls; - controls.push_back(std::move(c)); -} - -void Debug::pushGroup(GLenum source, GLuint id, std::string &&message) -{ - insertMessage(source, GL_DEBUG_TYPE_PUSH_GROUP, id, GL_DEBUG_SEVERITY_NOTIFICATION, - std::string(message)); - - Group g; - g.source = source; - g.id = id; - g.message = std::move(message); - mGroups.push_back(std::move(g)); -} - -void Debug::popGroup() -{ - // Make sure the default group is not about to be popped - ASSERT(mGroups.size() > 1); - - Group g = mGroups.back(); - mGroups.pop_back(); - - insertMessage(g.source, GL_DEBUG_TYPE_POP_GROUP, g.id, GL_DEBUG_SEVERITY_NOTIFICATION, - g.message); -} - -size_t Debug::getGroupStackDepth() const -{ - return mGroups.size(); -} - -bool Debug::isMessageEnabled(GLenum source, GLenum type, GLuint id, GLenum severity) const -{ - if (!mOutputEnabled) - { - return false; - } - - for (auto groupIter = mGroups.rbegin(); groupIter != mGroups.rend(); groupIter++) - { - const auto &controls = groupIter->controls; - for (auto controlIter = controls.rbegin(); controlIter != controls.rend(); controlIter++) - { - const auto &control = *controlIter; - - if (control.source != GL_DONT_CARE && control.source != source) - { - continue; - } - - if (control.type != GL_DONT_CARE && control.type != type) - { - continue; - } - - if (control.severity != GL_DONT_CARE && control.severity != severity) - { - continue; - } - - if (!control.ids.empty() && - std::find(control.ids.begin(), control.ids.end(), id) == control.ids.end()) - { - continue; - } - - return control.enabled; - } - } - - return true; -} - -void Debug::pushDefaultGroup() -{ - Group g; - g.source = GL_NONE; - g.id = 0; - g.message = ""; - - Control c0; - c0.source = GL_DONT_CARE; - c0.type = GL_DONT_CARE; - c0.severity = GL_DONT_CARE; - c0.enabled = true; - g.controls.push_back(std::move(c0)); - - Control c1; - c1.source = GL_DONT_CARE; - c1.type = GL_DONT_CARE; - c1.severity = GL_DEBUG_SEVERITY_LOW; - c1.enabled = false; - g.controls.push_back(std::move(c1)); - - mGroups.push_back(std::move(g)); -} -} // namespace gl diff --git a/src/3rdparty/angle/src/libANGLE/Debug2.h b/src/3rdparty/angle/src/libANGLE/Debug2.h deleted file mode 100644 index f545b815e4..0000000000 --- a/src/3rdparty/angle/src/libANGLE/Debug2.h +++ /dev/null @@ -1,120 +0,0 @@ -// -// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// - -// Debug.h: Defines debug state used for GL_KHR_debug - -#ifndef LIBANGLE_DEBUG_H_ -#define LIBANGLE_DEBUG_H_ - -#include "angle_gl.h" -#include "common/angleutils.h" - -#include -#include -#include - -namespace gl -{ - -class LabeledObject -{ - public: - virtual ~LabeledObject() {} - virtual void setLabel(const std::string &label) = 0; - virtual const std::string &getLabel() const = 0; -}; - -class Debug : angle::NonCopyable -{ - public: - Debug(); - - void setMaxLoggedMessages(GLuint maxLoggedMessages); - - void setOutputEnabled(bool enabled); - bool isOutputEnabled() const; - - void setOutputSynchronous(bool synchronous); - bool isOutputSynchronous() const; - - void setCallback(GLDEBUGPROCKHR callback, const void *userParam); - GLDEBUGPROCKHR getCallback() const; - const void *getUserParam() const; - - void insertMessage(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - const std::string &message); - void insertMessage(GLenum source, - GLenum type, - GLuint id, - GLenum severity, - std::string &&message); - - void setMessageControl(GLenum source, - GLenum type, - GLenum severity, - std::vector &&ids, - bool enabled); - size_t getMessages(GLuint count, - GLsizei bufSize, - GLenum *sources, - GLenum *types, - GLuint *ids, - GLenum *severities, - GLsizei *lengths, - GLchar *messageLog); - size_t getNextMessageLength() const; - size_t getMessageCount() const; - - void pushGroup(GLenum source, GLuint id, std::string &&message); - void popGroup(); - size_t getGroupStackDepth() const; - - private: - bool isMessageEnabled(GLenum source, GLenum type, GLuint id, GLenum severity) const; - - void pushDefaultGroup(); - - struct Message - { - GLenum source; - GLenum type; - GLuint id; - GLenum severity; - std::string message; - }; - - struct Control - { - GLenum source; - GLenum type; - GLenum severity; - std::vector ids; - bool enabled; - }; - - struct Group - { - GLenum source; - GLuint id; - std::string message; - - std::vector controls; - }; - - bool mOutputEnabled; - GLDEBUGPROCKHR mCallbackFunction; - const void *mCallbackUserParam; - std::deque mMessages; - GLuint mMaxLoggedMessages; - bool mOutputSynchronous; - std::vector mGroups; -}; -} // namespace gl - -#endif // LIBANGLE_DEBUG_H_ diff --git a/src/angle/src/common/gles_common.pri b/src/angle/src/common/gles_common.pri index 5d5682a1df..82d38a62e6 100644 --- a/src/angle/src/common/gles_common.pri +++ b/src/angle/src/common/gles_common.pri @@ -1,4 +1,4 @@ -CONFIG += simd no_batch +CONFIG += simd no_batch object_parallel_to_source include(common.pri) INCLUDEPATH += $$OUT_PWD/.. $$ANGLE_DIR/src/libANGLE @@ -48,6 +48,7 @@ HEADERS += \ $$ANGLE_DIR/src/libANGLE/Constants.h \ $$ANGLE_DIR/src/libANGLE/Context.h \ $$ANGLE_DIR/src/libANGLE/Data.h \ + $$ANGLE_DIR/src/libANGLE/Debug.h \ $$ANGLE_DIR/src/libANGLE/Device.h \ $$ANGLE_DIR/src/libANGLE/Display.h \ $$ANGLE_DIR/src/libANGLE/Error.h \ @@ -169,6 +170,7 @@ SOURCES += \ $$ANGLE_DIR/src/libANGLE/Config.cpp \ $$ANGLE_DIR/src/libANGLE/Context.cpp \ $$ANGLE_DIR/src/libANGLE/Data.cpp \ + $$ANGLE_DIR/src/libANGLE/Debug.cpp \ $$ANGLE_DIR/src/libANGLE/Device.cpp \ $$ANGLE_DIR/src/libANGLE/Display.cpp \ $$ANGLE_DIR/src/libANGLE/Error.cpp \ @@ -241,14 +243,6 @@ SOURCES += \ SSE2_SOURCES += $$ANGLE_DIR/src/libANGLE/renderer/d3d/loadimageSSE2.cpp -DEBUG_SOURCE = $$ANGLE_DIR/src/libANGLE/Debug.cpp -debug_copy.input = DEBUG_SOURCE -debug_copy.output = $$ANGLE_DIR/src/libANGLE/Debug2.cpp -debug_copy.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} -debug_copy.variable_out = GENERATED_SOURCES -debug_copy.CONFIG = target_predeps -QMAKE_EXTRA_COMPILERS += debug_copy - angle_d3d11 { HEADERS += \ $$ANGLE_DIR/src/libANGLE/renderer/d3d/d3d11/Blit11.h \ From fef6b31b994befac0ee14391572ebc2b9b33e104 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Feb 2018 14:40:46 +0100 Subject: [PATCH 11/11] GTK: fix menu positioning on high-DPI The target position is passed in physical native pixels, so call QPlatformWindow::mapToGlobal() instead of QWindow::mapToGlobal(). The latter operates on logical pixels. Task-number: QTBUG-55251 Change-Id: I789128a0a345d4113fced82ed1b215fe14044634 Reviewed-by: Friedemann Kleint --- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 99407a21de..cdd1abaf7d 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -41,6 +41,7 @@ #include #include +#include #undef signals #include @@ -450,8 +451,9 @@ void QGtk3Menu::showPopup(const QWindow *parentWindow, const QRect &targetRect, m_targetPos = QPoint(targetRect.x(), targetRect.y() + targetRect.height()); - if (parentWindow) - m_targetPos = parentWindow->mapToGlobal(m_targetPos); + QPlatformWindow *pw = parentWindow ? parentWindow->handle() : nullptr; + if (pw) + m_targetPos = pw->mapToGlobal(m_targetPos); gtk_menu_popup(GTK_MENU(m_menu), NULL, NULL, qt_gtk_menu_position_func, this, 0, gtk_get_current_event_time()); }