26
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <coemain.h>
|
|
19 |
#include <eikenv.h>
|
|
20 |
#include <hal.h>
|
|
21 |
#include "CMIDEnv.h"
|
|
22 |
#include "CMIDToolkit.h"
|
|
23 |
#include "CMIDNotify.h"
|
|
24 |
#include "CMIDKeyTranslator.h"
|
|
25 |
#include "CMIDToLcduiObserver.h"
|
|
26 |
|
|
27 |
#ifdef RD_JAVA_NGA_ENABLED
|
|
28 |
#include <EGL/egl.h>
|
|
29 |
#include <GLES/gl.h>
|
|
30 |
#include <libc/string.h>
|
|
31 |
#endif // RD_JAVA_NGA_ENABLED
|
|
32 |
|
|
33 |
const TUint16 KCharComma = ',';
|
|
34 |
|
|
35 |
CMIDEnv::CMIDEnv(CMIDToolkit* aToolkit, const TSize& aSize)
|
|
36 |
: iToolkit(aToolkit)
|
|
37 |
, iObservers(EGranularity)
|
|
38 |
, iCanvasAssumedSize(aSize)
|
|
39 |
, iToLcduiObserver(NULL)
|
|
40 |
#ifdef RD_JAVA_NGA_ENABLED
|
|
41 |
, iHardwareStatus(0)
|
|
42 |
#endif
|
|
43 |
{
|
|
44 |
iCanvasData.iLock.CreateLocal();
|
|
45 |
}
|
|
46 |
|
|
47 |
void CMIDEnv::ConstructL()
|
|
48 |
{
|
|
49 |
iKeyTranslator = new(ELeave) CMIDKeyTranslator(*this);
|
|
50 |
iKeyTranslator->ConstructL();
|
|
51 |
iToLcduiObserver = new(ELeave) CMIDToLcduiObserver();
|
|
52 |
|
|
53 |
// On a non-full-screen (normal) mode Canvas the background image must be initially shown,
|
|
54 |
// if the value of the Nokia-UI-Enhancement attribute is "CanvasHasBackground". The
|
|
55 |
// attribute may be placed in the JAD or the manifest.
|
|
56 |
iCanvasData.iHasBackground = MidletAttributeContainsVal(
|
|
57 |
LcduiMidletAttributes::KAttribUIEnhancement,
|
|
58 |
LcduiMidletAttributeValues::KUIEnhCanvasBackground);
|
|
59 |
#ifdef RD_JAVA_NGA_ENABLED
|
|
60 |
InitHardwareStatusL();
|
|
61 |
#endif // RD_JAVA_NGA_ENABLED
|
|
62 |
}
|
|
63 |
|
|
64 |
CMIDEnv::~CMIDEnv()
|
|
65 |
{
|
|
66 |
if (iToLcduiObserver)
|
|
67 |
{
|
|
68 |
delete iToLcduiObserver;
|
|
69 |
iToLcduiObserver = NULL;
|
|
70 |
}
|
|
71 |
delete iKeyTranslator;
|
|
72 |
iObservers.Close();
|
|
73 |
iCanvasData.iLock.Close();
|
|
74 |
}
|
|
75 |
|
|
76 |
void CMIDEnv::SetUtils(MMIDUtils* aUtils)
|
|
77 |
{
|
|
78 |
iKeyTranslator->SetUtils(aUtils);
|
|
79 |
}
|
|
80 |
|
|
81 |
TPtrC CMIDEnv::MidletName() const
|
|
82 |
{
|
|
83 |
return iToolkit->MidletName();
|
|
84 |
}
|
|
85 |
|
|
86 |
TUid CMIDEnv::MidletUid() const
|
|
87 |
{
|
|
88 |
return iToolkit->MidletUid();
|
|
89 |
}
|
|
90 |
|
|
91 |
TPtrC CMIDEnv::MidletHome() const
|
|
92 |
{
|
|
93 |
return iToolkit->MidletHome();
|
|
94 |
}
|
|
95 |
|
|
96 |
#ifdef RD_SCALABLE_UI_V2
|
|
97 |
TUid CMIDEnv::MidletSuiteUid()
|
|
98 |
{
|
|
99 |
if (!iMidletSuiteUid.iUid)
|
|
100 |
{
|
|
101 |
//Midlet suite uid is located inside brackets in the midlet home path.
|
|
102 |
const TChar KUidStart = '[';
|
|
103 |
const TChar KUidEnd = ']';
|
|
104 |
|
|
105 |
const TPtrC midletHome = MidletHome();
|
|
106 |
|
|
107 |
//Finding start and end positions
|
|
108 |
TInt startPos = midletHome.Locate(KUidStart) + 1;
|
|
109 |
TInt endPos = midletHome.LocateReverse(KUidEnd);
|
|
110 |
|
|
111 |
if (startPos != KErrNotFound && endPos != KErrNotFound &&
|
|
112 |
startPos < endPos && endPos <= midletHome.Length())
|
|
113 |
{
|
|
114 |
//Creating new pointer descriptor representing the midlet suite uid
|
|
115 |
const TPtrC uidDesc = midletHome.Mid(startPos, endPos - startPos);
|
|
116 |
|
|
117 |
if (uidDesc.Length())
|
|
118 |
{
|
|
119 |
//Creating unsigned integer out of the hex string.
|
|
120 |
TUint uint;
|
|
121 |
TLex lexer(uidDesc);
|
|
122 |
TInt err = lexer.Val(uint, EHex);
|
|
123 |
|
|
124 |
if (err == KErrNone)
|
|
125 |
{
|
|
126 |
iMidletSuiteUid = TUid::Uid(uint);
|
|
127 |
}
|
|
128 |
else
|
|
129 |
{
|
|
130 |
iMidletSuiteUid = TUid::Uid(KNullUidValue);
|
|
131 |
}
|
|
132 |
}
|
|
133 |
else
|
|
134 |
{
|
|
135 |
iMidletSuiteUid = TUid::Uid(KNullUidValue);
|
|
136 |
}
|
|
137 |
}
|
|
138 |
else
|
|
139 |
{
|
|
140 |
iMidletSuiteUid = TUid::Uid(KNullUidValue);
|
|
141 |
}
|
|
142 |
}
|
|
143 |
return iMidletSuiteUid;
|
|
144 |
}
|
|
145 |
#endif // RD_SCALABLE_UI_V2
|
|
146 |
|
|
147 |
|
|
148 |
TBool CMIDEnv::PostJavaEvent
|
|
149 |
(
|
|
150 |
MMIDComponent& aSource,
|
|
151 |
TSourceType aSourceType,
|
|
152 |
TEventType aEventType,
|
|
153 |
TInt aEventData,
|
|
154 |
TInt aEventData1,
|
|
155 |
TInt aEventData2
|
|
156 |
)
|
|
157 |
{
|
|
158 |
#ifdef TRACE_EVENTS
|
|
159 |
RDebug::Print(_L("CMIDEnv::PostJavaEvent(%x,%d,%d,%d,%d,%d)"),
|
|
160 |
aSource,
|
|
161 |
aSourceType,
|
|
162 |
aEventType,
|
|
163 |
aEventData,aEventData1, aEventData2);
|
|
164 |
#endif
|
|
165 |
switch (aSourceType)
|
|
166 |
{
|
|
167 |
case EItem:
|
|
168 |
return iToolkit->PostItemEvent(aSource, aEventType, aEventData, aEventData1, aEventData2);
|
|
169 |
case EDisplayable:
|
|
170 |
return iToolkit->PostDisplayableEvent(aSource, aEventType, aEventData, aEventData1);
|
|
171 |
case ECanvasGraphicsItemPainterEvent:
|
|
172 |
return iToolkit->PostCanvasGraphicsItemPainterEvent(aSource, aEventType, aEventData, aEventData1);
|
|
173 |
default:
|
|
174 |
ASSERT(EFalse);
|
|
175 |
}
|
|
176 |
return EFalse;
|
|
177 |
}
|
|
178 |
|
|
179 |
TBool CMIDEnv::PostJavaEvent(MMIDComponent& aSource,TSourceType aSourceType,TEventType aEventType,TInt aEventData)
|
|
180 |
{
|
|
181 |
return PostJavaEvent(aSource, aSourceType, aEventType, aEventData, 0, 0);
|
|
182 |
}
|
|
183 |
|
|
184 |
TBool CMIDEnv::PostJavaEvent(MMIDComponent& aSource,TSourceType aSourceType,TInt aEventData)
|
|
185 |
{
|
|
186 |
return PostJavaEvent(aSource, aSourceType, ENoType, aEventData, 0, 0);
|
|
187 |
}
|
|
188 |
|
|
189 |
TBool CMIDEnv::PostMidletEvent(TEventType aEventType)
|
|
190 |
{
|
|
191 |
return iToolkit->PostDisplayEvent(aEventType);
|
|
192 |
}
|
|
193 |
|
|
194 |
MMIDNotifyEvent* CMIDEnv::NewNotifyL(MMIDComponent& aSource)
|
|
195 |
{
|
|
196 |
return new(ELeave) CMIDNotifyEvent(iToolkit->ComponentPeer(aSource));
|
|
197 |
}
|
|
198 |
|
|
199 |
TBool CMIDEnv::PostJavaNotify(MMIDNotifyEvent* aNotifyEvent)
|
|
200 |
{
|
|
201 |
CMIDNotifyEvent* notify = static_cast<CMIDNotifyEvent*>(aNotifyEvent);
|
|
202 |
return iToolkit->PostEvent(notify, CJavaEventBase::ENotifyPriority);
|
|
203 |
}
|
|
204 |
|
|
205 |
TBool CMIDEnv::TranslateKeyL(TMIDKeyEvent& aEvent, const TKeyEvent& aWsEvent, TEventCode aType)
|
|
206 |
{
|
|
207 |
return iKeyTranslator->TranslateL(aEvent, aWsEvent, aType);
|
|
208 |
}
|
|
209 |
|
|
210 |
TBool CMIDEnv::PostKeyEvent(MMIDComponent& aSource, TMIDKeyEvent& aEvent)
|
|
211 |
{
|
|
212 |
return iKeyTranslator->PostKeyEvent(aSource, aEvent);
|
|
213 |
}
|
|
214 |
|
|
215 |
void CMIDEnv::ResetKeys()
|
|
216 |
{
|
|
217 |
iKeyTranslator->Reset();
|
|
218 |
}
|
|
219 |
|
|
220 |
MMIDDisplayable* CMIDEnv::Current()
|
|
221 |
{
|
|
222 |
return iToolkit->Current();
|
|
223 |
}
|
|
224 |
|
|
225 |
/**
|
|
226 |
* Set the zoom size which may be queried by Canvas in the
|
|
227 |
* plugin. This is a relic from when Canvas was implemented
|
|
228 |
* in the framework. Should be deprecated.
|
|
229 |
*/
|
|
230 |
void CMIDEnv::SetCanvasZoomSize(const TSize& aSize)
|
|
231 |
{
|
|
232 |
iCanvasZoomSize=aSize;
|
|
233 |
}
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Get the zoom size - used by the Canvas in the plugin.
|
|
237 |
* Relic from when Canvas was implementd in the framework.
|
|
238 |
* Should be deprecated.
|
|
239 |
*/
|
|
240 |
TSize CMIDEnv::CanvasZoomSize()
|
|
241 |
{
|
|
242 |
return iCanvasZoomSize;
|
|
243 |
}
|
|
244 |
|
|
245 |
TSize CMIDEnv::CanvasAssumedSize()
|
|
246 |
{
|
|
247 |
return iCanvasAssumedSize;
|
|
248 |
}
|
|
249 |
|
|
250 |
TInt CMIDEnv::NumColors()
|
|
251 |
{
|
|
252 |
TDisplayMode mode = DisplayMode();
|
|
253 |
return TDisplayModeUtils::NumDisplayModeColors(mode);
|
|
254 |
}
|
|
255 |
|
|
256 |
TDisplayMode CMIDEnv::DisplayMode()
|
|
257 |
{
|
|
258 |
MMIDGraphicsFactory& factory = iToolkit->GraphicsFactory();
|
|
259 |
return factory.DisplayMode();
|
|
260 |
}
|
|
261 |
|
|
262 |
void CMIDEnv::AddObserverL(MMIDEnvObserver& aObserver)
|
|
263 |
{
|
|
264 |
ASSERT(iObservers.Find(&aObserver) == KErrNotFound);
|
|
265 |
//
|
|
266 |
User::LeaveIfError(iObservers.Append(&aObserver));
|
|
267 |
}
|
|
268 |
|
|
269 |
void CMIDEnv::RemoveObserver(MMIDEnvObserver& aObserver)
|
|
270 |
{
|
|
271 |
TInt index = iObservers.Find(&aObserver);
|
|
272 |
if (index != KErrNotFound)
|
|
273 |
{
|
|
274 |
iObservers.Remove(index);
|
|
275 |
}
|
|
276 |
}
|
|
277 |
|
|
278 |
void CMIDEnv::HandleSwitchOnL(TBool aSwitchOn)
|
|
279 |
{
|
|
280 |
for (TInt i = iObservers.Count(); i--;)
|
|
281 |
iObservers[i]->HandleSwitchOnL(aSwitchOn);
|
|
282 |
}
|
|
283 |
|
|
284 |
void CMIDEnv::HandleForegroundL(TBool aForeground)
|
|
285 |
{
|
|
286 |
#ifdef RD_JAVA_NGA_ENABLED
|
|
287 |
if (aForeground)
|
|
288 |
{
|
|
289 |
iFullOrPartialFg = ETrue;
|
|
290 |
}
|
|
291 |
#endif // RD_JAVA_NGA_ENABLED
|
|
292 |
|
|
293 |
for (TInt i = iObservers.Count(); i--;)
|
|
294 |
{
|
|
295 |
iObservers[i]->HandleForegroundL(aForeground);
|
|
296 |
}
|
|
297 |
if (aForeground && iToolkit && iToolkit->Utils())
|
|
298 |
{
|
|
299 |
iToolkit->Utils()->HandleForegroundL(aForeground);
|
|
300 |
}
|
|
301 |
}
|
|
302 |
|
|
303 |
void CMIDEnv::HandleResourceChangeL(TInt aType)
|
|
304 |
{
|
|
305 |
for (TInt i = iObservers.Count(); i--;)
|
|
306 |
{
|
|
307 |
iObservers[i]->HandleResourceChangeL(aType);
|
|
308 |
}
|
|
309 |
if (iToolkit && iToolkit->Utils())
|
|
310 |
{
|
|
311 |
iToolkit->Utils()->HandleResourceChangedL();
|
|
312 |
}
|
|
313 |
}
|
|
314 |
|
|
315 |
#ifdef RD_JAVA_NGA_ENABLED
|
|
316 |
void CMIDEnv::HandleFullOrPartialForegroundL(TBool aForeground)
|
|
317 |
{
|
|
318 |
iFullOrPartialFg = aForeground;
|
|
319 |
for (TInt i = iObservers.Count(); i--;)
|
|
320 |
{
|
|
321 |
iObservers[i]->HandleFullOrPartialForegroundL(aForeground);
|
|
322 |
}
|
|
323 |
}
|
|
324 |
|
|
325 |
void CMIDEnv::HandleFreeGraphicsMemory()
|
|
326 |
{
|
|
327 |
for (TInt i = iObservers.Count(); i--;)
|
|
328 |
{
|
|
329 |
iObservers[i]->HandleFreeGraphicsMemory();
|
|
330 |
}
|
|
331 |
}
|
|
332 |
|
|
333 |
TBool CMIDEnv::HasFullOrPartialForeground() const
|
|
334 |
{
|
|
335 |
return iFullOrPartialFg;
|
|
336 |
}
|
|
337 |
#endif //RD_JAVA_NGA_ENABLED
|
|
338 |
|
|
339 |
TInt CMIDEnv::MidletAttribute(const TDesC& aAttributeName, TPtrC& aAttributeValue)
|
|
340 |
{
|
|
341 |
return iToolkit->MidletAttribute(aAttributeName,aAttributeValue);
|
|
342 |
}
|
|
343 |
|
|
344 |
TBool CMIDEnv::MidletAttributeIsSetToVal(const TDesC& aAttributeName,
|
|
345 |
const TDesC& aAttributeValue)
|
|
346 |
{
|
|
347 |
TPtrC attributeValue;
|
|
348 |
|
|
349 |
if (MidletAttribute(aAttributeName, attributeValue) == KErrNone &&
|
|
350 |
attributeValue.CompareF(aAttributeValue) == 0)
|
|
351 |
{
|
|
352 |
return ETrue;
|
|
353 |
}
|
|
354 |
else
|
|
355 |
{
|
|
356 |
return EFalse;
|
|
357 |
}
|
|
358 |
}
|
|
359 |
|
|
360 |
TBool CMIDEnv::MidletAttributeContainsVal(const TDesC& aAttributeName,
|
|
361 |
const TDesC& aAttributeValue)
|
|
362 |
{
|
|
363 |
TPtrC attributeValue;
|
|
364 |
|
|
365 |
if (MidletAttribute(aAttributeName, attributeValue) == KErrNone)
|
|
366 |
{
|
|
367 |
TInt startIdx = attributeValue.FindF(aAttributeValue);
|
|
368 |
if (startIdx != KErrNotFound)
|
|
369 |
{
|
|
370 |
if (aAttributeName.FindF(LcduiMidletAttributes::KAttribUIEnhancement) == KErrNotFound)
|
|
371 |
{
|
|
372 |
// If there is a preceding character before the value substring, it must be a comma
|
|
373 |
if (startIdx == 0 || attributeValue[ startIdx - 1 ] == KCharComma)
|
|
374 |
{
|
|
375 |
// Check what comes after the found value substring.
|
|
376 |
TInt endIdx = startIdx + aAttributeValue.Length();
|
|
377 |
if (endIdx < attributeValue.Length())
|
|
378 |
{
|
|
379 |
// only comma is ok
|
|
380 |
if (attributeValue[ endIdx ] == KCharComma)
|
|
381 |
{
|
|
382 |
return ETrue;
|
|
383 |
}
|
|
384 |
}
|
|
385 |
}
|
|
386 |
else // the found substring was right at the end of attributeValue string
|
|
387 |
{
|
|
388 |
return ETrue;
|
|
389 |
}
|
|
390 |
}
|
|
391 |
else // it is "Nokia-UI-Enhancement" - it is enough just to identify the substring in list of values
|
|
392 |
{
|
|
393 |
return ETrue;
|
|
394 |
}
|
|
395 |
}
|
|
396 |
}
|
|
397 |
|
|
398 |
return EFalse;
|
|
399 |
}
|
|
400 |
|
|
401 |
void CMIDEnv::SetCanvasAssumedSize(const TSize& aSize)
|
|
402 |
{
|
|
403 |
iCanvasAssumedSize = aSize;
|
|
404 |
}
|
|
405 |
CFbsBitmap* CMIDEnv::ReserveCanvasFrameBufferL(MMIDCanvas& aCanvas, const TSize& aSz)
|
|
406 |
{
|
|
407 |
CMIDEnv::TMutexAutoLock lock(&iCanvasData.iLock);
|
|
408 |
if (!aCanvas.IsGameCanvas())
|
|
409 |
{
|
|
410 |
if (!iCanvasData.iFrameBuffer)
|
|
411 |
{
|
|
412 |
iCanvasData.iFrameBuffer = CreateCanvasFrameBufferL(aCanvas, ETrue, aSz);
|
|
413 |
}
|
|
414 |
iCanvasData.iRefCount++;
|
|
415 |
return iCanvasData.iFrameBuffer;
|
|
416 |
}
|
|
417 |
return CreateCanvasFrameBufferL(aCanvas, ETrue, aSz);
|
|
418 |
}
|
|
419 |
|
|
420 |
void CMIDEnv::ReleaseCanvasFrameBuffer(MMIDCanvas& aCanvas, CFbsBitmap*& aFrameBuffer)
|
|
421 |
{
|
|
422 |
CMIDEnv::TMutexAutoLock lock(&iCanvasData.iLock);
|
|
423 |
if (!aCanvas.IsGameCanvas())
|
|
424 |
{
|
|
425 |
if (iCanvasData.iFrameBuffer)
|
|
426 |
{
|
|
427 |
iCanvasData.iRefCount--;
|
|
428 |
if (iCanvasData.iRefCount <= 0)
|
|
429 |
{
|
|
430 |
iCanvasData.Reset();
|
|
431 |
}
|
|
432 |
}
|
|
433 |
}
|
|
434 |
else
|
|
435 |
{
|
|
436 |
delete aFrameBuffer;
|
|
437 |
aFrameBuffer = NULL;
|
|
438 |
}
|
|
439 |
}
|
|
440 |
|
|
441 |
CFbsBitmap* CMIDEnv::CreateCanvasFrameBufferL(
|
|
442 |
MMIDCanvas& /* aCanvas */, TBool aWsBitmap, const TSize& aSz)
|
|
443 |
{
|
|
444 |
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
|
|
445 |
CleanupStack::PushL(bitmap);
|
|
446 |
TInt err = KErrGeneral;
|
|
447 |
err = bitmap->CreateHardwareBitmap(aSz, DisplayMode(), MidletUid());
|
|
448 |
if (KErrNone != err)
|
|
449 |
{
|
|
450 |
// Failed to create hardware bitmap. Fall back to normal software only bitmaps
|
|
451 |
User::LeaveIfError(bitmap->Create(aSz, DisplayMode()));
|
|
452 |
}
|
|
453 |
if (!aWsBitmap)
|
|
454 |
{
|
|
455 |
CleanupStack::Pop();
|
|
456 |
return bitmap;
|
|
457 |
}
|
|
458 |
CWsBitmap* wsBitmap =
|
|
459 |
new(ELeave) CWsBitmap(CCoeEnv::Static()->WsSession());
|
|
460 |
err = wsBitmap->Duplicate(bitmap->Handle());
|
|
461 |
if (KErrNone != err)
|
|
462 |
{
|
|
463 |
delete wsBitmap;
|
|
464 |
User::Leave(err);
|
|
465 |
}
|
|
466 |
CleanupStack::PopAndDestroy(bitmap);
|
|
467 |
return wsBitmap;
|
|
468 |
}
|
|
469 |
|
|
470 |
TBool CMIDEnv::CanvasHasBackground(const MMIDCanvas& /* aCanvas */) const
|
|
471 |
{
|
|
472 |
return iCanvasData.iHasBackground;
|
|
473 |
}
|
|
474 |
|
|
475 |
#ifdef RD_JAVA_NGA_ENABLED
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
//
|
|
478 |
// ---------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
TBool CMIDEnv::IsHardwareAcceleratedL(MMIDEnv::THardwareType aHardwareType)
|
|
481 |
{
|
|
482 |
ASSERT(iHardwareStatus);
|
|
483 |
return (iHardwareStatus & aHardwareType);
|
|
484 |
}
|
|
485 |
|
|
486 |
// ---------------------------------------------------------------------------
|
|
487 |
// Checks from OpenGL ES API, if it is HW accelerated
|
|
488 |
// ---------------------------------------------------------------------------
|
|
489 |
//
|
|
490 |
TInt CMIDEnv::InitHardwareStatusL()
|
|
491 |
{
|
|
492 |
iHardwareStatus = 1;
|
|
493 |
|
|
494 |
EGLDisplay eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
|
495 |
eglInitialize(eglDisplay, NULL, NULL);
|
|
496 |
|
|
497 |
EGLConfig config;
|
|
498 |
EGLint numOfConfigs = 0;
|
|
499 |
// Choose suitable display config
|
|
500 |
const EGLint attribs[] =
|
|
501 |
{
|
|
502 |
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
|
|
503 |
EGL_BUFFER_SIZE, 32,
|
|
504 |
EGL_DEPTH_SIZE, 16,
|
|
505 |
EGL_NONE
|
|
506 |
};
|
|
507 |
eglChooseConfig(eglDisplay, attribs, &config, 1, &numOfConfigs);
|
|
508 |
// Create a surface
|
|
509 |
const EGLint pBuffAttribs[] =
|
|
510 |
{
|
|
511 |
EGL_WIDTH, 1,
|
|
512 |
EGL_HEIGHT, 1,
|
|
513 |
EGL_NONE
|
|
514 |
};
|
|
515 |
EGLSurface surface = eglCreatePbufferSurface(eglDisplay, config, pBuffAttribs);
|
|
516 |
// Create a context into this thread.
|
|
517 |
EGLContext context = eglCreateContext(eglDisplay, config, EGL_NO_CONTEXT, NULL);
|
|
518 |
// Try to bind surface to context
|
|
519 |
if (context != EGL_NO_CONTEXT && surface != EGL_NO_SURFACE &&
|
|
520 |
eglMakeCurrent(eglDisplay, surface, surface, context))
|
|
521 |
{
|
|
522 |
if (strstr((const char *)glGetString(GL_RENDERER), "HW"))
|
|
523 |
{
|
|
524 |
iHardwareStatus |= MMIDEnv::EHardware3D;
|
|
525 |
}
|
|
526 |
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
|
527 |
}
|
|
528 |
|
|
529 |
if (context != EGL_NO_CONTEXT)
|
|
530 |
{
|
|
531 |
eglDestroyContext(eglDisplay, context);
|
|
532 |
}
|
|
533 |
|
|
534 |
if (surface != EGL_NO_SURFACE)
|
|
535 |
{
|
|
536 |
eglDestroySurface(eglDisplay, surface);
|
|
537 |
}
|
|
538 |
|
|
539 |
eglTerminate(eglDisplay);
|
|
540 |
|
|
541 |
return iHardwareStatus;
|
|
542 |
}
|
|
543 |
|
|
544 |
#endif // RD_JAVA_NGA_ENABLED
|
|
545 |
|
|
546 |
void CMIDEnv::MappingDataForKey(TKeyEvent& aEvent, TEventCode aType)
|
|
547 |
{
|
|
548 |
iToolkit->Utils()->MappingDataForKey(aEvent, aType);
|
|
549 |
}
|
|
550 |
|
|
551 |
void CMIDEnv::SetLastKeyEvent(const TKeyEvent& aEvent)
|
|
552 |
{
|
|
553 |
iToolkit->Utils()->SetLastKeyEvent(aEvent);
|
|
554 |
}
|
|
555 |
|
|
556 |
|
|
557 |
// ---------------------------------------------------------------------------
|
|
558 |
// CMIDEnv::ToLcduiObserver
|
|
559 |
// Gets an instance of ToLcduiObserver.
|
|
560 |
// ---------------------------------------------------------------------------
|
|
561 |
//
|
|
562 |
MMIDToLcduiObserver& CMIDEnv::ToLcduiObserver()
|
|
563 |
{
|
|
564 |
return *iToLcduiObserver;
|
|
565 |
}
|
|
566 |
|
|
567 |
void CMIDEnv::DisplayableIsDestructed(const MMIDDisplayable* aDisplayable)
|
|
568 |
{
|
|
569 |
// Inform CMIDToolkit about deleting of displayble. This is needed
|
|
570 |
// for prevereting of panic during changing to new Displayable
|
|
571 |
iToolkit->DisplayableIsDestructed(aDisplayable);
|
|
572 |
}
|
|
573 |
|
|
574 |
const MMIDDisplayable* CMIDEnv::LastFullscreenDisplayable() const
|
|
575 |
{
|
|
576 |
return iToolkit->LastFullscreenDisplayable();
|
|
577 |
}
|