mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-11 08:36:38 -04:00
Merge pull request #1368 from shinovon/1
Symbian: Implement browser opening
This commit is contained in:
commit
6a0291a9ab
@ -35,9 +35,11 @@ LIBRARY libpthread.lib
|
|||||||
|
|
||||||
STATICLIBRARY libcrt0.lib
|
STATICLIBRARY libcrt0.lib
|
||||||
|
|
||||||
|
ALWAYS_BUILD_AS_ARM
|
||||||
OPTION ARMCC -Otime --diag_suppress 1296 --diag_suppress 1293 --diag_suppress 66
|
OPTION ARMCC -Otime --diag_suppress 1296 --diag_suppress 1293 --diag_suppress 66
|
||||||
OPTION_REPLACE ARMCC --cpu 6
|
OPTION_REPLACE ARMCC --cpu 6
|
||||||
OPTION_REPLACE ARMCC --fpu softvfp+vfpv2 --fpmode fast
|
OPTION_REPLACE ARMCC --fpu softvfp+vfpv2 --fpmode fast
|
||||||
|
OPTION_REPLACE ARMCC -O2 -O3
|
||||||
|
|
||||||
SOURCEPATH ../../src
|
SOURCEPATH ../../src
|
||||||
SOURCE Animations.c Audio.c AudioBackend.c AxisLinesRenderer.c Bitmap.c Block.c BlockPhysics.c Builder.c Camera.c Chat.c Commands.c Deflate.c Drawer.c Drawer2D.c Entity.c EntityComponents.c EntityRenderers.c EnvRenderer.c Event.c ExtMath.c FancyLighting.c Formats.c Game.c GameVersion.c Generator.c Graphics_GL1.c Graphics_SoftGPU.c Gui.c HeldBlockRenderer.c Http_Web.c Http_Worker.c Input.c InputHandler.c Inventory.c IsometricDrawer.c LBackend.c LScreens.c LWeb.c LWidgets.c Launcher.c Lighting.c Logger.c MapRenderer.c MenuOptions.c Menus.c Model.c Options.c PackedCol.c Particle.c Physics.c Picking.c Platform_Posix.c Protocol.c Queue.c Resources.c SSL.c Screens.c SelOutlineRenderer.c SelectionBox.c Server.c Stream.c String.c SystemFonts.c TexturePack.c TouchUI.c Utils.c Vectors.c Widgets.c World.c _autofit.c _cff.c _ftbase.c _ftbitmap.c _ftglyph.c _ftinit.c _ftsynth.c _psaux.c _pshinter.c _psmodule.c _sfnt.c _smooth.c _truetype.c _type1.c Vorbis.c main.c Platform_Symbian.cpp Graphics_GL2.c Window_Symbian.cpp
|
SOURCE Animations.c Audio.c AudioBackend.c AxisLinesRenderer.c Bitmap.c Block.c BlockPhysics.c Builder.c Camera.c Chat.c Commands.c Deflate.c Drawer.c Drawer2D.c Entity.c EntityComponents.c EntityRenderers.c EnvRenderer.c Event.c ExtMath.c FancyLighting.c Formats.c Game.c GameVersion.c Generator.c Graphics_GL1.c Graphics_SoftGPU.c Gui.c HeldBlockRenderer.c Http_Web.c Http_Worker.c Input.c InputHandler.c Inventory.c IsometricDrawer.c LBackend.c LScreens.c LWeb.c LWidgets.c Launcher.c Lighting.c Logger.c MapRenderer.c MenuOptions.c Menus.c Model.c Options.c PackedCol.c Particle.c Physics.c Picking.c Platform_Posix.c Protocol.c Queue.c Resources.c SSL.c Screens.c SelOutlineRenderer.c SelectionBox.c Server.c Stream.c String.c SystemFonts.c TexturePack.c TouchUI.c Utils.c Vectors.c Widgets.c World.c _autofit.c _cff.c _ftbase.c _ftbitmap.c _ftglyph.c _ftinit.c _ftsynth.c _psaux.c _pshinter.c _psmodule.c _sfnt.c _smooth.c _truetype.c _type1.c Vorbis.c main.c Platform_Symbian.cpp Graphics_GL2.c Window_Symbian.cpp
|
||||||
|
@ -71,6 +71,21 @@ class CWindow;
|
|||||||
|
|
||||||
CWindow* window;
|
CWindow* window;
|
||||||
|
|
||||||
|
static void ConvertToUnicode(TDes& dst, const char* src, size_t length) {
|
||||||
|
if (!src) return;
|
||||||
|
|
||||||
|
cc_unichar* uni = reinterpret_cast <cc_unichar*> (const_cast <TUint16*> (dst.Ptr()));
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
*uni++ = Convert_CP437ToUnicode(src[i]);
|
||||||
|
}
|
||||||
|
*uni = '\0';
|
||||||
|
dst.SetLength(length);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ConvertToUnicode(TDes& dst, const cc_string* src) {
|
||||||
|
ConvertToUnicode(dst, src->buffer, (size_t)src->length);
|
||||||
|
}
|
||||||
|
|
||||||
class CWindow : public CBase
|
class CWindow : public CBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -82,7 +97,7 @@ public:
|
|||||||
void ProcessEvents(float delta);
|
void ProcessEvents(float delta);
|
||||||
void RequestClose();
|
void RequestClose();
|
||||||
void InitEvents();
|
void InitEvents();
|
||||||
cc_result OpenBrowser(const cc_string* url);
|
cc_result OpenBrowserL(const cc_string* url);
|
||||||
~CWindow();
|
~CWindow();
|
||||||
|
|
||||||
TWsEvent iWsEvent;
|
TWsEvent iWsEvent;
|
||||||
@ -464,6 +479,7 @@ void CWindow::HandleWsEvent(const TWsEvent& aWsEvent) {
|
|||||||
}
|
}
|
||||||
// shutdown request from task manager
|
// shutdown request from task manager
|
||||||
case KAknShutOrHideApp: {
|
case KAknShutOrHideApp: {
|
||||||
|
WindowInfo.Exists = false;
|
||||||
RequestClose();
|
RequestClose();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -471,6 +487,7 @@ void CWindow::HandleWsEvent(const TWsEvent& aWsEvent) {
|
|||||||
case EEventUser: {
|
case EEventUser: {
|
||||||
TApaSystemEvent apaSystemEvent = *(TApaSystemEvent*) aWsEvent.EventData();
|
TApaSystemEvent apaSystemEvent = *(TApaSystemEvent*) aWsEvent.EventData();
|
||||||
if (apaSystemEvent == EApaSystemEventShutdown) {
|
if (apaSystemEvent == EApaSystemEventShutdown) {
|
||||||
|
WindowInfo.Exists = false;
|
||||||
RequestClose();
|
RequestClose();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -590,28 +607,31 @@ void CWindow::InitEvents() {
|
|||||||
iWsSession.EventReady(&iWsEventStatus);
|
iWsSession.EventReady(&iWsEventStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result CWindow::OpenBrowser(const cc_string* url) {
|
cc_result CWindow::OpenBrowserL(const cc_string* url) {
|
||||||
#if 0
|
#if defined CC_BUILD_SYMBIAN_3 || defined CC_BUILD_SYMBIAN_S60V5
|
||||||
TUid browserUid = {0x1020724d};
|
TUid browserUid = {0x10008D39};
|
||||||
|
#else
|
||||||
|
TUid browserUid = {0x1020724D};
|
||||||
|
#endif
|
||||||
TApaTaskList tasklist(window->iWsSession);
|
TApaTaskList tasklist(window->iWsSession);
|
||||||
TApaTask task = tasklist.FindApp(browserUid);
|
TApaTask task = tasklist.FindApp(browserUid);
|
||||||
TPtrC des;
|
|
||||||
// TODO convert url to utf16
|
|
||||||
|
|
||||||
if (task.Exists()) {
|
if (task.Exists()) {
|
||||||
task.BringToForeground();
|
task.BringToForeground();
|
||||||
|
task.SendMessage(TUid::Uid(0), TPtrC8((TUint8 *)url->buffer, (TInt)url->length));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
RApaLsSession ls;
|
RApaLsSession ls;
|
||||||
if (!ls.Connect()) {
|
if (!ls.Handle()) {
|
||||||
TThreadId tid;
|
User::LeaveIfError(ls.Connect());
|
||||||
ls.StartDocument(des, browserUid, tid);
|
|
||||||
ls.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TThreadId tid;
|
||||||
|
TBuf<FILENAME_SIZE> buf;
|
||||||
|
ConvertToUnicode(buf, url);
|
||||||
|
ls.StartDocument(buf, browserUid, tid);
|
||||||
|
ls.Close();
|
||||||
}
|
}
|
||||||
#endif
|
return 0;
|
||||||
return ERR_NOT_SUPPORTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_PreInit(void) {
|
void Window_PreInit(void) {
|
||||||
@ -779,7 +799,7 @@ void GLContext_Create(void) {
|
|||||||
|
|
||||||
cc_result Process_StartOpen(const cc_string* args) {
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
TInt err = 0;
|
TInt err = 0;
|
||||||
TRAP(err, err = window->OpenBrowser(args));
|
TRAP(err, err = window->OpenBrowserL(args));
|
||||||
return (cc_result) err;
|
return (cc_result) err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user