714 |
717 |
715 void PluginWin::HandlePointerEventFromPluginL(const TPointerEvent& aEvent) |
718 void PluginWin::HandlePointerEventFromPluginL(const TPointerEvent& aEvent) |
716 { |
719 { |
717 CBrCtl* brCtl = control(m_pluginskin->frame()); |
720 CBrCtl* brCtl = control(m_pluginskin->frame()); |
718 WebView* view = brCtl->webView(); |
721 WebView* view = brCtl->webView(); |
719 TPointerEvent event(aEvent); |
722 #ifdef BRDO_MULTITOUCH_ENABLED_FF |
|
723 if (aEvent.IsAdvancedPointerEvent()) { |
|
724 TAdvancedPointerEvent tadvp = *(static_cast<const TAdvancedPointerEvent *>(&aEvent)); |
|
725 if (!StaticObjectsContainer::instance()->isPluginFullscreen()) { |
|
726 tadvp.iPosition = aEvent.iPosition - view->PositionRelativeToScreen(); |
|
727 } |
|
728 view->pointerEventHandler()->HandlePointerEventL(tadvp); |
|
729 } |
|
730 else { |
|
731 #endif |
|
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 { |
|
745 TBool ret = EFalse; |
720 |
746 |
721 if (!StaticObjectsContainer::instance()->isPluginFullscreen()) { |
747 TGestureEvent eventForPlugin; |
722 event.iPosition = aEvent.iPosition - view->PositionRelativeToScreen(); |
748 switch(aEvent.Code()) |
723 } |
749 { |
724 view->pointerEventHandler()->HandlePointerEventL(event); |
750 case EGestureUidUnknown : |
725 } |
751 eventForPlugin.SetCode(EGestureUnknown); |
726 |
752 break; |
727 |
753 case EGestureUidTouch : |
728 TBool PluginWin::HandleGesture(const TGestureEvent& aEvent) |
754 eventForPlugin.SetCode(EGestureStart); |
729 { |
755 break; |
730 TBool ret = EFalse; |
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 |
731 if (m_control) { |
784 if (m_control) { |
732 TGestureEvent gestEvent(aEvent); |
|
733 CBrCtl* brCtl = control(m_pluginskin->frame()); |
785 CBrCtl* brCtl = control(m_pluginskin->frame()); |
734 WebView* view = brCtl->webView(); |
786 WebView* view = brCtl->webView(); |
735 TPoint newPos = aEvent.CurrentPos(); |
787 TPoint newPos = aEvent.CurrentPos(); |
736 TPoint startPos = aEvent.StartPos(); |
788 // Not sure plugins need the start position of the gesture. Not inlcuded in the new struct |
|
789 TPoint startPos = aEvent.CurrentPos(); |
737 TPoint viewPos = view->PositionRelativeToScreen(); |
790 TPoint viewPos = view->PositionRelativeToScreen(); |
738 TPoint ctrlPos = m_control->PositionRelativeToScreen(); |
791 TPoint ctrlPos = m_control->PositionRelativeToScreen(); |
739 |
792 |
740 if (!StaticObjectsContainer::instance()->isPluginFullscreen()) { |
793 if (!StaticObjectsContainer::instance()->isPluginFullscreen()) { |
741 // adjust the position to make it relative to top left corner of |
794 // adjust the position to make it relative to top left corner of |
742 newPos += viewPos; |
795 newPos += viewPos; |
743 startPos += viewPos; |
796 startPos += viewPos; |
744 gestEvent.SetCurrentPos(newPos); |
797 } |
745 gestEvent.SetStartPos(startPos); |
798 eventForPlugin.SetCurrentPos(newPos); |
746 } |
799 eventForPlugin.SetStartPos(startPos); |
747 |
800 if (StaticObjectsContainer::instance()->isPluginFullscreen() || |
748 if (StaticObjectsContainer::instance()->isPluginFullscreen() || |
|
749 m_control->Rect().Contains(newPos - ctrlPos)) { |
801 m_control->Rect().Contains(newPos - ctrlPos)) { |
750 NPEvent event; |
802 NPEvent event; |
751 NPEventPointer ev; |
803 NPEventPointer ev; |
752 event.event = ENppEventPointer; |
804 event.event = ENppEventPointer; |
753 ev.reserved = &gestEvent; |
805 ev.reserved = &eventForPlugin; |
754 ev.pointerEvent = NULL; |
806 ev.pointerEvent = NULL; |
755 event.param = &ev; |
807 event.param = &ev; |
756 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
808 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
757 static_cast<void*>(&event)); |
809 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 } |
758 } |
817 } |
759 } |
818 } |
760 else if(!m_windowedPlugin && m_pluginskin->getNPPluginFucs() && m_pluginskin->getNPPluginFucs()->event){ |
819 else if(!m_windowedPlugin && m_pluginskin->getNPPluginFucs() && m_pluginskin->getNPPluginFucs()->event){ |
761 TRect cliprect = m_pluginskin->getClipRect(); |
820 TRect cliprect = m_pluginskin->getClipRect(); |
762 TPoint newpos = aEvent.CurrentPos(); |
821 TPoint newPos = aEvent.CurrentPos(); |
763 if(cliprect.Contains(newpos)){ |
822 eventForPlugin.SetCurrentPos(newPos); |
764 TGestureEvent gestEvent(aEvent); |
823 eventForPlugin.SetCurrentPos(newPos); |
|
824 |
|
825 if(cliprect.Contains(newPos)){ |
765 NPEvent event; |
826 NPEvent event; |
766 NPEventPointer ev; |
827 NPEventPointer ev; |
767 event.event = ENppEventPointer; |
828 event.event = ENppEventPointer; |
768 ev.reserved = &gestEvent; |
829 ev.reserved = &eventForPlugin; |
769 ev.pointerEvent = NULL; |
830 ev.pointerEvent = NULL; |
770 event.param = &ev; |
831 event.param = &ev; |
771 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
832 ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), |
772 static_cast<void*>(&event)); |
833 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 } |
773 } |
841 } |
774 } |
842 } |
775 return ret; |
843 return ret; |
776 |
844 |
777 } |
845 } |