diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-05-12 16:26:03 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-05-12 17:10:26 (GMT) |
commit | 25107b9b08dbb97363181eeb5768e7769cbb98c7 (patch) | |
tree | b7e615b5498fb2017c6421a0252e5d8c907973c9 /src/gui | |
parent | f699d9af27c8450a36266d8542c54d53a6d57f15 (diff) | |
download | Qt-25107b9b08dbb97363181eeb5768e7769cbb98c7.zip Qt-25107b9b08dbb97363181eeb5768e7769cbb98c7.tar.gz Qt-25107b9b08dbb97363181eeb5768e7769cbb98c7.tar.bz2 |
Fix spurious mouse click when dismissing a native menu
Native menus are dismissed by the key press event.
The Qt application then receives the key up event, as it now has keyboard
focus.
The virtual mouse implementation now filters out select key press/release
which don't match the expected mouse button state.
Task-number: QTBUG-9860
Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 387762f..ea5c14c 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -643,11 +643,13 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod QPoint pos = QCursor::pos(); TPointerEvent fakeEvent; + fakeEvent.iType = (TPointerEvent::TType)(-1); fakeEvent.iModifiers = keyEvent.iModifiers; TInt x = pos.x(); TInt y = pos.y(); if (type == EEventKeyUp) { - if (keyCode == Qt::Key_Select) + if (keyCode == Qt::Key_Select && + (S60->virtualMousePressedKeys & QS60Data::Select)) fakeEvent.iType = TPointerEvent::EButton1Up; S60->virtualMouseAccel = 1; S60->virtualMouseLastKey = 0; @@ -698,8 +700,7 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod // example for drag'n'drop), Symbian starts producing spurious up and // down messages for some keys. Therefore, make sure we have a clean slate // of pressed keys before starting a new button press. - if (S60->virtualMousePressedKeys != 0) { - S60->virtualMousePressedKeys |= QS60Data::Select; + if (S60->virtualMousePressedKeys & QS60Data::Select) { return EKeyWasConsumed; } else { S60->virtualMousePressedKeys |= QS60Data::Select; @@ -728,7 +729,8 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod TPoint cpos = epos - PositionRelativeToScreen(); fakeEvent.iPosition = cpos; fakeEvent.iParentPosition = epos; - HandlePointerEvent(fakeEvent); + if(fakeEvent.iType != -1) + HandlePointerEvent(fakeEvent); return EKeyWasConsumed; } else { |