My favorites
▼
|
Sign in
jaikuengine-mobile-client
JaikuEngine Mobile Client
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
keyevents
/
client.cpp
r21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// Copyright (c) 2007-2009 Google Inc.
// Copyright (c) 2006-2007 Jaiku Ltd.
// Copyright (c) 2002-2006 Mika Raento and Renaud Petit
//
// This software is licensed at your choice under either 1 or 2 below.
//
// 1. MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// 2. Gnu General Public license 2.0
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//
// This file is part of the JaikuEngine mobile client.
#include "keyevents/client.h"
#include "keyevents/client_server.rh"
// The RKeyEventsAnim class is the client side class for CKeyEventsAnim
// animation class. No commands are needed (commands would normally be used in
// animation dlls to actually trigger animations/other functionality), the
// construction of this class will create the CKeyEventsAnim object
// server-side, which will notify of keypresses via the RProperty key given in
// the args as a TPckg<TKeyEventArgs>.
class RKeyEventsAnim : public RAnim {
public:
RKeyEventsAnim(RAnimDll* dll);
TInt Construct(const RWindowBase& device, const TDesC8& args);
// Inherited destructor is fine.
};
// *****************************************************************************
// RKeyEventsAnim
// The parameter dll will not be NULL, only called from CKeyEventsClient
RKeyEventsAnim::RKeyEventsAnim(RAnimDll *dll) : RAnim(*dll) {
}
TInt RKeyEventsAnim::Construct(const RWindowBase& device, const TDesC8& args) {
// server side Anim doesn't care about parameters
return RAnim::Construct(device, 0, args);
}
// *****************************************************************************
// CKeyEventsClient
EXPORT_C CKeyEventsClient* CKeyEventsClient::NewL(const TUid& category_uid,
TUint key_id, RWsSession* ws_io, RWindowGroup* window_group_io) {
if (!ws_io || !window_group_io) {
User::Leave(KErrArgument);
}
CKeyEventsClient* ret = new (ELeave) CKeyEventsClient(ws_io);
CleanupStack::PushL(ret);
ret->ConstructL(category_uid, key_id, window_group_io);
CleanupStack::Pop(ret);
return ret;
}
EXPORT_C void CKeyEventsClient::OpenNotificationPropertyL(
RProperty* property_out) {
property_out->Attach(TUid::Uid(property_definition_.category_uid),
property_definition_.key_id, EOwnerThread);
}
EXPORT_C CKeyEventsClient::~CKeyEventsClient() {
// Destroy() does Close() and delete.
if (keyevents_) keyevents_->Destroy();
keyevents_dll_.Close();
window_.Close();
}
CKeyEventsClient::CKeyEventsClient(RWsSession* ws_io)
: keyevents_dll_(*ws_io),
window_(*ws_io),
property_definition_pckg_(property_definition_) {
// The parameter ws_io is checked for NULL in NewL.
}
// We use ProtServ to protect the property, as that is basically
// what the animation dll is required to have. We can't use
// SwEvent (at least not as a write policy) as the
// window server doesn't have it. Realistically, we could
// just have it world accessible.
static _LIT_SECURITY_POLICY_C1(kProtServPolicy, ECapabilityProtServ);
void CKeyEventsClient::ConstructL(const TUid& category_uid,
TUint key_id, RWindowGroup* window_group_io) {
// The parameter window_group_io is checked for NULL in NewL.
property_definition_.category_uid = category_uid.iUid;
property_definition_.key_id = key_id;
TInt err = RProperty::Define(category_uid, key_id, RProperty::EInt,
kProtServPolicy, kProtServPolicy);
if (err != KErrNone && err != KErrAlreadyExists) User::Leave(err);
err = keyevents_dll_.Load(TPtrC(
reinterpret_cast<const TUint16*>(
KEYEVENTS_SERVER_DLL_NAME_STRING)));
if (err != KErrNone)
User::Leave(err);
keyevents_ = new (ELeave) RKeyEventsAnim(&keyevents_dll_);
err = window_.Construct(*window_group_io,
reinterpret_cast<TUint32>(&window_));
if (err != KErrNone)
User::Leave(err);
// By not Activate()ing the window, it stays invisible and gets no events
err = keyevents_->Construct(window_, property_definition_pckg_);
if (err != KErrNone)
User::Leave(err);
}
Show details
Hide details
Change log
r2
by mika.raento on Mar 11, 2009
Diff
initial import
Go to:
/trunk/.p4config
/trunk/BlackBoard
/trunk/BlackBoard/common
...mon/BlackBoardFactory_common.mmp
...ard/common/BlackBoard_common.mmp
...nk/BlackBoard/common/S60_3rd_FP1
...FP1/BlackBoardFactory-thumbU.DEF
..._FP1/BlackBoardFactory-winsU.DEF
/trunk/BlackBoard/common/S60_3rd_MR
..._MR/BlackBoardFactory-thumbU.DEF
...d_MR/BlackBoardFactory-winsU.DEF
...k/BlackBoard/common/SERIES60_V21
...60_V21/BLACKBOARDDATA-THUMBU.DEF
...V21/BLACKBOARDFACTORY-THUMBU.DEF
..._V21/BLACKBOARDFACTORY-WINSU.DEF
/trunk/BlackBoard/gv1
...lackBoard/gv1/BlackBoardData.mmp
...lackBoard/gv1/BlackBoardData.pkg
...kBoard/gv1/BlackBoardFactory.mmp
...kBoard/gv1/BlackBoardFactory.pkg
...ackBoard/gv1/BlackBoard_test.mmp
/trunk/BlackBoard/gv1/bld.inf
/trunk/BlackBoard/gv2
...lackBoard/gv2/BlackBoardData.mmp
...lackBoard/gv2/BlackBoardData.pkg
...kBoard/gv2/BlackBoardFactory.mmp
...kBoard/gv2/BlackBoardFactory.pkg
/trunk/BlackBoard/gv2/bld.inf
...k/BlackBoard/gv2/test_common.mmp
/trunk/BlackBoard/gv3
...lackBoard/gv3/BlackBoardData.mmp
...lackBoard/gv3/BlackBoardData.pkg
...v3/BlackBoardData_S60_3rd_MR.pkg
...kBoard/gv3/BlackBoardFactory.mmp
...kBoard/gv3/BlackBoardFactory.pkg
...BlackBoardFactory_S60_3rd_MR.pkg
...ackBoard/gv3/BlackBoard_test.mmp
/trunk/BlackBoard/gv3/bld.inf
...k/BlackBoard/gv3/test_common.mmp
/trunk/BlackBoard/ids.txt
/trunk/BlackBoard/inc
/trunk/BlackBoard/inc/bb_incoming.h
/trunk/BlackBoard/inc/bbdata.h
/trunk/BlackBoard/inc/bberrorinfo.h
/trunk/BlackBoard/inc/bberrors.h
/trunk/BlackBoard/inc/bblist.h
/trunk/BlackBoard/inc/bbtuple.h
/trunk/BlackBoard/inc/bbtypes.h
/trunk/BlackBoard/inc/bbutil.h
/trunk/BlackBoard/inc/bbxml.h
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 5702 bytes, 143 lines
View raw file
Powered by
Google Project Hosting