Skip to content
Snippets Groups Projects
Commit 9ddf3076 authored by DarkGod's avatar DarkGod
Browse files

test

parent aa89689d
No related branches found
No related tags found
No related merge requests found
......@@ -565,6 +565,26 @@ project "te4-web"
includedirs {"/opt/cef3/1547/include/", "/opt/cef3/1547/"}
links { "cef", "cef_dll_wrapper" }
defines { 'SELFEXE_LINUX' }
project "cef3spawn"
kind "WindowedApp"
language "C++"
targetname "cef3spawn"
includedirs {"../src/web-cef3/", }
files {
"../src/web-cef3/spawn.cpp",
}
configuration "linux"
buildoptions{"-pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/libdrm"}
libdirs {"/opt/cef3/1547/out/Release/obj.target/"}
libdirs {"/opt/cef3/1547/Release/"}
links {"cef_dll_wrapper"}
includedirs {"/opt/cef3/1547/include/", "/opt/cef3/1547/", }
links { "cef" }
end
if _OPTIONS.steam then
......
/*
TE4 - T-Engine 4
Copyright (C) 2009 - 2014 Nicolas Casalini
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 3 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, see <http://www.gnu.org/licenses/>.
Nicolas Casalini "DarkGod"
darkgod@te4.org
*/
extern "C" {
#include "web-external.h"
#include <stdio.h>
#include <stdlib.h>
}
#include "web.h"
#include "web-internal.h"
class ClientApp :
public CefApp
{
public:
IMPLEMENT_REFCOUNTING(ClientApp);
};
int main(int argc, char* argv[]) {
#ifdef _WIN32
CefMainArgs args(GetModuleHandle(NULL));
#else
CefMainArgs args(argc, argv);
#endif
CefRefPtr<ClientApp> app(new ClientApp);
int ret = CefExecuteProcess(args, app.get());
return ret;
}
\ No newline at end of file
......@@ -797,6 +797,7 @@ void te4_web_do_update(void (*cb)(WebEvent*)) {
static int g_argc;
static char **g_argv;
static char *spawnname;
CefRefPtr<ClientApp> app(new ClientApp);
void te4_web_setup(
......@@ -829,21 +830,9 @@ void te4_web_setup(
web_key_mods = key_mods;
web_instant_js = instant_js;
spawnname = spawnc;
g_argc = argc;
g_argv = gargv;
#ifdef _WIN32
CefMainArgs args(GetModuleHandle(NULL));
#else
char **cargv = (char**)calloc(argc, sizeof(char*));
for (int i = 0; i < argc; i++) cargv[i] = strdup(gargv[i]);
CefMainArgs args(argc, cargv);
#endif
int exit_code = CefExecuteProcess(args, app.get());
if (exit_code >= 0) {
exit(exit_code);
}
}
void te4_web_initialize(const char *locales, const char *pak) {
......@@ -859,6 +848,8 @@ void te4_web_initialize(const char *locales, const char *pak) {
CefSettings settings;
settings.multi_threaded_message_loop = false;
CefString spawn(spawnname);
CefString(&settings.browser_subprocess_path) = spawn;
CefString clocales(locales);
CefString(&settings.locales_dir_path) = clocales;
CefString resources(pak);
......
......@@ -508,18 +508,35 @@ static void web_instant_js(int handlers, const char *fct, int nb_args, WebJsValu
}
void te4_web_load() {
const char *self = get_self_executable(g_argc, g_argv);
#if defined(SELFEXE_LINUX) || defined(SELFEXE_BSD)
#if defined(TE4_RELPATH64)
const char *spawnbname = "cef3spawn64";
char *spawnname = malloc(strlen(self) + strlen(spawnbname) + 1);
strcpy(spawnname, self);
strcpy(strrchr(spawnname, '/') + 1, spawnbname);
void *web = SDL_LoadObject("lib64/libte4-web.so");
#elif defined(TE4_RELPATH64)
#elif defined(TE4_RELPATH32)
const char *spawnbname = "cef3spawn32";
char *spawnname = malloc(strlen(self) + strlen(spawnbname) + 1);
strcpy(spawnname, self);
strcpy(strrchr(spawnname, '/') + 1, spawnbname);
void *web = SDL_LoadObject("lib/libte4-web.so");
#else
const char *spawnbname = "cef3spawn";
char *spawnname = malloc(strlen(self) + strlen(spawnbname) + 1);
strcpy(spawnname, self);
strcpy(strrchr(spawnname, '/') + 1, spawnbname);
void *web = SDL_LoadObject("libte4-web.so");
#endif
#elif defined(SELFEXE_WINDOWS)
const char *spawnbname = "cef3spawn.exe";
char *spawnname = malloc(strlen(self) + strlen(spawnbname) + 1);
strcpy(spawnname, self);
strcpy(strrchr(spawnname, '\\') + 1, spawnbname);
void *web = SDL_LoadObject("te4-web.dll");
#elif defined(SELFEXE_MACOSX)
const char *self = get_self_executable(g_argc, g_argv);
char *spawnname = NULL;
const char *name = "libte4-web.dylib";
char *lib = malloc(strlen(self) + strlen(name) + 1);
strcpy(lib, self);
......@@ -557,7 +574,7 @@ void te4_web_load() {
te4_web_set_js_call = (void (*)(web_view_type *view, const char *name)) SDL_LoadFunction(web, "te4_web_set_js_call");
te4_web_setup(
g_argc, g_argv, NULL,
g_argc, g_argv, spawnname,
web_mutex_create, web_mutex_destroy, web_mutex_lock, web_mutex_unlock,
web_make_texture, web_del_texture, web_texture_update,
web_key_mods,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment