|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Main classes for Graphics Out of Memory Monitor |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <akneiksrvc.h> |
|
20 #include <apgwgnam.h> |
|
21 #include "goomwserveventreceiver.h" |
|
22 #include "goommemorymonitor.h" |
|
23 #include "goomtraces.h" |
|
24 #include "goomconstants.hrh" |
|
25 |
|
26 CWservEventReceiver::CWservEventReceiver(CMemoryMonitor& aMonitor, RWsSession& aWs) |
|
27 : CActive(CActive::EPriorityStandard), iMonitor(aMonitor), iWs(aWs), iWg(aWs) |
|
28 { |
|
29 FUNC_LOG; |
|
30 |
|
31 CActiveScheduler::Add(this); |
|
32 } |
|
33 |
|
34 CWservEventReceiver::~CWservEventReceiver() |
|
35 { |
|
36 FUNC_LOG; |
|
37 |
|
38 Cancel(); |
|
39 iWg.Close(); |
|
40 } |
|
41 |
|
42 void CWservEventReceiver::ConstructL() |
|
43 { |
|
44 FUNC_LOG; |
|
45 |
|
46 User::LeaveIfError(iWg.Construct((TUint32)this, EFalse)); |
|
47 iWg.SetOrdinalPosition(0, ECoeWinPriorityNeverAtFront); |
|
48 iWg.EnableFocusChangeEvents(); |
|
49 iWg.AutoForeground(EFalse); |
|
50 iWg.EnableReceiptOfFocus(EFalse); |
|
51 |
|
52 // first aid for triggering poll |
|
53 //iWg.EnableGroupChangeEvents(); |
|
54 Queue(); |
|
55 } |
|
56 |
|
57 void CWservEventReceiver::Queue() |
|
58 { |
|
59 FUNC_LOG; |
|
60 |
|
61 iWs.EventReady(&iStatus); |
|
62 SetActive(); |
|
63 } |
|
64 |
|
65 void CWservEventReceiver::DoCancel() |
|
66 { |
|
67 FUNC_LOG; |
|
68 |
|
69 iWs.EventReadyCancel(); |
|
70 } |
|
71 |
|
72 void CWservEventReceiver::RunL() |
|
73 { |
|
74 FUNC_LOG; |
|
75 |
|
76 TWsEvent event; |
|
77 iWs.GetEvent(event); |
|
78 if (event.Type() == EEventFocusGroupChanged || event.Type() == EEventWindowGroupsChanged ) |
|
79 { |
|
80 // The following is done in order to avoid changing application threshholds when fastswap is activated |
|
81 // 1) get the new focused app's details |
|
82 // 2) we check to see if the fastswap uid caused the change |
|
83 // 3a) If it didn't we proceed as normal: handleFocusedWgChangeL is called |
|
84 // 3b) If not, we skip handleFocusedWgChangeL |
|
85 CApaWindowGroupName* aWgName = CApaWindowGroupName::NewLC(iWs, iWs.GetFocusWindowGroup()); |
|
86 if(aWgName->AppUid() != KUidFastSwap) |
|
87 { |
|
88 iMonitor.HandleFocusedWgChangeL(aWgName->AppUid().iUid); |
|
89 } |
|
90 CleanupStack::PopAndDestroy(aWgName); |
|
91 } |
|
92 |
|
93 Queue(); |
|
94 } |