From 51a35f5c021836bf31276749c638addefac12ebb Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Fri, 31 May 2013 14:57:52 +0200 Subject: eglfs: prevent expose/geometrychange loop This prevents EGLFS from getting stuck after exposing the first frame, by constantly generating new Expose and GeometryChange events which are synchronously processed. Change-Id: Id3b09821ea31e9c1ddab7c520e782a4e42844a08 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/eglfs/qeglfswindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index cd92a07f00..98c54e0ee0 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -68,11 +68,11 @@ QEglFSWindow::~QEglFSWindow() void QEglFSWindow::create() { - setWindowState(Qt::WindowFullScreen); - if (m_window) return; + setWindowState(Qt::WindowFullScreen); + if (window()->type() == Qt::Desktop) { QRect rect(QPoint(), QEglFSHooks::hooks()->screenSize()); QPlatformWindow::setGeometry(rect); -- cgit v1.2.3 From fb7e0e24c4181e9e97d85a3a80c3e2ef5a40770a Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Sat, 1 Jun 2013 17:57:34 +0200 Subject: eglfs: Fix bug determining physical screen size In the situation that the screenSize EGLFS hook had been defined, but not the physicalScreenSize, the uninitialized contents of fb_var_screeninfo vinfo would be used to calculate the fall-back physical screen size. Since this value is undefined, devices like the Raspberry Pi would end unable to render DPI dependent fonts. Change-Id: Ic9f67c1c646cc7b328b695b76a84d78577fefcd8 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index 91a97ff977..c334f46c2c 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -99,6 +99,7 @@ QSizeF QEglFSHooks::physicalScreenSize() const struct fb_var_screeninfo vinfo; int w = -1; int h = -1; + QSize screenResolution; if (framebuffer != -1) { if (ioctl(framebuffer, FBIOGET_VSCREENINFO, &vinfo) == -1) { @@ -106,12 +107,15 @@ QSizeF QEglFSHooks::physicalScreenSize() const } else { w = vinfo.width; h = vinfo.height; + screenResolution = QSize(vinfo.xres, vinfo.yres); } + } else { + screenResolution = screenSize(); } const int defaultPhysicalDpi = 100; - size.setWidth(w <= 0 ? vinfo.xres * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w)); - size.setHeight(h <= 0 ? vinfo.yres * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h)); + size.setWidth(w <= 0 ? screenResolution.width() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w)); + size.setHeight(h <= 0 ? screenResolution.height() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h)); if (w <= 0 || h <= 0) { qWarning("EGLFS: Unable to query physical screen size, defaulting to %d dpi.\n" -- cgit v1.2.3 From d4415cdd84519de5c3a4b8830b7407074877ea80 Mon Sep 17 00:00:00 2001 From: Daiwei Li Date: Wed, 5 Jun 2013 14:28:26 -0700 Subject: Fix themeHint typo in qcocoatheme: PasswordMaskDelay should be PasswordMaskCharacter Task-number: QTBUG-31498 Change-Id: Ie6b1b0a2238923e37d52fa2e90782e874bb224b4 Reviewed-by: Mitch Curtis --- src/plugins/platforms/cocoa/qcocoatheme.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 36d7a49746..9c10bc26dd 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -281,7 +281,7 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const sizes << 16 << 32 << 64 << 128; return QVariant::fromValue(sizes); } - case QPlatformTheme::PasswordMaskDelay: + case QPlatformTheme::PasswordMaskCharacter: return QVariant(QChar(kBulletUnicode)); default: break; -- cgit v1.2.3 From 119882714f87ffeb6945fdb2d02997ae125ff50c Mon Sep 17 00:00:00 2001 From: Romain Perier Date: Thu, 30 May 2013 08:33:25 +0200 Subject: Cocoa:Fixed crash when sharing QMenu between two QMenuBar instances Don't insert a NSMenuItem into a NSMenu if this one already belongs to another NSMenu, this is forbidden in the Cocoa framework and raises an Exception. The solution consists in tagging the menu as sharable and moving it from one menubar to another when the window gets focus. Task-number: QTBUG-31342 Change-Id: Ic3bfadd4704f363ac26122ae15547543a0f6d44d Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoamenu.h | 5 ++ src/plugins/platforms/cocoa/qcocoamenu.mm | 13 +++++- src/plugins/platforms/cocoa/qcocoamenubar.h | 2 + src/plugins/platforms/cocoa/qcocoamenubar.mm | 68 +++++++++++++++++++--------- 4 files changed, 66 insertions(+), 22 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h index 9100b9b15f..7224ee2ff8 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.h +++ b/src/plugins/platforms/cocoa/qcocoamenu.h @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE +class QCocoaMenuBar; + class QCocoaMenu : public QPlatformMenu { public: @@ -87,6 +89,8 @@ public: QList items() const; QList merged() const; + void setMenuBar(QCocoaMenuBar *menuBar); + QCocoaMenuBar *menuBar() const; private: QCocoaMenuItem *itemOrNull(int index) const; void insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem); @@ -97,6 +101,7 @@ private: NSObject *m_delegate; bool m_enabled; quintptr m_tag; + QCocoaMenuBar *m_menuBar; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 25ece7349c..d4cf83a380 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -215,7 +215,8 @@ QT_BEGIN_NAMESPACE QCocoaMenu::QCocoaMenu() : m_enabled(true), - m_tag(0) + m_tag(0), + m_menuBar(0) { m_delegate = [[QT_MANGLE_NAMESPACE(QCocoaMenuDelegate) alloc] initWithMenu:this]; m_nativeItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; @@ -534,4 +535,14 @@ void QCocoaMenu::syncModalState(bool modal) } } +void QCocoaMenu::setMenuBar(QCocoaMenuBar *menuBar) +{ + m_menuBar = menuBar; +} + +QCocoaMenuBar *QCocoaMenu::menuBar() const +{ + return m_menuBar; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.h b/src/plugins/platforms/cocoa/qcocoamenubar.h index 8086676cc5..7a1bda74a4 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.h +++ b/src/plugins/platforms/cocoa/qcocoamenubar.h @@ -75,6 +75,8 @@ private: static QCocoaMenuBar *findGlobalMenubar(); bool shouldDisable(QCocoaWindow *active) const; + void insertNativeMenu(QCocoaMenu *menu, QCocoaMenu *beforeMenu); + void removeNativeMenu(QCocoaMenu *menu); QList m_menus; NSMenu *m_nativeMenu; diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index e280cf4581..73331db40d 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -83,9 +83,24 @@ QCocoaMenuBar::~QCocoaMenuBar() } } -void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before) +void QCocoaMenuBar::insertNativeMenu(QCocoaMenu *menu, QCocoaMenu *beforeMenu) { QCocoaAutoReleasePool pool; + + if (beforeMenu) { + NSUInteger nativeIndex = [m_nativeMenu indexOfItem:beforeMenu->nsMenuItem()]; + [m_nativeMenu insertItem: menu->nsMenuItem() atIndex: nativeIndex]; + } else { + [m_nativeMenu addItem: menu->nsMenuItem()]; + } + + menu->setMenuBar(this); + syncMenu(static_cast(menu)); + [m_nativeMenu setSubmenu: menu->nsMenu() forItem: menu->nsMenuItem()]; +} + +void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before) +{ QCocoaMenu *menu = static_cast(platformMenu); QCocoaMenu *beforeMenu = static_cast(before); #ifdef QT_COCOA_ENABLE_MENU_DEBUG @@ -96,39 +111,36 @@ void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *befor qWarning() << Q_FUNC_INFO << "This menu already belongs to the menubar, remove it first"; return; } - if (beforeMenu) { - if (!m_menus.contains(beforeMenu)) { - qWarning() << Q_FUNC_INFO << "The before menu does not belong to the menubar"; - return; - } - m_menus.insert(m_menus.indexOf(beforeMenu), menu); - NSUInteger nativeIndex = [m_nativeMenu indexOfItem:beforeMenu->nsMenuItem()]; - [m_nativeMenu insertItem: menu->nsMenuItem() atIndex: nativeIndex]; - } else { - m_menus.append(menu); - [m_nativeMenu addItem: menu->nsMenuItem()]; + + if (beforeMenu && !m_menus.contains(beforeMenu)) { + qWarning() << Q_FUNC_INFO << "The before menu does not belong to the menubar"; + return; } - platformMenu->setParent(this); - syncMenu(platformMenu); - [m_nativeMenu setSubmenu: menu->nsMenu() forItem: menu->nsMenuItem()]; + m_menus.insert(beforeMenu ? m_menus.indexOf(beforeMenu) : m_menus.size(), menu); + if (!menu->menuBar()) + insertNativeMenu(menu, beforeMenu); } -void QCocoaMenuBar::removeMenu(QPlatformMenu *platformMenu) +void QCocoaMenuBar::removeNativeMenu(QCocoaMenu *menu) { QCocoaAutoReleasePool pool; + if (menu->menuBar() == this) + menu->setMenuBar(0); + NSUInteger realIndex = [m_nativeMenu indexOfItem:menu->nsMenuItem()]; + [m_nativeMenu removeItemAtIndex: realIndex]; +} + +void QCocoaMenuBar::removeMenu(QPlatformMenu *platformMenu) +{ QCocoaMenu *menu = static_cast(platformMenu); if (!m_menus.contains(menu)) { qWarning() << Q_FUNC_INFO << "Trying to remove a menu that does not belong to the menubar"; return; } m_menus.removeOne(menu); - - if (platformMenu->parent() == this) - platformMenu->setParent(0); - NSUInteger realIndex = [m_nativeMenu indexOfItem:menu->nsMenuItem()]; - [m_nativeMenu removeItemAtIndex: realIndex]; + removeNativeMenu(menu); } void QCocoaMenuBar::syncMenu(QPlatformMenu *menu) @@ -207,6 +219,20 @@ void QCocoaMenuBar::updateMenuBarImmediately() m->syncModalState(disableForModal); } + // reparent shared menu items if necessary. + // We browse the list in reverse order to be sure that the next items are redrawn before the current ones, + // in this way we are sure that "beforeMenu" (see below) is part of the native menu before "m" is redraw + for (int i = mb->m_menus.size() - 1; i >= 0; i--) { + QCocoaMenu *m = mb->m_menus.at(i); + QCocoaMenuBar *menuBar = m->menuBar(); + if (menuBar != mb) { + QCocoaMenu *beforeMenu = i < (mb->m_menus.size() - 1) ? mb->m_menus.at(i + 1) : 0; + if (menuBar) + menuBar->removeNativeMenu(m); + mb->insertNativeMenu(m, beforeMenu); + } + } + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); [loader ensureAppMenuInMenu:mb->nsMenu()]; -- cgit v1.2.3 From 1828ab8557e824ec22b0c425dd417df3a0794a8c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 5 Jun 2013 16:14:42 +0200 Subject: Windows: Send a geometry change after Window creation. Task-number: QTBUG-30996 Change-Id: I03b5e1fdbbdd779f86541291c13e9eb6840ff3c6 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/windows/qwindowsintegration.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 814892b43a..fc2ba454df 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -433,6 +433,9 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons return 0; if (requested.flags != obtained.flags) window->setFlags(obtained.flags); + // Trigger geometry change signals of QWindow. + if ((obtained.flags & Qt::Desktop) != Qt::Desktop && requested.geometry != obtained.geometry) + QWindowSystemInterface::handleGeometryChange(window, obtained.geometry); return new QWindowsWindow(window, obtained); } -- cgit v1.2.3 From cd756e5ed55a7859eca354e898ea5a3039fcb2e6 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 30 May 2013 13:02:45 +0200 Subject: Cocoa Accessibility: fix ignoring of objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Mac it's expected that some elements are filtered out of the a11y hierarchy. We do this with the shouldBeIgnored function. The problem is that we would ignore some objects and then return them in the child attribute function. This is inconsistent and leads to voice over not working. For example having a plain QWidget with other widgets as children would cut off all of these widgets, since the plain QWidget would be ignored. Change-Id: I5f6c26b272e5ca57d59c1ed1ef47e9a2b1181295 Reviewed-by: Gabriel de Dietrich Reviewed-by: Jan Arve Sæther --- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 6 ++---- src/plugins/platforms/cocoa/qnsviewaccessibility.mm | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index f7c945c50d..55a23fda76 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -151,8 +151,7 @@ [kids addObject: element]; [element release]; } - // ### maybe we should use NSAccessibilityUnignoredChildren(kids); this needs more profiling - return kids; + return NSAccessibilityUnignoredChildren(kids); } else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { // Just check if the app thinks we're focused. @@ -272,8 +271,7 @@ // No child found, meaning we hit this element. if (!childInterface) { // qDebug() << "Hit test returns: " << id << iface; - return self; - //return NSAccessibilityUnignoredAncestor(self); + return NSAccessibilityUnignoredAncestor(self); } QAccessible::Id childId = QAccessible::uniqueId(childInterface); diff --git a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm index 6ebb1f6ba8..331a66417d 100644 --- a/src/plugins/platforms/cocoa/qnsviewaccessibility.mm +++ b/src/plugins/platforms/cocoa/qnsviewaccessibility.mm @@ -88,7 +88,7 @@ [element release]; } - return kids; + return NSAccessibilityUnignoredChildren(kids); } else { return [super accessibilityAttributeValue:attribute]; } -- cgit v1.2.3 From 16eea84aa873771047785db9ee00a51904c50ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 31 May 2013 16:04:21 +0200 Subject: Fix for when we don't have XSettings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-31418 Task-number: QTBUG-31410 Task-number: QTBUG-31446 Change-Id: I3fbed40054f3e0720b50ada0dc4ad0ae4cb0412e Reviewed-by: Jan Arve Sæther --- src/plugins/platforms/xcb/qxcbxsettings.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index 7ffd3e105f..c106bd00f8 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -214,23 +214,37 @@ QXcbXSettings::QXcbXSettings(QXcbScreen *screen) QByteArray settings_atom_for_screen("_XSETTINGS_S"); settings_atom_for_screen.append(QByteArray::number(screen->screenNumber())); xcb_intern_atom_cookie_t atom_cookie = xcb_intern_atom(screen->xcb_connection(), - false, + true, settings_atom_for_screen.length(), settings_atom_for_screen.constData()); - xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(screen->xcb_connection(),atom_cookie,NULL); + xcb_generic_error_t *error = 0; + xcb_intern_atom_reply_t *atom_reply = xcb_intern_atom_reply(screen->xcb_connection(),atom_cookie,&error); + if (error) { + qWarning() << Q_FUNC_INFO << "Failed to find XSETTINGS_S atom"; + return; + } xcb_atom_t selection_owner_atom = atom_reply->atom; free(atom_reply); xcb_get_selection_owner_cookie_t selection_cookie = xcb_get_selection_owner(screen->xcb_connection(), selection_owner_atom); + xcb_get_selection_owner_reply_t *selection_result = - xcb_get_selection_owner_reply(screen->xcb_connection(), selection_cookie, NULL); + xcb_get_selection_owner_reply(screen->xcb_connection(), selection_cookie, &error); + if (error) { + qWarning() << Q_FUNC_INFO << "Failed to get selection owner for XSETTINGS_S atom"; + return; + } d_ptr->x_settings_window = selection_result->owner; + if (!d_ptr->x_settings_window) { + return; + } free(selection_result); + const uint32_t event = XCB_CW_EVENT_MASK; const uint32_t event_mask[] = { XCB_EVENT_MASK_STRUCTURE_NOTIFY|XCB_EVENT_MASK_PROPERTY_CHANGE }; - xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,XCB_CW_EVENT_MASK,event_mask); + xcb_change_window_attributes(screen->xcb_connection(),d_ptr->x_settings_window,event,event_mask); d_ptr->populateSettings(d_ptr->getSettings()); } -- cgit v1.2.3 From 60df445d3bca6d6908bc8c07708e2df1c02584c9 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Fri, 31 May 2013 15:26:41 -0300 Subject: QNX: fix QQnxWindow To ensure the correct event order, only set the geometry() once the window is actually made visible. We also need to post the expose event even for child windows (i.e., windows which have a parent). Change-Id: Ief80778bc3202352bd194e4b3ba655f619350b1a Reviewed-by: Kevin Krammer Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxwindow.cpp | 80 ++++++++++++++++++-------------- src/plugins/platforms/qnx/qqnxwindow.h | 1 + 2 files changed, 45 insertions(+), 36 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 9523685f70..4c95950a7e 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -77,7 +77,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) #endif m_screen(0), m_parentWindow(0), - m_visible(true), + m_visible(false), m_windowState(Qt::WindowNoState), m_requestedBufferSize(window->geometry().size()) { @@ -153,7 +153,6 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) if (window->parent() && window->parent()->handle()) setParent(window->parent()->handle()); setGeometryHelper(window->geometry()); - setVisible(window->isVisible()); } QQnxWindow::~QQnxWindow() @@ -272,6 +271,9 @@ void QQnxWindow::setVisible(bool visible) { qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "visible =" << visible; + if (m_visible == visible) + return; + m_visible = visible; QQnxWindow *root = this; @@ -282,13 +284,13 @@ void QQnxWindow::setVisible(bool visible) window()->requestActivate(); - if (window()->isTopLevel()) { - QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); + QWindowSystemInterface::handleExposeEvent(window(), window()->geometry()); - if (!visible) { - // Flush the context, otherwise it won't disappear immediately - screen_flush_context(m_screenContext, 0); - } + if (visible) { + applyWindowState(); + } else { + // Flush the context, otherwise it won't disappear immediately + screen_flush_context(m_screenContext, 0); } } @@ -625,35 +627,10 @@ void QQnxWindow::setWindowState(Qt::WindowState state) if (m_windowState == state) return; - switch (state) { - - // WindowActive is not an accepted parameter according to the docs - case Qt::WindowActive: - return; - - case Qt::WindowMinimized: - minimize(); - - if (m_unmaximizedGeometry.isValid()) - setGeometry(m_unmaximizedGeometry); - else - setGeometry(m_screen->geometry()); - - break; - - case Qt::WindowMaximized: - case Qt::WindowFullScreen: - m_unmaximizedGeometry = geometry(); - setGeometry(state == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry()); - break; - - case Qt::WindowNoState: - if (m_unmaximizedGeometry.isValid()) - setGeometry(m_unmaximizedGeometry); - break; - } - m_windowState = state; + + if (m_visible) + applyWindowState(); } void QQnxWindow::gainedFocus() @@ -734,6 +711,37 @@ void QQnxWindow::updateZorder(int &topZorder) childWindow->updateZorder(topZorder); } +void QQnxWindow::applyWindowState() +{ + switch (m_windowState) { + + // WindowActive is not an accepted parameter according to the docs + case Qt::WindowActive: + return; + + case Qt::WindowMinimized: + minimize(); + + if (m_unmaximizedGeometry.isValid()) + setGeometry(m_unmaximizedGeometry); + else + setGeometry(m_screen->geometry()); + + break; + + case Qt::WindowMaximized: + case Qt::WindowFullScreen: + m_unmaximizedGeometry = geometry(); + setGeometry(m_windowState == Qt::WindowMaximized ? m_screen->availableGeometry() : m_screen->geometry()); + break; + + case Qt::WindowNoState: + if (m_unmaximizedGeometry.isValid()) + setGeometry(m_unmaximizedGeometry); + break; + } +} + void QQnxWindow::blitHelper(QQnxBuffer &source, QQnxBuffer &target, const QPoint &sourceOffset, const QPoint &targetOffset, const QRegion ®ion, bool flush) { diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h index 4a327fd54b..63d5dc0979 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.h +++ b/src/plugins/platforms/qnx/qqnxwindow.h @@ -124,6 +124,7 @@ private: void setOffset(const QPoint &setOffset); void updateVisibility(bool parentVisible); void updateZorder(int &topZorder); + void applyWindowState(); void fetchBuffers(); -- cgit v1.2.3 From 275c4b8403ddbdcd126cd55dfcc37bd1f5b6d9f7 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 16 May 2013 04:42:39 +1000 Subject: code cleanup. make one way to access system dbus. remove dead uncommented code Change-Id: Ia53cdc27f354269bb393ac137802b8807652cef9 Reviewed-by: Thiago Macieira --- .../bearer/connman/qconnmanservice_linux.cpp | 34 +++++----------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index 4efecc5464..380cf92a24 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -74,7 +74,6 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &map) return argument; } -static QDBusConnection dbusConnection = QDBusConnection::systemBus(); QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent) : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), QLatin1String(CONNMAN_MANAGER_PATH), @@ -98,7 +97,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal) QLatin1String(CONNMAN_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), this,SIGNAL(propertyChanged(QString,QDBusVariant)))) { - qWarning() << "PropertyCHanged not connected"; + qWarning() << "PropertyChanged not connected"; } } @@ -118,7 +117,7 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), QLatin1String(CONNMAN_MANAGER_PATH), QLatin1String(CONNMAN_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -379,7 +378,7 @@ void QConnmanProfileInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanProfileInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_PROFILE_INTERFACE), QLatin1String("PropertyChanged"), @@ -449,7 +448,7 @@ void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanServiceInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_SERVICE_INTERFACE), QLatin1String("PropertyChanged"), @@ -460,7 +459,7 @@ void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_SERVICE_INTERFACE), QLatin1String("PropertyChanged"), @@ -514,9 +513,6 @@ void QConnmanServiceInterface::remove() QDBusReply reply = this->call(QLatin1String("Remove")); } -// void moveBefore(QDBusObjectPath &service); -// void moveAfter(QDBusObjectPath &service); - // properties QString QConnmanServiceInterface::getState() { @@ -779,7 +775,7 @@ void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal) { static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanTechnologyInterface::propertyChanged); if (signal == propertyChangedSignal) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), QLatin1String("PropertyChanged"), @@ -790,7 +786,7 @@ void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal) QConnmanDBusHelper *helper; helper = new QConnmanDBusHelper(this); - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE), this->path(), QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE), QLatin1String("PropertyChanged"), @@ -861,23 +857,11 @@ QConnmanAgentInterface::~QConnmanAgentInterface() void QConnmanAgentInterface::connectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged); -// if (signal == propertyChangedSignal) { -// dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), -// this->path(), -// QLatin1String(CONNMAN_NETWORK_INTERFACE), -// QLatin1String("PropertyChanged"), -// this,SIGNAL(propertyChanged(QString,QVariant&))); -// } } void QConnmanAgentInterface::disconnectNotify(const QMetaMethod &signal) { Q_UNUSED(signal); -// static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanAgentInterface::propertyChanged); -// if (signal == propertyChangedSignal) { - -// } } @@ -889,10 +873,6 @@ void QConnmanAgentInterface::reportError(QDBusObjectPath &/*path*/, const QStrin { } -//dict QConnmanAgentInterface::requestInput(QDBusObjectPath &path, dict fields) -//{ -//} - void QConnmanAgentInterface::cancel() { } -- cgit v1.2.3 From 9ddcd900f6616da19bed344583ce08ced46fec36 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Fri, 24 May 2013 17:06:35 +0400 Subject: Fix leak in QCocoaDrag. Change-Id: I2961d08f95c68446a2893721dc79ba56bf98c0de Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoadrag.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index 7dad4271b5..a37552d844 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -123,7 +123,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) if (pm.isNull()) pm = defaultPixmap(); - NSImage *nsimage = static_cast(qt_mac_create_nsimage(pm)); + NSImage *nsimage = qt_mac_create_nsimage(pm); QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND); m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy")); @@ -145,6 +145,8 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o) source:m_lastView slideBack:YES]; + [nsimage release]; + m_drag = 0; return m_executed_drop_action; } -- cgit v1.2.3 From 7ae6e48d57f89596ddf40980aeff4ef7340ba689 Mon Sep 17 00:00:00 2001 From: Sebastian Eifert Date: Thu, 30 May 2013 19:13:32 +0200 Subject: Windows: Prevent spurious leave events. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When behind a mouse-event-transparent window, synthesized leave events are emitted, because the transparent window is considered as the window under the mouse, not the Qt window. This change skips transparent windows when searching for the window under the mouse. Task-number: QTBUG-31464 Change-Id: I85c8b46a1af37b4d1c5d1d77566ab045657aa9ae Reviewed-by: Björn Breitmeyer Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qplatformfunctions_wince.h | 1 + src/plugins/platforms/windows/qwindowsmousehandler.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h index 3190e39ec5..30fc66563e 100644 --- a/src/plugins/platforms/windows/qplatformfunctions_wince.h +++ b/src/plugins/platforms/windows/qplatformfunctions_wince.h @@ -74,6 +74,7 @@ #ifndef CWP_SKIPINVISIBLE #define CWP_SKIPINVISIBLE 0x0001 +#define CWP_SKIPTRANSPARENT 0x0004 #define findPlatformWindowAt(a, b, c) findPlatformWindowAt(a, b) #endif diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 5c096b7eca..c6cfa4dbbc 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -232,8 +232,10 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, } const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition); + // In this context, neither an invisible nor a transparent window (transparent regarding mouse + // events, "click-through") can be considered as the window under mouse. QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ? - QWindowsScreen::windowAt(globalPosition) : window; + QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window; compressMouseMove(&msg); // Qt expects the platform plugin to capture the mouse on -- cgit v1.2.3