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