src/gui/kernel/qapplication_s60.cpp
changeset 25 e24348a560a6
parent 23 89e065397ea6
child 29 b72c6db6890b
equal deleted inserted replaced
23:89e065397ea6 25:e24348a560a6
   438             }
   438             }
   439             if (event->PointerNumber() == 0)
   439             if (event->PointerNumber() == 0)
   440                 state |= Qt::TouchPointPrimary;
   440                 state |= Qt::TouchPointPrimary;
   441             touchPoint.setState(state);
   441             touchPoint.setState(state);
   442 
   442 
   443             QPointF screenPos = QPointF(event->iPosition.iX, event->iPosition.iY);
   443             QPointF screenPos = qwidget->mapToGlobal(QPoint(event->iPosition.iX, event->iPosition.iY));
   444             touchPoint.setScreenPos(screenPos);
   444             touchPoint.setScreenPos(screenPos);
   445             touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(),
   445             touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(),
   446                                                 screenPos.y() / screenGeometry.height()));
   446                                                 screenPos.y() / screenGeometry.height()));
   447 
   447 
   448             touchPoint.setPressure(event->Pressure() / qreal(d->maxTouchPressure));
   448             touchPoint.setPressure(event->Pressure() / qreal(d->maxTouchPressure));
   640                     S60->virtualMouseAccel = 1;
   640                     S60->virtualMouseAccel = 1;
   641                 S60->virtualMouseLastKey = keyCode;
   641                 S60->virtualMouseLastKey = keyCode;
   642 
   642 
   643                 QPoint pos = QCursor::pos();
   643                 QPoint pos = QCursor::pos();
   644                 TPointerEvent fakeEvent;
   644                 TPointerEvent fakeEvent;
       
   645                 fakeEvent.iType = (TPointerEvent::TType)(-1);
   645                 TInt x = pos.x();
   646                 TInt x = pos.x();
   646                 TInt y = pos.y();
   647                 TInt y = pos.y();
   647                 if (type == EEventKeyUp) {
   648                 if (type == EEventKeyUp) {
   648                     if (keyCode == Qt::Key_Select)
   649                     if (keyCode == Qt::Key_Select &&
       
   650                         (S60->virtualMousePressedKeys & QS60Data::Select))
   649                         fakeEvent.iType = TPointerEvent::EButton1Up;
   651                         fakeEvent.iType = TPointerEvent::EButton1Up;
   650                     S60->virtualMouseAccel = 1;
   652                     S60->virtualMouseAccel = 1;
   651                     S60->virtualMouseLastKey = 0;
   653                     S60->virtualMouseLastKey = 0;
   652                     switch (keyCode) {
   654                     switch (keyCode) {
   653                     case Qt::Key_Left:
   655                     case Qt::Key_Left:
   692                     case Qt::Key_Select:
   694                     case Qt::Key_Select:
   693                         // Platform bug. If you start pressing several keys simultaneously (for
   695                         // Platform bug. If you start pressing several keys simultaneously (for
   694                         // example for drag'n'drop), Symbian starts producing spurious up and
   696                         // example for drag'n'drop), Symbian starts producing spurious up and
   695                         // down messages for some keys. Therefore, make sure we have a clean slate
   697                         // down messages for some keys. Therefore, make sure we have a clean slate
   696                         // of pressed keys before starting a new button press.
   698                         // of pressed keys before starting a new button press.
   697                         if (S60->virtualMousePressedKeys != 0) {
   699                         if (S60->virtualMousePressedKeys & QS60Data::Select) {
   698                             S60->virtualMousePressedKeys |= QS60Data::Select;
       
   699                             return EKeyWasConsumed;
   700                             return EKeyWasConsumed;
   700                         } else {
   701                         } else {
   701                             S60->virtualMousePressedKeys |= QS60Data::Select;
   702                             S60->virtualMousePressedKeys |= QS60Data::Select;
   702                             fakeEvent.iType = TPointerEvent::EButton1Down;
   703                             fakeEvent.iType = TPointerEvent::EButton1Down;
   703                         }
   704                         }
   716                 TPoint epos(x, y);
   717                 TPoint epos(x, y);
   717                 TPoint cpos = epos - PositionRelativeToScreen();
   718                 TPoint cpos = epos - PositionRelativeToScreen();
   718                 fakeEvent.iModifiers = keyEvent.iModifiers;
   719                 fakeEvent.iModifiers = keyEvent.iModifiers;
   719                 fakeEvent.iPosition = cpos;
   720                 fakeEvent.iPosition = cpos;
   720                 fakeEvent.iParentPosition = epos;
   721                 fakeEvent.iParentPosition = epos;
   721                 HandlePointerEvent(fakeEvent);
   722                 if(fakeEvent.iType != -1)
       
   723                     HandlePointerEvent(fakeEvent);
   722                 return EKeyWasConsumed;
   724                 return EKeyWasConsumed;
   723             }
   725             }
   724             else {
   726             else {
   725                 S60->virtualMouseLastKey = keyCode;
   727                 S60->virtualMouseLastKey = keyCode;
   726                 S60->virtualMouseAccel = 1;
   728                 S60->virtualMouseAccel = 1;
   989         if (buttonGroup) {
   991         if (buttonGroup) {
   990             // Visibility
   992             // Visibility
   991             const TBool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen;
   993             const TBool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen;
   992             const TBool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint;
   994             const TBool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint;
   993             buttonGroup->MakeVisible(visible || (isFullscreen && cbaVisibilityHint));
   995             buttonGroup->MakeVisible(visible || (isFullscreen && cbaVisibilityHint));
   994 
       
   995             // Responsiviness
       
   996             CEikCba *cba = static_cast<CEikCba *>( buttonGroup->ButtonGroup() ); // downcast from MEikButtonGroup
       
   997             TUint cbaFlags = cba->ButtonGroupFlags();
       
   998             if(qwidget->windowFlags() & Qt::WindowSoftkeysRespondHint)
       
   999                 cbaFlags |= EAknCBAFlagRespondWhenInvisible;
       
  1000             else
       
  1001                 cbaFlags &= ~EAknCBAFlagRespondWhenInvisible;
       
  1002             cba->SetButtonGroupFlags(cbaFlags);
       
  1003         }
   996         }
  1004 #endif
   997 #endif
  1005     } else if (QApplication::activeWindow() == qwidget->window()) {
   998     } else if (QApplication::activeWindow() == qwidget->window()) {
  1006         if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) {
   999         if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) {
  1007             QWidget *fw = QApplication::focusWidget();
  1000             QWidget *fw = QApplication::focusWidget();