From 4d670c5747618e056f22da5fc03e51fc01d5ad12 Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Thu, 13 Dec 2012 14:53:46 +0100 Subject: More explicit QCocoaAccessibleElement memory mngmt Don't autorelease in the elementWithInterface function, rename it to createElementWithInterface. The element can then be released immediately or autoreleased ("delete later"). Change-Id: I155a85404c34d756c1752eb7c24a7fb0f3cf2e77 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/cocoa/qcocoaaccessibility.mm | 3 ++- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h | 2 +- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 12 ++++++++---- src/plugins/platforms/cocoa/qnsviewaccessibility.mm | 7 +++++-- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index e643f22793..0587da706a 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -71,7 +71,8 @@ void QCococaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) case QAccessible::TextInserted : case QAccessible::TextRemoved : case QAccessible::TextUpdated : { - QCocoaAccessibleElement *element = [QCocoaAccessibleElement elementWithInterface : interface parent : nil]; + QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithInterface : interface parent : nil]; + [element autorelease]; NSAccessibilityPostNotification(element, NSAccessibilityValueChangedNotification); break; } diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h index fce72da98f..eb810522d7 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h @@ -56,7 +56,7 @@ } - (id)initWithInterface:(void *)anQAccessibleInterface parent:(id)aParent; -+ (QCocoaAccessibleElement *)elementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent; ++ (QCocoaAccessibleElement *)createElementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent; @end diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index d5841c1983..7c9ae963f6 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -68,9 +68,9 @@ static QAccessibleInterface *acast(void *ptr) return self; } -+ (QCocoaAccessibleElement *)elementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent ++ (QCocoaAccessibleElement *)createElementWithInterface:(void *)anQAccessibleInterface parent:(id)aParent { - return [[[self alloc] initWithInterface:anQAccessibleInterface parent:aParent] autorelease]; + return [[self alloc] initWithInterface:anQAccessibleInterface parent:aParent]; } - (void)dealloc { @@ -136,7 +136,9 @@ static QAccessibleInterface *acast(void *ptr) NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; for (int i = 0; i < numKids; ++i) { QAccessibleInterface *childInterface = acast(accessibleInterface)->child(i); - [kids addObject:[QCocoaAccessibleElement elementWithInterface:(void*)childInterface parent:self]]; + QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithInterface:(void*)childInterface parent:self]; + [kids addObject: element]; + [element release]; } return kids; @@ -251,7 +253,9 @@ static QAccessibleInterface *acast(void *ptr) } // hit a child, forward to child accessible interface. - QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithInterface:childInterface parent:self]; + QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement createElementWithInterface:childInterface parent:self]; + [accessibleElement autorelease]; + return [accessibleElement accessibilityHitTest:point]; } diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index da714d3326..9b94abf115 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -77,7 +77,9 @@ int numKids = m_accessibleRoot->childCount(); NSMutableArray *kids = [NSMutableArray arrayWithCapacity:numKids]; for (int i = 0; i < numKids; ++i) { - [kids addObject:[QCocoaAccessibleElement elementWithInterface: m_accessibleRoot->child(i) parent:self ]]; + QCocoaAccessibleElement *element = [QCocoaAccessibleElement createElementWithInterface: m_accessibleRoot->child(i) parent:self ]; + [kids addObject: element]; + [element release]; } return kids; @@ -98,7 +100,8 @@ // Hit a child, forward to child accessible interface. - QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithInterface: childInterface parent:self ]; + QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement createElementWithInterface: childInterface parent:self ]; + [accessibleElement autorelease]; return [accessibleElement accessibilityHitTest:point]; } -- cgit v1.2.3 From ffd912a51d2230a0d9d40b271a7e7f94f93b5e4e Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Mon, 12 Nov 2012 11:36:09 +0100 Subject: fix linuxfb crash on program start the KDGETMODE ioctl should use a pointer to int as param, not a pointer to pointer to int, otherwise it may crash Change-Id: Ie255d240f3b6ca1ff5398f972308116135374ae3 Reviewed-by: Sergio Ahumada --- src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp index 1dac60a745..4d170f15f2 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp @@ -264,7 +264,7 @@ static int openTtyDevice(const QString &device) static bool switchToGraphicsMode(int ttyfd, int *oldMode) { - ioctl(ttyfd, KDGETMODE, &oldMode); + ioctl(ttyfd, KDGETMODE, oldMode); if (*oldMode != KD_GRAPHICS) { if (ioctl(ttyfd, KDSETMODE, KD_GRAPHICS) != 0) return false; -- cgit v1.2.3 From c95b0982d5466069de3ac491ce3cbf9337060e3d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 10 Jan 2013 15:33:51 +0100 Subject: Clear backingstore for windows with alpha channel. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes painting artifacts in translucent windows. Task-number: QTBUG-28531 Change-Id: I00a7a86f88a40d356fa3e37bd497a288b2118469 Reviewed-by: Samuel Rødal --- src/plugins/platforms/windows/qwindowsbackingstore.cpp | 16 +++++++++++++--- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 2 -- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index b7937b4d84..5d3822d2cd 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -45,6 +45,7 @@ #include "qwindowscontext.h" #include +#include #include @@ -147,8 +148,10 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) nsp << " from: " << m_image->image().size(); } #endif - m_image.reset(new QWindowsNativeImage(size.width(), size.height(), - QWindowsNativeImage::systemFormat())); + QImage::Format format = QWindowsNativeImage::systemFormat(); + if (format == QImage::Format_RGB32 && rasterWindow()->window()->format().hasAlpha()) + format = QImage::Format_ARGB32; + m_image.reset(new QWindowsNativeImage(size.width(), size.height(), format)); } } @@ -168,9 +171,16 @@ bool QWindowsBackingStore::scroll(const QRegion &area, int dx, int dy) void QWindowsBackingStore::beginPaint(const QRegion ®ion) { - Q_UNUSED(region); if (QWindowsContext::verboseBackingStore > 1) qDebug() << __FUNCTION__; + + if (m_image->image().hasAlphaChannel()) { + QPainter p(&m_image->image()); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QColor blank = Qt::transparent; + foreach (const QRect &r, region.rects()) + p.fillRect(r, blank); + } } QWindowsWindow *QWindowsBackingStore::rasterWindow() const diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 649469ab9d..42abf046a9 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -272,7 +272,6 @@ void QXcbBackingStore::beginPaint(const QRegion ®ion) m_image->preparePaint(region); -#if 0 if (m_image->image()->hasAlphaChannel()) { QPainter p(m_image->image()); p.setCompositionMode(QPainter::CompositionMode_Source); @@ -282,7 +281,6 @@ void QXcbBackingStore::beginPaint(const QRegion ®ion) p.fillRect(*it, blank); } } -#endif } void QXcbBackingStore::endPaint(const QRegion &) -- cgit v1.2.3 From d5257644302e349fec8df5750d100fd4918ddd6b Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 14 Jan 2013 11:29:39 +0000 Subject: QNX: Make QWidget::hide() work immediately. Change-Id: I3ea2556769703a8cd4c2931cc2332ab0733fbea6 Reviewed-by: Sean Harmer Reviewed-by: Kevin Krammer Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxwindow.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index af7a89a399..2cee666e23 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -271,8 +271,14 @@ void QQnxWindow::setVisible(bool visible) window()->requestActivate(); - if (window()->isTopLevel() && visible) - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + if (window()->isTopLevel()) { + if (visible) { + QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + } else { + // Flush the context, otherwise it won't disappear immediately + screen_flush_context(m_screenContext, 0); + } + } } void QQnxWindow::updateVisibility(bool parentVisible) -- cgit v1.2.3 From 856f209fb63ae336bfb389a12d2a75fa886dc1c5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 21 Dec 2012 10:07:53 -0800 Subject: Change all shmget calls to user-only memory Drop the read and write permissions for group and other users in the system. Change-Id: I8fc753f09126651af3fb82df3049050f0b14e876 Reviewed-by: Richard J. Moore --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 649469ab9d..e2e0bff94c 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -107,7 +107,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI if (!segmentSize) return; - int id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT | 0777); + int id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT | 0600); if (id == -1) qWarning("QXcbShmImage: shmget() failed (%d) for size %d (%dx%d)", errno, segmentSize, size.width(), size.height()); -- cgit v1.2.3 From d2e64c47ce63607e7c4159ad9fb6a31e6652f8b8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 14 Jan 2013 15:53:59 +0100 Subject: XCB: Force XSync after creating Window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure that dpy->request == dpy->last_request_read after setting up a new window. If we don't do this, last_request_read might never be updated until the difference hits a limit that can lead to hangs in the application (see e.g. QTCREATORBUG-8373). Task-number: QTBUG-29106 Change-Id: I390493ca6f966dc105d3ea3a2c48abec01177bc2 Reviewed-by: Uli Schlachter Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbwindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 528c4c6580..01f4d6d231 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -382,6 +382,11 @@ void QXcbWindow::create() if (window()->flags() & Qt::WindowTransparentForInput) setTransparentForMouseEvents(true); +#ifdef XCB_USE_XLIB + // force sync to read outstanding requests - see QTBUG-29106 + XSync(DISPLAY_FROM_XCB(m_screen), false); +#endif + #ifndef QT_NO_DRAGANDDROP connection()->drag()->dndEnable(this, true); #endif -- cgit v1.2.3 From cd7ba89a07f794b17fc66ba29515b104c4d21f27 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 14 Jan 2013 15:42:33 +0100 Subject: Windows: Force toplevel flag in setParent() in both cases. When re-applying window flags in setParent, force top level on or off according to state. Task-number: QTBUG-28872 Change-Id: If931fcb38394f472a6cdf260aa935c1d03779611 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 3831c6b10e..9360ba6460 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -267,7 +267,7 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, qreal level) struct WindowCreationData { typedef QWindowsWindow::WindowData WindowData; - enum Flags { ForceChild = 0x1 }; + enum Flags { ForceChild = 0x1, ForceTopLevel = 0x2 }; WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0), topLevel(false), popup(false), dialog(false), desktop(false), @@ -319,7 +319,13 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag parentHandle = (HWND)prop.value(); } - topLevel = ((creationFlags & ForceChild) || embedded) ? false : w->isTopLevel(); + if (creationFlags & ForceChild) { + topLevel = false; + } else if (creationFlags & ForceTopLevel) { + topLevel = true; + } else { + topLevel = w->isTopLevel(); + } if (topLevel && flags == 1) { flags |= Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint @@ -984,10 +990,9 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const // WS_CHILD/WS_POPUP must be manually set/cleared in addition // to dialog frames, etc (see SetParent() ) if the top level state changes. - if (wasTopLevel != isTopLevel) { - const unsigned flags = isTopLevel ? unsigned(0) : unsigned(WindowCreationData::ForceChild); - setWindowFlags_sys(window()->flags(), flags); - } + // Force toplevel state as QWindow::isTopLevel cannot be relied upon here. + if (wasTopLevel != isTopLevel) + setWindowFlags_sys(window()->flags(), unsigned(isTopLevel ? WindowCreationData::ForceTopLevel : WindowCreationData::ForceChild)); } } -- cgit v1.2.3 From 3d9a40038f01bc2a3df0027a9be04e7fa3ce3850 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Jan 2013 16:52:54 +0100 Subject: Implement QPlatformWindow::isExposed() on Windows. Task-number: QTBUG-28439 Change-Id: I4a81a8947056ecd4e1e61ffb0e5d94ee2ad860df Reviewed-by: Gunnar Sletta --- src/plugins/platforms/windows/qwindowswindow.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 978d1d5a53..2ca1a41c18 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -154,6 +154,7 @@ public: virtual void setVisible(bool visible); bool isVisible() const; + virtual bool isExposed() const { return m_windowState != Qt::WindowMinimized && isVisible(); } virtual bool isActive() const; virtual bool isEmbedded(const QPlatformWindow *parentWindow) const; virtual QPoint mapToGlobal(const QPoint &pos) const; -- cgit v1.2.3