273 TKeyResponse ret = EKeyWasNotConsumed; |
270 TKeyResponse ret = EKeyWasNotConsumed; |
274 if ( m_control ) { |
271 if ( m_control ) { |
275 ret = m_control->OfferKeyEventL( aKeyEvent, aType ); |
272 ret = m_control->OfferKeyEventL( aKeyEvent, aType ); |
276 } |
273 } |
277 else if (!m_windowedPlugin && m_pluginskin->getNPPluginFucs() && m_pluginskin->getNPPluginFucs()->event) { |
274 else if (!m_windowedPlugin && m_pluginskin->getNPPluginFucs() && m_pluginskin->getNPPluginFucs()->event) { |
278 WebCursor* c = StaticObjectsContainer::instance()->webCursor(); |
|
279 TPoint pt = (c->position()); |
|
280 pt = m_pluginskin->frame()->frameView()->viewCoordsInFrameCoords(pt); |
|
281 pt -= m_pluginskin->rect().iTl; |
|
282 NPEvent event; |
275 NPEvent event; |
283 NPEventKey eventKey; |
276 NPEventKey eventKey; |
284 event.event = ENppEventKey; |
277 event.event = ENppEventKey; |
285 eventKey.keyEvent = &aKeyEvent; |
278 eventKey.keyEvent = &aKeyEvent; |
286 eventKey.type = aType; |
279 eventKey.type = aType; |
287 eventKey.reserved = static_cast<void*>(&pt); |
280 eventKey.reserved = NULL; |
288 event.param = &eventKey; |
281 event.param = &eventKey; |
289 ret = (TKeyResponse)m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), static_cast<void*>(&event)); |
282 ret = (TKeyResponse)m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), static_cast<void*>(&event)); |
290 } |
283 } |
291 return ret; |
284 return ret; |
292 } |
285 } |
717 |
710 |
718 void PluginWin::HandlePointerEventFromPluginL(const TPointerEvent& aEvent) |
711 void PluginWin::HandlePointerEventFromPluginL(const TPointerEvent& aEvent) |
719 { |
712 { |
720 CBrCtl* brCtl = control(m_pluginskin->frame()); |
713 CBrCtl* brCtl = control(m_pluginskin->frame()); |
721 WebView* view = brCtl->webView(); |
714 WebView* view = brCtl->webView(); |
722 #ifdef BRDO_MULTITOUCH_ENABLED_FF |
715 TPointerEvent event(aEvent); |
723 if (aEvent.IsAdvancedPointerEvent()) { |
716 |
724 TAdvancedPointerEvent tadvp = *(static_cast<const TAdvancedPointerEvent *>(&aEvent)); |
717 if (!StaticObjectsContainer::instance()->isPluginFullscreen()) { |
725 if (!StaticObjectsContainer::instance()->isPluginFullscreen()) { |
718 event.iPosition = aEvent.iPosition - view->PositionRelativeToScreen(); |
726 tadvp.iPosition = aEvent.iPosition - view->PositionRelativeToScreen(); |
719 } |
727 } |
720 view->pointerEventHandler()->HandlePointerEventL(event); |
728 view->pointerEventHandler()->HandlePointerEventL(tadvp); |
721 } |
729 } |
722 |
730 else { |
723 |
731 #endif |
724 TBool PluginWin::HandleGesture(const TGestureEvent& aEvent) |
732 TPointerEvent event(aEvent); |
|
733 if (!StaticObjectsContainer::instance()->isPluginFullscreen()) { |
|
734 event.iPosition = aEvent.iPosition - view->PositionRelativeToScreen(); |
|
735 } |
|
736 view->pointerEventHandler()->HandlePointerEventL(event); |
|
737 #ifdef BRDO_MULTITOUCH_ENABLED_FF |
|
738 } |
|
739 #endif |
|
740 } |
|
741 |
|
742 |
|
743 TBool PluginWin::HandleGesture(const TStmGestureEvent& aEvent) |
|
744 { |
725 { |
745 TBool ret = EFalse; |
726 TBool ret = EFalse; |
746 |
|
747 TGestureEvent eventForPlugin; |
|
748 switch(aEvent.Code()) |
|
749 { |
|
750 case EGestureUidUnknown : |
|
751 eventForPlugin.SetCode(EGestureUnknown); |
|
752 break; |
|
753 case EGestureUidTouch : |
|
754 eventForPlugin.SetCode(EGestureStart); |
|
755 break; |
|
756 case EGestureUidTap : |
|
757 if(aEvent.Type() == ETapTypeSingle) |
|
758 eventForPlugin.SetCode(EGestureTap); |
|
759 else |
|
760 eventForPlugin.SetCode(EGestureDoubleTap); |
|
761 break; |
|
762 case EGestureUidLongPress : |
|
763 eventForPlugin.SetCode(EGestureLongTap); |
|
764 break; |
|
765 case EGestureUidPan : |
|
766 eventForPlugin.SetCode(EGestureDrag); |
|
767 break; |
|
768 case EGestureUidRelease : |
|
769 eventForPlugin.SetCode(EGestureReleased); |
|
770 break; |
|
771 case EGestureUidFlick : |
|
772 eventForPlugin.SetCode(EGestureFlick); |
|
773 break; |
|
774 case EGestureUidPinch : |
|
775 eventForPlugin.SetCode(EGesturePinch); |
|
776 break; |
|
777 default : |
|
778 break; |
|
779 |
|
780 } |
|
781 |
|
782 |
|
783 |
|
784 if (m_control) { |
727 if (m_control) { |
|
728 TGestureEvent gestEvent(aEvent); |
785 CBrCtl* brCtl = control(m_pluginskin->frame()); |
729 CBrCtl* brCtl = control(m_pluginskin->frame()); |
786 WebView* view = brCtl->webView(); |
730 WebView* view = brCtl->webView(); |
787 TPoint newPos = aEvent.CurrentPos(); |
731 TPoint newPos = aEvent.CurrentPos(); |
788 // Not sure plugins need the start position of the gesture. Not inlcuded in the new struct |
732 TPoint startPos = aEvent.StartPos(); |
789 TPoint startPos = aEvent.CurrentPos(); |
|
790 TPoint viewPos = view->PositionRelativeToScreen(); |
733 TPoint viewPos = view->PositionRelativeToScreen(); |
791 TPoint ctrlPos = m_control->PositionRelativeToScreen(); |
734 TPoint ctrlPos = m_control->PositionRelativeToScreen(); |
792 |
735 |
793 if (!StaticObjectsContainer::instance()->isPluginFullscreen()) { |
736 if (!StaticObjectsContainer::instance()->isPluginFullscreen()) { |
794 // adjust the position to make it relative to top left corner of |
737 // adjust the position to make it relative to top left corner of |
795 newPos += viewPos; |
738 newPos += viewPos; |
796 startPos += viewPos; |
739 startPos += viewPos; |
797 } |
740 gestEvent.SetCurrentPos(newPos); |
798 eventForPlugin.SetCurrentPos(newPos); |
741 gestEvent.SetStartPos(startPos); |
799 eventForPlugin.SetStartPos(startPos); |
742 } |
800 if (StaticObjectsContainer::instance()->isPluginFullscreen() || |
743 |
|
744 if (StaticObjectsContainer::instance()->isPluginFullscreen() || |
801 m_control->Rect().Contains(newPos - ctrlPos)) { |
745 m_control->Rect().Contains(newPos - ctrlPos)) { |
802 NPEvent event; |
746 NPEvent event; |
803 NPEventPointer ev; |
747 NPEventPointer ev; |
804 event.event = ENppEventPointer; |
748 event.event = ENppEventPointer; |
805 ev.reserved = &eventForPlugin; |
749 ev.reserved = &gestEvent; |
806 ev.pointerEvent = NULL; |
750 ev.pointerEvent = NULL; |
807 event.param = &ev; |
751 event.param = &ev; |
808 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
752 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
809 static_cast<void*>(&event)); |
753 static_cast<void*>(&event)); |
810 |
|
811 if (eventForPlugin.Code(EAxisBoth) == EGestureTap) { |
|
812 eventForPlugin.SetCode(EGestureReleased); |
|
813 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
|
814 static_cast<void*>(&event)); |
|
815 |
|
816 } |
|
817 } |
754 } |
818 } |
755 } |
819 else if(!m_windowedPlugin && m_pluginskin->getNPPluginFucs() && m_pluginskin->getNPPluginFucs()->event){ |
756 else if(!m_windowedPlugin && m_pluginskin->getNPPluginFucs() && m_pluginskin->getNPPluginFucs()->event){ |
820 TRect cliprect = m_pluginskin->getClipRect(); |
757 TRect cliprect = m_pluginskin->getClipRect(); |
821 TPoint newPos = aEvent.CurrentPos(); |
758 TPoint newpos = aEvent.CurrentPos(); |
822 eventForPlugin.SetCurrentPos(newPos); |
759 if(cliprect.Contains(newpos)){ |
823 eventForPlugin.SetCurrentPos(newPos); |
760 TGestureEvent gestEvent(aEvent); |
824 |
|
825 if(cliprect.Contains(newPos)){ |
|
826 NPEvent event; |
761 NPEvent event; |
827 NPEventPointer ev; |
762 NPEventPointer ev; |
828 event.event = ENppEventPointer; |
763 event.event = ENppEventPointer; |
829 ev.reserved = &eventForPlugin; |
764 ev.reserved = &gestEvent; |
830 ev.pointerEvent = NULL; |
765 ev.pointerEvent = NULL; |
831 event.param = &ev; |
766 event.param = &ev; |
832 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
767 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
833 static_cast<void*>(&event)); |
768 static_cast<void*>(&event)); |
834 |
|
835 if (eventForPlugin.Code(EAxisBoth) == EGestureTap) { |
|
836 eventForPlugin.SetCode(EGestureReleased); |
|
837 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
|
838 static_cast<void*>(&event)); |
|
839 |
|
840 } |
|
841 } |
769 } |
842 } |
770 } |
843 return ret; |
771 return ret; |
844 |
772 |
845 } |
773 } |