Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
57a6423f
Commit
57a6423f
authored
7 years ago
by
Sergey Linev
Committed by
Bertrand Bellenot
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
webgui: enable usage of CEF in canvas painter
parent
12d6a73e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gui/canvaspainter/v7/src/TCanvasPainter.cxx
+94
-0
94 additions, 0 deletions
gui/canvaspainter/v7/src/TCanvasPainter.cxx
with
94 additions
and
0 deletions
gui/canvaspainter/v7/src/TCanvasPainter.cxx
+
94
−
0
View file @
57a6423f
...
...
@@ -34,6 +34,30 @@
#include
"TClass.h"
#include
"TBufferJSON.h"
#ifdef WEBGUI_WITH_CEF
#include
"../cef/simple_app.h"
#include
"TApplication.h"
#include
"TTimer.h"
class
TCefTimer
:
public
TTimer
{
public:
TCefTimer
(
Long_t
milliSec
,
Bool_t
mode
)
:
TTimer
(
milliSec
,
mode
)
{
// construtor
}
virtual
~
TCefTimer
()
{
// destructor
}
virtual
void
Timeout
()
{
// just dummy workaround
CefDoMessageLoopWork
();
}
};
#endif
namespace
{
/** \class TCanvasPainter
...
...
@@ -162,6 +186,76 @@ void TCanvasPainter::PopupBrowser()
addr
.
Form
(
"%s/web7gui/%s/draw.htm?webcanvas"
,
fAddr
.
c_str
(),
GetName
());
#ifdef WEBGUI_WITH_CEF
const
char
*
cef
=
gSystem
->
Getenv
(
"CEF_PATH"
);
Info
(
"Show"
,
"CEF %s"
,
cef
);
if
(
cef
&&
!
gSystem
->
AccessPathName
(
cef
))
{
TApplication
*
root_app
=
gROOT
->
GetApplication
();
printf
(
"Start cef window with addr %s app %p
\n
"
,
addr
.
Data
(),
root_app
);
CefMainArgs
main_args
(
root_app
->
Argc
(),
root_app
->
Argv
());
// CEF applications have multiple sub-processes (render, plugin, GPU, etc)
// that share the same executable. This function checks the command-line and,
// if this is a sub-process, executes the appropriate logic.
/* int exit_code = CefExecuteProcess(main_args, NULL, NULL);
if (exit_code >= 0) {
// The sub-process has completed so return here.
return exit_code;
}
*/
// Install xlib error handlers so that the application won't be terminated
// on non-fatal errors.
// XSetErrorHandler(XErrorHandlerImpl);
// XSetIOErrorHandler(XIOErrorHandlerImpl);
// Specify CEF global settings here.
CefSettings
settings
;
// settings.multi_threaded_message_loop = false; // not supported
// settings.external_message_pump = false;
const
char
*
rootsys
=
gSystem
->
Getenv
(
"ROOTSYS"
);
printf
(
"Get build dir %s
\n
"
,
rootsys
);
TString
path
,
path2
,
cef_main
;
path
.
Form
(
"%s/Resources/"
,
cef
);
path2
.
Form
(
"%s/Resources/locales/"
,
cef
);
cef_main
.
Form
(
"%s/bin/cef_main"
,
rootsys
);
cef_string_ascii_to_utf16
(
path
.
Data
(),
path
.
Length
(),
&
settings
.
resources_dir_path
);
cef_string_ascii_to_utf16
(
path2
.
Data
(),
path2
.
Length
(),
&
settings
.
locales_dir_path
);
settings
.
no_sandbox
=
true
;
// settings.single_process = true;
// SimpleApp implements application-level callbacks for the browser process.
// It will create the first browser instance in OnContextInitialized() after
// CEF has initialized.
CefRefPtr
<
SimpleApp
>
*
app
=
new
CefRefPtr
<
SimpleApp
>
(
new
SimpleApp
(
addr
.
Data
(),
cef_main
.
Data
()));
// Initialize CEF for the browser process.
CefInitialize
(
main_args
,
settings
,
app
->
get
(),
NULL
);
// let run CEF message loop, should be improved later
TCefTimer
*
timer
=
new
TCefTimer
(
10
,
kTRUE
);
timer
->
TurnOn
();
// Shut down CEF.
//CefShutdown();
return
;
}
#endif
if
(
gSystem
->
InheritsFrom
(
"TMacOSXSystem"
))
exec
.
Form
(
"open %s"
,
addr
.
Data
());
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment