From befbaa0c61876c3bfebe29499fd16930db400b2b Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Fri, 16 Apr 2010 13:10:51 +0200 Subject: Fixed a crash on Windows 7 systems with invalid PrinterPorts entries. Some Windows 7 systems appear to have invalid entries in the PrinterPorts registry key. It's supposed to contain 3 entries, but some return a single value. Task-number: QTBUG-9938 Reviewed-by: Kim --- src/gui/painting/qprintengine_win.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp index 374bfa0..76dad72 100644 --- a/src/gui/painting/qprintengine_win.cpp +++ b/src/gui/painting/qprintengine_win.cpp @@ -964,12 +964,13 @@ void QWin32PrintEnginePrivate::queryDefault() return; QStringList info = output.split(QLatin1Char(',')); - if (info.size() > 0) { + int infoSize = info.size(); + if (infoSize > 0) { if (name.isEmpty()) name = info.at(0); - if (program.isEmpty()) + if (program.isEmpty() && infoSize > 1) program = info.at(1); - if (port.isEmpty()) + if (port.isEmpty() && infoSize > 2) port = info.at(2); } } -- cgit v0.12 From d22afdb8cf874aae3c5593f6108d4c7897a8ac20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 15 Apr 2010 18:06:33 +0200 Subject: Mac: Graphics View starving user events and sometimes crashes. Problem was that we called processEvents() and excluded user input events. The idea was to only process pending update requests, but by doing that there's also a chance that user input events will starve. Also, there's no gurantee that only update requests will be processed by processEvents(), so a safer solution is to call "HIViewRender" on Carbon and "displayIfNeeded" on Cocoa. This will for sure dispatch pending update requests and nothing else (which is exactly what we want). No auto test regressions. Fixes tst_qgraphicsproxywidget::updateAndDelete failure on Carbon. Benchmarks indicate an increase in performance. Task-number: QTBUG-7502 Reviewed-by: richard --- src/gui/graphicsview/qgraphicsview_p.h | 8 ++++++-- src/gui/kernel/qt_cocoa_helpers_mac.mm | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index 9d3edcb..1c66d07 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -183,8 +183,12 @@ public: else QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest); #else - QCoreApplication::processEvents(QEventLoop::AllEvents | QEventLoop::ExcludeSocketNotifiers - | QEventLoop::ExcludeUserInputEvents); + // At this point either HIViewSetNeedsDisplay (Carbon) or setNeedsDisplay: YES (Cocoa) + // is called, which means there's a pending update request. We want to dispatch it + // now because otherwise graphics view updates would require two + // round-trips in the event loop before the item is painted. + extern void qt_mac_dispatchPendingUpdateRequests(QWidget *); + qt_mac_dispatchPendingUpdateRequests(viewport->window()); #endif } diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 65c04e5..ce1e3c5 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1167,6 +1167,17 @@ CGContextRef qt_mac_graphicsContextFor(QWidget *widget) return context; } +void qt_mac_dispatchPendingUpdateRequests(QWidget *widget) +{ + if (!widget) + return; +#ifndef QT_MAC_USE_COCOA + HIViewRender(qt_mac_nativeview_for(widget)); +#else + [qt_mac_nativeview_for(widget) displayIfNeeded]; +#endif +} + CGFloat qt_mac_get_scalefactor() { #ifndef QT_MAC_USE_COCOA -- cgit v0.12 From 3d86aa8f7188bee865bd286fa7dffd80a5c78215 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 16 Apr 2010 16:21:58 +0200 Subject: QMenu: Behavior regression When opening a submenu, and then moving the mouse over the parent menu margins, the submenu would close, whereas it didn't in 4.5. Reviewed-by: Olivier Task-number: QTBUG-9785 --- src/gui/widgets/qmenu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index c7573bf..d0ae90c 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -2813,7 +2813,9 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) QAction *action = d->actionAt(e->pos()); if (!action) { - if (d->hasHadMouse) + if (d->hasHadMouse + && (!d->currentAction + || !(d->currentAction->menu() && d->currentAction->menu()->isVisible()))) d->setCurrentAction(0); return; } else if(e->buttons()) { -- cgit v0.12