-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kenton Hamaluik
committed
Mar 23, 2020
1 parent
1e0c962
commit cf4a184
Showing
5 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use cef_simple::{Cef, WindowOptions}; | ||
use simplelog::*; | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let cef = Cef::initialize(None, true)?; | ||
|
||
CombinedLogger::init(vec![TermLogger::new( | ||
LevelFilter::Trace, | ||
Config::default(), | ||
TerminalMode::Mixed, | ||
) | ||
.unwrap()]) | ||
.unwrap(); | ||
|
||
let page = urlencoding::encode(include_str!("page.html")); | ||
|
||
cef.open_window(WindowOptions { | ||
url: format!("data:text/html,{}", page), | ||
title: Some("CEF Simple—Fullscreen Demo".to_string()), | ||
window_icon: Some(include_bytes!(concat!( | ||
env!("CARGO_MANIFEST_DIR"), | ||
"/icon.png" | ||
))), | ||
window_app_icon: Some(include_bytes!(concat!( | ||
env!("CARGO_MANIFEST_DIR"), | ||
"/icon.png" | ||
))), | ||
..WindowOptions::default() | ||
})?; | ||
|
||
cef.run()?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>CEF Fullscreen Demo</title> | ||
</head> | ||
<body> | ||
<script> | ||
function toggleFullscreen() { | ||
if(document.fullscreenElement === null) document.documentElement.requestFullscreen(); | ||
else document.exitFullscreen(); | ||
} | ||
</script> | ||
<a href="#" onclick="toggleFullscreen(); return false;">Click here</a> to go fullscreen. | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters