29 //INCLUDE |
29 //INCLUDE |
30 #include "peninputanim.h" |
30 #include "peninputanim.h" |
31 #include "peninputcmdparam.h" |
31 #include "peninputcmdparam.h" |
32 #include "peninputcmdparamext.h" |
32 #include "peninputcmdparamext.h" |
33 #include "peninputcmd.h" |
33 #include "peninputcmd.h" |
34 // Modify for bug ETMA-7X2C5Y begin |
|
35 #include "penpointereventsuppressor.h" |
34 #include "penpointereventsuppressor.h" |
36 // Modify for bug ETMA-7X2C5Y end |
|
37 // ----------- Touch feedback additions start |
35 // ----------- Touch feedback additions start |
38 #ifdef RD_TACTILE_FEEDBACK |
36 #ifdef RD_TACTILE_FEEDBACK |
39 #include <coecntrl.h> |
37 #include <coecntrl.h> |
40 #include <tactilefeedbackserver.h> |
38 #include <tactilefeedbackserver.h> |
41 #include <featmgr.h> |
39 #include <featmgr.h> |
42 #endif //RD_TACTILE_FEEDBACK |
40 #endif //RD_TACTILE_FEEDBACK |
43 // ----------- Touch feedback additions start |
41 // ----------- Touch feedback additions start |
44 |
42 |
45 #include <avkondomainpskeys.h> |
43 #include <avkondomainpskeys.h> |
46 //CONSTANT |
44 //CONSTANT |
47 const TInt KMsgSlot1 = 1; //msg slot 2 in IPC |
45 const TInt KMsgSlot1 = 1; //msg slot 2 in IPC |
48 const TInt KMsgSlot2 = 2; //msg slot 2 in IPC |
46 const TInt KMsgSlot2 = 2; //msg slot 2 in IPC |
49 const TInt KFlushTimerPeriod = 1000; //1/1000 second |
47 const TInt KFlushTimerPeriod = 1000 * 10; //1/100 second |
50 const TInt KResponseQueueWaitTime = 100000; //1/10 second |
48 const TInt KResponseQueueWaitTime = 100000; //1/10 second |
51 |
49 |
52 // ======== GLOBAL FUNCTIONS ======== |
50 // ======== GLOBAL FUNCTIONS ======== |
53 |
51 |
54 // --------------------------------------------------------------------------- |
52 // --------------------------------------------------------------------------- |
55 // CreateCAnimDllL |
53 // CreateCAnimDllL |
83 // Constructor |
81 // Constructor |
84 // --------------------------------------------------------------------------- |
82 // --------------------------------------------------------------------------- |
85 // |
83 // |
86 CPeninputAnim::CPeninputAnim() |
84 CPeninputAnim::CPeninputAnim() |
87 { |
85 { |
88 iIsActive = EFalse; |
86 iIsActive = EFalse; |
89 //iSpritePosition and iSpriteSize are initialized to 0 by default constructor |
87 //iSpritePosition and iSpriteSize are initialized to 0 by default constructor |
90 //iSpritePosition = TPoint(0, 0); |
88 //iSpritePosition = TPoint(0, 0); |
91 //iSpriteSize = TSize(0, 0); |
89 //iSpriteSize = TSize(0, 0); |
92 iIsPointerCaptured = EFalse; |
90 iIsPointerCaptured = EFalse; |
93 iIsPenDown = EFalse; |
91 iIsPenDown = EFalse; |
94 |
92 |
95 iPrimaryTouchPtNum = 0; |
93 iPrimaryTouchPtNum = 0; |
96 iPrimaryTouchPtDetected = EFalse; |
94 iPrimaryTouchPtDetected = EFalse; |
97 |
95 |
98 |
96 |
99 #ifdef RD_TACTILE_FEEDBACK |
97 #ifdef RD_TACTILE_FEEDBACK |
100 TRAPD( err, FeatureManager::InitializeLibL() ); |
98 TRAPD( err, FeatureManager::InitializeLibL() ); |
101 if( err == KErrNone ) |
99 if( err == KErrNone ) |
102 { |
100 { |
103 iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ); |
101 iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ); |
104 } |
102 } |
105 iFeedback = MTactileFeedbackServer::Instance(); |
103 iFeedback = MTactileFeedbackServer::Instance(); |
106 #endif // RD_TACTILE_FEEDBACK |
104 #endif // RD_TACTILE_FEEDBACK |
107 |
105 |
108 iEnableSprite = ETrue; |
106 iEnableSprite = ETrue; |
109 iDSAState = EFalse; |
107 iDSAState = EFalse; |
110 } |
108 } |
111 |
109 |
112 // --------------------------------------------------------------------------- |
110 // --------------------------------------------------------------------------- |
113 // CPeninputAnim::~CPeninputAnim |
111 // CPeninputAnim::~CPeninputAnim |
114 // Destructor |
112 // Destructor |
115 // --------------------------------------------------------------------------- |
113 // --------------------------------------------------------------------------- |
116 // |
114 // |
117 CPeninputAnim::~CPeninputAnim() |
115 CPeninputAnim::~CPeninputAnim() |
118 { |
116 { |
119 Deactivate(); |
117 Deactivate(); |
120 |
118 |
121 iMsgBufQueue.Close(); |
119 iMsgBufQueue.Close(); |
122 iKeyMsgResponseQueue.Close(); |
120 iKeyMsgResponseQueue.Close(); |
123 iResponseQueueSemaphore.Close(); |
121 iResponseQueueSemaphore.Close(); |
124 |
122 |
125 delete iFlushTimer; |
123 delete iFlushTimer; |
126 #ifdef RD_TACTILE_FEEDBACK |
124 #ifdef RD_TACTILE_FEEDBACK |
127 FeatureManager::UnInitializeLib(); |
125 FeatureManager::UnInitializeLib(); |
128 iTactileControl.Close(); |
126 iTactileControl.Close(); |
129 iBackupTactileControl.Close(); |
127 iBackupTactileControl.Close(); |
130 #endif // RD_TACTILE_FEEDBACK |
128 #endif // RD_TACTILE_FEEDBACK |
131 // Modify for bug ETMA-7X2C5Y begin |
129 delete iPointerEventSuppressor; |
132 delete iPointerEventSuppressor; |
|
133 // Modify for bug ETMA-7X2C5Y end |
|
134 if (iDiscreetPopSubscriber) |
|
135 { |
|
136 iDiscreetPopSubscriber->StopSubscribe(); |
|
137 } |
|
138 iDiscreetPopProperty.Close(); |
|
139 delete iDiscreetPopSubscriber; |
|
140 iAknUiSrv.Close(); |
|
141 } |
130 } |
142 |
131 |
143 // --------------------------------------------------------------------------- |
132 // --------------------------------------------------------------------------- |
144 // CPeninputAnim::ConstructL |
133 // CPeninputAnim::ConstructL |
145 // Second phase constructor |
134 // Second phase constructor |
146 // --------------------------------------------------------------------------- |
135 // --------------------------------------------------------------------------- |
147 // |
136 // |
148 void CPeninputAnim::ConstructL(TAny* /*aParameters*/) |
137 void CPeninputAnim::ConstructL(TAny* /*aParameters*/) |
149 { |
138 { |
150 // the animation feature is not used |
139 // the animation feature is not used |
151 iFunctions->SetInterval(0); |
140 iFunctions->SetInterval(0); |
152 iFlushTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
141 iFlushTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
153 |
142 |
154 iFunctions->RegisterForNotifications(EDirectScreenAccess); |
143 iFunctions->RegisterForNotifications(EDirectScreenAccess); |
155 // Modify for bug ETMA-7X2C5Y begin |
|
156 iPointerEventSuppressor = CPenPointerEventSuppressor::NewL(); |
144 iPointerEventSuppressor = CPenPointerEventSuppressor::NewL(); |
157 // Modify for bug ETMA-7X2C5Y end |
|
158 User::LeaveIfError(iDiscreetPopProperty.Attach(KPSUidAvkonDomain, |
|
159 KAknGlobalDiscreetPopupNumChanged)); |
|
160 iDiscreetPopSubscriber = new (ELeave) CSubscriber( |
|
161 TCallBack( DiscreetPopChangeNotification, this), |
|
162 iDiscreetPopProperty); |
|
163 iDiscreetPopSubscriber->SubscribeL(); |
|
164 |
|
165 User::LeaveIfError(iAknUiSrv.Connect()); |
|
166 iDiscreetPopArea = iAknUiSrv.GetInUseGlobalDiscreetPopupRect(); |
|
167 if(iDiscreetPopArea.Size().iWidth > 0) |
|
168 { |
|
169 iDiscreetPoped = ETrue; |
|
170 } |
|
171 } |
145 } |
172 |
146 |
173 |
147 |
174 // --------------------------------------------------------------------------- |
148 // --------------------------------------------------------------------------- |
175 // CPeninputAnim::Animate |
149 // CPeninputAnim::Animate |
402 iTactileControl[idx].iArea = area.iNewRect; |
385 iTactileControl[idx].iArea = area.iNewRect; |
403 } |
386 } |
404 } |
387 } |
405 break; |
388 break; |
406 case EPeninputOpChangeFeedbackType: |
389 case EPeninputOpChangeFeedbackType: |
407 { |
390 { |
408 PanicClientIfNoParam(aParams); |
391 PanicClientIfNoParam(aParams); |
409 TTactileFeedbackArea area = *(static_cast<TTactileFeedbackArea*>(aParams)); |
392 TTactileFeedbackArea area = *(static_cast<TTactileFeedbackArea*>(aParams)); |
410 TTactileControlInfo controlitem(area.iId, area.iNewRect, area.iTactileType); |
393 TTactileControlInfo controlitem(area.iId, area.iNewRect, area.iTactileType); |
411 TInt idx = iTactileControl.Find(controlitem, |
394 TInt idx = iTactileControl.Find(controlitem, |
412 TIdentityRelation<TTactileControlInfo>(CPeninputAnim::MatchItemByControlID)); |
395 TIdentityRelation<TTactileControlInfo>(CPeninputAnim::MatchItemByControlID)); |
413 if(idx != KErrNotFound) |
396 if(idx != KErrNotFound) |
414 { |
397 { |
415 //change the tactile type |
398 //change the tactile type |
416 iTactileControl[idx].iTactileType = area.iTactileType; |
399 iTactileControl[idx].iTactileType = area.iTactileType; |
417 } |
400 } |
418 } |
401 } |
419 break; |
402 break; |
420 #endif // RD_TACTILE_FEEDBACK |
403 #endif // RD_TACTILE_FEEDBACK |
421 case EPeninputOpEnalbeSprite: |
404 case EPeninputOpEnalbeSprite: |
422 { |
405 { |
423 PanicClientIfNoParam(aParams); |
406 PanicClientIfNoParam(aParams); |
519 break; |
502 break; |
520 |
503 |
521 case EPeninputOpCapturePointer: |
504 case EPeninputOpCapturePointer: |
522 { |
505 { |
523 TInt captureCtrlID; |
506 TInt captureCtrlID; |
524 TPckg<TBool> msgData(iIsPointerCaptured); |
507 TPckg<TBool> msgData(iIsPointerCaptured); |
525 TPckg<TInt> msgCaptureCtrlIDData(captureCtrlID); |
508 TPckg<TInt> msgCaptureCtrlIDData(captureCtrlID); |
526 |
509 |
527 msg->ReadL(KMsgSlot1,msgData); |
510 msg->ReadL(KMsgSlot1,msgData); |
528 msg->ReadL(KMsgSlot2,msgCaptureCtrlIDData); |
511 msg->ReadL(KMsgSlot2,msgCaptureCtrlIDData); |
529 #ifdef RD_TACTILE_FEEDBACK |
512 #ifdef RD_TACTILE_FEEDBACK |
530 // When pointer is captured by some ctrl, |
513 // When pointer is captured by some ctrl, |
531 // only the captured ctrl has tactile feedback ablity, |
514 // only the captured ctrl has tactile feedback ablity, |
532 // disable all other one's. |
515 // disable all other one's. |
533 if (iIsPointerCaptured) |
516 if (iIsPointerCaptured) |
534 { |
517 { |
535 // Back up all the tactile area |
518 // Back up all the tactile area |
536 iBackupTactileControl.Reset(); |
519 iBackupTactileControl.Reset(); |
537 TInt count = iTactileControl.Count(); |
520 TInt count = iTactileControl.Count(); |
538 for(TInt i = 0; i < count; ++i) |
521 for(TInt i = 0; i < count; ++i) |
539 { |
522 { |
540 iBackupTactileControl.Append(iTactileControl[i]); |
523 iBackupTactileControl.Append(iTactileControl[i]); |
541 } |
524 } |
542 |
525 |
543 // Clean up the original tactile area |
526 // Clean up the original tactile area |
544 iTactileControl.Reset(); |
527 iTactileControl.Reset(); |
545 |
528 |
546 // Find the captured ctrl, restore its tactile ablity |
529 // Find the captured ctrl, restore its tactile ablity |
547 for(TInt i = 0; i < count; ++i) |
530 for(TInt i = 0; i < count; ++i) |
548 { |
531 { |
549 if (iBackupTactileControl[i].iId == captureCtrlID) |
532 if (iBackupTactileControl[i].iId == captureCtrlID) |
550 { |
533 { |
551 iTactileControl.Append(iBackupTactileControl[i]); |
534 iTactileControl.Append(iBackupTactileControl[i]); |
552 } |
535 } |
553 } |
536 } |
554 |
537 |
555 } |
538 } |
556 // When pointer released captured, |
539 // When pointer released captured, |
557 // restore all original tactile area. |
540 // restore all original tactile area. |
558 else |
541 else |
559 { |
542 { |
560 if (iBackupTactileControl.Count() != 0) |
543 if (iBackupTactileControl.Count() != 0) |
561 { |
544 { |
562 iTactileControl.Reset(); |
545 iTactileControl.Reset(); |
563 |
546 |
564 TInt count = iBackupTactileControl.Count(); |
547 TInt count = iBackupTactileControl.Count(); |
565 for(TInt i = 0; i < count; ++i) |
548 for(TInt i = 0; i < count; ++i) |
566 { |
549 { |
567 iTactileControl.Append(iBackupTactileControl[i]); |
550 iTactileControl.Append(iBackupTactileControl[i]); |
568 } |
551 } |
569 iBackupTactileControl.Reset(); |
552 iBackupTactileControl.Reset(); |
570 } |
553 } |
571 } |
554 } |
572 #endif |
555 #endif |
573 } |
556 } |
574 break; |
557 break; |
575 case EPeninputOpLayoutSizeChangedWithSize: |
558 case EPeninputOpLayoutSizeChangedWithSize: |
576 { |
559 { |
577 TPckg<TSize> msgData(iSpriteSize); |
560 TPckg<TSize> msgData(iSpriteSize); |
721 // Makes PENINPUT window visible |
712 // Makes PENINPUT window visible |
722 // --------------------------------------------------------------------------- |
713 // --------------------------------------------------------------------------- |
723 // |
714 // |
724 void CPeninputAnim::Activate() |
715 void CPeninputAnim::Activate() |
725 { |
716 { |
726 if(!iIsActive) |
717 if(!iIsActive) |
727 { |
718 { |
728 iSpriteFunctions->SetPosition(iSpritePosition); |
719 iSpriteFunctions->SetPosition(iSpritePosition); |
729 if(iEnableSprite) |
720 if(iEnableSprite) |
730 iSpriteFunctions->Activate(ETrue); |
721 iSpriteFunctions->Activate(ETrue); |
731 iFunctions->GetRawEvents(ETrue); |
722 iFunctions->GetRawEvents(ETrue); |
732 iIsActive = ETrue; |
723 iIsActive = ETrue; |
733 |
724 } |
734 StartTimer(); |
|
735 } |
|
736 } |
725 } |
737 |
726 |
738 // --------------------------------------------------------------------------- |
727 // --------------------------------------------------------------------------- |
739 // CPeninputAnim::Deactivate |
728 // CPeninputAnim::Deactivate |
740 // Makes PENINPUT window invisible |
729 // Makes PENINPUT window invisible |
741 // --------------------------------------------------------------------------- |
730 // --------------------------------------------------------------------------- |
742 // |
731 // |
743 void CPeninputAnim::Deactivate() |
732 void CPeninputAnim::Deactivate() |
744 { |
733 { |
745 if(iIsActive) |
734 if(iIsActive) |
746 { |
735 { |
747 if(iEnableSprite) |
736 if(iEnableSprite) |
748 iSpriteFunctions->Activate(EFalse); |
737 iSpriteFunctions->Activate(EFalse); |
749 iFunctions->GetRawEvents(EFalse); |
738 iFunctions->GetRawEvents(EFalse); |
750 iIsActive = EFalse; |
739 iIsActive = EFalse; |
751 |
740 |
752 StopTimer(); |
741 StopTimer(); |
753 } |
742 } |
754 } |
743 } |
755 |
744 |
756 #ifdef RD_TACTILE_FEEDBACK |
745 #ifdef RD_TACTILE_FEEDBACK |
757 // --------------------------------------------------------------------------- |
746 // --------------------------------------------------------------------------- |
758 // CPeninputAnim::DoTactileFeedBack |
747 // CPeninputAnim::DoTactileFeedBack |
759 // Give tactile feedback |
748 // Give tactile feedback |
760 // --------------------------------------------------------------------------- |
749 // --------------------------------------------------------------------------- |
761 // |
750 // |
762 void CPeninputAnim::DoTactileFeedBack(const TPoint& aPos) |
751 void CPeninputAnim::DoTactileFeedBack(const TPoint& aPos) |
763 { |
752 { |
764 if ( iFeedback ) |
753 if ( iFeedback ) |
765 { |
754 { |
766 TInt count = iTactileControl.Count(); |
755 TInt count = iTactileControl.Count(); |
784 // --------------------------------------------------------------------------- |
773 // --------------------------------------------------------------------------- |
785 // |
774 // |
786 |
775 |
787 TBool CPeninputAnim::OnRawButton1Down(const TRawEvent& aRawEvent) |
776 TBool CPeninputAnim::OnRawButton1Down(const TRawEvent& aRawEvent) |
788 { |
777 { |
789 if(iIsSimulatedEvent) |
778 if(iIsSimulatedEvent) |
790 { |
779 { |
791 return EFalse; |
780 return EFalse; |
792 } |
781 } |
793 |
782 |
794 if(iDirty ) |
783 |
795 { |
784 if(iDiscreetPoped && iDiscreetPopArea.Contains(aRawEvent.Pos())) |
796 Refresh(); |
785 { |
797 } |
786 iDiscreetPopedCapture = ETrue; |
798 |
787 return EFalse; |
799 if(iDiscreetPoped && iDiscreetPopArea.Contains(aRawEvent.Pos())) |
788 } |
800 { |
789 TRect rect(iSpritePosition, iSpriteSize); |
801 iDiscreetPopedCapture = ETrue; |
790 if(rect.Contains(aRawEvent.Pos())) |
802 return EFalse; |
791 { |
803 } |
792 #ifdef RD_TACTILE_FEEDBACK |
804 TRect rect(iSpritePosition, iSpriteSize); |
793 //give tactile feedback |
805 if(rect.Contains(aRawEvent.Pos())) |
794 if(iTactileSupported) |
806 { |
|
807 #ifdef RD_TACTILE_FEEDBACK |
|
808 //give tactile feedback |
|
809 if(iTactileSupported) |
|
810 DoTactileFeedBack(aRawEvent.Pos() - rect.iTl); |
795 DoTactileFeedBack(aRawEvent.Pos() - rect.iTl); |
811 #endif // RD_TACTILE_FEEDBACK |
796 #endif // RD_TACTILE_FEEDBACK |
812 iIsPenDown = ETrue; |
797 iIsPenDown = ETrue; |
813 PostRawEvent(aRawEvent); |
798 |
814 return ETrue; |
799 // When button downing event is happened, iIsMove is reset to EFalse |
815 } |
800 iIsMove = EFalse; |
816 |
801 |
817 if(iIsPointerCaptured) |
802 // Recording pointer that button is pressing down in at this time |
818 { |
803 iPointerDown = aRawEvent.Pos(); |
819 PostRawEvent(aRawEvent); |
804 // |
820 return ETrue; |
805 |
821 } |
806 PostRawEvent(aRawEvent); |
822 |
807 return ETrue; |
823 //pointer outside of input area,inform layout |
808 } |
824 SendRawEvent(aRawEvent); |
809 |
825 |
810 if(iIsPointerCaptured) |
826 return EFalse; |
811 { |
|
812 PostRawEvent(aRawEvent); |
|
813 return ETrue; |
|
814 } |
|
815 |
|
816 //pointer outside of input area,inform layout |
|
817 SendRawEvent(aRawEvent); |
|
818 |
|
819 return EFalse; |
827 } |
820 } |
828 |
821 |
829 TBool CPeninputAnim::OnRawButton1Up(const TRawEvent& aRawEvent) |
822 TBool CPeninputAnim::OnRawButton1Up(const TRawEvent& aRawEvent) |
830 { |
823 { |
831 if(iIsSimulatedEvent) |
824 if(iIsSimulatedEvent) |
832 { |
825 { |
833 return EFalse; |
826 return EFalse; |
834 } |
827 } |
835 |
828 |
836 //For discreetPop |
829 //For discreetPop |
837 if(iDiscreetPopedCapture ) |
830 if(iDiscreetPopedCapture ) |
838 { |
831 { |
839 iDiscreetPopedCapture = EFalse; |
832 iDiscreetPopedCapture = EFalse; |
840 return EFalse; |
833 return EFalse; |
841 } |
834 } |
842 if(iIsPenDown) |
835 if(iIsPenDown) |
843 { |
836 { |
844 iIsPenDown = EFalse; |
837 |
845 |
838 // When the control key pressing down in is different with the control key pressing up |
846 TRect rect(iSpritePosition, iSpriteSize); |
839 // and pointer moving event isn¡¯t happened, |
847 if(rect.Contains(aRawEvent.Pos())) |
840 // pointer moving event will is supplied |
848 { |
841 if(iPointerDown != aRawEvent.Pos() && !iIsMove) |
849 //send pen up event immediately |
842 { |
850 SendRawEvent(aRawEvent); |
843 TRawEvent rawEvent = aRawEvent; |
851 return ETrue; |
844 rawEvent.Set( TRawEvent::EPointerMove ); |
852 } |
845 OnRawPointerMove(rawEvent); |
853 } |
846 } |
854 |
847 // |
855 if(iIsPointerCaptured) |
848 |
856 { |
849 iIsPenDown = EFalse; |
857 PostRawEvent(aRawEvent); |
850 |
858 return ETrue; |
851 TRect rect(iSpritePosition, iSpriteSize); |
859 } |
852 if(rect.Contains(aRawEvent.Pos())) |
860 |
853 { |
861 //pointer outside of input area,inform layout |
854 //send pen up event immediately |
862 SendRawEvent(aRawEvent); |
855 SendRawEvent(aRawEvent); |
863 |
856 |
864 return EFalse; |
857 // When key pressing up event is completed, iIsMove is reset to EFalse. |
|
858 iIsMove = EFalse; |
|
859 // |
|
860 |
|
861 return ETrue; |
|
862 } |
|
863 } |
|
864 |
|
865 if(iIsPointerCaptured) |
|
866 { |
|
867 PostRawEvent(aRawEvent); |
|
868 return ETrue; |
|
869 } |
|
870 |
|
871 //pointer outside of input area,inform layout |
|
872 SendRawEvent(aRawEvent); |
|
873 |
|
874 return EFalse; |
865 } |
875 } |
866 |
876 |
867 TBool CPeninputAnim::OnRawPointerMove(const TRawEvent& aRawEvent) |
877 TBool CPeninputAnim::OnRawPointerMove(const TRawEvent& aRawEvent) |
868 { |
878 { |
869 if(iIsSimulatedEvent) |
879 if(iIsSimulatedEvent) |
870 { |
880 { |
871 return EFalse; |
881 return EFalse; |
872 } |
882 } |
873 if(iDiscreetPopedCapture) |
883 if(iDiscreetPopedCapture) |
874 { |
884 { |
875 return EFalse; |
885 return EFalse; |
876 } |
886 } |
877 #ifdef RD_TACTILE_FEEDBACK |
887 #ifdef RD_TACTILE_FEEDBACK |
878 TRect rect(iSpritePosition, iSpriteSize); |
888 TRect rect(iSpritePosition, iSpriteSize); |
879 if( iIsPenDown && iIsPointerCaptured) |
889 if( iIsPenDown && iIsPointerCaptured) |
880 { |
890 { |
881 //give tactile feedback |
891 //give tactile feedback |
882 |
892 // When pointer moving event is happened, iIsMove is set to ETrue |
883 PostRawEvent(aRawEvent); |
893 iIsMove = ETrue; |
884 return ETrue; |
894 // |
885 } |
895 |
886 #endif // RD_TACTILE_FEEDBACK |
896 PostRawEvent(aRawEvent); |
887 |
897 return ETrue; |
888 if(iIsPointerCaptured || iIsPenDown) |
898 } |
889 { |
899 #endif // RD_TACTILE_FEEDBACK |
890 PostRawEvent(aRawEvent); |
900 |
891 return ETrue; |
901 if(iIsPointerCaptured || iIsPenDown) |
892 } |
902 { |
893 |
903 // When pointer moving event is happened, iIsMove is set to ETrue |
894 return EFalse; |
904 iIsMove = ETrue; |
|
905 // |
|
906 |
|
907 PostRawEvent(aRawEvent); |
|
908 return ETrue; |
|
909 } |
|
910 |
|
911 return EFalse; |
895 } |
912 } |
896 |
913 |
897 // --------------------------------------------------------------------------- |
914 // --------------------------------------------------------------------------- |
898 // CPeninputAnim::SetPosition |
915 // CPeninputAnim::SetPosition |
899 // called when sprite has been moved |
916 // called when sprite has been moved |
900 // --------------------------------------------------------------------------- |
917 // --------------------------------------------------------------------------- |
901 // |
918 // |
902 |
919 |
903 TPoint CPeninputAnim::SetPosition(const TPoint& aNewPos) |
920 TPoint CPeninputAnim::SetPosition(const TPoint& aNewPos) |
904 { |
921 { |
905 if(aNewPos != iSpritePosition) |
922 if(aNewPos != iSpritePosition) |
906 { |
923 { |
907 iSpritePosition = aNewPos; |
924 iSpritePosition = aNewPos; |
908 iSpriteFunctions->SetPosition(iSpritePosition); |
925 iSpriteFunctions->SetPosition(iSpritePosition); |
909 } |
926 } |
910 return iSpritePosition; |
927 return iSpritePosition; |
911 } |
928 } |
912 |
929 |
913 // --------------------------------------------------------------------------- |
930 // --------------------------------------------------------------------------- |
914 // CPeninputAnim::UpdateArea |
931 // CPeninputAnim::UpdateArea |
915 // Update sprite rect |
932 // Update sprite rect |
916 // --------------------------------------------------------------------------- |
933 // --------------------------------------------------------------------------- |
917 // |
934 // |
918 void CPeninputAnim::UpdateArea(const TRect& aRect, TBool aFullUpdate) |
935 void CPeninputAnim::UpdateArea(const TRect& aRect, TBool aFullUpdate) |
919 { |
936 { |
920 if(iIsActive) |
937 if(iIsActive) |
921 { |
938 { |
922 // if function is called without specifying the parameter aRect |
939 // if function is called without specifying the parameter aRect |
923 // (using default param value) the whole area drawn to is updated |
940 // (using default param value) the whole area drawn to is updated |
924 iSpriteFunctions->UpdateMember(0, aRect, aFullUpdate); |
941 iSpriteFunctions->UpdateMember(0, aRect, aFullUpdate); |
925 } |
942 } |
926 } |
943 } |
927 |
944 |
928 // --------------------------------------------------------------------------- |
945 // --------------------------------------------------------------------------- |
929 // CPeninputAnim::TimerCallBack |
946 // CPeninputAnim::TimerCallBack |
991 // Wait until it's processed or timer out |
1008 // Wait until it's processed or timer out |
992 // --------------------------------------------------------------------------- |
1009 // --------------------------------------------------------------------------- |
993 // |
1010 // |
994 TBool CPeninputAnim::OnRawKeyEvent(const TRawEvent& aRawEvent) |
1011 TBool CPeninputAnim::OnRawKeyEvent(const TRawEvent& aRawEvent) |
995 { |
1012 { |
996 TInt ret = KErrNone; |
1013 TInt ret = KErrNone; |
997 |
1014 |
998 //first sends all buffered event out |
1015 //first sends all buffered event out |
999 FlushRawEventBuffer(); |
1016 FlushRawEventBuffer(); |
1000 |
1017 |
1001 //clear the signal and the response msg queue |
1018 //clear the signal and the response msg queue |
1002 TBool isHandled = EFalse; |
1019 TBool isHandled = EFalse; |
1003 ret = iKeyMsgResponseQueue.Receive(isHandled); |
1020 ret = iKeyMsgResponseQueue.Receive(isHandled); |
1004 while(ret == KErrNone) |
1021 while(ret == KErrNone) |
1005 { |
1022 { |
1006 iResponseQueueSemaphore.Wait(); |
1023 iResponseQueueSemaphore.Wait(); |
1007 ret = iKeyMsgResponseQueue.Receive(isHandled); |
1024 ret = iKeyMsgResponseQueue.Receive(isHandled); |
1008 } |
1025 } |
1009 |
1026 |
1010 //send the event directly |
1027 //send the event directly |
1011 iEventBuffer.iNum = 1; |
1028 iEventBuffer.iNum = 1; |
1012 iEventBuffer.iEvent[0] = aRawEvent; |
1029 iEventBuffer.iEvent[0] = aRawEvent; |
1013 ret = FlushRawEventBuffer(); |
1030 ret = FlushRawEventBuffer(); |
1014 |
1031 |
1015 isHandled = EFalse; |
1032 isHandled = EFalse; |
1016 if(ret == KErrNone) |
1033 if(ret == KErrNone) |
1017 { |
1034 { |
1018 //wait for the key event processed. |
1035 //wait for the key event processed. |
1019 ret = iResponseQueueSemaphore.Wait(KResponseQueueWaitTime); |
1036 ret = iResponseQueueSemaphore.Wait(KResponseQueueWaitTime); |
1020 if(ret == KErrNone) |
1037 if(ret == KErrNone) |
1021 { |
1038 { |
1022 //read the response from msg queue |
1039 //read the response from msg queue |
1023 iKeyMsgResponseQueue.Receive(isHandled); |
1040 iKeyMsgResponseQueue.Receive(isHandled); |
1024 } |
1041 } |
1025 } |
1042 } |
1026 |
1043 |
1027 return isHandled; |
1044 return isHandled; |
1028 } |
1045 } |
1029 |
1046 |
1032 // Initial and start timer |
1049 // Initial and start timer |
1033 // --------------------------------------------------------------------------- |
1050 // --------------------------------------------------------------------------- |
1034 // |
1051 // |
1035 void CPeninputAnim::StartTimer() |
1052 void CPeninputAnim::StartTimer() |
1036 { |
1053 { |
1037 iFlushTimer->Start( |
1054 if ( iIsActive && !iFlushTimer->IsActive()) |
1038 KFlushTimerPeriod, |
1055 { |
1039 KFlushTimerPeriod, |
1056 iFlushTimer->Start( |
1040 TCallBack(FlushTimerCallBack, this)); |
1057 KFlushTimerPeriod, |
1041 } |
1058 KFlushTimerPeriod, |
1042 |
1059 TCallBack(FlushTimerCallBack, this)); |
|
1060 } |
|
1061 } |
|
1062 |
1043 // --------------------------------------------------------------------------- |
1063 // --------------------------------------------------------------------------- |
1044 // CPeninputAnim::StopTimer |
1064 // CPeninputAnim::StopTimer |
1045 // Cancel timer |
1065 // Cancel timer |
1046 // --------------------------------------------------------------------------- |
1066 // --------------------------------------------------------------------------- |
1047 // |
1067 // |
1048 void CPeninputAnim::StopTimer() |
1068 void CPeninputAnim::StopTimer() |
1049 { |
1069 { |
1050 iFlushTimer->Cancel(); |
1070 iFlushTimer->Cancel(); |
|
1071 FlushRawEventBuffer(); |
1051 } |
1072 } |
1052 |
1073 |
1053 #ifdef RD_TACTILE_FEEDBACK |
1074 #ifdef RD_TACTILE_FEEDBACK |
1054 void CPeninputAnim::GetFeedbackAreaDataL(RArray<TTactileControlInfo>& aTactileControlArray, |
1075 void CPeninputAnim::GetFeedbackAreaDataL(RArray<TTactileControlInfo>& aTactileControlArray, |
1055 const RMessagePtr2* msg, |
1076 const RMessagePtr2* msg, |
1056 RArray<TRect>* aPrevRectArray) |
1077 RArray<TRect>* aPrevRectArray) |
1057 { |
1078 { |
1058 TInt num; |
1079 TInt num; |
1059 TPckg<TInt> numBuf(num); |
1080 TPckg<TInt> numBuf(num); |
1060 msg->ReadL(KMsgSlot1,numBuf); |
1081 msg->ReadL(KMsgSlot1,numBuf); |
1082 // CPeninputAnim::MatchItemByControlID |
1103 // CPeninputAnim::MatchItemByControlID |
1083 // Compare the Item by ID |
1104 // Compare the Item by ID |
1084 // --------------------------------------------------------------------------- |
1105 // --------------------------------------------------------------------------- |
1085 // |
1106 // |
1086 TBool CPeninputAnim::MatchItemByControlID (const TTactileControlInfo& aFirst, const TTactileControlInfo& aSecond) |
1107 TBool CPeninputAnim::MatchItemByControlID (const TTactileControlInfo& aFirst, const TTactileControlInfo& aSecond) |
1087 { |
1108 { |
1088 if (aFirst.iId == aSecond.iId) |
1109 if (aFirst.iId == aSecond.iId) |
1089 return ETrue; |
1110 return ETrue; |
1090 return EFalse; |
1111 return EFalse; |
1091 } |
1112 } |
1092 |
1113 |
1093 // --------------------------------------------------------------------------- |
1114 // --------------------------------------------------------------------------- |
1094 // CPeninputAnim::MatchItemByControlIDAndArea |
1115 // CPeninputAnim::MatchItemByControlIDAndArea |
1095 // Compare the Item by ID and Area |
1116 // Compare the Item by ID and Area |
1096 // --------------------------------------------------------------------------- |
1117 // --------------------------------------------------------------------------- |
1097 // |
1118 // |
1098 TBool CPeninputAnim::MatchItemByControlIDAndArea (const TTactileControlInfo& aFirst, const TTactileControlInfo& aSecond) |
1119 TBool CPeninputAnim::MatchItemByControlIDAndArea (const TTactileControlInfo& aFirst, const TTactileControlInfo& aSecond) |
1099 { |
1120 { |
1100 if ((aFirst.iId == aSecond.iId) && (aFirst.iArea == aSecond.iArea)) |
1121 if ((aFirst.iId == aSecond.iId) && (aFirst.iArea == aSecond.iArea)) |
1101 return ETrue; |
1122 return ETrue; |
1102 return EFalse; |
1123 return EFalse; |
1103 } |
1124 } |
1104 #endif // RD_TACTILE_FEEDBACK |
1125 #endif // RD_TACTILE_FEEDBACK |
1105 TInt CPeninputAnim::DiscreetPopChangeNotification(TAny* aObj) |
1126 |
1106 { |
1127 void CPeninputAnim::SetDiscreeptPop(TRect aArea) |
1107 if (aObj) |
1128 { |
1108 { |
1129 iDiscreetPopArea = aArea; |
1109 static_cast<CPeninputAnim*>(aObj)->HandleDiscreetPopNotification(); |
|
1110 return KErrNone; |
|
1111 } |
|
1112 else |
|
1113 { |
|
1114 return KErrArgument; |
|
1115 } |
|
1116 } |
|
1117 |
|
1118 void CPeninputAnim::Refresh() |
|
1119 { |
|
1120 iDiscreetPopArea = iAknUiSrv.GetInUseGlobalDiscreetPopupRect(); |
|
1121 if(iDiscreetPopArea.Size().iWidth > 0) |
1130 if(iDiscreetPopArea.Size().iWidth > 0) |
1122 { |
1131 { |
1123 iDiscreetPoped = ETrue; |
1132 iDiscreetPoped = ETrue; |
1124 } |
1133 } |
1125 else |
1134 else |
1126 { |
1135 { |
1127 iDiscreetPoped = EFalse; |
1136 iDiscreetPoped = EFalse; |
1128 iDiscreetPopedCapture = EFalse; |
1137 iDiscreetPopedCapture = EFalse; |
1129 } |
1138 } |
1130 iDirty = EFalse; |
|
1131 } |
|
1132 |
|
1133 void CPeninputAnim::HandleDiscreetPopNotification() |
|
1134 { |
|
1135 iDirty = ETrue; |
|
1136 } |
|
1137 |
|
1138 CSubscriber::CSubscriber(TCallBack aCallBack, RProperty& aProperty) |
|
1139 : |
|
1140 CActive(EPriorityNormal), iCallBack(aCallBack), iProperty(aProperty) |
|
1141 { |
|
1142 CActiveScheduler::Add(this); |
|
1143 } |
|
1144 |
|
1145 CSubscriber::~CSubscriber() |
|
1146 { |
|
1147 Cancel(); |
|
1148 } |
|
1149 |
|
1150 void CSubscriber::SubscribeL() |
|
1151 { |
|
1152 if (!IsActive()) |
|
1153 { |
|
1154 iProperty.Subscribe(iStatus); |
|
1155 SetActive(); |
|
1156 } |
|
1157 } |
|
1158 |
|
1159 void CSubscriber::StopSubscribe() |
|
1160 { |
|
1161 Cancel(); |
|
1162 } |
|
1163 |
|
1164 void CSubscriber::RunL() |
|
1165 { |
|
1166 if (iStatus.Int() == KErrNone) |
|
1167 { |
|
1168 iCallBack.CallBack(); |
|
1169 SubscribeL(); |
|
1170 } |
|
1171 } |
|
1172 |
|
1173 void CSubscriber::DoCancel() |
|
1174 { |
|
1175 iProperty.Cancel(); |
|
1176 } |
1139 } |
1177 // End of File |
1140 // End of File |